diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 41227271..00000000 --- a/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -/.idea -/.vscode -*.log -.env -.DS_Store -runtime/ -vendor/ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 36f7b6f9..00000000 --- a/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -sudo: false - -language: php - -branches: - only: - - stable - -cache: - directories: - - $HOME/.composer/cache - -before_install: - - composer self-update - -install: - - composer install --no-dev --no-interaction --ignore-platform-reqs - - zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Core.zip . - - composer require --update-no-dev --no-interaction "topthink/think-image:^1.0" - - composer require --update-no-dev --no-interaction "topthink/think-migration:^1.0" - - composer require --update-no-dev --no-interaction "topthink/think-captcha:^1.0" - - composer require --update-no-dev --no-interaction "topthink/think-mongo:^1.0" - - composer require --update-no-dev --no-interaction "topthink/think-worker:^1.0" - - composer require --update-no-dev --no-interaction "topthink/think-helper:^1.0" - - composer require --update-no-dev --no-interaction "topthink/think-queue:^1.0" - - composer require --update-no-dev --no-interaction "topthink/think-angular:^1.0" - - composer require --dev --update-no-dev --no-interaction "topthink/think-testing:^1.0" - - zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Full.zip . - -script: - - php think unit - -deploy: - provider: releases - api_key: - secure: TSF6bnl2JYN72UQOORAJYL+CqIryP2gHVKt6grfveQ7d9rleAEoxlq6PWxbvTI4jZ5nrPpUcBUpWIJHNgVcs+bzLFtyh5THaLqm39uCgBbrW7M8rI26L8sBh/6nsdtGgdeQrO/cLu31QoTzbwuz1WfAVoCdCkOSZeXyT/CclH99qV6RYyQYqaD2wpRjrhA5O4fSsEkiPVuk0GaOogFlrQHx+C+lHnf6pa1KxEoN1A0UxxVfGX6K4y5g4WQDO5zT4bLeubkWOXK0G51XSvACDOZVIyLdjApaOFTwamPcD3S1tfvuxRWWvsCD5ljFvb2kSmx5BIBNwN80MzuBmrGIC27XLGOxyMerwKxB6DskNUO9PflKHDPI61DRq0FTy1fv70SFMSiAtUv9aJRT41NQh9iJJ0vC8dl+xcxrWIjU1GG6+l/ZcRqVx9V1VuGQsLKndGhja7SQ+X1slHl76fRq223sMOql7MFCd0vvvxVQ2V39CcFKao/LB1aPH3VhODDEyxwx6aXoTznvC/QPepgWsHOWQzKj9ftsgDbsNiyFlXL4cu8DWUty6rQy8zT2b4O8b1xjcwSUCsy+auEjBamzQkMJFNlZAIUrukL/NbUhQU37TAbwsFyz7X0E/u/VMle/nBCNAzgkMwAUjiHM6FqrKKBRWFbPrSIixjfjkCnrMEPw= - file: - - ThinkPHP_Core.zip - - ThinkPHP_Full.zip - skip_cleanup: true - on: - tags: true diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index 574a39c4..00000000 --- a/LICENSE.txt +++ /dev/null @@ -1,32 +0,0 @@ - -ThinkPHP遵循Apache2开源协议发布,并提供免费使用。 -版权所有Copyright © 2006-2016 by ThinkPHP (http://thinkphp.cn) -All rights reserved。 -ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。 - -Apache Licence是著名的非盈利开源组织Apache采用的协议。 -该协议和BSD类似,鼓励代码共享和尊重原作者的著作权, -允许代码修改,再作为开源或商业软件发布。需要满足 -的条件: -1. 需要给代码的用户一份Apache Licence ; -2. 如果你修改了代码,需要在被修改的文件中说明; -3. 在延伸的代码中(修改和有源代码衍生的代码中)需要 -带有原来代码中的协议,商标,专利声明和其他原来作者规 -定需要包含的说明; -4. 如果再发布的产品中包含一个Notice文件,则在Notice文 -件中需要带有本协议内容。你可以在Notice中增加自己的 -许可,但不可以表现为对Apache Licence构成更改。 -具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0 - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md deleted file mode 100644 index ef27d58e..00000000 --- a/README.md +++ /dev/null @@ -1,68 +0,0 @@ - -# 免费学生成绩统计系统 - -  坦率地讲,在不久的将来,这也许会是辽东半岛上第二好用的成绩统计系统。如果你觉得还可以,还不赶紧 Watch 、 Start 一下。如果觉得不好,何不给个改进意见再离开,反正已经来了,是吧? - -![表情包](https://gitee.com/dlbz/student_achievement_statistics/raw/master/public/examples/timg.jpg) - -  言归正传 - -  这是一款注重优化成绩采集方法、丰富成绩分析维度的小学成绩统计系统,力争做到符合教师工作习惯、使用方法简单、数据分析多样、分析结果科学,为教师的试卷分析、教育科研提供数据参考。 - -  开发者是一名非计算机专业的小学教师,只因工作遇到了兴趣,才有了这个小项目。为了让自己统计成绩工作变得更优雅,才边学边写这个成绩统计项目。信息录入简单,学生、老师的信息可以直接从学籍、人事负责人获取,将获取的数据复制到模板中便可上传。在操作设计中,遵循 Giles Colborne 的简约至上原则,尽量做到三步便可到达要操作的位置。统计维度参考华东师范大学教育学系王孝玲教授著作的《教育统计学》第五版。前端采用X-admin,后端采用ThinkPHP框架开发。 - - -  “情怀”的代言人罗永浩说:“科技的每一次进步,给我们带来的是更好的世界,而不是完美的世界”。因此,我会不断完善系统功能,让统计成绩不再是一份辛苦的工作,让大家变成成绩分析牛人! - - - -## 主要功能: - -* 设置系统信息、单位信息管理、类别管理 -* 学期、班级、学科 管理 -* 管理员与权限管理 -* 教师与学生信息管理 -* 考试信息设置 -* 生成学生的考试号 -* 生成学生试卷标签 -* 生成学生成绩采集表 -* 使用电子表格录入成绩 -* 使用二维码录入成绩 -* 编辑、删除成绩 -* 查看成绩列表 -* 查看成绩统计结果 - -![学生成绩列表](https://gitee.com/dlbz/student_achievement_statistics/raw/master/public/examples/20190524162731.png) -学生成绩列表 - -![班级成绩统计](https://gitee.com/dlbz/student_achievement_statistics/raw/master/public/examples/20190524164321.png) -班级成绩统计 - -![扫码录入成绩页面](https://gitee.com/dlbz/student_achievement_statistics/raw/master/public/examples/20190524164409.png) -扫码录入成绩页面 - -![权限分配](https://gitee.com/dlbz/student_achievement_statistics/raw/master/public/examples/20190524164451.png) -权限分配页面 - - -## 演示地址 -[http://xiaoshongshu.cn](http://xiaoshongshu.cn) - -帐号 test1 密码 123456 - -里面隐藏了两个很实用的功能,如果想了解隐藏功能,请下载。 - -## 更新内容 -  前端使用X-admin(感谢singliang大神建议),最佳浏览器为 Chrome 和 Firefox ,搜狗、360等浏览器请打开极速模式,只使用IE浏览器的朋友请绕行。后端更新最新TP框架。优化代码。 -## 升级提示 -  相比1.0版,增减了很多字段和数据,建议重新建表。 - - -## 更详细信息请查阅官方手册 -https://www.kancloud.cn/llblax/abcd/789222 - -## 下一步工作 -* 继续增加统计项目 -* 以图表形式呈现统计结果 -* 增加教师职务权限验证 -* 增加学生自助查询成绩 \ No newline at end of file diff --git a/application/.htaccess b/application/.htaccess deleted file mode 100644 index 3418e55a..00000000 --- a/application/.htaccess +++ /dev/null @@ -1 +0,0 @@ -deny from all \ No newline at end of file diff --git a/application/admin/common.php b/application/admin/common.php deleted file mode 100644 index b3d9bbc7..00000000 --- a/application/admin/common.php +++ /dev/null @@ -1 +0,0 @@ -assign('list',$list); - - // 渲染模板 - return $this->fetch(); - } - - - // 获取角色列表 - public function ajaxData() - { - // 获取参数 - $src = $this->request - ->only([ - 'page'=>'1', - 'limit'=>'10', - 'field'=>'id', - 'type'=>'asc', - 'searchval'=>'' - ],'POST'); - - - // 实例化 - $ag = new AG; - - // 查询要显示的数据 - $data = $ag->search($src); - // 获取符合条件记录总数 - $cnt = $data->count(); - // 获取当前页数据 - $limit_start = $src['page'] * $src['limit'] - $src['limit']; - $limit_length = $src['limit']; - $data = $data->slice($limit_start,$limit_length); - - // 重组返回内容 - $data = [ - 'code'=> 0 , // ajax请求次数,作为标识符 - 'msg'=>"", // 获取到的结果数(每页显示数量) - 'count'=>$cnt, // 符合条件的总数据量 - 'data'=>$data, //获取到的数据结果 - ]; - - return json($data); - } - - - // 创建角色 - public function create() - { - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'添加角色', - 'butname'=>'添加', - 'formpost'=>'POST', - 'url'=>'/authgroup', - ); - - - // 模板赋值 - $this->assign('list',$list); - - // 渲染 - return $this->fetch(); - } - - - // 保存角色信息 - public function save() - { - - // 实例化验证模型 - $validate = new \app\admin\validate\RuleGroup; - - - // 获取表单数据 - $list = request()->only(['title','rules','miaoshu'],'post'); - $list['rules'] = implode(",",$list['rules']); - - - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]);; - } - - // 保存数据 - $data = AG::create($list); - - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - /** - * 显示指定的资源 - * - * @param int $id - * @return \think\Response - */ - public function read($id) - { - // - } - - - - - // 修改角色信息 - public function edit($id) - { - // 获取单位信息 - $list['data'] = AG::field('id,title,miaoshu,rules') - ->find($id); - - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'编辑角色', - 'butname'=>'修改', - 'formpost'=>'PUT', - 'url'=>'/authgroup/'.$id, - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - } - - - - - - // 更新角色信息 - public function update($id) - { - - // 实例化验证模型 - $validate = new \app\admin\validate\RuleGroup; - - // 获取表单数据 - $list = request()->only(['title','rules','miaoshu'],'put'); - $list['rules'] = implode(",",$list['rules']); - - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]);; - } - - - $data = AG::where('id',$id)->update($list); - - // 根据更新结果设置返回提示信息 - $data>=0 ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - - // 删除角色 - public function delete($id) - { - - if($id == 'm') - { - $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 - } - - $data = AG::destroy($id); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - // 设置角色状态 - public function setStatus() - { - - // 获取id变量 - $id = request()->post('id'); - $value = request()->post('value'); - - // 更新数据 - $data= AG::where('id',$id)->update(['status'=>$value]); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - -} diff --git a/application/admin/controller/AuthGroupAccess.php b/application/admin/controller/AuthGroupAccess.php deleted file mode 100644 index d55b50f9..00000000 --- a/application/admin/controller/AuthGroupAccess.php +++ /dev/null @@ -1,14 +0,0 @@ -assign('list',$list); - - // 渲染模板 - return $this->fetch(); - } - - - // 获取权限信息列表 - public function ajaxData() - { - // 获取参数 - $src = $this->request - ->only([ - 'page'=>'1' - ,'limit'=>'10' - ,'field'=>'id' - ,'type'=>'asc' - ,'searchval'=>'' - ],'POST'); - - // 实例化 - $ar = new AR; - - // 查询要显示的数据 - $data = $ar->search($src); - // 获取符合条件记录总数 - $cnt = $data->count(); - // 获取当前页数据 - $limit_start = $src['page'] * $src['limit'] - $src['limit']; - $limit_length = $src['limit']; - $data = $data->slice($limit_start,$limit_length); - - // 重组返回内容 - $data = [ - 'code'=> 0 , // ajax请求次数,作为标识符 - 'msg'=>"", // 获取到的结果数(每页显示数量) - 'count'=>$cnt, // 符合条件的总数据量 - 'data'=>$data, //获取到的数据结果 - ]; - - return json($data); - } - - - - // 创建权限 - public function create() - { - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'添加权限', - 'butname'=>'添加', - 'formpost'=>'POST', - 'url'=>'/authrule', - ); - - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - } - - - - // 保存信息 - public function save() - { - // 实例化验证模型 - $validate = new \app\admin\validate\Rule; - - - // 获取表单数据 - $list = request()->only(['title','name','pid','condition','paixu','ismenu','font','beizhu','url'],'post'); - - - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]);; - } - - // 保存数据 - $data = AR::create($list); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - // - public function read($id) - { - // - } - - - - - // 修改权限信息 - public function edit($id) - { - - // 获取权限信息 - $list['data'] = AR::field('id,title,name,condition,pid,paixu,ismenu,font,url') - ->find($id); - - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'编辑权限', - 'butname'=>'修改', - 'formpost'=>'PUT', - 'url'=>'/authrule/'.$id, - ); - - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - } - - - - - - // 更新权限信息 - public function update($id) - { - $validate = new \app\admin\validate\Rule; - - // 获取表单数据 - $list = request()->only(['title','name','pid','condition','paixu','ismenu','font','beizhu','url'],'put'); - - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]);; - } - - - $data = AR::where('id',$id)->update($list); - - // 根据更新结果设置返回提示信息 - $data>=0 ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - - - // 删除权限 - public function delete($id) - { - if($id == 'm') - { - $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 - } - - $data = AR::destroy($id); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - // 设置权限状态 - public function setStatus() - { - - // 获取id变量 - $id = request()->post('id'); - $value = request()->post('value'); - - // 获取权限信息 - $data = AR::where('id',$id)->update(['status'=>$value]); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - -} diff --git a/application/admin/controller/Error.php b/application/admin/controller/Error.php deleted file mode 100644 index 23d823e6..00000000 --- a/application/admin/controller/Error.php +++ /dev/null @@ -1,11 +0,0 @@ -assign('list',$list); - - // 渲染模板 - return $this->fetch(); - } - - - // 获取数据管理员数据 - public function ajaxData() - { - // 获取参数 - $src = $this->request - ->only([ - 'page'=>'1' - ,'limit'=>'10' - ,'field'=>'id' - ,'type'=>'desc' - ,'searchval'=>'' - ],'POST'); - - // 实例化 - $ad = new AD; - - // 查询要显示的数据 - $data = $ad->search($src); - - // 获取符合条件记录总数 - $cnt = $data->count(); - // 获取当前页数据 - $limit_start = $src['page'] * $src['limit'] - $src['limit']; - $limit_length = $src['limit']; - $data = $data->slice($limit_start,$limit_length); - - // 重组返回内容 - $data = [ - 'code'=> 0 , // ajax请求次数,作为标识符 - 'msg'=>"", // 获取到的结果数(每页显示数量) - 'count'=>$cnt, // 符合条件的总数据量 - 'data'=>$data, //获取到的数据结果 - ]; - - return json($data); - } - - - // 创建用户信息 - public function create() - { - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'添加管理员', - 'butname'=>'添加', - 'formpost'=>'POST', - 'url'=>'/admin', - ); - - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - } - - - // 保存管理员 - public function save() - { - - // 实例化加密类 - $md5 = new APR1_MD5(); - // 实例化验证模型 - $validate = new \app\admin\validate\Admin; - - - // 获取表单数据 - $list = request()->only(['xingming','school','username','sex','shengri','phone','beizhu','group_id'],'post'); - - - // 设置密码,默认为123456 - $list['password'] = $md5->hash('123456'); - - - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]);; - } - - // 实例化管理员数据模型类 - $admin = new AD(); - $admindata = $admin->create($list); - - // 更新中间表 - $groupdata=$admindata->glGroup()->saveAll($list['group_id']); - - - // 根据更新结果设置返回提示信息 - $admindata&&$groupdata ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - - } - - - - - // 读取用户信息 - public function read($id) - { - // 获取管理员信息 - $ad = new AD; - $list = AD::where('id',$id) - ->field('id,xingming,sex,shengri,username,school,phone,denglucishu,lastip,ip,lasttime,thistime,create_time,update_time') - ->with([ - 'adSchool'=>function($query){ - $query->field('id,title'); - } - ]) - ->find(); - $list['webtitle'] = '帐号信息'; - $list->groupnames = $ad->getGroupnames($id); - - // 模板赋值 - $this->assign('list',$list); - - // 渲染模板 - return $this->fetch(); - } - - - // 读取用户信息 - public function myinfo() - { - $id = session('userid'); - $ad = new AD; - // 获取管理员信息 - $list = $ad->where('id',$id) - ->field('id,xingming,sex,shengri,username,school,phone,denglucishu,lastip,ip,lasttime,thistime,create_time,update_time') - ->with([ - 'adSchool'=>function($query){ - $query->field('id,title'); - } - ]) - ->find(); - $list->groupnames = $ad->getGroupnames($id); - - - $list['webtitle'] = '我的信息'; - - // 模板赋值 - $this->assign('list',$list); - - - // 渲染模板 - return $this->fetch('read'); - } - - - - - // - public function edit($id) - { - - // 获取用户信息 - $list['data'] = AD::where('id',$id) - ->field('id,school,username,xingming,sex,shengri,phone,beizhu') - ->with([ - 'adSchool'=>function($query){ - $query->field('id,jiancheng'); - } - ,'glGroup'=>function($query){ - $query->where('status',1)->field('title,rules,miaoshu'); - } - ]) - ->find(); - - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'编辑管理员', - 'butname'=>'修改', - 'formpost'=>'PUT', - 'url'=>'/admin/'.$id, - ); - - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - - } - - // 更新管理员信息 - public function update($id) - { - - // 实例化验证模型 - $validate = new \app\admin\validate\Admin; - - // 获取表单数据 - $list = request()->only(['xingming','school','username','sex','shengri','phone','beizhu','group_id'],'put'); - - $list['group_id'] = array_values($list['group_id']); - - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]);; - } - - - // 更新管理员信息 - $list['id'] = $id; - $admindata = AD::update($list); - - // 更新中间表 - $groupdata=$admindata->glGroup()->detach(); - $groupdata=$admindata->glGroup()->attach($list['group_id']); - - // 根据更新结果设置返回提示信息 - $admindata&&$groupdata ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - /** - * 删除指定资源 - * - * @param int $id - * @return \think\Response - */ - public function delete($id) - { - - if($id == 'm'){ - $id = request()->delete('ids'); - } - - $data = AD::destroy($id); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - // 修改管理员状态 - public function setStatus() - { - - // 获取id变量 - $id = request()->post('id'); - $value = request()->post('value'); - - // 更新管理员信息 - $data = AD::where('id',$id)->update(['status'=>$value]); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - // 重置密码 - public function resetpassword($id) - { - - // 实例化加密类 - $md5 = new APR1_MD5(); - - // 生成密码 - $password = $md5->hash('123456'); - - // 查询用户信息 - $data = AD::where('id',$id)->update(['password'=>$password]); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'密码已经重置为:
123456','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - // 修改自己的密码 - public function editPassword() - { - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'修改密码', - 'butname'=>'修改', - 'formpost'=>'PUT', - 'url'=>'/editpassword/'.session('userid'), - ); - - // 模板赋值 - $this->assign('list',$list); - - // 渲染模板 - return $this->fetch(); - } - - - // 保存新密码 - public function updatePassword($id) - { - // 获取表单数据 - $list = request()->post(); - - // 验证表单数据 - // 实例化验证模型 - $validate = new \app\admin\validate\SetPassword; - $result = $validate->check($list); - $msg = $validate->getError(); - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]);; - } - - - // 获取用户名 - $serpassword = AD::where('id',$id)->value('password'); - - // 实例化加密类 - $md5 = new APR1_MD5(); - //验证密码 - $check = $md5->check($list['oldpassword'],$serpassword); - - if(!$check) - { - $data=['msg'=>'旧密码错误','val'=>0]; - return json($data); - } - - // 更新密码 - $password = $md5->hash($list['newpassword']); - $data = AD::update(['id'=>$id,'password'=>$password]); - - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'修改成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - -} diff --git a/application/admin/model/Admin.php b/application/admin/model/Admin.php deleted file mode 100644 index 2d89a907..00000000 --- a/application/admin/model/Admin.php +++ /dev/null @@ -1,146 +0,0 @@ -order([$src['field'] =>$src['type']]) - ->where('id','>',2) - ->when(strlen($searchval)>0,function($query) use($searchval){ - $query->where('xingming|username','like','%'.$searchval.'%'); - }) - ->with([ - 'adSchool'=>function($query){ - $query->field('id,jiancheng'); - } - ,'glGroup'=>function($query){ - $query->where('status',1)->field('title,rules,miaoshu'); - } - ]) - ->hidden(['password','create_time','update_time','delete_time']) - ->select(); - return $data; - } - - public function glGroup() - { - return $this->belongsToMany('AuthGroup','AuthGroupAccess','group_id','uid'); - } - - - // 用户角色获取器 - public function userGroup() - { - return $this->belongsToMany('AuthGroup','AuthGroupAccess','id','uid'); - } - - - // 获取密码 - public function password($username) - { - // 查询数据 - $pasW = $this - ->where('username',$username) - ->value('password'); - - // 返回数据 - return $pasW; - } - - // 生日修改器 - public function setShengriAttr($value) - { - return strtotime($value); - } - - // 生日获取器 - public function getShengriAttr($value) - { - return date('Y-m-d',$value); - } - - // 创建时间获取器 - public function getCreateTimeAttr($value) - { - return date('Y-m-d',$value); - } - - // 性别获取器 - public function getSexAttr($value) - { - $sex = array('0'=>'女','1'=>'男','2'=>'保密'); - return $sex[$value]; - } - - - // 最后登录时间取器 - public function getLasttimeAttr($value) - { - return date('Y年m月d日 H:i:s',$value); - } - - // 本次登录时间取器 - public function getThistimeAttr($value) - { - return date('Y年m月d日 H:i:s',$value); - } - - - // 角色关联 - public function authGroup() - { - return $this->hasMany('AuthGroupAccess','uid','id')->field('id,uid,group_id'); - } - - - // 获取角色名称 - public function getGroupnames($userid) - { - // 如果用户ID为1或2,则为超级管理员 - if($userid == 1 || $userid == 2) - { - return '超级管理员'; - } - - // 查询用户拥有的权限 - $admininfo = $this->where('id',$userid) - ->field('id') - ->with([ - 'glGroup'=>function($query){ - $query->where('status',1)->field('title'); - } - ]) - ->find(); - $groupname = ''; - foreach ($admininfo->gl_group as $key => $value) { - if($key == 0){ - $groupname = $value->title; - }else{ - $groupname = $groupname.'、'.$value->title; - } - } - - // 返回角色名 - return $groupname; - } - - // 单位关联模型 - public function adSchool() - { - return $this->belongsTo('\app\system\model\School','school','id'); - } - - - -} diff --git a/application/admin/model/AuthGroup.php b/application/admin/model/AuthGroup.php deleted file mode 100644 index 06696f77..00000000 --- a/application/admin/model/AuthGroup.php +++ /dev/null @@ -1,26 +0,0 @@ -order([$src['field'] =>$src['type']]) - ->when(strlen($searchval)>0,function($query) use($searchval){ - $query->where('title','like','%'.$searchval.'%'); - }) - ->select(); - return $data; - } - -} diff --git a/application/admin/model/AuthGroupAccess.php b/application/admin/model/AuthGroupAccess.php deleted file mode 100644 index b8cede76..00000000 --- a/application/admin/model/AuthGroupAccess.php +++ /dev/null @@ -1,11 +0,0 @@ -belongsTo('AuthRule','pid','id'); - } - - - // 子菜单数据模型关联 - public function authCid() - { - return $this->hasMany('AuthRule','pid','id'); - } - - - // 查询所有角色 - public function search($src) - { - // 整理变量 - $searchval = $src['searchval']; - - // 查询数据 - $data = $this - ->order([$src['field'] =>$src['type']]) - ->when(strlen($searchval)>0,function($query) use($searchval){ - $query->where('title|name','like','%'.$searchval.'%'); - }) - ->with(['authPid'=>function($query){ - $query->field('id,title'); - }]) - ->select(); - return $data; - } -} diff --git a/application/admin/validate/Admin.php b/application/admin/validate/Admin.php deleted file mode 100644 index d18987eb..00000000 --- a/application/admin/validate/Admin.php +++ /dev/null @@ -1,34 +0,0 @@ - ['规则1','规则2'...] - * - * @var array - */ - protected $rule = [ - 'xingming|用户姓名' => 'require|chs|length:2,6', - 'username|帐号' => ['require','uset'=>'/^[a-z][a-z0-9-_]*$/'], - 'group_id|角色' => 'require|array', - 'shengri|出生日期' => 'date', - 'xingbie|性别' => 'in:0,1,2', - 'phone|手机' => 'mobile', - 'beizhu|备注' => 'max:80', - ]; - - /** - * 定义错误信息 - * 格式:'字段名.规则名' => '错误信息' - * - * @var array - */ - protected $message = [ - 'username.ustr' => '帐号格式错误', - ]; -} diff --git a/application/admin/validate/Rule.php b/application/admin/validate/Rule.php deleted file mode 100644 index da6525ef..00000000 --- a/application/admin/validate/Rule.php +++ /dev/null @@ -1,28 +0,0 @@ - ['规则1','规则2'...] - * - * @var array - */ - protected $rule = [ - 'title|规则名' => 'require|chs|length:2,6', - 'name|规则' => ['require','length:1,80','uset'=>'/^[a-zA-Z\/]*$/'], - 'paixu|排序' => 'number|max:999', - ]; - - /** - * 定义错误信息 - * 格式:'字段名.规则名' => '错误信息' - * - * @var array - */ - protected $message = []; -} diff --git a/application/admin/validate/RuleGroup.php b/application/admin/validate/RuleGroup.php deleted file mode 100644 index 3cad141f..00000000 --- a/application/admin/validate/RuleGroup.php +++ /dev/null @@ -1,24 +0,0 @@ - ['规则1','规则2'...] - * - * @var array - */ - protected $rule = []; - - /** - * 定义错误信息 - * 格式:'字段名.规则名' => '错误信息' - * - * @var array - */ - protected $message = []; -} diff --git a/application/admin/validate/SetPassword.php b/application/admin/validate/SetPassword.php deleted file mode 100644 index 93735d8e..00000000 --- a/application/admin/validate/SetPassword.php +++ /dev/null @@ -1,30 +0,0 @@ - ['规则1','规则2'...] - * - * @var array - */ - protected $rule = [ - 'oldpassword|原密码' => 'require', - 'newpassword|新密码' => ['require','regex'=>'/^[a-zA-Z]{1}([a-zA-Z0-9]|[._]){6,20}$/'], - 'newpassword2|两次密码' => 'require|confirm:newpassword', - ]; - - /** - * 定义错误信息 - * 格式:'字段名.规则名' => '错误信息' - * - * @var array - */ - protected $message = [ - 'newpassword.regex' => '只能输入6-16个字母、数字、半角句号、下划线', - ]; -} diff --git a/application/admin/view/auth_group/create.html b/application/admin/view/auth_group/create.html deleted file mode 100644 index 78097456..00000000 --- a/application/admin/view/auth_group/create.html +++ /dev/null @@ -1,179 +0,0 @@ -{extend name="common@create" /} - -{block name="form"} -
-
- -
- -
-
-
- -
- -
-
- {php} - $authrule = new \app\admin\model\AuthRule; - $authrulelist = $authrule->where('status',1)->where('pid',0)->select(); - {/php} -
- {volist name="authrulelist" id="vo"} -
- -
-
- {volist name="vo.auth_cid" id="vc"} -
- - {volist name="vc.auth_cid" id="vd"} - - {/volist} -
- {/volist} -
- {/volist} -
-
- -
-
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/admin/view/auth_group/index.html b/application/admin/view/auth_group/index.html deleted file mode 100644 index 763a00b6..00000000 --- a/application/admin/view/auth_group/index.html +++ /dev/null @@ -1,91 +0,0 @@ - -{extend name="common@list" /} -{block name="jsset"} - -{/block} -{block name="nav"} - - 管理员管理 - 角色管理 - 角色列表 - -{/block} -{block name="search"} -
- -
- -
-
-{/block} -{block name="table"} -
-{/block} -{block name="myjs"} - - - - - - -{/block} \ No newline at end of file diff --git a/application/admin/view/auth_rule/create.html b/application/admin/view/auth_rule/create.html deleted file mode 100644 index f4223d3a..00000000 --- a/application/admin/view/auth_rule/create.html +++ /dev/null @@ -1,241 +0,0 @@ -{extend name="common@create" /} - -{block name="form"} -
-
- -
- -
-
-
- -
- -
-
-
- -
- {php} - $authrule = new \app\admin\model\AuthRule; - $authrulelist = $authrule - ->where('pid',0) - ->where('status',1) - ->with(['authCid'=>function($query){ - $query->field('id,title,pid'); - } - ]) - ->field('pid,id,title') - ->select(); - {/php} - -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- - -
-
-
- -
- -
-
-
- -
- -
-
-
- -
-
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/admin/view/auth_rule/index.html b/application/admin/view/auth_rule/index.html deleted file mode 100644 index de704a8c..00000000 --- a/application/admin/view/auth_rule/index.html +++ /dev/null @@ -1,101 +0,0 @@ - -{extend name="common@list" /} -{block name="jsset"} - -{/block} -{block name="nav"} - - 管理员管理 - 权限管理 - 权限列表 - -{/block} -{block name="search"} -
- -
- -
-
-{/block} -{block name="table"} -
-{/block} -{block name="myjs"} - - - - - - -{/block} \ No newline at end of file diff --git a/application/admin/view/index/create.html b/application/admin/view/index/create.html deleted file mode 100644 index 25beaac3..00000000 --- a/application/admin/view/index/create.html +++ /dev/null @@ -1,132 +0,0 @@ -{extend name="common@create" /} - -{block name="form"} -
-
- -
- -
-
-
- -
- -
-
-
- -
- {php} $schlist = schlist('校级','区级');{/php} - -
-
-
- -
- {php} - $authgroup = new \app\admin\model\AuthGroup; - $authgrouplist = $authgroup->where('status',1)->select(); - {/php} - {volist name="authgrouplist" id="vo"} - - {/volist} - -
-
-
- -
- -
-
-
- -
- - -
-
-
- -
- -
-
-
- -
- -
-
-
- -
-
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/admin/view/index/edit_password.html b/application/admin/view/index/edit_password.html deleted file mode 100644 index 4a348e8c..00000000 --- a/application/admin/view/index/edit_password.html +++ /dev/null @@ -1,43 +0,0 @@ -{extend name="common@create" /} - -{block name="form"} -
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
-
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/admin/view/index/index.html b/application/admin/view/index/index.html deleted file mode 100644 index f5dac00f..00000000 --- a/application/admin/view/index/index.html +++ /dev/null @@ -1,119 +0,0 @@ - -{extend name="common@list" /} -{block name="jsset"} - -{/block} -{block name="nav"} - - 管理员管理 - 用户管理 - 管理员列表 - -{/block} -{block name="search"} -
- -
- -
-
-{/block} -{block name="table"} -
-{/block} -{block name="myjs"} - - - - - - -{/block} \ No newline at end of file diff --git a/application/admin/view/index/read.html b/application/admin/view/index/read.html deleted file mode 100644 index 1a0e95c5..00000000 --- a/application/admin/view/index/read.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - {php}echo session('webtitle'){/php} - - - - {load href="__STATIC__/xadmin/css/font.css" /} - {load href="__STATIC__/xadmin/css/xadmin.css" /} - {load href="__STATIC__/xadmin/js/jquery.min.js" /} - {load href="__STATIC__/xadmin/lib/layui/layui.js" /} - {load href="__STATIC__/xadmin/js/xadmin.js" /} - {load href="__STATIC__/xadmin/js/cookie.js" /} - {load href="__STATIC__/xadmin/js/md5.min.js" /} - {$list.webtitle} - - -
- -
- 个人信息 -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
帐号{$list.username}
姓名{$list.xingming}
性别{$list.sex}
出生日期{$list.shengri}
所在单位{$list.ad_school.title}
拥有角色 - {$list.groupnames} -
联系电话{$list.phone}
登录次数{$list.denglucishu}
上次登录IP{$list.lastip}         - {$list.lasttime}
本次登录IP{$list.ip}         - {$list.thistime}
注册时间{$list.create_time}
更新时间{$list.update_time}
-
-
- - \ No newline at end of file diff --git a/application/chengji/common.php b/application/chengji/common.php deleted file mode 100644 index 9719a412..00000000 --- a/application/chengji/common.php +++ /dev/null @@ -1,53 +0,0 @@ -where('id',$kaohaoid)->value('kaoshi'); - - // 根据考试号和学科名获取满分 - $KSXK = new app\kaoshi\model\KaoshiSubject; - $manfen = $KSXK->where('kaoshiid',$kaoshiid)->where('subjectid','in',$subjectid)->value('manfen'); - $manfen = floatval($manfen); - return $manfen; -} - -// 分数验证 -function manfenvalidate($defen,$manfen) -{ - $data['val'] = 1; - $data['msg'] = '验证通过'; - - if(is_numeric($defen) == false) - { - $data['val'] = 0; - $data['msg'] = '得分必须是数字'; - return $data; - } - - if( $defen < 0 ) - { - $data['val'] = 0; - $data['msg'] = '得分必须大于等于0'; - return $data; - } - - if($defen > $manfen) - { - $data['val'] = 0; - $data['msg'] = '得分必须必须小于等于'.$manfen; - return $data; - } - - if( ($defen*10)%5 != 0 ) - { - $data['val'] = 0; - $data['msg'] = '得分必须只能是x.5'; - return $data; - } - - return $data; -} - diff --git a/application/chengji/controller/Bjtongji.php b/application/chengji/controller/Bjtongji.php deleted file mode 100644 index 509e6dbb..00000000 --- a/application/chengji/controller/Bjtongji.php +++ /dev/null @@ -1,213 +0,0 @@ -where('id',$kaoshi) - ->with([ - 'KsNianji' - ,'ksSubject'=>function($query){ - $query->field('kaoshiid,subjectid,manfen') - ->with(['subjectName'=>function($q){ - $q->field('id,title,lieming'); - }] - ); - } - ]) - ->field('id,title') - ->find(); - - if(count($ksinfo->ks_nianji)>0) - { - $list['nianji'] = $ksinfo->ks_nianji[0]->nianji; - }else{ - $list['nianji'] = "一年级"; - } - $list['subject'] = $ksinfo->ks_subject->toArray(); - // 设置要给模板赋值的信息 - $list['webtitle'] = '各年级的班级成绩列表'; - $list['kaoshi'] = $kaoshi; - $list['kaoshititle'] = $ksinfo->title; - - - // 模板赋值 - $this->assign('list',$list); - - // 渲染模板 - return $this->fetch(); - } - - - // 获取年级成绩统计结果 - public function ajaxBianji() - { - // 获取参数 - $src = $this->request - ->only([ - 'page'=>'1', - 'limit'=>'10', - 'kaoshi'=>'', - 'nianji'=>'', - 'school'=>array(), - 'paixu'=>array(), - ],'POST'); - - // 统计成绩 - $btj = new BTJ; - - $data = $btj->tjBanji($src['kaoshi'],$src['nianji'],$src['school'],$src['paixu']); - - - // 获取记录总数 - $cnt = count($data); - // 截取当前页数据 - $data = array_slice($data,($src['page']-1)*$src['limit'],$src['limit']); - - // 重组返回内容 - $data = [ - 'code'=> 0 , // ajax请求次数,作为标识符 - 'msg'=>"", // 获取到的结果数(每页显示数量) - 'count'=>$cnt, // 符合条件的总数据量 - 'data'=>$data, //获取到的数据结果 - ]; - - return json($data); - } - - // 年级、班级学生成绩统计结果下载界面 - public function dwBanji($kaoshi) - { - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'各班级成绩汇总表下载', - 'butname'=>'下载', - 'formpost'=>'POST', - 'url'=>'/bjtongji/dwBanji', - 'kaoshi'=>$kaoshi - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch(); - - } - - - // 年级、班级学生成绩统计下载表格 - public function dwBanjixls($kaoshi) - { - // 获取表单参数 - $src = $this->request - ->only([ - 'kaoshi'=>'', - 'nianji'=>'一年级', - 'school'=>array(), - ],'POST'); - - $schools = [$src['school']]; - - - // 统计成绩 - $btj = new BTJ; - $data = $btj->tjBanji($src['kaoshi'],$src['nianji'],$schools,array()); - - - // 获取参考学科 - $ks = new \app\kaoshi\model\Kaoshi; - $ksinfo = $ks->where('id',$src['kaoshi']) - ->field('id,title') - ->with([ - 'ksSubject'=>function($query){ - $query->field('kaoshiid,subjectid,manfen') - ->with(['subjectName'=>function($q){ - $q->field('id,title,lieming'); - }] - ); - } - ]) - ->find(); - $xk = $ksinfo->ks_subject; - - - // 获取要下载成绩的学校和年级信息 - $school = new \app\system\model\School; - $schoolname = $school->where('id',$src['school'])->value('jiancheng'); - $tabletitle = $ksinfo->title.' '.$schoolname.' '.$src['nianji'].'各班级成绩汇总'; - - // 创建表格 - $spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet; - $sheet = $spreadsheet->getActiveSheet(); - - $sbjcol = ['xkcnt'=>'人数','avg'=>'平均分','jige'=>'及格率%','youxiu'=>'优秀率%']; - $sbjcolcnt = count($sbjcol); - $colname = excelLieming(); - $colcnt = $sbjcolcnt*count($xk)+3; - - - // 设置表头信息 - $sheet->mergeCells('A1:'.$colname[$colcnt].'1'); - $sheet->setCellValue('A1', $tabletitle); - $sheet->mergeCells('A3:A4'); - $sheet->setCellValue('A3', '序号'); - $sheet->mergeCells('B3:B4'); - $sheet->setCellValue('B3', '班级'); - $col = 2; - foreach ($xk as $key => $value) { - $colend = $col + $sbjcolcnt - 1; - $sheet->mergeCells($colname[$col].'3:'.$colname[$colend].'3'); - $sheet->setCellValue($colname[$col].'3', $value->subject_name->title.' ('.$value->manfen.')'); - foreach ($sbjcol as $k => $val) { - $sheet->setCellValue($colname[$col].'4', $val); - $col++; - } - } - $sheet->mergeCells($colname[$col].'3:'.$colname[$col].'4'); - $sheet->setCellValue($colname[$col].'3', '全科及格率%'); - $col++; - $sheet->mergeCells($colname[$col].'3:'.$colname[$col].'4'); - $sheet->setCellValue($colname[$col].'3', '全科平均'); - - $row = 5; - foreach ($data as $key => $value) { - $col = 2; - $sheet->setCellValue('A'.$row, $row-4); - $sheet->setCellValue('B'.$row, $value['banji']); - foreach ($xk as $ke => $val) { - foreach ($sbjcol as $k => $v) { - $sheet->setCellValue($colname[$col].$row, $value['chengji'][$val->subject_name->lieming][$k]); - $col++; - } - } - $sheet->setCellValue($colname[$col].$row, $value['chengji']['rate']); - $col++; - $sheet->setCellValue($colname[$col].$row, $value['chengji']['avg']); - $row++; - } - - - // 保存文件 - $filename = $tabletitle.date('ymdHis').'.xlsx'; - header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); - header('Content-Disposition: attachment;filename="' . $filename . '"'); - header('Cache-Control: max-age=0'); - $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx'); - $writer->save('php://output'); - ob_flush(); - flush(); - - } - - - -} diff --git a/application/chengji/controller/Error.php b/application/chengji/controller/Error.php deleted file mode 100644 index 303efba0..00000000 --- a/application/chengji/controller/Error.php +++ /dev/null @@ -1,11 +0,0 @@ -'扫码录成绩', - 'butname'=>'录入', - 'formpost'=>'PUT', - 'url'=>'/chengji/malu', - ); - - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch(); - } - - // 保存使用二维码录入的成绩 - public function malusave() - { - // 获取表单数据 - $list = $this->request->only(['kaohao_id','subject_id','defen'],'post'); - - // 成绩验证 - $manfen = getmanfen($list['kaohao_id'],$list['subject_id']); - $mfyz = manfenvalidate($list['defen'],$manfen); - if($mfyz['val'] == 0) - { - return json($mfyz); - } - - $cj = new Chengji(); - // 更新成绩 - $data = Chengji::withTrashed() - ->where('subject_id',$list['subject_id']) - ->where('kaohao_id',$list['kaohao_id']) - ->find(); - - if($data) - { - $data->delete(true); - } - - $cj->kaohao_id = $list['kaohao_id']; - $cj->subject_id = $list['subject_id']; - $cj->defen = $list['defen']; - $cj->user_id = session('userid'); - $data = $cj->save(); - - $data ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - return json($data); - } - - - // 学生成绩表中修改成绩 - public function update($id) #id为考号ID - { - // 获取表单数据 - $list = $this->request->only( - ['colname', - 'newdefen'] - ,'post'); - $list['kaohao_id'] = $id; - // 获取学科信息 - $subject = new \app\teach\model\Subject; - $subject_id = $subject->where('lieming',$list['colname'])->value('id'); - - // 成绩验证 - $manfen = getmanfen($list['kaohao_id'],$subject_id); - $mfyz = manfenvalidate($list['newdefen'],$manfen); - if($mfyz['val'] == 0) - { - return json($mfyz); - } - - // 更新成绩 - $cj = new Chengji; - $cjinfo = Chengji::withTrashed() - ->where('kaohao_id',$list['kaohao_id']) - ->where('subject_id',$subject_id) - ->find(); - // 如果存在成绩则更新,不存在则添加 - if($cjinfo){ - $cjinfo->restore(); - $cjinfo->defen = $list['newdefen']; - $cjinfo->user_id = session('userid'); - $data = $cjinfo->save(); - }else{ - $cj->defen = $list['newdefen']; - $cj->kaohao_id = $list['kaohao_id']; - $cj->subject_id = $subject_id; - $cj->user_id = session('userid'); - $data = $cj->save(); - } - // update(['defen'=>$list['newdefen']]); - - // 判断返回内容 - $data ? $data=['msg'=>'录入成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回更新结果 - return $data; - } - - - - // 根据考号获取学生信息 - public function read() - { - // 获取表单数据 - // 获取表单数据 - $val = input('post.val'); - $val = action('system/Encrypt/decrypt',[$val,'key'=>'dlbz']); - $list = explode('|',$val); - $sbj = $list[1]; - - $cjlist = Kaohao::where('id',$list[0]) - ->field('id,banji,school,student') - ->with([ - 'ksChengji'=>function($q) use($sbj){ - $q->where('subject_id',$sbj) - ->field('kaohao_id,subject_id,defen'); - } - ,'cjBanji'=>function($q){ - $q->field('id,paixu,ruxuenian') - ->append(['numTitle','banjiTitle']); - } - ,'cjSchool'=>function($q){ - $q->field('id,jiancheng'); - } - ,'cjStudent'=>function($q){ - $q->field('id,xingming'); - } - ]) - ->find(); - if($cjlist->cj_student == Null) - { - $stu = new \app\renshi\model\Student; - $stuinfo = $stu::withTrashed() - ->where('id',$cjlist->student) - ->field('id,xingming,sex') - ->find(); - $cjlist->cj_student = array( - 'id'=>$stuinfo->id, - 'xingming'=>$stuinfo->xingming - ); - } - $cjlist->sbj = Subject::where('id',$sbj)->field('id,title')->find(); - - // 获取列名 - return json($cjlist); - } - - - // 表格录入成绩上传页面 - public function biaolu() - { - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'表格录入成绩', - 'butname'=>'批传', - 'formpost'=>'POST', - 'url'=>'/chengji/biaolu', - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch(); - } - - - - // 保存表格批量上传的成绩 - public function saveAll() - { - set_time_limit(0); - // 获以电子表格存储位置 - $url = input('post.url'); - - // 实例化操作表格类 - $excel = new \app\renshi\controller\Myexcel; - - // 读取表格数据 - $cjinfo = $excel->readXls($url); - - // 删除空单元格得到学科列名数组 - array_splice($cjinfo[1],0,4); - $xk = $cjinfo[1]; - - // 删除成绩采集表无用的标题行得到成绩数组 - array_splice($cjinfo,0,3); - - // 查询考试信息 - $kh = new Kaohao; - $ks = new \app\kaoshi\model\Kaoshi; - - $user_id = session('userid'); - // 重新组合成绩信息 - foreach ($cjinfo as $key => $value) { - foreach ($xk as $k => $val) { - - $thissbj = $val; # 当前学科 - $defen = $value[$k+4]; # 当前学科 - - // 如果不存在值,跳过这次循环 - if($defen === null){ - continue; - } - - // 成绩验证 - $manfen = getmanfen($value[1],$val); - $mfyz = manfenvalidate($defen,$manfen); - if($mfyz['val'] == 0) - { - continue; - } - - - // 查询是否存在这个成绩 - $cj = Chengji::withTrashed() - ->where('kaohao_id',$value[1]) - ->where('subject_id',$val) - ->find(); - // 如果存在则删除 - if($cj){ - $cj->delete(true); - } - $data = Chengji::create([ - 'kaohao_id'=>$value[1], - 'subject_id'=>$val, - 'user_id'=>$user_id, - 'defen'=>$defen - ]); - } - } - - // 判断成绩更新结果 - empty($data) ? $data=['msg'=>'表格录入成绩失败','val'=>0] : $data=['msg'=>'表格录入成绩成功','val'=>1]; - - ob_flush(); - flush(); - // 返回成绩结果 - return json($data); - } - - - // 上传成绩采集表格 - public function upload() - { - // 获取文件信息 - $list['text'] = $this->request->post('text'); - $list['serurl'] = $this->request->post('serurl'); - - // 获取表单上传文件 - $file = request()->file('file'); - - // 上传文件并返回结果 - $data = upload($list,$file,true); - - return json($data); - } - - - // 成绩列表 - public function index($kaoshi) - { - - // 设置要给模板赋值的信息 - $list['webtitle'] = '学生成绩列表'; - - // 实例化考试数据模型 - $ks = new \app\kaoshi\model\Kaoshi; - $ksinfo = $ks->where('id',$kaoshi) - ->field('id') - ->with([ - 'ksSubject'=>function($query){ - $query->field('kaoshiid,subjectid') - ->with(['subjectName'=>function($q){ - $q->field('id,title,lieming'); - }] - ); - } - ,'ksNianji' - ]) - ->find(); - - - - $list['subject'] = $ksinfo->ks_subject; - $list['kaoshi'] = $kaoshi; - if(count($ksinfo->ks_nianji)>0) - { - $list['nianji'] = $ksinfo->ks_nianji[0]->nianji; - }else{ - $list['nianji'] = "一年级"; - } - - // 模板赋值 - $this->assign('list',$list); - - // 渲染模板 - return $this->fetch(); - } - - - - // 获取成绩信息 - public function ajaxData() - { - // 获取参数 - $src = $this->request - ->only(['page','limit','field','type','kaoshi','school','nianji','paixu','searchval' - ],'POST'); - - // 根据班级排序获取班级id - if(isset($src['paixu'])) - { - $banji = new \app\teach\model\Banji; - $src['banji'] = $banji - ->where('paixu','in',$src['paixu']) - ->column('id'); - } - - - // 实例化 - $kaohao = new Kaohao; - - // 查询要显示的数据 - $data = $kaohao->srcChengji($src); - - - // 获取符合条件记录总数 - $cnt = count($data); - // 获取当前页数据 - $limit_start = $src['page'] * $src['limit'] - $src['limit']; - $limit_length = $src['limit']; - $data = array_slice($data,$limit_start,$limit_length); - - // 重组返回内容 - $data = [ - 'code'=> 0 , // ajax请求次数,作为标识符 - 'msg'=>"", // 获取到的结果数(每页显示数量) - 'count'=>$cnt, // 符合条件的总数据量 - 'data'=>$data, //获取到的数据结果 - ]; - - - return json($data); - } - - - - - // 删除成绩 - public function deletecj($id) - { - - // 声明要删除成绩数组 - $data = array(); - - if($id == 'm') - { - $id = request()->delete('ids/a');// 获取delete请求方式传送过来的数据并转换成数据 - $i=0; - foreach ($id as $key => $value) { - $data[$i]['id'] = $value; - $data[$i]['yuwen'] = Null; - $data[$i]['shuxue'] = Null; - $data[$i]['wanyu'] = Null; - } - }else{ - $data[0]['id'] = $id; - $data[0]['yuwen'] = Null; - $data[0]['shuxue'] = Null; - $data[0]['waiyu'] = Null; - $data[0]['stuSum'] = Null; - $data[0]['stuAvg'] = Null; - } - - - $cj = new Chengji(); - $data = $cj->saveAll($data); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'成绩删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - // 批量删除成绩 - public function deletecjs($kaoshi) - { - - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'批量删除成绩', - 'butname'=>'删除', - 'formpost'=>'POST', - 'url'=>'/deletecjmore', - 'kaoshi'=>$kaoshi - ); - - $ks = new \app\kaoshi\model\Kaoshi; - $subject = $ks - ->where('id',$kaoshi) - ->with([ - 'ksSubject'=>function($query){ - $query->field('kaoshiid,subjectid') - ->with(['subjectName'=>function($q){ - $q->field('id,title'); - }] - ); - } - ]) - ->find() - ->toArray(); - $list['subject'] = $subject['ks_subject']; - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch(); - } - - - // 按条件删除成绩 - public function deletecjmore() - { - // 获取参数 - $src = $this->request - ->only(['kaoshi','banji','subject'],'POST'); - $banji = $src['banji']; - - // 获取要删除成绩的考号 - $kaohao = new \app\kaoshi\model\Kaohao; - $kaohaolist = $kaohao::where('kaoshi',$src['kaoshi']) - ->where('banji','in',$src['banji']) - ->column('student'); - - // 查询成绩id - $chengjilist = Chengji::where('kaohao_id','in',$kaohaolist) - ->where('subject_id','in',$src['subject']) - ->column('id'); - // 删除成绩 - $data = Chengji::destroy($chengjilist); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'成绩删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - - - // 删除单人单科成绩 - public function delete($id) - { - - if($id == 'm') - { - $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 - } - - $data = Chengji::destroy($id); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - - - // 设置成绩状态 - public function setStatus() - { - - // 获取id变量 - $id = request()->post('id'); - $value = request()->post('value'); - - // 获取班级信息 - $data = Chengji::where('id',$id)->update(['status'=>$value]); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - - - - // 下载成绩表格 - public function dwChengji($kaoshi) - { - - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'成绩下载', - 'butname'=>'下载', - 'formpost'=>'POST', - 'url'=>'/chengji/dwChengji', - 'kaoshi'=>$kaoshi - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch(); - } - - - - - - //生成学生表格 - public function dwchengjixls() - { - // 获取参数 - $list = $this->request - ->only([ - 'kaoshi'=>'1', - 'banji'=>array(), - 'school', - 'ruxuenian' - ],'POST'); - - // 获取要下载成绩的学校和年级信息 - $school = new \app\system\model\School; - $schoolname = $school->where('id',$list['school'])->value('jiancheng'); - $nianji = nianjiList(); - - - // 实例化验证模型 - $validate = new \app\chengji\validate\Cjdownload; - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - // 如果验证不通过则停止保存 - if(!$result){ - $this->error($msg); - } - - - // 获取数据库信息 - $kh = new Kaohao(); - $src = [ - 'kaoshi'=>$list['kaoshi'], - 'banji'=>$list['banji'], - ]; - $chengjiinfo = $kh->srcChengji($src); - - - // 获取考试标题 - $ks = new \app\kaoshi\model\Kaoshi; - $ks = $ks->where('id',$list['kaoshi']) - ->field('id,title') - ->with([ - 'ksSubject'=>function($query){ - $query->field('kaoshiid,subjectid') - ->with(['subjectName'=>function($q){ - $q->field('id,title,lieming'); - }] - ); - } - ]) - ->find(); - - $tabletitle =$ks->title.' '.$schoolname.' '.$nianji[$list['ruxuenian']].' '.'学生成绩详细列表'; - - $colname = excelLieming(); - - set_time_limit(0); - // 创建表格 - $spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet; - $sheet = $spreadsheet->getActiveSheet(); - - - // 设置表头信息 - $sheet->setCellValue('A1', $tabletitle); - $sheet->setCellValue('A2', '序号'); - $sheet->setCellValue('B2', '班级'); - $sheet->setCellValue('C2', '姓名'); - $sheet->setCellValue('D2', '性别'); - $i = 4; - foreach ($ks->ks_subject as $key => $value) { - $sheet->setCellValue($colname[$i].'2', $value->subject_name->title); - $i++; - } - $sheet->setCellValue($colname[$i].'2', '平均分'); - $sheet->setCellValue($colname[$i+1].'2', '总分'); - $i=$i+4; - $sheet->setCellValue($colname[$i].'2', '项目'); - $sheet->setCellValue($colname[$i].'3', '人数'); - $sheet->setCellValue($colname[$i].'4', '平均分'); - $sheet->setCellValue($colname[$i].'5', '优秀率%'); - $sheet->setCellValue($colname[$i].'6', '及格率%'); - $sheet->setCellValue($colname[$i].'7', '标准差'); - $i++; - foreach ($ks->ks_subject as $key => $value) { - $sheet->setCellValue($colname[$i].'2', $value->subject_name->title); - $i++; - } - $sheet->setCellValue($colname[$i+1].'2', '总平均分'); - $sheet->setCellValue($colname[$i+2].'2', '全科及格率%'); - - - // 循环写出成绩及个人信息 - $i = 3; - foreach ($chengjiinfo as $key => $value) { - // 表格赋值 - $sheet->setCellValue('A'.$i, $i-2); - $sheet->setCellValue('B'.$i, $value['banji']); - $sheet->setCellValue('C'.$i, $value['student']); - $sheet->setCellValue('D'.$i, $value['sex']); - $colcnt = 4; - foreach ($ks->ks_subject as $k => $val) { - if(isset($value[$val->subject_name->lieming])) - { - $sheet->setCellValue($colname[$colcnt].$i, $value[$val->subject_name->lieming]); - } - $colcnt++; - } - $sheet->setCellValue($colname[$colcnt].$i, $value['avg']); - $sheet->setCellValue($colname[$colcnt+1].$i, $value['sum']); - $i++; - } - - $tj = new \app\chengji\model\Tongji; - $nianji = array(); - $chengjiinfo = $tj->srcChengji($list['kaoshi'],$list['banji']); - $temp = $tj->tongji($chengjiinfo,$list['kaoshi']); - isset($colcnt) ? $colcnt = $colcnt+5 : $colcnt = 12; - // 循环写出统计结果 - foreach ($ks->ks_subject as $key => $value) { - $sheet->setCellValue($colname[$colcnt].'3', $temp[$value->subject_name->lieming]['xkcnt']); - $sheet->setCellValue($colname[$colcnt].'4', $temp[$value->subject_name->lieming]['avg']); - $sheet->setCellValue($colname[$colcnt].'5', $temp[$value->subject_name->lieming]['youxiu']); - $sheet->setCellValue($colname[$colcnt].'6', $temp[$value->subject_name->lieming]['jige']); - $sheet->setCellValue($colname[$colcnt].'7', $temp[$value->subject_name->lieming]['biaozhuncha']); - $colcnt++; - } - - $sheet->setCellValue($colname[$colcnt+1].'3', $temp['avg']); - $sheet->setCellValue($colname[$colcnt+2].'3', $temp['rate']); - - - // 保存文件 - $filename = $tabletitle.date('ymdHis').'.xlsx'; - header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); - header('Content-Disposition: attachment;filename="' . $filename . '"'); - header('Cache-Control: max-age=0'); - $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx'); - $writer->save('php://output'); - ob_flush(); - flush(); - } - - - - - - // 学生成绩录入信息 - public function readAdd($kaohao) - { - // 设置要给模板赋值的信息 - $list['webtitle'] = '查看成绩录入信息'; - $list['kaohao'] = $kaohao; - - // 模板赋值 - $this->assign('list',$list); - - // 渲染模板 - return $this->fetch(); - } - - - - - - // ajax获取学生成绩录入信息 - public function ajaxaddinfo() - { - // 获取参数 - $src = $this->request - ->only([ - 'page'=>'1', - 'limit'=>'10', - 'field'=>'subject_id', - 'type'=>'desc', - 'kaohao'=>'' - ],'POST'); - - $chengji = new Chengji; - - $data = $chengji - ->where('kaohao_id',$src['kaohao']) - ->field('id,kaohao_id,subject_id,user_id,defen,update_time') - ->order([$src['field']=>$src['type']]) - ->with([ - 'subjectName'=>function($query){ - $query->field('id,title'); - }, - 'userName'=>function($query){ - $query->field('id,school,xingming') - ->with([ - 'adSchool'=>function($query){ - $query->field('id,jiancheng'); - } - ]); - } - ]) - ->select(); - - $cnt = count($data); - - // 获取当前页数据 - $limit_start = $src['page'] * $src['limit'] - $src['limit']; - $limit_length = $src['limit']; - $data = $data->slice($limit_start,$limit_length); - - // 重组返回内容 - $data = [ - 'code'=> 0 , // ajax请求次数,作为标识符 - 'msg'=>"", // 获取到的结果数(每页显示数量) - 'count'=>$cnt, // 符合条件的总数据量 - 'data'=>$data, //获取到的数据结果 - ]; - - - return json($data); - } - - -} diff --git a/application/chengji/controller/Njtongji.php b/application/chengji/controller/Njtongji.php deleted file mode 100644 index bd548272..00000000 --- a/application/chengji/controller/Njtongji.php +++ /dev/null @@ -1,204 +0,0 @@ -where('id',$kaoshi) - ->with([ - 'KsNianji' - ,'ksSubject'=>function($query){ - $query->field('kaoshiid,subjectid,manfen') - ->with(['subjectName'=>function($q){ - $q->field('id,title,lieming'); - }] - ); - } - ]) - ->field('id,title') - ->find(); - - if(count($ksinfo->ks_nianji)>0) - { - $list['nianji'] = $ksinfo->ks_nianji[0]->nianji; - }else{ - $list['nianji'] = "一年级"; - } - - $list['subject'] = $ksinfo->ks_subject; - // 设置要给模板赋值的信息 - $list['webtitle'] = '各学校的年级成绩统计表'; - $list['kaoshi'] = $kaoshi; - $list['kaoshititle'] = $ksinfo->title; - - - // 模板赋值 - $this->assign('list',$list); - - // 渲染模板 - return $this->fetch(); - } - - - // 获取年级成绩统计结果 - public function ajaxNianji() - { - // 获取参数 - $src = $this->request - ->only([ - 'page'=>'1', - 'limit'=>'10', - 'kaoshi'=>'', - 'nianji'=>'一年级', - ],'POST'); - // 统计成绩 - $ntj = new NTJ; - $data = $ntj->tjNianji($kaoshi=$src['kaoshi'],$nianji=$src['nianji']); - // 获取记录数 - $cnt = count($data); - // 截取当前页数据 - $data = array_slice($data,($src['page']-1)*$src['limit'],$src['limit']); - - // 重组返回内容 - $data = [ - 'code'=> 0 , // ajax请求次数,作为标识符 - 'msg'=>"", // 获取到的结果数(每页显示数量) - 'count'=>$cnt, // 符合条件的总数据量 - 'data'=>$data, //获取到的数据结果 - ]; - - - return json($data); - } - - - - // 年级、班级学生成绩统计结果下载界面 - public function dwNianji($kaoshi) - { - - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'各年级成绩汇总表下载', - 'butname'=>'下载', - 'formpost'=>'POST', - 'url'=>'/njtongji/dwNanji', - 'kaoshi'=>$kaoshi - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch(); - - } - - - // 年级、班级学生成绩统计下载表格 - public function dwNianjixls($kaoshi) - { - - // 获取参数 - $src = $this->request - ->only([ - 'page'=>'1', - 'limit'=>'10', - 'kaoshi'=>'', - 'nianji'=>'一年级', - ],'POST'); - - // 统计成绩 - $ntj = new NTJ; - $data = $ntj->tjNianji($kaoshi=$src['kaoshi'],$nianji=$src['nianji']); - - // 获取参考学科 - $ks = new \app\kaoshi\model\Kaoshi; - $ksinfo = $ks->where('id',$src['kaoshi']) - ->field('id,title') - ->with([ - 'ksSubject'=>function($query){ - $query->field('kaoshiid,subjectid,manfen') - ->with(['subjectName'=>function($q){ - $q->field('id,title,lieming'); - }] - ); - } - ]) - ->find(); - $xk = $ksinfo->ks_subject; - - // 获取要下载成绩的学校和年级信息 - $tabletitle = $ksinfo->title.' '.$src['nianji'].'各学校成绩汇总'; - - - // 创建表格 - $spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet; - $sheet = $spreadsheet->getActiveSheet(); - - $sbjcol = ['xkcnt'=>'人数','avg'=>'平均分','jige'=>'及格率%','youxiu'=>'优秀率%']; - $sbjcolcnt = count($sbjcol); - $colname = excelLieming(); - $colcnt = $sbjcolcnt*count($xk)+3; - - - // 设置表头信息 - $sheet->mergeCells('A1:'.$colname[$colcnt].'1'); - $sheet->setCellValue('A1', $tabletitle); - $sheet->mergeCells('A3:A4'); - $sheet->setCellValue('A3', '序号'); - $sheet->mergeCells('B3:B4'); - $sheet->setCellValue('B3', '班级'); - $col = 2; - foreach ($xk as $key => $value) { - $colend = $col + $sbjcolcnt - 1; - $sheet->mergeCells($colname[$col].'3:'.$colname[$colend].'3'); - $sheet->setCellValue($colname[$col].'3', $value->subject_name->title.' ('.$value->manfen.')'); - foreach ($sbjcol as $k => $val) { - $sheet->setCellValue($colname[$col].'4', $val); - $col++; - } - } - $sheet->mergeCells($colname[$col].'3:'.$colname[$col].'4'); - $sheet->setCellValue($colname[$col].'3', '全科及格率%'); - $col++; - $sheet->mergeCells($colname[$col].'3:'.$colname[$col].'4'); - $sheet->setCellValue($colname[$col].'3', '总平均分'); - - $row = 5; - foreach ($data as $key => $value) { - $col = 2; - $sheet->setCellValue('A'.$row, $row-4); - $sheet->setCellValue('B'.$row, $value['school']); - foreach ($xk as $ke => $val) { - foreach ($sbjcol as $k => $v) { - $sheet->setCellValue($colname[$col].$row, $value['chengji'][$val->subject_name->lieming][$k]); - $col++; - } - } - $sheet->setCellValue($colname[$col].$row, $value['chengji']['rate']); - $col++; - $sheet->setCellValue($colname[$col].$row, $value['chengji']['avg']); - $row++; - } - - // 保存文件 - $filename = $tabletitle.date('ymdHis').'.xlsx'; - header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); - header('Content-Disposition: attachment;filename="' . $filename . '"'); - header('Cache-Control: max-age=0'); - $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx'); - $writer->save('php://output'); - ob_flush(); - flush(); - } -} diff --git a/application/chengji/controller/Tongji.php b/application/chengji/controller/Tongji.php deleted file mode 100644 index 0d3af2db..00000000 --- a/application/chengji/controller/Tongji.php +++ /dev/null @@ -1,52 +0,0 @@ -where('id',$kaoshi) - ->with([ - 'KsNianji' - ,'ksSubject'=>function($query){ - $query->field('kaoshiid,subjectid,manfen') - ->with(['subjectName'=>function($q){ - $q->field('id,title,lieming'); - }] - ); - } - ]) - ->field('id,title') - ->find(); - - if(count($ksinfo->ks_nianji)>0) - { - $list['nianji'] = $ksinfo->ks_nianji[0]->nianji; - }else{ - $list['nianji'] = "一年级"; - } - $list['subject'] = $ksinfo->ks_subject->toArray(); - // 设置要给模板赋值的信息 - $list['webtitle'] = '各年级的班级成绩列表'; - $list['kaoshi'] = $kaoshi; - $list['kaoshititle'] = $ksinfo->title; - - - // 模板赋值 - $this->assign('list',$list); - - // 渲染模板 - return $this->fetch(); - } - - -} diff --git a/application/chengji/model/Bjtongji.php b/application/chengji/model/Bjtongji.php deleted file mode 100644 index 52af791f..00000000 --- a/application/chengji/model/Bjtongji.php +++ /dev/null @@ -1,63 +0,0 @@ -cyBanji($kaoshi=$kaoshi,$ruxuenian=$nianji,$school=$school,$paixu=$paixu); - - $data = array(); - if($bj->isEmpty()){ - return $data; - } - - // 实例化学生成绩统计类 - $tj = new TJ; - - // 获取并统计各班级成绩 - $data = array(); - $bjs = array(); - foreach ($bj as $key => $value) { - $bjs[] = $value->banji; - $banji=[$value->banji]; - $temp = $tj->srcChengji($kaoshi=$kaoshi,$banji=$banji,$nianji=$nianji,$school=array()); - $temp = $tj->tongji($temp,$kaoshi); - $data[] = [ - 'banji'=>$value->bjtitle, - 'school'=>$value->cj_school->jiancheng, - 'chengji'=>$temp - ]; - - } - - - // 获取年级成绩 - $allcj = $tj->srcChengji($kaoshi=$kaoshi,$banji=$bjs,$nianji=$nianji,$school=array()); - $temp = $tj->tongji($allcj,$kaoshi); - $data[] = [ - 'banji'=>'合计', - 'school'=>'', - 'chengji'=>$temp - ]; - - - return $data; - } -} diff --git a/application/chengji/model/Chengji.php b/application/chengji/model/Chengji.php deleted file mode 100644 index 7c01bb9f..00000000 --- a/application/chengji/model/Chengji.php +++ /dev/null @@ -1,31 +0,0 @@ -belongsTo('\app\teach\model\Subject'); - } - - // 学科关联 - public function subjectName() - { - return $this->belongsTo('\app\teach\model\Subject','subject_id','id'); - } - - // 学科关联 - public function userName() - { - return $this->belongsTo('\app\admin\model\Admin','user_id','id'); - } - - -} diff --git a/application/chengji/model/Njtongji.php b/application/chengji/model/Njtongji.php deleted file mode 100644 index 3c7fb764..00000000 --- a/application/chengji/model/Njtongji.php +++ /dev/null @@ -1,55 +0,0 @@ -cySchool($kaoshi=$kaoshi,$ruxuenian=$nianji); - - $data = array(); - if($school->isEmpty()){ - return $data; - } - - // 实例化学生成绩统计类 - $tj = new TJ; - - // 获取并统计各班级成绩 - $data = array(); - foreach ($school as $key => $value) { - $schools=[$value->cj_school->id]; - $temp = $tj->srcChengji($kaoshi=$kaoshi,$banji=array(),$nianji=$nianji,$schools=$schools); - $temp = $tj->tongji($temp,$kaoshi); - $data[] = [ - 'school'=>$value->cj_school->jiancheng, - 'chengji'=>$temp - ]; - } - - // 获取年级成绩 - $allcj = $tj->srcChengji($kaoshi=$kaoshi,$banji=array(),$nianji=$nianji,$school=array()); - $temp = $tj->tongji($allcj,$kaoshi); - $data[] = [ - 'school'=>'合计', - 'chengji'=>$temp - ]; - return $data; - } -} diff --git a/application/chengji/model/Tongji.php b/application/chengji/model/Tongji.php deleted file mode 100644 index 32a08fde..00000000 --- a/application/chengji/model/Tongji.php +++ /dev/null @@ -1,234 +0,0 @@ -where('kaoshi',$kaoshi) - ->field('id,nianji,banji') - ->when(count($school)>0,function($query) use($school){ - $query->where('school','in',$school); - }) - ->when(strlen($nianji)>0,function($query) use($nianji){ - $query->where('ruxuenian',$nianji); - }) - ->when(count($banji)>0,function($query) use($banji){ - $query->where('banji','in',$banji); - }) - ->with([ - 'ksChengji'=>function($query){ - $query->field('kaohao_id,subject_id,defen'); - } - ]) - ->select(); - if($khlist->isEmpty()) - { - return $data = array(); - } - - // 获取参考学科 - $ks = new \app\kaoshi\model\Kaoshi; - $ksinfo = $ks->where('id',$kaoshi) - ->with([ - 'ksSubject'=>function($query){ - $query->field('kaoshiid,subjectid,lieming'); - } - ]) - ->find(); - if($ksinfo->ks_subject->isEmpty()) - { - return $data = array(); - } - $xk = array(); - foreach ($ksinfo->ks_subject as $key => $value) { - $xk[$value->subjectid] = $value->lieming; - } - - // 整理数据 - $data = array(); - foreach ($khlist as $key => $value) { - if(count($value->ks_chengji)== 0) - { - continue; - } - $data[$key]['sum'] = 0; - $sbjcnt = 0; - foreach ($value->ks_chengji as $k => $val) { - $data[$key][$xk[$val->subject_id]] = $val->defen*1; - $data[$key]['sum'] = ($data[$key]['sum'] + $val->defen) * 1; - $sbjcnt ++ ; - } - $data[$key]['sum'] == 0 ? $data[$key]['avg'] = 0 : $data[$key]['sum'] / $sbjcnt; - } - - return $data; - } - - - - // 统计成绩 - public function tongji($cj=array(),$kaoshi) - { - - $ks = new \app\kaoshi\model\Kaoshi; - $ksinfo = $ks->where('id',$kaoshi) - ->field('id') - ->with('ksSubject') - ->find(); - $data = array(); - // $allcj = array(); - foreach ($ksinfo->ks_subject as $key => $value) { - $cjcol = array_column($cj,$value->lieming); - // $allcj = array_merge($allcj,$cjcol); - $temp = array(); - $temp['xkcnt'] = count($cjcol); - $temp['sum'] = array_sum($cjcol); - $temp['xkcnt']>0 ? $temp['avg'] = $temp['sum']/$temp['xkcnt'] : $temp['avg']=0; - $temp['biaozhuncha'] = round($this->getVariance($temp['avg'], $cjcol,true),2); - $temp['avg'] = round($temp['avg'],2); - $temp['youxiu'] = $this->rate($cjcol,$value->youxiu); - $temp['jige'] = $this->rate($cjcol,$value->jige); - $temp['sifenwei'] = $this->quartile($cjcol); - $data[$value->lieming] = $temp; - } - $cjcol = array_column($cj,'sum'); - $data['bmcnt'] = count($cj); # 报名人数 - $data['sum'] = array_sum($cjcol); - $data['bmcnt']>0 ? $data['avg'] = round($data['sum']/$data['bmcnt'],2) : $data['avg']=0; - foreach ($cj as $key => $value) { - unset($cj[$key]['avg']); - unset($cj[$key]['sum']); - } - $data['rate'] = $this->rateAll($cj,$ksinfo->ks_subject); #全科及格率 - - return $data; - } - - - // 统计优秀、及格率 - public function rate($cj = array(),$fenshuxian) - { - $cnt = 0; - foreach ($cj as $key => $value) { - if($value>=$fenshuxian) - { - $cnt++; - } - } - if(count($cj)>0) - { - return round($cnt/count($cj)*100,2); - }else{ - return '0'; - } - - } - - - // 全科及格率 - public function rateAll($cj = array(), $sbj=array()) - { - $jige = 0; # 总及格人数 - $sbjcnt = count($sbj); - // 开始循环每个人的成绩 - foreach ($cj as $key => $value) { - $temjige = 0; #记录学生及格的学科数 - // 开始循环这个学生的每个学科成绩 - foreach ($sbj as $k => $val) { - if(isset($value[$val->lieming])) - { - if($value[$val->lieming]>=$val->jige) - { - $temjige++; - } - } - } - // 如果这个学生及格学科数等于学科总数,那么全科及格总数加1 - $temjige == $sbjcnt && $temjige>0 ? $jige++ : $jige ; - } - - - if(count($cj)>0) - { - return round($jige/count($cj)*100,2); - }else{ - return 0; - } - } - - - - - /** - * 得到数组的标准差 - * @param unknown type $avg - * @param Array $list - * @param Boolen $isSwatch - * @return unknown type - */ - public static function getVariance($avg, $list, $isSwatch = FALSE) { - $arrayCount = count($list); - if($arrayCount == 1 && $isSwatch == TRUE){ - return '-'; - }elseif($arrayCount > 0 ){ - $total_var = 0; - foreach ($list as $lv) - $total_var += pow(($lv - $avg), 2); - if($arrayCount == 1 && $isSwatch == TRUE) - return FALSE; - return $isSwatch?sqrt($total_var / (count($list) - 1 )):sqrt($total_var / count($list)); - } - else - return '-'; - } - - - // 四分位 - public function quartile($items) { - // 获取数组长度 - $length = count($items); - if ($items == null || $length == 0) return $result = [0=>'-',1=>'-',2=>'-']; - - if ($length < 5) return $result = [0=>'-',1=>'-',2=>'-']; - $result = array(); - - sort($items); - - if ($length % 2 == 0) {//偶数 - $result[1] = ($items[$length/2 - 1] + $items[$length/2]) / 2; - } else {//奇数 - $result[1] = $items[($length + 1)/2 - 1]; - } - - if ($length % 4 == 0) { - $result[0] = ($items[$length/4 - 1] + $items[$length/4]) / 2; - $result[2] = ($items[3*$length/4 - 1] + $items[3*$length/4]) / 2; - } else { - $result[0] = $items[$length/4]; - $result[2] = $items[3*$length/4]; - } - - return $result; - } - - -} diff --git a/application/chengji/validate/Cjdownload.php b/application/chengji/validate/Cjdownload.php deleted file mode 100644 index 6d335ac5..00000000 --- a/application/chengji/validate/Cjdownload.php +++ /dev/null @@ -1,27 +0,0 @@ - ['规则1','规则2'...] - * - * @var array - */ - protected $rule = [ - 'banji|班级' => 'require|array', - 'kaoshi|考试' => 'require|number' - ]; - - /** - * 定义错误信息 - * 格式:'字段名.规则名' => '错误信息' - * - * @var array - */ - protected $message = []; -} diff --git a/application/chengji/validate/Tjschool.php b/application/chengji/validate/Tjschool.php deleted file mode 100644 index 30484351..00000000 --- a/application/chengji/validate/Tjschool.php +++ /dev/null @@ -1,24 +0,0 @@ - ['规则1','规则2'...] - * - * @var array - */ - protected $rule = []; - - /** - * 定义错误信息 - * 格式:'字段名.规则名' => '错误信息' - * - * @var array - */ - protected $message = []; -} diff --git a/application/chengji/view/bjtongji/biaoge.html b/application/chengji/view/bjtongji/biaoge.html deleted file mode 100644 index 4421b988..00000000 --- a/application/chengji/view/bjtongji/biaoge.html +++ /dev/null @@ -1,176 +0,0 @@ - -{extend name="common@list" /} -{block name="jsset"} - -{/block} -{block name="nav"} - - 考试管理 - 更多操作 - 成绩查看 - 各班级成绩统计表 - {$list['kaoshititle']} - -{/block} -{block name="search"} -
- -
- {php} $schoollist = schlist('校级','校级',['小学','中小学']);{/php} - {volist name="schoollist" id="vo"} - - {/volist} -
-
-
- -
- {php} - $nianji = new \app\kaoshi\model\KaoshiNianji; - $njlist = $nianji - ->where('kaoshiid',$list['kaoshi']) - ->field('nianji,nianjiname') - ->select(); - {/php} - {foreach $njlist as $key=>$vo} - - {/foreach} -
-
-
- -
- {php} - $banji = new \app\teach\model\Banji; - $njlist = array_column($njlist->toArray(),'nianji'); - $paixu = $banji->where('status',1) - ->where('ruxuenian','in',$njlist) - ->max('paixu'); - $bjlist = banjinamelist(); - {/php} - {for start="1" end="$paixu+1" } - - {/for} -
-
- -{/block} -{block name="table"} -
-{/block} -{block name="myjs"} - - - - - - -{/block} \ No newline at end of file diff --git a/application/chengji/view/bjtongji/dw_banji.html b/application/chengji/view/bjtongji/dw_banji.html deleted file mode 100644 index 7fbcf141..00000000 --- a/application/chengji/view/bjtongji/dw_banji.html +++ /dev/null @@ -1,61 +0,0 @@ -{extend name="common@create" /} - -{block name="form"} -
- -
- -
- {php} $schoollist = schlist('校级','校级',['小学','中小学']);{/php} - -
-
-
- -
- {php} - $nianji = new \app\kaoshi\model\KaoshiNianji; - $njlist = $nianji - ->where('kaoshiid',$list['set']['kaoshi']) - ->field('nianji,nianjiname') - ->select(); - {/php} - -
-
- -
- -
-
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/chengji/view/index/biaolu.html b/application/chengji/view/index/biaolu.html deleted file mode 100644 index 498751bc..00000000 --- a/application/chengji/view/index/biaolu.html +++ /dev/null @@ -1,59 +0,0 @@ -{extend name="common@create" /} - -{block name="form"} -
- -
-
-
- -
- -
-
-
- -
-
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/chengji/view/index/deletecjs.html b/application/chengji/view/index/deletecjs.html deleted file mode 100644 index 1f5a4dbf..00000000 --- a/application/chengji/view/index/deletecjs.html +++ /dev/null @@ -1,145 +0,0 @@ -{extend name="common@create" /} - -{block name="form"} -
-
- -
- {volist name="list.subject" id="vo"} - - {/volist} - -
-
- - -
- -
- {php} $schoollist = schlist('校级','校级',['小学','中小学']);{/php} - -
-
-
- -
- {php} - $nianji = new \app\kaoshi\model\KaoshiNianji; - $njlist = $nianji - ->where('kaoshiid',$list['set']['kaoshi']) - ->field('nianji,nianjiname') - ->select(); - {/php} - -
-
-
- -
-
-
- -
- -
-
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/chengji/view/index/dw_chengji.html b/application/chengji/view/index/dw_chengji.html deleted file mode 100644 index 0baeeb79..00000000 --- a/application/chengji/view/index/dw_chengji.html +++ /dev/null @@ -1,129 +0,0 @@ -{extend name="common@create" /} - -{block name="form"} -
- -
- -
- {php} $schoollist = schlist('校级','校级',['小学','中小学']);{/php} - -
-
-
- -
- {php} $njlist = nianjiList();{/php} - -
-
-
- -
-
-
- -
- -
-
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/chengji/view/index/edit.html b/application/chengji/view/index/edit.html deleted file mode 100644 index 50015273..00000000 --- a/application/chengji/view/index/edit.html +++ /dev/null @@ -1,90 +0,0 @@ -{extend name="common@create" /} -{block name="formaa"} -
-
- -
- {$list['cj_kaoshi']['title']} -
-
-
- -
- {$list['cj_student']['xingming']} -
-
- {php} - - $xk = new \app\teach\model\Subject; - $xk = $xk->where('id','<',4)->select(); - $xkTitle = $xk->column('title','id'); - $xkLieming = $xk->column('lieming','id'); - - $cj = new \app\chengji\model\Chengji; - $cj = $cj->where('id',$list['id'])->append(['cj_manfen'])->find(); - foreach ($cj->cj_manfen as $key => $value) { - $manfen[$value['subjectid']]=$value['manfen']; - } - {/php} - {foreach $manfen as $key=>$vo} -
- -
- -
-
- {/foreach} - -
-
- -
-
-
-{/block} -{block name="yanzheng"} - -{/block} \ No newline at end of file diff --git a/application/chengji/view/index/index.html b/application/chengji/view/index/index.html deleted file mode 100644 index 4a195f6e..00000000 --- a/application/chengji/view/index/index.html +++ /dev/null @@ -1,199 +0,0 @@ - -{extend name="common@list" /} -{block name="jsset"} - -{/block} -{block name="nav"} - - 考试管理 - 更多操作 - 成绩查看 - 成绩列表 - -{/block} -{block name="search"} - -
- -
- -
-
-
- -
- {php} $schoollist = schlist('校级','校级',['小学','中小学']);{/php} - {volist name="schoollist" id="vo"} - - {/volist} -
-
-
- -
- {php} - $nianji = new \app\kaoshi\model\KaoshiNianji; - $njlist = $nianji - ->where('kaoshiid',$list['kaoshi']) - ->field('nianji,nianjiname') - ->select(); - {/php} - {foreach $njlist as $key=>$vo} - - {/foreach} -
-
-
- -
- {php} - $banji = new \app\teach\model\Banji; - $njlist = $njlist->column('nianji'); - $paixu = $banji->where('status',1) - ->where('ruxuenian','in',$njlist) - ->max('paixu'); - $bjlist = banjinamelist(); - {/php} - {for start="1" end="$paixu+1" } - - {/for} -
-
- - -{/block} -{block name="table"} -
-{/block} -{block name="myjs"} - - - - - - -{/block} \ No newline at end of file diff --git a/application/chengji/view/index/malu.html b/application/chengji/view/index/malu.html deleted file mode 100644 index 194bfb09..00000000 --- a/application/chengji/view/index/malu.html +++ /dev/null @@ -1,117 +0,0 @@ -{extend name="common@createhref" /} - -{block name="form"} -
- -
- -
-
-
学校
-
-
班级
-
-
姓名
-
-
学科
-
-
-
-
-
- -
- - -
-
-
- - -{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/chengji/view/index/read_add.html b/application/chengji/view/index/read_add.html deleted file mode 100644 index 98774b30..00000000 --- a/application/chengji/view/index/read_add.html +++ /dev/null @@ -1,122 +0,0 @@ - -{extend name="common@list" /} -{block name="jsset"} - -{/block} -{block name="nav"} - - 成绩管理 - 成绩列表 - 录入信息 - -{/block} -{block name="search"} -{/block} -{block name="table"} -
-{/block} -{block name="myjs"} - - - - - - -{/block} \ No newline at end of file diff --git a/application/chengji/view/njtongji/biaoge.html b/application/chengji/view/njtongji/biaoge.html deleted file mode 100644 index bcb5612a..00000000 --- a/application/chengji/view/njtongji/biaoge.html +++ /dev/null @@ -1,150 +0,0 @@ - -{extend name="common@list" /} -{block name="jsset"} - -{/block} -{block name="nav"} - - 考试管理 - 更多操作 - 成绩查看 - 各年级成绩统计表 - {$list['kaoshititle']} - -{/block} -{block name="search"} -
- -
- {php} - $nianji = new \app\kaoshi\model\KaoshiNianji; - $njlist = $nianji - ->where('kaoshiid',$list['kaoshi']) - ->field('nianji,nianjiname') - ->select(); - {/php} - {foreach $njlist as $key=>$vo} - - {/foreach} -
-
- -{/block} -{block name="table"} -
-{/block} -{block name="myjs"} - - - - - - -{/block} \ No newline at end of file diff --git a/application/chengji/view/njtongji/dw_nianji.html b/application/chengji/view/njtongji/dw_nianji.html deleted file mode 100644 index c6dc00ba..00000000 --- a/application/chengji/view/njtongji/dw_nianji.html +++ /dev/null @@ -1,41 +0,0 @@ -{extend name="common@create" /} - -{block name="form"} -
-
- -
- {php} - $nianji = new \app\kaoshi\model\KaoshiNianji; - $njlist = $nianji - ->where('kaoshiid',$list['set']['kaoshi']) - ->field('nianji,nianjiname') - ->select(); - {/php} - -
-
- -
- -
-
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/chengji/view/tongji/yilu_cnt.html b/application/chengji/view/tongji/yilu_cnt.html deleted file mode 100644 index e964d419..00000000 --- a/application/chengji/view/tongji/yilu_cnt.html +++ /dev/null @@ -1,171 +0,0 @@ - -{extend name="common@list" /} -{block name="jsset"} - -{/block} -{block name="nav"} - - 考试管理 - 更多操作 - 前期操作 - 已录成绩数量 - {$list['kaoshititle']} - -{/block} -{block name="search"} -
- -
- {php} $schoollist = schlist('校级','校级',['小学','中小学']);{/php} - {volist name="schoollist" id="vo"} - - {/volist} -
-
-
- -
- {php} - $nianji = new \app\kaoshi\model\KaoshiNianji; - $njlist = $nianji - ->where('kaoshiid',$list['kaoshi']) - ->field('nianji,nianjiname') - ->select(); - {/php} - {foreach $njlist as $key=>$vo} - - {/foreach} -
-
-
- -
- {php} - $banji = new \app\teach\model\Banji; - $njlist = array_column($njlist->toArray(),'nianji'); - $paixu = $banji->where('status',1) - ->where('ruxuenian','in',$njlist) - ->max('paixu'); - $bjlist = banjinamelist(); - {/php} - {for start="1" end="$paixu+1" } - - {/for} -
-
- -{/block} -{block name="table"} -
-{/block} -{block name="myjs"} - - - - - - -{/block} \ No newline at end of file diff --git a/application/command.php b/application/command.php deleted file mode 100644 index 826bb2b2..00000000 --- a/application/command.php +++ /dev/null @@ -1,12 +0,0 @@ - -// +---------------------------------------------------------------------- - -return []; diff --git a/application/common.php b/application/common.php deleted file mode 100644 index c29b5946..00000000 --- a/application/common.php +++ /dev/null @@ -1,354 +0,0 @@ - -// +---------------------------------------------------------------------- - -// 应用公共文件 - -// 获取类别列表 -function getCategory($id = '0') -{ - $category = new \app\system\model\Category; - // 根据父级id查询类别列表 - $list = $category - ->where('pid','in',$id) - ->where('status',1) - ->field('id,title') - ->select(); - - // 返回类别列表 - return $list; -} - - -// 获取类别名称 -function getCategoryTitle($id) -{ - $category = new \app\system\model\Category; - // 根据id查询类别名 - $value = $category - ->where('id',$id) - ->vlaue('title'); - // 返回类别名 - return $value; -} - - -function nianjiList($riqi=0) -{ - // 定义学年时间节点日期为每年的8月10日 - // $yd = '8-10'; - $time = new think\helper\Time(); - if($riqi == 0) - { - $jiedian = strtotime(date('Y').'-8-1'); - $thisday = $time->today(); - }else{ - $jiedian = strtotime(date('Y',$riqi).'-8-1'); - $thisday = $riqi; - } - - - if($thisday[0]<=$jiedian) - { - $str = 1; - }else{ - $str = 0; - } - - $nian = date('Y') - $str; - - $njlist = array(); - - $njlist[$nian]='一年级'; - $njlist[$nian-1]='二年级'; - $njlist[$nian-2]='三年级'; - $njlist[$nian-3]='四年级'; - $njlist[$nian-4]='五年级'; - $njlist[$nian-5]='六年级'; - - return $njlist; -} - - -// 班级列表 -function banjinamelist() -{ - $bjarr = array( - '1'=>'一班', - '2'=>'二班', - '3'=>'三班', - '4'=>'四班', - '5'=>'五班', - '6'=>'六班', - '7'=>'七班', - '8'=>'八班', - '9'=>'九班', - '10'=>'十班', - '11'=>'十一班', - '12'=>'十二班', - '13'=>'十三班', - '14'=>'十四班', - '15'=>'十五班', - '16'=>'十六班', - '17'=>'十七班', - '18'=>'十八班', - '19'=>'十九班', - '20'=>'二十班', - '21'=>'二十一班', - '22'=>'二十二班', - '23'=>'二十三班', - '24'=>'二十四班', - '25'=>'二十五班', - ); - - return $bjarr; -} - - - - -/** -* $date是时间戳 -* $type为1的时候是虚岁,2的时候是周岁 -*/ -function getAgeByBirth($date = 0,$type = 1){ - $nowYear = date("Y",time()); - $nowMonth = date("m",time()); - $nowDay = date("d",time()); - $birthYear = date("Y",$date); - $birthMonth = date("m",$date); - $birthDay = date("d",$date); - if($type == 1){ - $age = $nowYear - ($birthYear - 1); - }elseif($type == 2){ - if($nowMonth<$birthMonth){ - $age = $nowYear - $birthYear - 1; - }elseif($nowMonth==$birthMonth){ - if($nowDay<$birthDay){ - $age = $nowYear - $birthYear - 1; - }else{ - $age = $nowYear - $birthYear; - } - }else{ - $age = $nowYear - $birthYear; - } - } - return $age; -} - - -// EXCEL表格列名 -function excelLieming() -{ - $liemingarr = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','AA','AB','AC','AD','AE','AF']; - return $liemingarr; -} - - - -// 单位列表 -function schlist($low='班级',$high='其它级',$xueduan=array()) -{ - // 实例化单位模型 - $sch = new \app\system\model\School; - // 实例化类别数据模型 - $cat = new \app\system\model\Category; - // 获取获取级别列表 - $catlist = $cat->where('pid',102) - ->where('status',1) - ->column('title,id'); - - // 获取学段列表 - if(count($xueduan)>0){ - $xdlist = $cat->where('pid',103) - ->where('status',1) - ->where('title','in',$xueduan) - ->column('id'); - }else{ - $xdlist = $cat->where('pid',103) - ->where('status',1) - ->column('id'); - } - - - // 查询学校 - $schlist = $sch->where('jibie','between',[$catlist[$low],$catlist[$high]]) - ->where('status',1) - ->where('xueduan','in',$xdlist) - ->order(['paixu']) - ->column('id,title,jiancheng'); - - return $schlist; -} - - -// 整理教师名 -function teacherNames($list = array()) -{ - if(count($list) == 0 ) - { - return ''; - } - - - $names = ''; - foreach ($list as $key => $value) { - if($key == 0) - { - $names = $value['teacher']['xingming']; - }else{ - $names = $names . '、'. $value['teacher']['xingming']; - } - } - - return $names; -} - - - -/** -* 上传文件,并返回文件存储地址 -* -* @access public -* @param array $list 文件信息 -* @param mixed $list['serurl'] 文件要存到哪儿 -* @param mixed $list[''] 文件要存到哪儿 -* @param mixed $file 文件 -* @param array $isSave 是否将文件信息保存到数据库 -* @return array 返回类型 数组 -* @return msg string 提示 -* @return val string 结果 -* @return url string 如果保存到数据库,返回完整路径,否则保存部分路径。 -*/ -function upload($list,$file,$isSave=false) -{ - // 声明默认目录 - $myrul = '..\public\uploads\\'; - - // 实例化文件数据模型 - $field = new \app\system\model\Fields; - - - // 移动到框架应用根目录/uploads/ 目录下 - $info = $file->move($myrul.$list['serurl']); - - - // 如果上传成功 - if(!$info){ - // 上传失败获取错误信息 - $data = array('msg'=>$file->getError(),'val'=>false,'url'=>null); - return $data; - } - - - // 成功上传后 获取上传信息 - $list['category'] = $info->getExtension(); - $list['url'] = $list['serurl'].$info->getSaveName(); - $list['newname'] = $info->getFilename(); - $list['hash'] = $info->hash('sha1'); - $list['userid'] = session('userid'); - $list['oldname'] = $info->getInfo('name'); - $list['fieldsize'] = $info->getInfo('size'); - // $list['bianjitime'] = Null; - - - // 如果需要保存文件 - if($isSave == true){ - - //将文件信息保存 - $data = $field->create($list); - - if($data){ - $data = array( - 'msg'=>'上传成功' - ,'val'=>true - ,'url'=>$myrul.$list['serurl'].$info->getSaveName() - ); - }else{ - $data = array( - 'msg'=>'保存文件信息失败' - ,'val'=>false - ); - } - }else{ - $data = array( - 'msg'=>'上传成功' - ,'val'=>true - ,'url'=>$info->getSaveName() - ); - } - - - - // 返回信息 - return $data; -} - - - -/** - * 数组重新排序 - * $array 要排序的数组 - * $field 排序字段 - * $sort 排序方式 SORT_DESC 降序;SORT_ASC 升序 - * */ -function arraySequence($data, $field = 'id', $sort = 'desc') { - // 排序方式 - $sort == 'desc' ? $sort = SORT_DESC : $sort = SORT_ASC; - // 获取参考列 - $column = array_column($data, $field); - // 排序 - array_multisort($column, $sort, $data); - - return $data; -} - - - - -/** - * 根据键值,用数组2的值替换数组1的值 - * $cover 覆盖数组,存储新值的数组 - * $covered 被覆盖数组,被更改值的数组 - * 返回 新arr1 - * */ -function array_cover( $cover = array(), $covered = array() ) -{ - foreach ($cover as $key => $value) { - if(isset($covered[$key]) == true) - { - $covered[$key] = $cover[$key]; - } - } - return $covered; -} - - -/** - * 根据考试ID值,判断考试是否已经结束 - * $kaoshiid 考试ID - * 返回 $data - * */ -function enddate($kaoshiid) -{ - $ks = new app\kaoshi\model\Kaoshi; - $enddate = $ks->where('id',$kaoshiid)->value('enddate'); - - $thistime = time(); - if($enddate[ - 'except'=>[ - 'exit', - ], - ], - ]; - - public function _empty() - { - $this->error('不好意思,您访问的页面不存在~'); - } - -} diff --git a/application/common/controller/BaseError.php b/application/common/controller/BaseError.php deleted file mode 100644 index 6d9c8031..00000000 --- a/application/common/controller/BaseError.php +++ /dev/null @@ -1,26 +0,0 @@ -error('不好意思,您访问的页面不存在~'); - } - - public function _empty() - { - $this->error('不好意思,您访问的页面不存在~'); - } - -} diff --git a/application/common/model/Base.php b/application/common/model/Base.php deleted file mode 100644 index e358707d..00000000 --- a/application/common/model/Base.php +++ /dev/null @@ -1,20 +0,0 @@ - ['规则1','规则2'...] - * - * @var array - */ - protected $rule = []; - - /** - * 定义错误信息 - * 格式:'字段名.规则名' => '错误信息' - * - * @var array - */ - protected $message = []; -} diff --git a/application/common/view/admininfo.html b/application/common/view/admininfo.html deleted file mode 100644 index 8fd605cf..00000000 --- a/application/common/view/admininfo.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - -{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui/css/H-ui.min.css" /} -{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui.admin/css/H-ui.admin.css" /} -{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/Hui-iconfont/1.0.8/iconfont.css" /} -{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui.admin/skin/default/skin.css" id="skin" /} -{css rel="stylesheet" type="text/css" href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui.admin/css/style.css" /} - -用户查看 - - -{block name="topdiv"}{/block} -
- {block name="mytable"}{/block} -
- -{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/jquery/1.9.1/jquery.min.js"} -{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/layer/2.4/layer.js"} -{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui/js/H-ui.min.js"} -{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui.admin/js/H-ui.admin.js"} - - - - - \ No newline at end of file diff --git a/application/common/view/create.html b/application/common/view/create.html deleted file mode 100644 index 7224c559..00000000 --- a/application/common/view/create.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - {$list.set.webtitle} - - - - {load href="__STATIC__/xadmin/css/font.css" /} - {load href="__STATIC__/xadmin/css/xadmin.css" /} - {load href="__STATIC__/xadmin/js/jquery.min.js" /} - {load href="__STATIC__/xadmin/lib/layui/layui.js" /} - {load href="__STATIC__/xadmin/js/xadmin.js" /} - {load href="__STATIC__/xadmin/js/cookie.js" /} - - - {block name="jscss"}{/block} - - -
- {block name="form"}{/block} -
- - {block name="myjs"}{/block} - - \ No newline at end of file diff --git a/application/common/view/createhref.html b/application/common/view/createhref.html deleted file mode 100644 index 84311210..00000000 --- a/application/common/view/createhref.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - {$list.set.webtitle} - - - - {load href="__STATIC__/xadmin/css/font.css" /} - {load href="__STATIC__/xadmin/css/xadmin.css" /} - {load href="__STATIC__/xadmin/js/jquery.min.js" /} - {load href="__STATIC__/xadmin/lib/layui/layui.js" /} - {load href="__STATIC__/xadmin/js/xadmin.js" /} - {load href="__STATIC__/xadmin/js/cookie.js" /} - - - {block name="jscss"}{/block} - - -
- {block name="form"}{/block} -
- - {block name="myjs"}{/block} - - \ No newline at end of file diff --git a/application/common/view/list.html b/application/common/view/list.html deleted file mode 100644 index b1711ca6..00000000 --- a/application/common/view/list.html +++ /dev/null @@ -1,137 +0,0 @@ - - - - - {$list.webtitle} - - - - {load href="__STATIC__/xadmin/css/font.css" /} - {load href="__STATIC__/xadmin/css/xadmin.css" /} - {load href="__STATIC__/xadmin/js/jquery.min.js" /} - {load href="__STATIC__/xadmin/lib/layui/layui.js" /} - {load href="__STATIC__/xadmin/js/xadmin.js" /} - {load href="__STATIC__/xadmin/js/cookie.js" /} - {load href="__STATIC__/xadmin/js/md5.min.js" /} - {block name="jsset"}{/block} - - - - -
- {block name="nav"}{/block} - - -
-
-
-
-

筛选

-
-
- -
-
-
-
- {block name="table"}{/block} -
- - - - {block name="myjs"}{/block} - - - \ No newline at end of file diff --git a/application/home/controller/Error.php b/application/home/controller/Error.php deleted file mode 100644 index 132697e4..00000000 --- a/application/home/controller/Error.php +++ /dev/null @@ -1,11 +0,0 @@ -error('不好意思,您访问的页面不存在~'); - } -} diff --git a/application/http/middleware/OnLine.php b/application/http/middleware/OnLine.php deleted file mode 100644 index 1fb5cc55..00000000 --- a/application/http/middleware/OnLine.php +++ /dev/null @@ -1,86 +0,0 @@ -top.location.href='/login';"; - } - - // 检验用户名或密码是否正确 - $yz = action('login/index/check',['username'=>$username,'password'=>$password]); - if($yz['status'] == 0){ - echo ""; - } - - - // 实例化权限验证类 - $auth = new Auth(); - - // 获取当前地址 - $mod = $request->module(); - $con = $request->controller(); - $act = $request->action(); - $url = $mod.'/'.$con.'/'.$act; - - // 排除模块 - $uneed_m = array('home'); - // 排除控制器 - $uneed_c = array(); # 荣誉器名首字母要大写 - // 排除方法 - $uneed_a = array( - 'welcome','upload','myinfo', - 'mybanji','banjilist', - 'editpassword','updatepassword', - // 教师信息查询 - 'srcteacher','srcry','srckt', - // 查询班级成绩、查询年级成绩、查询录入成绩人员信息 - 'ajaxbianji','ajaxnianji','ajaxaddinfo', - // 批量保存 - // 'saveall', - // 下载成绩表、下载成绩统计表 - 'dwchengjixls','dwbanjixls','dwnianjixls', - //保存考号、下载试卷标签、下载成绩采集表 - 'updateset','kaohaosave','biaoqianxls','dwcaiji', - //课题结题图片上传和更新 - 'jtupload','jtupdate','ajaxdata' - ); - // 排除指定模块下的指定方法 - $uneed_u = array('index/Index/index'); - - // 验证是否是排除方法 - if(in_array($mod,$uneed_m) || in_array($con,$uneed_c) || in_array($act,$uneed_a) || in_array($url,$uneed_u)) - { - $except = true; - }else{ - $except = false; - } - - // 验证方法 - if( !$auth->check($url, session('userid')) && $except == false ){// 第一个参数是规则名称,第二个参数是用户UID - $this->error('哎哟~ 因为权限不足'); - } - - return $next($request); - } -} diff --git a/application/index/controller/Error.php b/application/index/controller/Error.php deleted file mode 100644 index 47118e29..00000000 --- a/application/index/controller/Error.php +++ /dev/null @@ -1,12 +0,0 @@ -order(['id'=>'desc']) - ->field('id,webtitle,keywords,description') - ->find(); - - // 存储网站名 - session('webtitle',$list->webtitle); - - // 获取版本号 - $list->version = config('app.chengji.version'); - // 获取用户姓名 - $ad = new \app\admin\model\Admin; - $list->xingming = $ad->where('id',session('userid'))->value('xingming'); - - // 查询用户拥有的权限 - $admin = new \app\admin\model\Admin; - $admininfo = $admin->where('id',session('userid')) - ->field('id') - ->with([ - 'glGroup'=>function($query){ - $query->where('status',1)->field('title,rules,miaoshu'); - } - ]) - ->find(); - $rules = ''; - foreach ($admininfo->gl_group as $key => $value) { - if($key == 0){ - $rules = $value->rules; - }else{ - $rules = $rules.','.$value->rules; - } - } - - - // 实例化权限数据模型 - $authrule = new \app\admin\model\AuthRule; - - $list['menu'] = $authrule - ->where('pid',0) - ->where('status&ismenu',1) - ->when(session('userid')>2,function($query) use($rules){ - $query->where('id','in',$rules); - }) - ->field('id,title,font,name,pid') - ->with([ - 'authCid'=>function($query) use($rules){ - $query->where('status&ismenu',1) - ->when(session('userid')>2,function($query) use($rules) - { - $query->where('id','in',$rules); - }) - ->field('id,title,name,pid,url'); - }, - ]) - ->order(['paixu']) - ->select(); - - - - - // 模版赋值 - $this->assign('list',$list); - - // 渲染输出 - return $this->fetch(); - } - - public function welcome() - { - - //实例化数据模型 - $sysbasemod = new sysbasemod(); - - // 查询系统设置 - $list = $sysbasemod - ->order(['id'=>'desc']) - ->field('webtitle,thinks,danwei') - ->find(); - - // 查询用户登信息 - $list['username'] = session('username'); - - // 查询用户姓名及用户拥有的权限 - $admin = new \app\admin\model\Admin; - $list['xingming'] = $admin->where('id',session('userid'))->value('xingming'); - $list['group'] = $admin->getGroupnames(session('userid')); - - $list['server'] = request()->server(); - // 获取版本号 - $list->version = config('app.chengji.version'); - - - // 考试数 - $con = new \app\kaoshi\model\Kaoshi; - $list['kaoshi'] = $con->count(); - // 教师数 - $con = new \app\renshi\model\Teacher; - $list['teacher'] = $con->count(); - // 学生数 - $con = new \app\renshi\model\Student; - $list['student'] = $con->count(); - // 管理员数 - $con = new \app\admin\model\Admin; - $list['admin'] = $con->count(); - // 荣誉数 - $con = new \app\rongyu\model\JsRongyuInfo; - $list['rongyu'] = $con->count(); - // 课题数 - $con = new \app\keti\model\KetiInfo; - $list['keti'] = $con->count(); - - - - - // 模版赋值 - $this->assign('list',$list); - - - // 渲染输出 - return $this->fetch(); - } - - -} diff --git a/application/index/view/index/index.html b/application/index/view/index/index.html deleted file mode 100644 index 847b92e1..00000000 --- a/application/index/view/index/index.html +++ /dev/null @@ -1,118 +0,0 @@ - - - - - {php}echo session('webtitle'){/php} v{$list['version']} - - - - - {load href="__STATIC__/xadmin/css/font.css" /} - {load href="__STATIC__/xadmin/css/xadmin.css" /} - {load href="__STATIC__/xadmin/js/jquery.min.js" /} - {load href="__STATIC__/xadmin/js/md5.min.js" /} - {load href="__STATIC__/xadmin/lib/layui/layui.js" /} - {load href="__STATIC__/xadmin/js/xadmin.js" /} - {load href="__STATIC__/xadmin/js/cookie.js" /} - - - - - - - - - - -
-
- -
-
- - - -
-
-
    -
  • 我的桌面
  • -
-
-
-
关闭当前
-
关闭其它
-
关闭全部
-
-
-
-
- -
-
-
-
-
-
- - - - - - - \ No newline at end of file diff --git a/application/index/view/index/welcome.html b/application/index/view/index/welcome.html deleted file mode 100644 index 9883acda..00000000 --- a/application/index/view/index/welcome.html +++ /dev/null @@ -1,127 +0,0 @@ - - - - - {php}echo session('webtitle'){/php} - - - - {load href="__STATIC__/xadmin/css/font.css" /} - {load href="__STATIC__/xadmin/css/xadmin.css" /} - {$list.webtitle} - - -
-
欢迎『{$list.group}』: - {$list['xingming']}!当前时间:{php} echo date('Y-m-d h:m:s'){/php} -
-
- 数据统计 - -
-
- 系统通知 - -
-
- 系统信息 -
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
服务器地址{$list.server.SERVER_ADDR}
操作系统WINNT
运行环境{$list.server.SERVER_SOFTWARE}
ThinkPHP{$Think.version}
X-admin版本2.1
上传附件限制2M
执行时间限制30s
剩余空间86015.2M
-
-
-
感谢{$list.thinks}本系统由大连巴掌(w86112@vip.163.com)提供技术支持。
-
- - \ No newline at end of file diff --git a/application/kaoshi/common.php b/application/kaoshi/common.php deleted file mode 100644 index 0705b1d3..00000000 --- a/application/kaoshi/common.php +++ /dev/null @@ -1,5 +0,0 @@ -assign('list',$list); - - // 渲染模板 - return $this->fetch(); - } - - - // 获取考试信息列表 - public function ajaxData() - { - - // 获取参数 - $src = $this->request - ->only([ - 'page'=>'1', - 'limit'=>'10', - 'field'=>'id', - 'order'=>'desc', - 'searchval'=>'' - ],'POST'); - - - // 实例化 - $ks = new KS; - - // 查询要显示的数据 - $data = $ks->search($src); - // 获取符合条件记录总数 - $cnt = $data->count(); - // 获取当前页数据 - $limit_start = $src['page'] * $src['limit'] - $src['limit']; - $limit_length = $src['limit']; - $data = $data->slice($limit_start,$limit_length); - - // 重组返回内容 - $data = [ - 'code'=> 0 , // ajax请求次数,作为标识符 - 'msg'=>"", // 获取到的结果数(每页显示数量) - 'count'=>$cnt, // 符合条件的总数据量 - 'data'=>$data, //获取到的数据结果 - ]; - - - return json($data); - } - - - - // 创建考试 - public function create() - { - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'新建考试', - 'butname'=>'创建', - 'formpost'=>'POST', - 'url'=>'/kaoshi', - ); - - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - } - - - - // 保存信息 - public function save() - { - // 实例化验证模型 - $validate = new \app\kaoshi\validate\Kaoshi; - - - // 获取表单数据 - $list = request()->only(['title','xueqi','category','bfdate','enddate','zuzhi'],'post'); - - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]); - } - - - // 保存数据 - $ks = new KS(); - - $ksdata = $ks->create($list); - - - // 根据更新结果设置返回提示信息 - $ksdata ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - // - public function read($id) - { - // - } - - - - - // 修改考试信息 - public function edit($id) - { - - // 获取考试信息 - $list['data'] = KS::where('id',$id) - ->field('id,title,xueqi,category,bfdate,enddate,zuzhi') - ->append(['nianjiids','manfenedit']) - ->find(); - - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'编辑考试', - 'butname'=>'修改', - 'formpost'=>'PUT', - 'url'=>'/kaoshi/'.$id, - ); - - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - - } - - - - - - // 更新考试信息 - public function update($id) - { - $validate = new \app\kaoshi\validate\Kaoshi; - - // 获取表单数据 - $list = request()->only(['title','xueqi','category','bfdate','enddate','zuzhi'],'post'); - - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]);; - } - - $list['id'] = $id; - // 更新数据 - $ks = new KS(); - $ksdata = $ks::update($list); - - - // 根据更新结果设置返回提示信息 - $ksdata ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - - - // 设置考试信息 - public function kaoshiset($id) - { - - // 获取考试信息 - $data = KS::where('id',$id) - ->with([ - 'ksSubject'=>function($query){ - $query->with([ - 'subjectName'=>function($q){ - $q->field('id,jiancheng'); - } - ]); - } - ,'ksNianji' - ]) - ->field('id') - ->find(); - - - // 重新整理年级和学科 - $subject=array(); - $subjectid=array(); - foreach ($data['ks_subject'] as $key => $value) { - $subjectid[] = $value['subjectid']; - $subject[$value->lieming]['manfen'] = $value['manfen']; - $subject[$value->lieming]['youxiu'] = $value['youxiu']; - $subject[$value->lieming]['jige'] = $value['jige']; - } - - - $nianji = array(); - foreach ($data['ks_nianji'] as $key => $value) { - $nianji[] = $value['nianji']; - } - - $list['data']['ks_subjectid'] = implode(',' , $subjectid); - $list['data']['ks_nianjiid'] = implode(',' , $nianji); - $list['data']['ks_subject'] = $subject; - - - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'设置考试', - 'butname'=>'设置', - 'formpost'=>'PUT', - 'url'=>'/kaoshiset/'.$id, - 'kaoshi'=>$id, - ); - - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch(); - - } - - - - - - // 更新考试信息 - public function updateset($id) - { - $validate = new \app\kaoshi\validate\Kaoshiset; - - // 获取表单数据 - $list = request()->only(['nianji','subject','manfen','youxiu','jige','lieming','nianjiname'],'post'); - - - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]);; - } - - $list['id'] = $id; - - // 整理数据 - $data = array(); - $i = 0; - foreach ($list['subject'] as $key => $value) { - $data[$i]['subjectid'] = $key; - $data[$i]['manfen'] = $list['manfen'][$key]; - $data[$i]['youxiu'] = $list['youxiu'][$key]; - $data[$i]['jige'] = $list['jige'][$key]; - $data[$i]['lieming'] = $list['lieming'][$key]; - $data[$i]['kaoshiid'] = $id; - $i++; - } - - // 更新数据 - $subject = new \app\kaoshi\model\KaoshiSubject; - $subject->where('kaoshiid',$id)->delete(); - $subjectdata = $subject->saveAll($data); - - // 整理数据 - $data = array(); - $i = 0; - foreach ($list['nianji'] as $key => $value) { - $data[$i]['nianji'] = $key; - $data[$i]['nianjiname'] = $list['nianjiname'][$key]; - $data[$i]['kaoshiid'] = $id; - $i++; - } - - // 更新数据 - $nianji = new \app\kaoshi\model\KaoshiNianji; - $nianji->where('kaoshiid',$id)->delete(); - $nianjidata = $nianji->saveAll($data); - - - // 根据更新结果设置返回提示信息 - $subjectdata && $nianjidata ? $data=['msg'=>'设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - - - // 删除考试 - public function delete($id) - { - - if($id == 'm') - { - $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 - } - - $data = KS::destroy($id); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - // 设置考试状态 - public function setStatus() - { - - // 获取id变量 - $id = request()->post('id'); - $value = request()->post('value'); - - // 获取考试信息 - $data = KS::where('id',$id)->update(['status'=>$value]); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - // 考试更多操作页面 - public function moreAction($kaoshi) - { - // 获取考试信息 - $kaoshi = KS::where('id',$kaoshi) - ->field('id,title,bfdate,enddate') - ->find(); - - // 设置页面标题 - $list['webtitle'] = $kaoshi['title'] .'('. $kaoshi['bfdate'].'~'.$kaoshi['enddate'].')'; - $list['kaoshiid'] = $kaoshi['id']; - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch(); - } -} diff --git a/application/kaoshi/controller/Kaohao.php b/application/kaoshi/controller/Kaohao.php deleted file mode 100644 index 070a8ec1..00000000 --- a/application/kaoshi/controller/Kaohao.php +++ /dev/null @@ -1,589 +0,0 @@ -with([ - 'ksNianji' - ]) - ->find(); - if(count($kaoshilist->ks_nianji)>0) - { - foreach ($kaoshilist->ks_nianji as $key => $value) { - $list['data']['nianji'][$key]['id']=$value->nianji; - $list['data']['nianji'][$key]['title']=$value->nianjiname; - } - }else{ - $list['data']['nianji']= array(); - } - - - - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'生成考号', - 'butname'=>'生成', - 'formpost'=>'POST', - 'url'=>'/kaoshi/kaohao', - 'kaoshi'=>$kaoshi - ); - - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch(); - } - - // 保存考号 - public function save() - { - - // 实例化验证模型 - $validate = new \app\kaoshi\validate\Kaohao; - - // 获取表单数据 - $list = request()->only(['school','kaoshi','banjiids'],'post'); - - - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - // 如果验证不通过则停止保存 - if(!$result){ - return ['msg'=>$msg,'val'=>0]; - } - - if(enddate($list['kaoshi'])) - { - return ['msg'=>'考试已经结束,不能分配考号','val'=>0]; - } - - - - // 将班级转换成数组 - $list['banjiids'] = implode(',',$list['banjiids']); - $ksid = $list['kaoshi']; - - // 获取实例化学生数据模型 - $stu = new \app\renshi\model\Student; - // 获取参加考试学生名单 - $stulist = $stu::where('school',$list['school']) - ->where('banji','in',$list['banjiids']) - ->where('status',1) - ->field('id,school,banji') - ->with([ - 'stuBanji'=>function($query){ - $query->field('id,ruxuenian'); - } - ]) - ->select(); - $njlist = nianjiList(); - // 重新组合学生信息 - $kaohao = array(); - foreach ($stulist as $key => $value) { - $check = KH::withTrashed() - ->where('kaoshi',$list['kaoshi']) - ->where('student',$value->id) - ->find(); - if($check) - { - if($check->delete_time>0) - { - $check->restore(); - } - if($check->status == 0) - { - $check->status = 1; - $check->save(); - } - - continue; - } - $kaohao[$key]['student']= $value->id; - $kaohao[$key]['school']= $list['school']; - $kaohao[$key]['ruxuenian']= $value->stu_banji->ruxuenian; - $kaohao[$key]['nianji']= $njlist[$kaohao[$key]['ruxuenian']]; - $kaohao[$key]['banji']= $value->stu_banji->id; - $kaohao[$key]['kaoshi']= $list['kaoshi']; - } - - // 保存考号 - $kh = new \app\kaoshi\model\Kaohao; - - $data = $kh - ->allowField(['id','kaoshi','student','school','ruxuenian','nianji','banji','create_time','update_time']) - ->saveAll($kaohao); - - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'生成成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - /** - * 生成指定网址的二维码 - * @param string $url 二维码中所代表的网址 - */ - public function create_qrcode($url='127.0.0.1') - { - $qrCode = new QrCode($url); - header("Content-type: image/jpg"); - return $qrCode->writeString(); - } - - - - - // 生成试卷标签二维码可以换成pdf格式 - public function biaoqiandoc($id) - { - - set_time_limit(0); - // 获取数据库信息 - $chengjiinfo = Chengji::where('kaoshi',$id) - ->where('ruxuenian',2017) - ->append(['cj_school.jiancheng','cj_Student.xingming','banjiNumname']) - ->select(); - - // 获取学科信息 - $xks = KS::get($id); - $xks = $xks->Subjectids; - - $subject = new \app\teach\model\Subject(); - $xks = $subject->where('id','in',$xks)->column('id,title'); - - // Word处理 - // 实例化类 - $phpWord = new \PhpOffice\PhpWord\PhpWord(); - - - // 设置页面格式 - $sectionStyle = array( - 'pageSizeW'=>2*567, - 'pageSizeH'=>3*567, - 'orientation'=>'landscape', - 'marginLeft'=>80, - 'marginRight'=>80, - 'marginTop'=>100, - 'marginBottom'=>100 - ); - $section = $phpWord->createSection($sectionStyle); - - - // 设置图片格式 - $imageStyle = array('width'=>45,'height'=>45,'align'=>'left'); - - // 学生信息样式 - $myStyle = 'myStyle'; - $phpWord->addFontStyle( - $myStyle, - [ - 'name' => '宋体', - 'size' => 6.5, - 'color' => '000000', - 'bold' => true, - ] - ); - - - // 循环写出信息 - foreach ($chengjiinfo as $key => $value) { - foreach ($xks as $xkkey => $val) { - // 创建表格 - $table = $section->addTable($key); - $table->addRow(1500); - - - $img = $this->create_qrcode($value['id'].','.$xkkey); - $table->addCell(850)->addImage($img,$imageStyle); - - - // $table->addCell(700)->addImage('aaaa.jpg',$imageStyle); - $info = $table->addCell(650); - $info->addText($value['cj_school']['jiancheng'],$myStyle); - $info->addText($value['banjiNumname'],$myStyle); - $info->addText($value['cj_student']['xingming'],$myStyle); - $info->addText($val,$myStyle); - - } - } - - - - // 保存文件 - $filename = '试卷标签.docx'; - header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); - header('Content-Disposition: attachment;filename="' . $filename . '"'); - header('Cache-Control: max-age=0'); - $objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007'); - $objWriter->save('php://output'); - ob_flush(); - flush(); - - } - - - - // 标签下载 - public function biaoqian($kaoshi) - { - // 获取参考年级 - $kaoshilist = KS::where('id',$kaoshi) - ->with([ - 'ksNianji' - ,'ksSubject'=>function($query){ - $query->field('id,subjectid,kaoshiid') - ->with(['subjectName'=>function($q){ - $q->field('id,title'); - }] - ); - } - ]) - ->find(); - - - // 获取考试年级 - if(count($kaoshilist->ks_nianji)>0) - { - foreach ($kaoshilist->ks_nianji as $key => $value) { - $list['data']['nianji'][$key]['id']=$value->nianji; - $list['data']['nianji'][$key]['title']=$value->nianjiname; - } - }else{ - $list['data']['nianji']= array(); - } - // 获取考试学科 - if(count($kaoshilist->ks_subject)>0) - { - foreach ($kaoshilist->ks_subject as $key => $value) { - $list['data']['subject'][$key]['id']=$value->subjectid; - $list['data']['subject'][$key]['title']=$value->subject_name->title; - } - }else{ - $list['data']['subject']= array(); - } - - - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'下载考号', - 'butname'=>'下载', - 'formpost'=>'POST', - 'url'=>'/kaoshi/'.$kaoshi.'/biaoqianXls', - 'kaoshi'=>$kaoshi - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch(); - } - - - - //生成标签信息 - public function biaoqianXls() - { - set_time_limit(0); - // 获取表单数据 - $list = request()->only(['banjiids','kaoshi','subject'],'post'); - - $kaoshi = $list['kaoshi']; - $banji = $list['banjiids']; - $subject = $list['subject']; - - // 实例化验证模型 - $validate = new \app\kaoshi\validate\Biaoqian; - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - // 如果验证不通过则停止保存 - if(!$result){ - $data=['msg'=>'数据处理错误','val'=>0]; - return json($data); - } - - $ks = new KS(); - $kslist = $ks::where('id',$kaoshi) - ->field('id,title') - ->with([ - 'ksSubject'=>function($query) use($subject){ - $query->where('subjectid','in',$subject) - ->field('kaoshiid,subjectid') - ->with(['subjectName'=>function($q){ - $q->field('id,jiancheng,lieming'); - }] - ); - } - ]) - ->find(); - - $kh = new KH(); - // 获取考试信息 - $kaohao = $kh->srcKaohao($kaoshi,$banji); - - - // 创建表格 - $spreadsheet = new Spreadsheet(); - $sheet = $spreadsheet->getActiveSheet(); - - // 设置表头信息 - $sheet->setCellValue('A1', '序号'); - $sheet->setCellValue('B1', '考号'); - $sheet->setCellValue('C1', '学校'); - $sheet->setCellValue('D1', '班级'); - $sheet->setCellValue('E1', '学科'); - $sheet->setCellValue('F1', '姓名'); - - - // 循环写出信息 - $i = 2; - foreach ($kaohao as $key=>$bj) - { - foreach ($kslist->ks_subject as $ksbj => $sbj) - { - foreach ($bj->banji_kaohao as $kkh => $kh) - { - // 表格赋值 - $sheet->setCellValue('A'.$i, $i-1); - $sheet->setCellValue('B'.$i, action('system/Encrypt/encrypt',['data'=>$kh->id.'|'.$sbj->subject_name->id,'key'=>'dlbz'])); - $sheet->setCellValue('C'.$i, $bj->cj_school->jiancheng); - $sheet->setCellValue('D'.$i, $bj->cj_banji->numTitle); - $sheet->setCellValue('E'.$i, $sbj->subject_name->jiancheng); - $sheet->setCellValue('F'.$i, $kh->cj_student['xingming']); - $i++; - } - } - } - - // 保存文件 - $filename = $kslist->title.' 标签数据'.date('ymdHis').'.xls'; - header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); - header('Content-Disposition: attachment;filename="' . $filename . '"'); - header('Cache-Control: max-age=0'); - $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls'); - $writer->save('php://output'); - ob_flush(); - flush(); - } - - - - - // 下载考试成绩采集表 - public function caiji($kaoshi) - { - // 获取参考年级 - $kaoshilist = KS::where('id',$kaoshi) - ->with([ - 'ksNianji' - ,'ksSubject'=>function($query){ - $query->field('id,subjectid,kaoshiid') - ->with(['subjectName'=>function($q){ - $q->field('id,title'); - }] - ); - } - ]) - ->find(); - // 获取考试年级 - if(count($kaoshilist->ks_nianji)>0) - { - foreach ($kaoshilist->ks_nianji as $key => $value) { - $list['data']['nianji'][$key]['id']=$value->nianji; - $list['data']['nianji'][$key]['title']=$value->nianjiname; - } - }else{ - $list['data']['nianji']= array(); - } - // 获取考试学科 - if(count($kaoshilist->ks_subject)>0) - { - foreach ($kaoshilist->ks_subject as $key => $value) { - $list['data']['subject'][$key]['id']=$value->subjectid; - $list['data']['subject'][$key]['title']=$value->subject_name->title; - } - }else{ - $list['data']['subject']= array(); - } - - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'下载成绩采集表', - 'butname'=>'下载', - 'formpost'=>'POST', - 'url'=>'/kaoshi/caiji', - 'kaoshi'=>$kaoshi - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('biaoqian'); - } - - - - - - - // 获取参考名单 - public function dwcaiji() - { - // 实例化验证模型 - $validate = new \app\kaoshi\validate\Biaoqian; - - // 获取表单数据 - $list = request()->only(['banjiids','kaoshi','subject'],'post'); - - $kaoshi = $list['kaoshi']; - $banji = $list['banjiids']; - $subject = $list['subject']; - - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - // 如果验证不通过则停止保存 - if(!$result){ - $this->error($msg); - } - - $ks = new KS(); - $kslist = $ks::where('id',$kaoshi) - ->field('id,title') - ->with([ - 'ksSubject'=>function($query) use($subject){ - $query->where('subjectid','in',$subject) - ->field('kaoshiid,subjectid') - ->with(['subjectName'=>function($q){ - $q->field('id,title,lieming'); - }] - ); - } - ]) - ->find(); - - $kh = new KH(); - // 获取考试信息 - $kaohao = $kh->srcKaohao($kaoshi,$banji); - - - // 获取电子表格列名 - $lieming = excelLieming(); - - // 创建表格 - $spreadsheet = new Spreadsheet(); - $sheet = $spreadsheet->getActiveSheet(); - - // 设置表格标题与表头信息 - $sheet->setCellValue('A1',$kslist->title.' 成绩采集表'); - - $sheet->setCellValue('A3', '序号'); - $sheet->setCellValue('B3', '考号'); - $sheet->setCellValue('C3', '班级'); - $sheet->setCellValue('D3', '姓名'); - // 获取列数并合并和一行 - $col = $lieming[count($kslist->ks_subject)+3]; - $sheet->mergeCells('A1:'.$col.'1'); - - - // 写入列名 - foreach ($kslist->ks_subject as $key => $value) { - $sheet->setCellValue($lieming[$key + 4].'3', $value->subject_name->title); - $sheet->setCellValue($lieming[$key + 4].'2', $value->subject_name->id); - } - // 隐藏第二行和第二列 - $sheet->getRowDimension('2')->setRowHeight('0'); - $sheet->getColumnDimension('B')->setWidth('0'); - - - // 将学生信息循环写入表中 - $i = 4; - foreach ($kaohao as $key=>$bj) - { - foreach ($bj->banji_kaohao as $k => $kh) { - $sheet->setCellValue('A'.$i, $i-3); - $sheet->setCellValue('B'.$i, $kh->id); - $sheet->setCellValue('C'.$i, $bj->cj_banji->banjiTitle); - $sheet->setCellValue('D'.$i, $kh->cj_student->xingming); - $i++; - } - } - - - // 保存文件 - $filename = $kslist->title.'成绩采集表'.date('ymdHis').'.xls'; - header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); - header('Content-Disposition: attachment;filename="' . $filename . '"'); - header('Cache-Control: max-age=0'); - $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls'); - $writer->save('php://output'); - } - - - // 删除考号 - public function delete($id) - { - - if($id == 'm') - { - $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 - }else{ - $id = array($id); - } - - // 删除成绩 - $db = new \think\Db; - $db::startTrans(); # 启动事务 - try { - KH::destroy($id); - $chengji = new \app\chengji\model\Chengji; - $cjids = $chengji::where('kaohao_id','in',$id)->column('id'); - $chengji::destroy($cjids); - $data = true; - $db::commit(); - } catch (\Exception $e) { - $data = false; - // 回滚事务 - $db::rollback(); - } - - // 根据更新结果设置返回提示信息 - $data==true ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - -} diff --git a/application/kaoshi/model/Kaohao.php b/application/kaoshi/model/Kaohao.php deleted file mode 100644 index 73496b65..00000000 --- a/application/kaoshi/model/Kaohao.php +++ /dev/null @@ -1,350 +0,0 @@ -where('kaoshi',$kaoshi) - ->where('banji','in',$banji) - ->field('id,banji,school') - ->order(['banji']) - ->group('banji') - ->with([ - 'cjBanji'=>function($query){ - $query->field('id,paixu,ruxuenian') - ->append(['numTitle','banjiTitle']); - } - ,'cjSchool'=>function($query){ - $query->field('id,jiancheng'); - } - ,'banjiKaohao'=>function($query) use($kaoshi){ - $query->field('id,banji,student,kaoshi,school') - ->where('kaoshi',$kaoshi) - ->order(['banji','id']) - ->with([ - 'cjStudent'=>function($q){ - $q->field('id,xingming'); - } - ]); - } - ]) - ->select(); - - $stu = new \app\renshi\model\Student; - // 找出已经被删除学生,并添加该学生信息 - foreach ($data as $key => $value) { - foreach ($value->banji_kaohao as $k => $val) { - if($val->cj_student == Null) - { - $stuinof = $stu::withTrashed() - ->where('id',$val->student) - ->field('id,xingming') - ->find(); - $data[$key]->banji_kaohao[$key]->cj_student = array('id'=>$stuinof->id,'xingming'=>$stuinof->xingming); - } - } - } - - return $data; - } - - - /** - * 以考号为基础查询学生成绩信息并排序 - * 信息包括:学校、年级、班级、姓名、性别、各学科成绩、平均分、总分 - * @access public - * @param array $src 参数数组 - * @param number $src['school'] 学生所在学校 - * @param number $src['nianji'] 学生所在年级 - * @param number $src['paixu'] 班级标识 - * @param number $src['searchval'] 关键字 - * @param number $src['field'] 排序字段 - * @param number $src['type'] 排序类型 - * @return array 返回类型 - */ - public function srcChengji($srcfrom) - { - // 初始化参数 - $src = array( - 'page'=>'1', - 'limit'=>'10', - 'field'=>'banji', - 'type'=>'desc', - 'kaoshi'=>'', - 'school'=>array(), - 'nianji'=>'', - 'banji'=>array(), - 'searchval'=>'' - ); - // 用新值替换初始值 - $src = array_cover( $srcfrom , $src ) ; - - // 重新定义变量 - $school = $src['school']; - $nianji = $src['nianji']; - $banji = $src['banji']; - $seachval = $src['searchval']; - - // 查询成绩 - $khlist = $this->where('kaoshi',$src['kaoshi']) - ->field('id,school,student,nianji,banji') - ->when(count($school)>0,function($query) use($school){ - $query->where('school','in',$school); - }) - ->when(count($banji)>0,function($query) use($banji){ - $query->where('banji','in',$banji); - }) - ->when(strlen($nianji)>0,function($query) use($nianji){ - $query->where('ruxuenian',$nianji); - }) - ->when(strlen($seachval)>0,function($query) use($seachval){ - $query->where(function($w) use ($seachval){ - $w->whereOr('id',$seachval) - ->whereOr('student','in',function($q)use($seachval){ - $q->name('student')->where('xingming','like','%'.$seachval.'%')->field('id'); - }); - }); - }) - ->with([ - 'ksChengji'=>function($query){ - $query->field('kaohao_id,subject_id,defen'); - } - ,'cjBanji'=>function($query){ - $query->field('id,paixu,ruxuenian'); - } - ,'cjSchool'=>function($query){ - $query->field('id,jiancheng'); - } - ,'cjStudent'=>function($query){ - $query->field('id,xingming,sex'); - } - ]) - ->select(); - - if($khlist->isEmpty()) - { - return $data = array(); - } - - - // 获取参考学科 - $kaoshi = new \app\kaoshi\model\Kaoshi; - $ksinfo = $kaoshi->where('id',$src['kaoshi']) - ->with([ - 'ksSubject'=>function($query){ - $query->field('kaoshiid,subjectid,lieming'); - } - ]) - ->find(); - - if($ksinfo->ks_subject->isEmpty()) - { - return $data = array(); - } - - $xk = array(); - foreach ($ksinfo->ks_subject as $key => $value) { - $xk[$value->subjectid] = $value->lieming; - } - - $bjlist = banjinamelist(); - - // 整理数据 - $data = array(); - foreach ($khlist as $key => $value) { - $data[$key]['id'] = $value->id; - $data[$key]['school'] = $value->cj_school->jiancheng; - if($value->cj_student != Null){ - $data[$key]['student'] = $value->cj_student->xingming; - $data[$key]['sex'] = $value->cj_student->sex; - }else{ - $stuinfo = $stu::withTrashed() - ->where('id',$value->student) - ->field('id,xingming,sex') - ->find(); - $data[$key]['student'] = $stuinfo->xingming; - $data[$key]['sex'] = $stuinfo->sex; - } - $data[$key]['nianji'] = $value->nianji; - $data[$key]['banji'] = $value->nianji.$bjlist[$value->cj_banji->paixu]; - $dfsum = 0; - $sbjcnt = 0; - - $cjarr = $this->zzcj($value->ks_chengji); - - // 初始化参数 - $dfsum = 0; - $sbjcnt = 0; - - foreach ($xk as $k => $val) { - // 为每个学科赋值并记录学科数 - if(array_key_exists($k,$cjarr)) - { - $data[$key][$val]=$cjarr[$k] * 1; - $sbjcnt++; - $dfsum = $dfsum + $data[$key][$val]; - }else{ - $data[$key][$val]=''; - } - } - - - $data[$key]['sum'] = $dfsum; - if($sbjcnt>0){ - $data[$key]['avg'] = round($dfsum/$sbjcnt,1); - }else{ - $data[$key]['avg'] = 0; - } - } - - - // 按条件排序 - if(count($data)>0){ - $data = arraySequence($data,$src['field'],$src['type']); //排序 - } - - return $data; - } - - - - // 满分 - public function banjiKaohao() - { - return $this->hasMany('\app\kaoshi\model\Kaohao','banji','banji'); - } - - // 学校信息关联表 - public function cjSchool() - { - return $this->belongsTo('\app\system\model\School','school','id'); - } - - // 班级信息关联表 - public function cjBanji() - { - return $this->belongsTo('\app\teach\model\Banji','banji','id'); - } - - // 学生信息关联 - public function cjStudent() - { - return $this->belongsTo('\app\renshi\model\Student','student','id'); - } - - // 满分 - public function cjManfen() - { - return $this->hasMany('\app\kaoshi\model\KaoshiSubject','kaoshiid','kaoshi'); - } - - // 考试关联 - public function cjKaoshi() - { - return $this->belongsTo('\app\kaoshi\model\Kaoshi','kaoshi','id'); - } - - - // 考试成绩 - public function ksChengji() - { - return $this->hasMany('\app\chengji\model\Chengji','kaohao_id','id'); - } - - // 转置成绩数组 - private function zzcj($array = array()) - { - - $arr = array(); - foreach ($array as $key => $value) { - $arr[$value['subject_id']] = $value['defen']; - } - return $arr; - } - - /** - * 获取参加考试的学校 - * @access public - * @param number $kaoshi 考试id - * @param number $ruxuenian 入学年 - * @return array 返回类型 - */ - public function cySchool($kaoshi,$ruxuenian) - { - $data = $this->where('ruxuenian',$ruxuenian) - ->where('kaoshi',$kaoshi) - ->with(['cjSchool'=>function($query){ - $query->field('id,jiancheng'); - } - ]) - ->group('school') - ->field('school') - ->select(); - return $data; - - } - - - /** - * 获取参加考试的班级 - * @access public - * @param number $kaoshi 考试id - * @param number $ruxuenian 入学年 - * @return array 返回类型 - */ - public function cyBanji($kaoshi,$ruxuenian,$school=array(),$paixu=array()) - { - // 获取考试时间 - $ks = new \app\kaoshi\model\Kaoshi; - $kssj = $ks::where('id',$kaoshi)->value('bfdate'); - $year = date('Y',$kssj); - - - $data = $this->where('ruxuenian',$ruxuenian) - ->where('kaoshi',$kaoshi) - ->when(count($school)>0,function($query) use($school){ - $query->where('school','in',$school); - }) - ->when(count($paixu)>0,function($query) use($paixu){ - $query->where('banji','in',function($q)use($paixu){ - $q->name('banji')->where('paixu','in',$paixu)->field('id'); - }); - }) - ->with([ - 'cjBanji'=>function($query){ - $query->field('id,paixu,ruxuenian'); - } - ,'cjSchool'=>function($query){ - $query->field('id,jiancheng'); - } - ]) - ->group('banji,school') - ->field('banji,school') - ->select(); - $njlist = nianjiList($year); - $bjlist = banjinamelist(); - - - foreach ($data as $key => $value) { - # code... - $data[$key]['bjtitle'] = $njlist[$value->cjBanji->ruxuenian].$bjlist[$value->cjBanji->paixu]; - } - - return $data; - } - -} diff --git a/application/kaoshi/model/Kaoshi.php b/application/kaoshi/model/Kaoshi.php deleted file mode 100644 index 47dad9e2..00000000 --- a/application/kaoshi/model/Kaoshi.php +++ /dev/null @@ -1,98 +0,0 @@ -order([$src['field'] =>$src['order']]) - // ->when(count($xingzhi)>0,function($query) use($xingzhi){ - // $query->where('xingzhi','in',$xingzhi); - // }) - ->when(strlen($searchval)>0,function($query) use($searchval){ - $query->where('title','like','%'.$searchval.'%'); - }) - ->with( - [ - 'ksCategory'=>function($query){ - $query->field('id,title'); - } - ,'ksSubject'=>function($query){ - $query->field('kaoshiid,subjectid') - ->with(['subjectName'=>function($q){ - $q->field('id,jiancheng'); - }] - ); - } - ,'ksNianji' - ] - ) - ->select(); - return $data; - } - - - - // 开始时间修改器 - public function setBfdateAttr($value) - { - return strtotime($value); - } - - // 开始时间获取器 - public function getBfdateAttr($value) - { - return date('Y-m-d',$value); - } - - // 结束时间修改器 - public function setEnddateAttr($value) - { - return strtotime($value); - } - - // 结束时间获取器 - public function getEnddateAttr($value) - { - return date('Y-m-d',$value); - } - - //参考年级关联表 - public function ksNianji() - { - return $this->hasMany('KaoshiNianji','kaoshiid','id')->field('kaoshiid,nianji,nianjiname'); - } - - // 参考学科关联表 - public function ksSubject() - { - return $this->hasMany('KaoshiSubject','kaoshiid','id'); - } - // 参考学科关联表 - public function ksCategory() - { - return $this->belongsTo('\app\system\model\Category','category','id'); - } - - // 考试成绩关联表 - public function ksChengji() - { - return $this->hasMany('\app\chengji\model\Chengji','kaoshi','id'); - } - - - - -} diff --git a/application/kaoshi/model/KaoshiNianji.php b/application/kaoshi/model/KaoshiNianji.php deleted file mode 100644 index 1d06b85b..00000000 --- a/application/kaoshi/model/KaoshiNianji.php +++ /dev/null @@ -1,11 +0,0 @@ -belongsTo('\app\teach\model\Subject','subjectid','id'); - } -} diff --git a/application/kaoshi/validate/Biaoqian.php b/application/kaoshi/validate/Biaoqian.php deleted file mode 100644 index c9a45f20..00000000 --- a/application/kaoshi/validate/Biaoqian.php +++ /dev/null @@ -1,28 +0,0 @@ - ['规则1','规则2'...] - * - * @var array - */ - protected $rule = [ - 'banjiids|班级' => 'require|array', - 'kaoshi|考试' => 'require|number', - 'subject|学科' => 'require|array', - ]; - - /** - * 定义错误信息 - * 格式:'字段名.规则名' => '错误信息' - * - * @var array - */ - protected $message = []; -} diff --git a/application/kaoshi/validate/Kaohao.php b/application/kaoshi/validate/Kaohao.php deleted file mode 100644 index 38457974..00000000 --- a/application/kaoshi/validate/Kaohao.php +++ /dev/null @@ -1,27 +0,0 @@ - ['规则1','规则2'...] - * - * @var array - */ - protected $rule = [ - 'kaoshi|考试号' => 'require|number', - 'banjiids|参考班级' => 'require|array', - ]; - - /** - * 定义错误信息 - * 格式:'字段名.规则名' => '错误信息' - * - * @var array - */ - protected $message = []; -} diff --git a/application/kaoshi/validate/Kaoshi.php b/application/kaoshi/validate/Kaoshi.php deleted file mode 100644 index 97923051..00000000 --- a/application/kaoshi/validate/Kaoshi.php +++ /dev/null @@ -1,31 +0,0 @@ - ['规则1','规则2'...] - * - * @var array - */ - protected $rule = [ - 'title|标题' => 'require|length:1,25', - 'zuzhi|组织单位' => 'require|number', - 'xueqi|学期' => 'require|number', - 'category|分类' => 'require|number', - 'bfdate|考试时间' => 'require|date', - 'enddate|考试时间' => 'require|date', - ]; - - /** - * 定义错误信息 - * 格式:'字段名.规则名' => '错误信息' - * - * @var array - */ - protected $message = []; -} diff --git a/application/kaoshi/validate/Kaoshiset.php b/application/kaoshi/validate/Kaoshiset.php deleted file mode 100644 index a8523f92..00000000 --- a/application/kaoshi/validate/Kaoshiset.php +++ /dev/null @@ -1,31 +0,0 @@ - ['规则1','规则2'...] - * - * @var - */ - protected $rule = [ - 'nianji|年级' => 'require|array', - 'subject|学科' => 'require|array', - 'manfen|满分' => 'require|array', - 'youxiu|优秀' => 'require|array', - 'jige|及格' => 'require|array', - 'lieming|列名' => 'require|array', - ]; - - /** - * 定义错误信息 - * 格式:'字段名.规则名' => '错误信息' - * - * @var array - */ - protected $message = []; -} diff --git a/application/kaoshi/view/index/create.html b/application/kaoshi/view/index/create.html deleted file mode 100644 index d4c0f7b6..00000000 --- a/application/kaoshi/view/index/create.html +++ /dev/null @@ -1,126 +0,0 @@ -{extend name="common@create" /} - -{block name="form"} -
-
- -
- {php} $schoollist = schlist('校级','区级');{/php} - -
-
-
- -
- -
-
-
- -
- {php} - $xueqi = new \app\teach\model\Xueqi; - $xueqilist = $xueqi - ->limit(6) - ->order(['id'=>'desc']) - ->field('id,title') - ->select(); - {/php} - -
-
-
- -
- {php} $category = getCategory(109);{/php} - -
-
-
-
- -
- -
-
- -
-
-
-
- -
-
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/kaoshi/view/index/index.html b/application/kaoshi/view/index/index.html deleted file mode 100644 index 7c6ae650..00000000 --- a/application/kaoshi/view/index/index.html +++ /dev/null @@ -1,146 +0,0 @@ - -{extend name="common@list" /} -{block name="jsset"} - -{/block} -{block name="nav"} - - 考试管理 - 考试列表 - -{/block} -{block name="search"} -
- -
- -
-
-{/block} -{block name="table"} -
-{/block} -{block name="myjs"} - - - - - - -{/block} \ No newline at end of file diff --git a/application/kaoshi/view/index/kaoshiset.html b/application/kaoshi/view/index/kaoshiset.html deleted file mode 100644 index c9097816..00000000 --- a/application/kaoshi/view/index/kaoshiset.html +++ /dev/null @@ -1,159 +0,0 @@ -{extend name="common@create" /} - -{block name="form"} -
-
-
- - {php} - - $ks = new \app\kaoshi\model\Kaoshi; - $shijian = $ks - ->where('id',$list['set']['kaoshi']) - ->value('bfdate'); - $njlist = nianjiList($shijian); - {/php} - {foreach $njlist as $key=>$vo} -
- -
- - {/foreach} -
-
-
-
- -
-
- 学科 -
-
- 满分 -
-
- 优秀分数线 -
-
- 及格分数线 -
-
-
- - {php} - $subject = action('teach/Subject/subjectlist'); - {/php} - - - {volist name="subject" id="vo"} -
- -
- -
-
- -
-
- -
-
- -
- -
- {/volist} - -
-
- -
-
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/kaoshi/view/index/more_action.html b/application/kaoshi/view/index/more_action.html deleted file mode 100644 index c06f0140..00000000 --- a/application/kaoshi/view/index/more_action.html +++ /dev/null @@ -1,136 +0,0 @@ - - - - - {$list.webtitle} - - - - {load href="__STATIC__/xadmin/css/font.css" /} - {load href="__STATIC__/xadmin/css/xadmin.css" /} - {load href="__STATIC__/xadmin/js/jquery.min.js" /} - {load href="__STATIC__/xadmin/lib/layui/layui.js" /} - {load href="__STATIC__/xadmin/js/xadmin.js" /} - {load href="__STATIC__/xadmin/js/cookie.js" /} - {load href="__STATIC__/xadmin/js/md5.min.js" /} - {block name="jsset"}{/block} - - - - - - - {php}$kaoshiid =$list['kaoshiid']; {/php} -
-
    -
  • 1、前期操作
  • -
  • 2、成绩录入
  • -
  • 3、学生成绩
  • -
  • 4、班级成绩
  • -
  • 5、年级成绩
  • -
- -
- - - \ No newline at end of file diff --git a/application/kaoshi/view/kaohao/biaoqian.html b/application/kaoshi/view/kaohao/biaoqian.html deleted file mode 100644 index 653a7758..00000000 --- a/application/kaoshi/view/kaohao/biaoqian.html +++ /dev/null @@ -1,161 +0,0 @@ -{extend name="common@createhref" /} - -{block name="form"} -
-
- -
- - {volist name="$list.data.subject" id="vo"} - - {/volist} -
-
-
- -
- {php} $schoollist = schlist('校级','校级',['小学','中小学']);{/php} - -
-
-
- -
- -
-
-
- -
-
-
- - - -
- -
-
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/kaoshi/view/kaohao/caiji.html b/application/kaoshi/view/kaohao/caiji.html deleted file mode 100644 index 68c530ef..00000000 --- a/application/kaoshi/view/kaohao/caiji.html +++ /dev/null @@ -1,123 +0,0 @@ -{extend name="common@create" /} - -{block name="form"} -
-
- -
- {php} $schoollist = schlist('校级','校级',['小学','中小学']);{/php} - -
-
-
- {volist name="$list.data.nianji" id="vo"} - -
- -
- {php} - if($key==0){ - $nianji = $vo['id']; - }else{ - $nianji = $nianji.','.$vo['id']; - } - {/php} - {/volist} -
- -
- -
-
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/kaoshi/view/kaohao/index.html b/application/kaoshi/view/kaohao/index.html deleted file mode 100644 index bdd7900f..00000000 --- a/application/kaoshi/view/kaohao/index.html +++ /dev/null @@ -1,131 +0,0 @@ -{extend name="common@create" /} - -{block name="form"} -
-
- -
- {php} $schoollist = schlist('校级','校级',['小学','中小学']);{/php} - -
-
-
- {volist name="$list.data.nianji" id="vo"} - -
- -
- {php} - if($key==0){ - $nianji = $vo['id']; - }else{ - $nianji = $nianji.','.$vo['id']; - } - {/php} - {/volist} - {php} - if(empty($nianji)){ $nianji=''; } - {/php} -
- -
- -
-
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/keti/common.php b/application/keti/common.php deleted file mode 100644 index b3d9bbc7..00000000 --- a/application/keti/common.php +++ /dev/null @@ -1 +0,0 @@ -assign('list',$list); - - // 渲染模板 - return $this->fetch(); - } - - - - /** - * 显示课题册列表 - * - * @return \think\Response - */ - public function ajaxData() - { - // 获取参数 - $src = $this->request - ->only([ - 'page'=>'1', - 'limit'=>'10', - 'field'=>'update_time', - 'type'=>'desc', - 'lxdanweiid'=>array(), - 'category'=>array(), - 'searchval'=>'' - ],'POST'); - - - // 实例化 - $keti = new keti; - - // 查询要显示的数据 - $data = $keti->search($src); - // 获取符合条件记录总数 - $cnt = $data->count(); - // 获取当前页数据 - $limit_start = $src['page'] * $src['limit'] - $src['limit']; - $limit_length = $src['limit']; - $data = $data->slice($limit_start,$limit_length); - - // 重组返回内容 - $data = [ - 'code'=> 0 , // ajax请求次数,作为标识符 - 'msg'=>"", // 获取到的结果数(每页显示数量) - 'count'=>$cnt, // 符合条件的总数据量 - 'data'=>$data, //获取到的数据结果 - ]; - - - return json($data); - } - - - - /** - * 显示创建资源表单页. - * - * @return \think\Response - */ - public function create() - { - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'添加课题册', - 'butname'=>'添加', - 'formpost'=>'POST', - 'url'=>'/kt', - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - } - - /** - * 保存新建的资源 - * - * @param \think\Request $request - * @return \think\Response - */ - public function save() - { - // 获取表单数据 - $list = request()->only(['title','category','lxshijian','lxdanweiid'],'post'); - - // 实例化验证模型 - $validate = new \app\keti\validate\Keti; - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]);; - } - - // 保存数据 - $data = keti::create($list); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - /** - * 显示指定的资源 - * - * @param int $id - * @return \think\Response - */ - public function read($id) - { - - } - - /** - * 显示编辑资源表单页. - * - * @param int $id - * @return \think\Response - */ - public function edit($id) - { - // 获取荣誉册信息 - $list['data'] = keti::where('id',$id) - ->field('id,title,category,lxshijian,lxdanweiid') - ->find(); - - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'编辑课题册', - 'butname'=>'修改', - 'formpost'=>'PUT', - 'url'=>'/kt/'.$id, - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - } - - /** - * 保存更新的资源 - * - * @param \think\Request $request - * @param int $id - * @return \think\Response - */ - public function update($id) - { - // 获取表单数据 - $list = request()->only(['title','category','lxshijian','lxdanweiid'],'put'); - $list['id'] = $id; - - - // 实例化验证类 - $validate = new \app\keti\validate\Keti; - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]);; - } - - - // 更新数据 - $data = keti::update($list); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - /** - * 删除指定资源 - * - * @param int $id - * @return \think\Response - */ - public function delete($id) - { - if($id == 'm') - { - $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 - } - - $data = keti::destroy($id); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - // 设置荣誉状态 - public function setStatus() - { - - // 获取id变量 - $id = request()->post('id'); - $value = request()->post('value'); - - // 获取学生信息 - $data = keti::where('id',$id)->update(['status'=>$value]); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - -} diff --git a/application/keti/controller/KetiInfo.php b/application/keti/controller/KetiInfo.php deleted file mode 100644 index af77eb7d..00000000 --- a/application/keti/controller/KetiInfo.php +++ /dev/null @@ -1,592 +0,0 @@ -assign('list',$list); - - // 渲染模板 - return $this->fetch(); - } - - - /** - * 显示指定的资源 - * - * @param int $id - * @return \think\Response - */ - public function ketiList($ketice) - { - - $kt = new \app\keti\model\Keti; - // 设置要给模板赋值的信息 - $list['webtitle'] = $kt->where('id',$ketice)->value('title').' 列表'; - $list['ketice'] = $ketice; - - // 模板赋值 - $this->assign('list',$list); - - // 渲染模板 - return $this->fetch(); - } - - - - /** - * 显示课题信息列表 - * - * @return \think\Response - */ - public function ajaxData() - { - // 获取参数 - $src = $this->request - ->only([ - 'page'=>'1', - 'limit'=>'10', - 'field'=>'update_time', - 'type'=>'desc', - 'lxdanweiid'=>array(), - 'lxcategory'=>array(), - 'fzdanweiid'=>array(), - 'subject'=>array(), - 'category'=>array(), - 'jddengji'=>array(), - 'ketice'=>'', - 'searchval'=>'' - ],'POST'); - - - // 实例化 - $ktinfo = new ktinfo; - - // 查询要显示的数据 - $data = $ktinfo->search($src); - // 获取符合条件记录总数 - $cnt = $data->count(); - // 获取当前页数据 - $limit_start = $src['page'] * $src['limit'] - $src['limit']; - $limit_length = $src['limit']; - $data = $data->slice($limit_start,$limit_length); - - // 重组返回内容 - $data = [ - 'code'=> 0 , // ajax请求次数,作为标识符 - 'msg'=>"", // 获取到的结果数(每页显示数量) - 'count'=>$cnt, // 符合条件的总数据量 - 'data'=>$data, //获取到的数据结果 - ]; - - - return json($data); - } - - - - - /** - * 显示创建资源表单页. - * - * @return \think\Response - */ - public function create($ketice=0) - { - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'添加课题册', - 'butname'=>'添加', - 'formpost'=>'POST', - 'url'=>'/ktinfo', - 'ketice'=>$ketice - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - } - - /** - * 保存新建的资源 - * - * @param \think\Request $request - * @return \think\Response - */ - public function save() - { - // 获取表单数据 - $list = request()->only(['ketice','title','bianhao','fzdanweiid','subject','category','jhjtshijian','hjteachers'],'POST'); - - - // 实例化验证类 - $validate = new \app\keti\validate\KetiInfo; - // 验证表单数据 - $result = $validate->scene('add')->check($list); - $msg = $validate->getError(); - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]); - } - - - // 更新数据 - $data = ktinfo::create($list); - - // 声明教师数组 - $teacherlist = []; - // 循环组成获奖教师信息 - foreach ($list['hjteachers'] as $key => $value) { - $canyulist[] = [ - 'teacherid' => $value, - 'category' => 1, - ]; - } - - - // 添加新的获奖人与参与人信息 - $cy = $data->ktZcr()->saveAll($canyulist); - - // 根据更新结果设置返回提示信息 - if($cy){ - $data=['msg'=>'添加成功','val'=>1]; - }else{ - $data=['msg'=>'数据处理错误','val'=>0]; - $data->delete(true); - } - - // 返回信息 - return json($data); - } - - - // 批量上传立项通知书 - public function createAll($ketice) - { - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'批量添加课题信息', - 'butname'=>'批传', - 'formpost'=>'POST', - 'url'=>'/ktinfoaddall/'.$ketice, - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch(); - } - - // 批量保存图片 - public function saveall($ketice) - { - // 获取文件信息 - $list['text'] = $this->request->post('text'); - $list['serurl'] = $this->request->post('serurl'); - - // 获取表单上传文件 - $file = request()->file('file'); - // 上传文件并返回结果 - $data = upload($list,$file); - - if($data['val'] != 1) - { - $data=['msg'=>'添加失败','val'=>0]; - } - - $data = ktinfo::create([ - 'lxpic'=>$data['url'] - ,'title'=>'批传立项' - ,'ketice'=>$ketice - ]); - - $data ? $data=['msg'=>'批传成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - return json($data); - } - - - /** - * 上传荣誉图片并保存 - * - * @param \think\Request $request - * @return \think\Response - */ - public function upload() - { - // 获取文件信息 - $list['text'] = $this->request->post('text'); - $list['serurl'] = $this->request->post('serurl'); - - // 获取表单上传文件 - $file = request()->file('file'); - // 上传文件并返回结果 - $data = upload($list,$file); - - return json($data); - } - - - /** - * 显示指定的资源 - * - * @param int $id - * @return \think\Response - */ - public function read($id) - { - // - } - - /** - * 显示编辑资源表单页. - * - * @param int $id - * @return \think\Response - */ - public function edit($id) - { - // 获取课题信息 - $list['data'] = ktinfo::where('id',$id) - ->field('id,title,fzdanweiid,bianhao,subject,category,jhjtshijian,lxpic') - ->with([ - 'ktZcr'=>function($query){ - $query->field('ketiinfoid,teacherid') - ->with([ - 'teacher'=>function($q){ - $q->field('id,xingming'); - } - ]); - }, - ]) - ->find(); - - - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'编辑课题', - 'butname'=>'修改', - 'formpost'=>'PUT', - 'url'=>'/ktinfo/'.$id, - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - } - - /** - * 保存更新的资源 - * - * @param \think\Request $request - * @param int $id - * @return \think\Response - */ - public function update($id) - { - // 获取表单数据 - $list = request()->only(['title','bianhao','fzdanweiid','subject','category','jhjtshijian','hjteachers','lxpic'],'PUT'); - $list['id'] = $id; - - - // 实例化验证类 - $validate = new \app\keti\validate\KetiInfo; - // 验证表单数据 - $result = $validate->scene('edit')->check($list); - $msg = $validate->getError(); - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]); - } - - - // 更新数据 - $data = ktinfo::update($list); - - // 删除原来的获奖人与参与人信息 - $data->ktZcr()->delete(true); - // 声明教师数组 - $teacherlist = []; - // 循环组成获奖教师信息 - foreach ($list['hjteachers'] as $key => $value) { - $canyulist[] = [ - 'teacherid' => $value, - 'category' => 1, - ]; - } - - - // 添加新的获奖人与参与人信息 - $data = $data->ktZcr()->saveAll($canyulist); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - /** - * 删除指定资源 - * - * @param int $id - * @return \think\Response - */ - public function delete($id) - { - - if($id == 'm') - { - $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 - } - - $data = ktinfo::destroy($id); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - // 设置荣誉状态 - public function setStatus() - { - - // 获取id变量 - $id = request()->post('id'); - $value = request()->post('value'); - - // 获取学生信息 - $data = ktinfo::where('id',$id)->update(['status'=>$value]); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - // 结题页面 - public function jieTi($id) - { - // 获取课题信息 - $list['data'] = ktinfo::where('id',$id) - ->field('id,title,jddengji,jtshijian,jtpic') - ->with([ - 'ktCy'=>function($query){ - $query->field('ketiinfoid,teacherid') - ->with(['teacher'=>function($query){ - $query->field('id,xingming'); - }]); - }, - ]) - ->find(); - - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'编辑结题', - 'butname'=>'修改', - 'formpost'=>'PUT', - 'url'=>'/ktjt/'.$id, - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch(); - } - - - // 更新结题信息 - public function jtUpdate($id) - { - // 获取表单数据 - $list = request()->only(['jtpic','jddengji','jtshijian','cyteachers'],'PUT'); - $list['id'] = $id; - - - // 实例化验证类 - $validate = new \app\keti\validate\KetiInfo; - // 验证表单数据 - $result = $validate->scene('jieti')->check($list); - $msg = $validate->getError(); - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]); - } - - - // 更新数据 - $data = ktinfo::update($list); - - // 删除原来的获奖人与参与人信息 - $data->ktCy()->delete(true); - // 声明教师数组 - $teacherlist = []; - // 循环组成获奖教师信息 - foreach ($list['cyteachers'] as $key => $value) { - $canyulist[] = [ - 'teacherid' => $value, - 'category' => 2, - ]; - } - - - // 添加新的获奖人与参与人信息 - $data = $data->ktCy()->saveAll($canyulist); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - - - } - - - /** - * 上传荣誉图片并保存 - * - * @param \think\Request $request - * @return \think\Response - */ - public function jtupload() - { - - // 获取表单上传文件 例如上传了001.jpg - $file = request()->file('file'); - // 移动到框架应用根目录/uploads/ 目录下 - $info = $file->validate(['size'=>2*1024*1024,'ext'=>'jpg,png,gif,jpeg'])->move('uploads\keti\jieti'); - - if($info){ - // 成功上传后 获取上传信息 - $list['url'] = $info->getSaveName(); - $list['url'] = str_replace('\\','/',$list['url']); - // 如果图片上传成功,则返回 - $data = array('msg'=>'上传成功','val'=>true,'url'=>$list['url']); - }else{ - // 上传失败获取错误信息 - $data = array('msg'=>$file->getError(),'val'=>false,'url'=>null); - } - - // 返回信息 - return json($data); - } - - - // 下载课题信息表 - public function outXlsx($ketice) - { - $ketiinfo = new ketiinfo(); - $list = $ketiinfo->srcTuceRy($ketice); - - halt($list); - - if($list->isEmpty()) - { - $this->error('兄弟,没有要下载的信息呀~'); - return ''; - }else{ - $filename = $list[0]['ryTuce']['title']; - $fzschool = $list[0]['ryTuce']['fz_school']['title']; - $fzshijian = strtotime($list[0]['ryTuce']['fzshijian']); - $fzshijian = date('Ym',$fzshijian); - } - - //通过工厂模式创建内容 - $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load('jsRongyu.xlsx'); - $worksheet = $spreadsheet->getActiveSheet(); - - $worksheet->getCell('A1')->setValue($filename); - $worksheet->getCell('A2')->setValue('发证单位:'.$fzschool); - $worksheet->getCell('G2')->setValue('发证时间:'.$list[0]['ryTuce']['fzshijian']); - // 循环为excel每行赋值 - foreach ($list as $key => $value) { - $myrowid = $key + 4; - $worksheet->getCell('A'.$myrowid)->setValue($key+1); - $worksheet->getCell('B'.$myrowid)->setValue($value->title); - $worksheet->getCell('C'.$myrowid)->setValue($value->hjJsName); - if($value->hj_school){ - $worksheet->getCell('D'.$myrowid)->setValue($value->hj_school->jiancheng); - } - if($value->ry_subject){ - $worksheet->getCell('E'.$myrowid)->setValue($value->ry_subject->title); - } - $worksheet->getCell('F'.$myrowid)->setValue($value->cyJsName); - if($value->jx_category){ - $worksheet->getCell('G'.$myrowid)->setValue($value->jx_category->title); - } - $worksheet->getCell('H'.$myrowid)->setValue($value->bianhao); - } - - // 给单元格加边框 - $styleArray = [ - 'borders' => [ - 'allBorders' => [ - 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN, - 'color' => ['argb' => '00000000'], - ], - ], - ]; - - if($key+4>9) - { - - $worksheet->getStyle('A10:I'.($key+4))->applyFromArray($styleArray); - // 设置行高 - for($i = 10; $i<=($key+4); $i++){ - $worksheet->getRowDimension($i)->setRowHeight(30); - } - - } - - $worksheet->getStyle('A4')->applyFromArray($styleArray); - - - //告诉浏览器输出07Excel文件 - header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); - //告诉浏览器输出浏览器名称 - header('Content-Disposition: attachment;filename="'. $filename .$fzshijian.'.xlsx"'); - //禁止缓存 - header('Cache-Control: max-age=0'); - $writer = new Xlsx($spreadsheet); - $writer->save('php://output'); - // ob_end_clean(); - // ob_start(); - // 释放内存 - $spreadsheet->disconnectWorksheets(); - unset($spreadsheet); - - // return '下载后请关闭窗口'; - } - - - -} diff --git a/application/keti/model/Keti.php b/application/keti/model/Keti.php deleted file mode 100644 index 4489eb3e..00000000 --- a/application/keti/model/Keti.php +++ /dev/null @@ -1,104 +0,0 @@ -order([$src['field'] =>$src['type']]) - ->when(count($lxdanweiid)>0,function($query) use($lxdanweiid){ - $query->where('lxdanweiid','in',$lxdanweiid); - }) - ->when(count($category)>0,function($query) use($category){ - $query->where('category','in',$category); - }) - ->when(strlen( $searchval)>0,function($query) use( $searchval){ - $query->where('title','like', $searchval); - }) - ->with( - [ - 'ktCategory'=>function($query){ - $query->field('id,title'); - }, - 'ktLxdanwei'=>function($query){ - $query->field('id,title'); - }, - ] - ) - ->withCount(['ktInfo'=>'lxcount'],'id') - ->withCount(['ktInfo'=>function($query){ - $query->where('jddengji','between',[1,2]); - }]) - ->select(); - - - return $data; - } - - - // 类型关联 - public function ktCategory() - { - return $this->belongsTo('\app\system\model\Category','category','id'); - } - - - // 立项单位关联 - public function ktLxdanwei() - { - return $this->belongsTo('\app\system\model\School','lxdanweiid','id'); - } - - - // 课题信息关联 - public function ktInfo() - { - return $this->hasMany('KetiInfo','ketice','id'); - } - - - // 立项时间获取器 - public function getLxshijianAttr($value) - { - if ($value>0) - { - $value = date('Y-m-d',$value); - }else{ - $value = ""; - } - return $value; - } - - - // 立项时间 - public function setLxshijianAttr($value) - { - return strtotime($value); - } - - - // 课题数量 - public function getKtcntAttr() - { - return $this->ktInfo->count(); - } - - - // 结题课题数量 - public function getJtcntAttr() - { - return $this->ktInfo->where('jddengji','>',0)->where('jtshijian','>',0)->count(); - } -} diff --git a/application/keti/model/KetiCanyu.php b/application/keti/model/KetiCanyu.php deleted file mode 100644 index b17285c7..00000000 --- a/application/keti/model/KetiCanyu.php +++ /dev/null @@ -1,20 +0,0 @@ -belongsTo('\app\keti\model\Keti','ketiinfoid','id'); - } - - // 教师关联 - public function teacher() - { - return $this->belongsTo('\app\renshi\model\Teacher','teacherid','id'); - } -} diff --git a/application/keti/model/KetiInfo.php b/application/keti/model/KetiInfo.php deleted file mode 100644 index fcf615aa..00000000 --- a/application/keti/model/KetiInfo.php +++ /dev/null @@ -1,244 +0,0 @@ -order([$src['field'] =>$src['type']]) - ->when(count($lxdanweiid)>0,function($query) use($lxdanweiid){ - $query->where('ketice','in',function ($q) use($lxdanweiid){ - $q->name('keti')->where('lxdanweiid','in',$lxdanweiid)->field('id'); - }); - }) - ->when(count($lxcategory)>0,function($query) use($lxcategory){ - $query->where('ketice','in',function($q) use($lxcategory){ - $q->name('keti')->where('category','in',$lxcategory)->field('id'); - }); - }) - ->when(count($fzdanweiid)>0,function($query) use($fzdanweiid){ - $query->where('fzdanweiid','in',$fzdanweiid); - }) - ->when(count($subject)>0,function($query) use($subject){ - $query->where('subject','in',$subject); - }) - ->when(count($category)>0,function($query) use($category){ - $query->where('category','in',$category); - }) - ->when(count($jddengji)>0,function($query) use($jddengji){ - $query->where('jddengji','in',$jddengji); - }) - ->when(strlen($ketice)>0,function($query) use($ketice){ - $query->where('ketice',$ketice); - }) - ->when(strlen($searchval)>0,function($query) use($searchval){ - $query->where('title','like',$searchval); - }) - ->with( - [ - 'fzSchool'=>function($query){ - $query->field('id,jiancheng'); - }, - 'KtCe'=>function($query){ - $query->field('id,lxdanweiid,category,lxshijian') - ->with([ - 'ktCategory' => function($q){ - $q->field('id,title'); - }, - 'ktLxdanwei' => function($q){ - $q->field('id,jiancheng'); - } - ]); - }, - 'ktCategory'=>function($query){ - $query->field('id,title'); - }, - 'ktSubject'=>function($query){ - $query->field('id,title'); - }, - 'ktZcr'=>function($query){ - $query->field('ketiinfoid,teacherid') - ->with([ - 'teacher'=>function($q){ - $q->field('id,xingming'); - } - ]); - }, - 'ktCy'=>function($query){ - $query->field('ketiinfoid,teacherid') - ->with([ - 'teacher'=>function($q){ - $q->field('id,xingming'); - } - ]); - } - ]) - ->select(); - - - return $data; - } - - - //搜索课题册 - public function srcketi($ketice) - { - $data = $this - ->order([$src['field'] =>$src['type']]) - ->where('ketice',$ketice) - ->with( - [ - 'fzSchool'=>function($query){ - $query->field('id,jiancheng'); - }, - 'KtCe'=>function($query){ - $query->field('id,lxdanweiid,category,lxshijian') - ->with([ - 'ktCategory' => function($q){ - $q->field('id,title'); - }, - 'ktLxdanwei' => function($q){ - $q->field('id,jiancheng'); - } - ]); - }, - 'ktCategory'=>function($query){ - $query->field('id,title'); - }, - 'ktSubject'=>function($query){ - $query->field('id,title'); - }, - 'ktZcr'=>function($query){ - $query->field('ketiinfoid,teacherid') - ->with([ - 'teacher'=>function($q){ - $q->field('id,xingming'); - } - ]); - }, - 'ktCy'=>function($query){ - $query->field('ketiinfoid,teacherid') - ->with([ - 'teacher'=>function($q){ - $q->field('id,xingming'); - } - ]); - } - ] - ) - ->select(); - - - return $data; - } - - - // 课题主持人关联 - public function ktZcr() - { - return $this->hasMany('\app\keti\model\KetiCanyu','ketiinfoid','id')->where('category',1); - } - // 课题参与人关联 - public function ktCy() - { - return $this->hasMany('\app\keti\model\KetiCanyu','ketiinfoid','id')->where('category',2); - } - - // 立项单位关联 - public function fzSchool() - { - return $this->belongsTo('\app\system\model\School','fzdanweiid','id'); - } - - - // 研究类型关联 - public function ktCategory() - { - return $this->belongsTo('\app\system\model\Category','category','id'); - } - - - // 所属学科关联 - public function ktSubject() - { - return $this->belongsTo('\app\system\model\Category','subject','id'); - } - - - // 课题册关联 - public function ktCe() - { - return $this->belongsTo('\app\keti\model\Keti','ketice','id'); - } - - - - // 结题等级获取器 - public function getJddengjiAttr($value) - { - // 结题数组 - $jtdj = array('0'=>'研究中','1'=>'合格','2'=>'优秀','3'=>'流失'); - // 获取结题鉴定等级 - $str = $jtdj[$value]; - // 返回结题等级 - return $str; - } - - - - // 计划结题时间修改器 - public function setJhjtshijianAttr($value) - { - return strtotime($value); - } - - // 计划结题时间获取器 - public function getJhjtshijianAttr($value) - { - if ($value>0) - { - $value = date('Y-m-d',$value); - }else{ - $value = ""; - } - return $value; - } - - // 结题时间修改器 - public function setJtshijianAttr($value) - { - return strtotime($value); - } - - // 结题时间获取器 - public function getJtshijianAttr($value) - { - if ($value>0) - { - $value = date('Y-m-d',$value); - }else{ - $value = ""; - } - return $value; - } - - - - -} diff --git a/application/keti/validate/Keti.php b/application/keti/validate/Keti.php deleted file mode 100644 index 4ac222aa..00000000 --- a/application/keti/validate/Keti.php +++ /dev/null @@ -1,29 +0,0 @@ - ['规则1','规则2'...] - * - * @var array - */ - protected $rule = [ - 'title|课题册标题' => 'require|length:1,30', - 'category|课题类型' => 'require|number', - 'lxshijian|立项时间' => 'require|date', - 'lxdanweiid|立项单位' => 'require|number', - ]; - - /** - * 定义错误信息 - * 格式:'字段名.规则名' => '错误信息' - * - * @var array - */ - protected $message = []; -} diff --git a/application/keti/validate/KetiInfo.php b/application/keti/validate/KetiInfo.php deleted file mode 100644 index fd10c444..00000000 --- a/application/keti/validate/KetiInfo.php +++ /dev/null @@ -1,45 +0,0 @@ - ['规则1','规则2'...] - * - * @var array - */ - protected $rule = [ - 'id|请先上传立项通知书图片' => 'require', - 'ketice|课题册ID丢失' => 'require', - 'title|课题名称' => 'require|length:1,60', - 'bianhao|课题编号' => 'require|length:1,11', - 'hjteachers|课题主持人' => 'require|array', - 'fzdanweiid|课题负责单位' => 'require|number', - 'subject|课题所属学科' => 'require|number', - 'category|课题研究类型' => 'require|number', - 'jhjtshijian|计划结题时间' => 'require|date', - 'cyteachers|参与人' => 'array', - 'jtpic|结题鉴定图片' => 'length:1,100', - 'jtshijian|结题时间' => 'require|date', - 'jddengji|鉴定等级' => 'require|number', - ]; - - /** - * 定义错误信息 - * 格式:'字段名.规则名' => '错误信息' - * - * @var array - */ - protected $message = []; - - // 验证场景 - protected $scene = [ - 'add' => ['ketice','title','bianhao','fzdanweiid','subject','category','jhjtshijian','hjteachers'], - 'edit' => ['id','title','hjteachers','hjschool','subject','hjshijian','jiangxiang'], - 'jieti' => ['id','jtpic','jddengji','jtshijian','cyteachers'], - ]; -} diff --git a/application/keti/view/index/create.html b/application/keti/view/index/create.html deleted file mode 100644 index f00f31e8..00000000 --- a/application/keti/view/index/create.html +++ /dev/null @@ -1,84 +0,0 @@ -{extend name="common@create" /} -{block name="jscss"} -{/block} -{block name="form"} -
-
- -
- -
-
-
- -
- {php} $category = getCategory(115);{/php} - -
-
-
- -
- {php} $school = schlist('区级','其它级');{/php} - -
-
-
- -
- -
-
-
- -
-
-{/block} - -{block name="myjs"} - - -{/block} - diff --git a/application/keti/view/index/index.html b/application/keti/view/index/index.html deleted file mode 100644 index 7e70dc2c..00000000 --- a/application/keti/view/index/index.html +++ /dev/null @@ -1,131 +0,0 @@ - -{extend name="common@list" /} -{block name="jsset"} - -{/block} -{block name="nav"} - - 课题管理 - 课题册 - -{/block} -{block name="search"} -
- -
- -
-
-
- -
- {php} $category = getCategory(112);{/php} - {volist name="category" id="vo"} - - {/volist} -
-
-
- -
- {php} $school = schlist('区级','其它级'); {/php} - {volist name="school" id="vo"} - - {/volist} -
-
-{/block} -{block name="table"} -
-{/block} -{block name="myjs"} - - - - - - -{/block} \ No newline at end of file diff --git a/application/keti/view/keti_info/create.html b/application/keti/view/keti_info/create.html deleted file mode 100644 index 9ede2800..00000000 --- a/application/keti/view/keti_info/create.html +++ /dev/null @@ -1,244 +0,0 @@ -{extend name="common@create" /} -{block name="jscss"} - -{/block} -{block name="form"} -
- {eq name="$list.set.formpost" value="PUT" } - {if strlen($list.data.lxpic)>0} - - {else /} - - {/if} - {/eq} -
-
-
- -
-
- -
-
- -
-
-
-
- -
- -
-
-
- -
- -
-
-
- -
-
- -
- {present name="$list.data.kt_zcr"} - {volist name="$list.data.kt_zcr" id="vo"} -
-
- {$vo.teacher.xingming} -
-
- {/volist} - {/present} -
-
-
- -
- {php} $school = schlist('校级','区级');{/php} - -
-
-
- -
- {php}$subject = getCategory(116);{/php} - -
-
-
- -
- {php} $category = getCategory(117);{/php} - -
-
-
- -
- -
-
- -
- -
-
-{/block} - -{block name="myjs"} - - -{/block} - diff --git a/application/keti/view/keti_info/create_all.html b/application/keti/view/keti_info/create_all.html deleted file mode 100644 index c902f834..00000000 --- a/application/keti/view/keti_info/create_all.html +++ /dev/null @@ -1,43 +0,0 @@ -{extend name="common@create" /} - -{block name="form"} -
- -
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/keti/view/keti_info/index.html b/application/keti/view/keti_info/index.html deleted file mode 100644 index adc5e2e6..00000000 --- a/application/keti/view/keti_info/index.html +++ /dev/null @@ -1,159 +0,0 @@ - -{extend name="common@list" /} -{block name="jsset"} - -{/block} -{block name="nav"} - - 课题管理 - 课题册 - 课题列表 - -{/block} -{block name="search"} -
- -
- -
-
-
- -
- {php} $school = schlist('区级','其它级'); {/php} - {volist name="school" id="vo"} - - {/volist} -
-
-
- -
- {php} $category = getCategory(115);{/php} - {volist name="category" id="vo"} - - {/volist} -
-
-
- -
- {php} $school = schlist('校级','区级'); {/php} - {volist name="school" id="vo"} - - {/volist} -
-
-
- -
- {php} $category = getCategory(116);{/php} - {volist name="category" id="vo"} - - {/volist} -
-
-
- -
- {php} $category = getCategory(117);{/php} - {volist name="category" id="vo"} - - {/volist} -
-
-
- -
- - - - -
-
-{/block} -{block name="table"} -
-{/block} -{block name="myjs"} - - - - - - -{/block} \ No newline at end of file diff --git a/application/keti/view/keti_info/jie_ti.html b/application/keti/view/keti_info/jie_ti.html deleted file mode 100644 index ff65894d..00000000 --- a/application/keti/view/keti_info/jie_ti.html +++ /dev/null @@ -1,207 +0,0 @@ -{extend name="common@create" /} -{block name="jscss"} - -{/block} -{block name="form"} -
- {eq name="$list.set.formpost" value="PUT" } - {if strlen($list.data.jtpic)>0} - - {else /} - - {/if} - {/eq} -
-
-
- -
-
- -
-
- -
-
-
-
- -
-
- -
- {present name="$list.data.kt_cy"} - {volist name="$list.data.kt_cy" id="vo"} -
-
- {$vo.teacher.xingming} -
-
- {/volist} - {/present} -
-
-
- -
- -
-
-
- -
- -
-
-
- -
-
-{/block} - -{block name="myjs"} - - -{/block} - diff --git a/application/keti/view/keti_info/keti_list.html b/application/keti/view/keti_info/keti_list.html deleted file mode 100644 index a8b5a6b4..00000000 --- a/application/keti/view/keti_info/keti_list.html +++ /dev/null @@ -1,203 +0,0 @@ - -{extend name="common@list" /} -{block name="jsset"} - -{/block} -{block name="nav"} - - 课题管理 - 课题册 - 课题列表 - -{/block} -{block name="search"} -
- -
- -
-
-
- -
- {php} $school = schlist('区级','其它级'); {/php} - {volist name="school" id="vo"} - - {/volist} -
-
-
- -
- {php} $category = getCategory(115);{/php} - {volist name="category" id="vo"} - - {/volist} -
-
-
- -
- {php} $school = schlist('校级','区级'); {/php} - {volist name="school" id="vo"} - - {/volist} -
-
-
- -
- {php} $category = getCategory(116);{/php} - {volist name="category" id="vo"} - - {/volist} -
-
-
- -
- {php} $category = getCategory(117);{/php} - {volist name="category" id="vo"} - - {/volist} -
-
-
- -
- - - - -
-
- -{/block} -{block name="table"} -
-{/block} -{block name="myjs"} - - - - - - -{/block} \ No newline at end of file diff --git a/application/login/common.php b/application/login/common.php deleted file mode 100644 index b3d9bbc7..00000000 --- a/application/login/common.php +++ /dev/null @@ -1 +0,0 @@ -error('不好意思,您访问的页面不存在~'); - } - - public function _empty() - { - $this->error('不好意思,您访问的页面不存在~'); - } -} diff --git a/application/login/controller/Index.php b/application/login/controller/Index.php deleted file mode 100644 index 0345a1be..00000000 --- a/application/login/controller/Index.php +++ /dev/null @@ -1,140 +0,0 @@ -assign('list',$list); - - // 渲染输出 - return $this->fetch(); - } - - - // 登录验证 - public function yanzheng() - { - - // 实例化验证模型 - $validate = new \app\login\validate\Yanzheng; - - - // 获取表单数据 - $data = request()->only(['username','password','captcha']); - - - // 验证表单数据 - $result = $validate->check($data); - if(!$result){ - $data=['msg'=>$validate->getError(),'status'=>0]; - return json($data); - } - - // 验证用户名和密码 - $check = $this->check($data['username'],$data['password']); - - if($check['status']==1) - { - - // 设置cookie值 - if( request()->post('online') == true ) - { - // 设置 - cookie('userid', session('userid') ,259200); - cookie('username', $data['username'] ,259200); - cookie('password', $data['password'] ,259200); - } - - // 将本次信息上传到服务器上 - $userinfo = AD::where('username',$data['username']) - ->field('lastip,username,ip,denglucishu,lasttime,thistime') - ->find(); - $userinfo->lastip = $userinfo->ip; - $userinfo->ip = request()->ip(); - $userinfo->denglucishu = ['inc', 1]; - $userinfo->lasttime = $userinfo->getData('thistime'); - $userinfo->thistime = time(); - $userinfo->save(); - - // 跳转到首页 - $data=['msg'=>'验证成功','status'=>1]; - }else{ - // 提示错误信息 - $data=['msg'=>$check['msg'],'status'=>0]; - } - - return json($data); - } - - - // 已知密码进行验证 - public function check($username,$password) - { - // 实例化加密类 - $md5 = new APR1_MD5(); - - // 获取服务器密码 - $userinfo = AD::where('username',$username)->where('status',1)->find(); - - if($userinfo == null) - { - // 清除session(当前作用域) - session(null); - // 验证结果; - $data=['msg'=>'用户名不存在或被禁用','status'=>0]; - return $data; - } - - - //验证密码 - $check = $md5->check($password,$userinfo->password); - - if($check) - { - session(null); - session('userid', $userinfo->id); - session('username', $username); - session('password', $password); - $data=['msg'=>'验证成功','status'=>1]; - }else{ - // 清除cookie - cookie(null, 'think_'); - // 清除session(当前作用域) - session(null); - $data=['msg'=>'用户名或密码错误','status'=>0]; - } - return $data; - } - - // 生成验证码 - public function verify() - { - $captcha = new Captcha(); - $captcha->fontSize = 30; - $captcha->length = 6; - $captcha->codeSet = '0123456789'; - return $captcha->entry(); - } -} diff --git a/application/login/validate/Yanzheng.php b/application/login/validate/Yanzheng.php deleted file mode 100644 index d9044341..00000000 --- a/application/login/validate/Yanzheng.php +++ /dev/null @@ -1,24 +0,0 @@ - ['规则1','规则2'...] - * - * @var array - */ - protected $rule = [ - 'username|用户名' => 'require', - 'password|密码' => 'require', - 'captcha|验证码'=>'require|captcha', - ]; - - protected $message = [ - - ]; -} diff --git a/application/login/view/index/index.html b/application/login/view/index/index.html deleted file mode 100644 index e4095581..00000000 --- a/application/login/view/index/index.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - - 小学生成绩管理平台 v{$list['version']} - - - - - {load href="__STATIC__/xadmin/css/font.css" /} - {load href="__STATIC__/xadmin/css/xadmin.css" /} - {load href="__STATIC__/xadmin/js/jquery.min.js" /} - {load href="__STATIC__/xadmin/lib/layui/layui.js" /} - {load href="__STATIC__/xadmin/js/xadmin.js" /} - {load href="__STATIC__/xadmin/js/cookie.js" /} - - - - - - - - - \ No newline at end of file diff --git a/application/provider.php b/application/provider.php deleted file mode 100644 index d0fcd245..00000000 --- a/application/provider.php +++ /dev/null @@ -1,14 +0,0 @@ - -// +---------------------------------------------------------------------- - -// 应用容器绑定定义 -return [ -]; diff --git a/application/renshi/common.php b/application/renshi/common.php deleted file mode 100644 index b9d2bde1..00000000 --- a/application/renshi/common.php +++ /dev/null @@ -1,66 +0,0 @@ -where('title',$str)->value('id'); - - return $subjectId; -} - -// 查找职务 -function srcZw($str) -{ - // 实例化类型数据模型 - $category = new \app\system\model\Category; - - // 查询学科id - $categoryId = $category->where('pid',107)->where('title',$str)->value('id'); - - return $categoryId; -} - - -// 查找学历 -function srcXl($str) -{ - // 实例化类型数据模型 - $category = new \app\system\model\Category; - - // 查询学科id - $categoryId = $category->where('pid',105)->where('title',$str)->value('id'); - - return $categoryId; -} - -// 查找职称 -function srcZc($str) -{ - // 实例化类型数据模型 - $category = new \app\system\model\Category; - - // 查询学科id - $categoryId = $category->where('pid',106)->where('title',$str)->value('id'); - - return $categoryId; -} - diff --git a/application/renshi/controller/Error.php b/application/renshi/controller/Error.php deleted file mode 100644 index 7db451b5..00000000 --- a/application/renshi/controller/Error.php +++ /dev/null @@ -1,11 +0,0 @@ -assign('list',$list); - - // 渲染模板 - return $this->fetch(); - } - - - /** - * 显示教师信息列表 - * - * @return \think\Response - */ - public function ajaxData() - { - // 获取参数 - $src = $this->request - ->only([ - 'page'=>'1', - 'limit'=>'10', - 'field'=>'update_time', - 'type'=>'desc', - 'zhiwu'=>array(), - 'danwei'=>array(), - 'xueli'=>array(), - 'searchval'=>'' - ],'POST'); - - - // 实例化 - $teacher = new Teacher; - - // 查询要显示的数据 - $data = $teacher->search($src); - // 获取符合条件记录总数 - $cnt = $data->count(); - // 获取当前页数据 - $limit_start = $src['page'] * $src['limit'] - $src['limit']; - $limit_length = $src['limit']; - $data = $data->slice($limit_start,$limit_length); - - // 重组返回内容 - $data = [ - 'code'=> 0 , // ajax请求次数,作为标识符 - 'msg'=>"", // 获取到的结果数(每页显示数量) - 'count'=>$cnt, // 符合条件的总数据量 - 'data'=>$data, //获取到的数据结果 - ]; - - - return json($data); - } - - - - // 创建教师 - public function create() - { - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'添加教师', - 'butname'=>'添加', - 'formpost'=>'POST', - 'url'=>'/teacher', - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - } - - - - // 保存信息 - public function save() - { - // 实例化验证模型 - $validate = new \app\renshi\validate\Teacher; - - - // 获取表单数据 - $list = request()->only(['xingming','sex','quanpin','shoupin','shengri','zhiwu','zhicheng','xueli','biye','worktime','zhuanye','danwei'],'post'); - - - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - $list['quanpin'] = strtolower(str_replace(' ', '', $list['quanpin'])); - $list['shoupin'] = strtolower($list['shoupin']); - - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]);; - } - - // 保存数据 - $data = Teacher::create($list); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - // 查看教师信息 - public function read($id) - { - - // 查询教师信息 - $myInfo = Teacher::where('id',$id) - ->with( - [ - 'jsDanwei'=>function($query){ - $query->field('id,title'); - }, - 'jsZhiwu'=>function($query){ - $query->field('id,title'); - }, - 'jsZhicheng'=>function($query){ - $query->field('id,title'); - }, - 'jsXueli'=>function($query){ - $query->field('id,title'); - }, - 'jsSubject'=>function($query){ - $query->field('id,title'); - }, - ] - ) - ->append(['age','gongling']) - ->limit(1) - ->select(); - $myInfo = $myInfo[0]; - // 设置页面标题 - $myInfo['webtitle'] = $myInfo->xingming.'信息'; - - // 模板赋值 - $this->assign('list',$myInfo); - // 渲染模板 - return $this->fetch(); - } - - - - - // 修改教师信息 - public function edit($id) - { - - // 获取教师信息 - $list['data'] = Teacher::field('id,xingming,sex,quanpin,shoupin,shengri,zhiwu,zhicheng,xueli,biye,worktime,zhuanye,danwei') - ->find($id); - - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'编辑教师', - 'butname'=>'修改', - 'formpost'=>'PUT', - 'url'=>'/teacher/'.$id, - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - } - - - - - - // 更新教师信息 - public function update($id) - { - $validate = new \app\renshi\validate\Teacher; - - // 获取表单数据 - $list = request()->only(['xingming','sex','quanpin','shoupin','shengri','zhiwu','zhicheng','xueli','biye','worktime','zhuanye','danwei'],'put'); - - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]);; - } - - $list['quanpin'] = strtolower(str_replace(' ', '', $list['quanpin'])); - $list['shoupin'] = strtolower($list['shoupin']); - // 更新数据 - $teacher = new Teacher(); - $data = $teacher->save($list,['id'=>$id]); - // $data = Teacher::where('id',$id)->update($list); - - // 根据更新结果设置返回提示信息 - $data>=0 ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - - - // 删除教师 - public function delete($id) - { - - if($id == 'm'){ - $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 - } - - $data = Teacher::destroy($id); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - // 设置教师状态 - public function setStatus() - { - - // 获取id变量 - $id = request()->post('id'); - $value = request()->post('value'); - - // 获取教师信息 - $data = Teacher::where('id',$id)->update(['status'=>$value]); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - // 批量添加 - public function createAll() - { - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'批量上传教师信息', - 'butname'=>'批传', - 'formpost'=>'POST', - 'url'=>'/teacher/createall', - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch(); - } - - // 批量保存 - public function saveAll() - { - // 获取表单数据 - $list = request()->only(['school','url'],'post'); - - // 实例化操作表格类 - $excel = new \app\renshi\controller\Myexcel;; - - // 读取表格数据 - $teacherinfo = $excel->readXls($list['url']); - - // 判断表格是否正确 - if($teacherinfo[0][1] != "教师基本情况表" ) - { - $data = array('msg'=>'请使用模板上传','val'=>0,'url'=>null); - return json($data); - } - - // 删除标题行 - array_splice($teacherinfo,0,4 ); - - // 整理数据 - $i = 0; - $teacherlist = array(); - - foreach ($teacherinfo as $key => $value) { - // 如果姓名、性别、出生日期、全拼、首拼为空则跳过 - if(empty($value[1]) || empty($value[2]) || empty($value[3]) || empty($value[11]) || empty($value[12])) - { - continue; - } - - // 整理数据 - $teacherlist[$i]['xingming'] = $value[1]; - $teacherlist[$i]['sex'] = srcSex($value[2]); - $teacherlist[$i]['shengri'] = $value[3]; - $teacherlist[$i]['worktime'] = $value[4]; - $teacherlist[$i]['zhiwu'] = srcZw($value[5]); - $teacherlist[$i]['zhicheng'] = srcZc($value[6]); - $teacherlist[$i]['danwei'] = $list['school']; - $teacherlist[$i]['biye'] = $value[8]; - $teacherlist[$i]['subject'] = srcSubject($value[7]); - $teacherlist[$i]['zhuanye'] = $value[9]; - $teacherlist[$i]['xueli'] = srcXl($value[10]); - $teacherlist[$i]['quanpin'] = strtolower(str_replace(' ', '', $value[11])); - $teacherlist[$i]['shoupin'] = strtolower($value[12]); - - $i++; - } - - // 实例化学生信息数据模型 - $teacher = new Teacher(); - - // dump($teacherinfo[0]); - - // 保存或更新信息 - $data = $teacher->saveAll($teacherlist); - - // 返回添加结果 - $data ? $data = ['msg'=>'数据上传成功','val'=>1] : ['msg'=>'数据上传失败','val'=>0]; - - return json($data); - } - - // 根据教师姓名、首拼、全拼搜索教师信息 - public function srcTeacher($str="") - { - // 声明结果数组 - $data = array(); - - // 判断是否存在数据,如果没有数据则返回。 - if(strlen($str) <= 0){ - return json($data); - } - - // 如果有数据则查询教师信息 - $list = Teacher::field('id,xingming,danwei,shengri,sex') - ->whereOr('xingming|quanpin|shoupin','like','%'.$str.'%') - ->with( - [ - 'jsDanwei'=>function($query){ - $query->field('id,jiancheng'); - }, - ] - ) - ->append(['age']) - ->all(); - return json($list); - } - - // 上传文件 - public function upload() - { - // 获取文件信息 - $list['text'] = $this->request->post('text'); - $list['serurl'] = $this->request->post('serurl'); - - // 获取表单上传文件 - $file = request()->file('file'); - // 上传文件并返回结果 - $data = upload($list,$file,true); - - return json($data); - } - - - // 下载表格模板 - public function download() - { - $download = new \think\response\Download('uploads\teacher\TeacherInfo.xlsx'); - return $download->name('TeacherInfo.xlsx'); - } - - // 下载表格VBA代码 - public function downloadVba() - { - $download = new \think\response\Download('uploads\teacher\jiaoShiXingMingVBA.bas'); - return $download->name('TeacherVBA'); - } - - - // 查询教师荣誉 - public function srcRy($teacherid) - { - // 实例化荣誉数据模型 - $ry = new \app\rongyu\model\JsRongyuInfo; - - // 查询荣誉信息 - $data = $ry->where('status',1) - ->where('id','in',function($query) use($teacherid){ - $query->name('jsRongyuCanyu') - ->where('teacherid',$teacherid) - ->field('rongyuid'); - }) - ->with( - [ - 'jxCategory'=>function($query){ - $query->field('id,title'); - }, - 'ryTuce'=>function($query){ - $query->field('id,title,fzschool,category') - ->with([ - 'fzSchool'=>function($query){ - $query->field('id,jiancheng,jibie') - ->with(['dwJibie'=>function($q){ - $q->field('id,title'); - }]); - }, - 'lxCategory'=>function($query){ - $query->field('id,title'); - }, - - ]); - }, - 'hjJsry'=>function($query){ - $query->field('rongyuid,teacherid') - ->with(['teacher'=>function($query){ - $query->field('id,xingming'); - }]); - }, - ]) - ->field('id,rongyuce,jiangxiang,hjshijian,title') - ->order('hjshijian') - ->select(); - - // 获取符合条件记录总数 - $cnt = $data->count(); - - // 重组返回内容 - $data = [ - 'code'=> 0 , // ajax请求次数,作为标识符 - 'msg'=>"", // 获取到的结果数(每页显示数量) - 'count'=>$cnt, // 符合条件的总数据量 - 'data'=>$data, //获取到的数据结果 - ]; - - - return json($data); - } - - - // 查询教师课题 - public function srcKt($teacherid) - { - // 实例化荣誉数据模型 - $ry = new \app\keti\model\KetiInfo; - - // 查询荣誉信息 - $data = $ry->where('status',1) - ->where('id','in',function($query) use($teacherid){ - $query->name('KetiCanyu') - ->where('teacherid',$teacherid) - ->field('ketiinfoid'); - }) - ->with( - [ - 'fzSchool'=>function($query){ - $query->field('id,jiancheng,jibie') - ->with(['dwJibie'=>function($q){ - $q->field('id,title'); - }]); - }, - 'ktCategory'=>function($query){ - $query->field('id,title'); - }, - 'ktZcr'=>function($query){ - $query->field('ketiinfoid,teacherid') - ->with([ - 'teacher'=>function($q){ - $q->field('id,xingming'); - } - ]); - } - ]) - ->field('id,title,fzdanweiid,category,jddengji') - ->order('id') - ->select(); - - // 获取符合条件记录总数 - $cnt = $data->count(); - - // 重组返回内容 - $data = [ - 'code'=> 0 , // ajax请求次数,作为标识符 - 'msg'=>"", // 获取到的结果数(每页显示数量) - 'count'=>$cnt, // 符合条件的总数据量 - 'data'=>$data, //获取到的数据结果 - ]; - - - return json($data); - } - - - -} diff --git a/application/renshi/controller/Myexcel.php b/application/renshi/controller/Myexcel.php deleted file mode 100644 index a26d5c7f..00000000 --- a/application/renshi/controller/Myexcel.php +++ /dev/null @@ -1,28 +0,0 @@ -setInputEncoding('GBK'); - $excelReader->setDelimiter(','); - } - $phpexcel = $excelReader->load($path); - $activeSheet = $phpexcel->getActiveSheet(); - $sheet = $activeSheet->toArray(); - return $sheet; - } -} diff --git a/application/renshi/controller/Student.php b/application/renshi/controller/Student.php deleted file mode 100644 index 74b6ef7c..00000000 --- a/application/renshi/controller/Student.php +++ /dev/null @@ -1,519 +0,0 @@ -assign('list',$list); - - // 渲染模板 - return $this->fetch(); - } - - - // 获取学生信息列表 - public function ajaxData() - { - // 获取参数 - $src = $this->request - ->only([ - 'page'=>'1', - 'limit'=>'10', - 'field'=>'update_time', - 'type'=>'desc', - 'school'=>array(), - 'ruxuenian'=>array(), - 'paixu'=>array(), - 'searchval'=>'' - ],'POST'); - - $ruxuenian = $src['ruxuenian']; - $paixu = $src['paixu']; - - // 实例化班级数据模型 - $banji = new \app\teach\model\Banji; - $src['banji'] = $banji->where('status',1) - ->when(count($ruxuenian)>0,function($query) use($ruxuenian){ - $query->where('ruxuenian','in',$ruxuenian); - }) - ->when(count($paixu)>0,function($query) use($paixu){ - $query->where('paixu','in',$paixu); - }) - ->column('id'); - - // 实例化 - $stu = new STU; - - // 查询要显示的数据 - $data = $stu->search($src); - // 获取符合条件记录总数 - $cnt = $data->count(); - // 获取当前页数据 - $limit_start = $src['page'] * $src['limit'] - $src['limit']; - $limit_length = $src['limit']; - $data = $data->slice($limit_start,$limit_length); - - // 重组返回内容 - $data = [ - 'code'=> 0 , // ajax请求次数,作为标识符 - 'msg'=>"", // 获取到的结果数(每页显示数量) - 'count'=>$cnt, // 符合条件的总数据量 - 'data'=>$data, //获取到的数据结果 - ]; - - - return json($data); - } - - - - // 创建学生 - public function create() - { - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'添加学生', - 'butname'=>'添加', - 'formpost'=>'POST', - 'url'=>'/student', - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - } - - - - // 保存信息 - public function save() - { - // 实例化验证模型 - $validate = new \app\renshi\validate\Student; - - - // 获取表单数据 - $list = request()->only(['xingming','sex','shenfenzhenghao','shengri','school','ruxuenian','banji'],'post'); - - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]);; - } - - $list['shenfenzhenghao'] = strtolower($list['shenfenzhenghao']); - - // 查询数据是否重复 - $chongfu = STU::withTrashed()->where('shenfenzhenghao',$list['shenfenzhenghao'])->find(); - // 保存或更新数据 - $stu = new STU; - if($chongfu == Null) - { - $stu::create($list); - - }else{ - if($chongfu->delete_time>0) - { - $chongfu->restore(); - } - $data = $stu->save($list,['id'=>$chongfu->id]); - } - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - // - public function read($id) - { - // - } - - - - - // 修改学生信息 - public function edit($id) - { - - // 获取学生信息 - $list['data'] = STU::field('id,xingming,sex,shenfenzhenghao,shengri,banji,school,status') - ->with([ - 'stuBanji'=>function($query){ - $query->field('id,ruxuenian,paixu')->append(['banTitle']); - } - ]) - ->find($id); - - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'编辑学生', - 'butname'=>'修改', - 'formpost'=>'PUT', - 'url'=>'/student/'.$id, - ); - - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - } - - - - - - // 更新学生信息 - public function update($id) - { - $validate = new \app\renshi\validate\Student; - - // 获取表单数据 - $list = request()->only(['xingming','sex','shengri','school','shenfenzhenghao','ruxuenian','banji'],'put'); - - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]);; - } - - - // 更新数据 - $stu = new STU(); - $data = $stu->save($list,['id'=>$id]); - - // 根据更新结果设置返回提示信息 - $data>=0 ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - - - // 删除学生 - public function delete($id) - { - - if($id == 'm') - { - $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 - } - - $data = STU::destroy($id); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - // 设置学生状态 - public function setStatus() - { - - // 获取id变量 - $id = request()->post('id'); - $value = request()->post('value'); - - // 获取学生信息 - $data = STU::where('id',$id)->update(['status'=>$value]); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - // 批量添加 - public function createAll() - { - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'批量上传学生信息', - 'butname'=>'批传', - 'formpost'=>'POST', - 'url'=>'/student/createall', - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch(); - } - - // 批量保存 - public function saveAll() - { - // 获取表单数据 - $list = request()->only(['school','url'],'post'); - - // 实例化操作表格类 - $excel = new Myexcel(); - - // 读取表格数据 - $stuinfo = $excel->readXls($list['url']); - - // 判断表格是否正确 - if($stuinfo[0][0] != "学生信息上传模板" ) - { - $data = array('msg'=>'请使用模板上传','val'=>0,'url'=>null); - return json($data); - } - - // 删除标题行 - array_splice($stuinfo,0,3); - - // 实例化班级数据模型 - $banji = new \app\teach\model\Banji; - $njlist = nianjilist(); - $bjlist = banjinamelist(); - - - $i = 0; - $bfbanji = ''; - $bj = ''; - $students = array(); - // 重新计算组合数据,如果存在数据则更新数据 - foreach ($stuinfo as $key => $value) { - // 如果姓名、身份证号为空则跳过 - if(empty($value[1]) || empty($value[2])) - { - continue; - } - // 判断本行班级与上行班级数据是否相等,如果不相等则从数据库查询班级ID - if($bfbanji != $value[3]) - { - // 获取入学年与排序 - $paixu = array_search(substr($value[3],9),$bjlist); - $ruxuenian = array_search(substr($value[3],0,9),$njlist); - // 查询班级ID - $bj = $banji::where('school',$list['school']) - ->where('ruxuenian',$ruxuenian) - ->where('paixu',$paixu) - ->value('id'); - // 如果班级ID为空,删除数据并跳出当前循环 - if( empty($bj) ) - { - continue; - } - } - $bfbanji = $value[3]; - - // 各变量赋值 - $students[$i]['banji'] = $bj; - $students[$i]['xingming'] = $value[1]; - $students[$i]['shenfenzhenghao'] = strtolower($value[2]); - intval(substr($value[2],16,1) )% 2 ? $students[$i]['sex'] = 1 :$students[$i]['sex'] = 0 ; - $students[$i]['shengri'] = substr($value[2],6,4).'-'.substr($value[2],10,2).'-'.substr($value[2],12,2); - $students[$i]['school'] = $list['school']; - $stuid = STU::withTrashed()->where('shenfenzhenghao',$value[2])->find(); - if($stuid) - { - if($stuid->delete_time>0) - { - $stuid->restore(); - } - if($stuid->status == 0) - { - $stuid->status = 1; - $stuid->save(); - } - $students[$i]['id'] = $stuid->id; - } - // 销毁无用变量 - $i++; - } - - - // 实例化学生信息数据模型 - $student = new STU(); - - // 保存或更新信息 - $data = $student->saveAll($students); - - $data ? $data = ['msg'=>'数据同步成功','val'=>1] : ['msg'=>'数据同步失败','val'=>0]; - - return json($data); - } - - - - // 使用上传的表格进行校对,表格中不存在的数据删除 - public function Jiaodui() - { - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'校对并删除学生信息', - 'butname'=>'校对删除', - 'formpost'=>'POST', - 'url'=>'/student/jiaodui', - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create_all'); - } - - - // 使用上传的表格进行校对,表格中不存在的数据删除 - public function JiaoduiDel() - { - // 获取表单数据 - $list = request()->only(['school','url'],'post'); - - // 实例化操作表格类 - $excel = new Myexcel(); - - // 读取表格数据 - $stuinfo = $excel->readXls($list['url']); - - // 判断表格是否正确 - if($stuinfo[0][0] != "学生信息上传模板" ) - { - $data = array('msg'=>'请使用模板上传','val'=>0,'url'=>null); - return json($data); - } - - // 删除标题行 - array_splice($stuinfo,0,3); - - // 实例化班级数据模型 - $banji = new \app\teach\model\Banji; - $njlist = nianjilist(); - $bjlist = banjinamelist(); - - - $i = 0; - $bfbanji = ''; #前一个班级名 - $bj = ''; #当前班级名 - $students = array(); #存储整理后学生信息 - $bjarr = array(); #储存电子表格中包含的班级 - // 重新计算组合数据,如果存在数据则更新数据 - foreach ($stuinfo as $key => $value) { - // 如果姓名、身份证号为空则跳过 - if(empty($value[1]) || empty($value[2])) - { - continue; - } - // 判断本行班级与上行班级数据是否相等,如果不相等则从数据库查询班级ID - if($bfbanji != $value[3]) - { - // 获取入学年与排序 - $paixu = array_search(substr($value[3],9),$bjlist); - $ruxuenian = array_search(substr($value[3],0,9),$njlist); - // 查询班级ID - $bj = $banji::where('school',$list['school']) - ->where('ruxuenian',$ruxuenian) - ->where('paixu',$paixu) - ->value('id'); - // 如果班级ID为空,删除数据并跳出当前循环 - if( empty($bj) ) - { - continue; - } - array_push($bjarr, $bj); - } - $bfbanji = $value[3]; - - - // 各变量赋值 - $students[strtolower($value[2])] = $bj; - - // 销毁无用变量 - $i++; - } - - // 查询数据库中学生的信息 - // $student = new STU(); - - $stulist = STU::where('banji','in',$bjarr) - ->where('school',$list['school']) - ->field('banji') - ->column('id,shenfenzhenghao,school,banji'); - // 声明要删除学生的ID数组 - $stuidarr = array(); - - // 循环数据库中的学生信息,与电子表格中的信息对比,如果电子表格中不存在,则放数数组中。 - foreach ($stulist as $key => $value) { - if(array_key_exists($value['shenfenzhenghao'],$students)==false){ - array_push($stuidarr, $value['id']); - }else{ - if($value['banji']!=$students[$value['shenfenzhenghao']]) - { - array_push($stuidarr, $value['id']); - } - } - } - // 删除学生信息 - $data = STU::destroy($stuidarr); - - $data ? $data = ['msg'=>'数据同步成功','val'=>1] : ['msg'=>'数据同步失败','val'=>0]; - - return json($data); - } - - - - // 上传文件 - public function upload() - { - // 获取文件信息 - $list['text'] = $this->request->post('text'); - $list['serurl'] = $this->request->post('serurl'); - - // 获取表单上传文件 - $file = request()->file('file'); - // 上传文件并返回结果 - $data = upload($list,$file,true); - - return json($data); - } - - - - // 下载表格模板 - public function download() - { - $download = new \think\response\Download('uploads\student\student_template.xlsx'); - return $download->name('student_template.xlsx'); - } - - - - -} diff --git a/application/renshi/model/Student.php b/application/renshi/model/Student.php deleted file mode 100644 index 9e57c912..00000000 --- a/application/renshi/model/Student.php +++ /dev/null @@ -1,98 +0,0 @@ -belongsTo('\app\teach\model\Banji','banji','id'); - } - - // 学校获取器 - public function stuSchool() - { - return $this->belongsTo('\app\system\model\School','school','id'); - } - - // 年龄获取器 - public function getAgeAttr() - { - if(strlen($this->getData('shengri')) == 0){ - return ''; - }; - return getAgeByBirth($this->getData('shengri'),2); - } - - - // 生日修改器 - public function setShengriAttr($value) - { - return strtotime($value); - } - - // 生日获取器 - public function getShengriAttr($value) - { - return date('Y-m-d',$value); - } - - // 性别获取器 - public function getSexAttr($value) - { - $sex = array('0'=>'女','1'=>'男','2'=>'保密'); - return $sex[$value]; - } - - - // 数据筛选 - public function search($src) - { - // 获取参数 - $school = $src['school']; - $banji = $src['banji']; - $searchval = $src['searchval']; - - - $data = $this - ->order([$src['field'] =>$src['type']]) - ->when(count($school)>0,function($query) use($school){ - $query->where('school','in',$school); - }) - ->when(strlen($searchval)>0,function($query) use($searchval){ - $query->where('xingming','like','%'.$searchval.'%')->field('id'); - }) - ->where('banji','in',$banji) - ->with([ - 'stuSchool'=>function($query){ - $query->field('id,title'); - }, - 'stuBanji'=>function($query){ - $query->field('id,ruxuenian,paixu')->append(['banjiTitle']); - } - ]) - ->field('id,xingming,school,sex,shengri,banji,status') - ->append(['age']) - ->select(); - - return $data; - } - - - // 获取全部数据 - public function searchAll() - { - return $this->select(); - } - - - - - -} diff --git a/application/renshi/model/Teacher.php b/application/renshi/model/Teacher.php deleted file mode 100644 index 57dc1e1c..00000000 --- a/application/renshi/model/Teacher.php +++ /dev/null @@ -1,145 +0,0 @@ -order([$src['field'] =>$src['type']]) - ->when(count($danwei)>0,function($query) use($danwei){ - $query->where('danwei','in',$danwei); - }) - ->when(count($zhiwu)>0,function($query) use($zhiwu){ - $query->where('zhiwu','in',$zhiwu); - }) - ->when(count($xueli)>0,function($query) use($xueli){ - $query->where('xueli','in',$xueli); - }) - ->when(strlen($searchval)>0,function($query) use($searchval){ - $query->where('xingming|quanpin|shoupin','like','%'.$searchval.'%'); - }) - ->with( - [ - 'jsDanwei'=>function($query){ - $query->field('id,jiancheng'); - }, - 'jsZhiwu'=>function($query){ - $query->field('id,title'); - }, - 'jsZhicheng'=>function($query){ - $query->field('id,title'); - }, - 'jsXueli'=>function($query){ - $query->field('id,title'); - }, - 'jsSubject'=>function($query){ - $query->field('id,title'); - }, - ] - ) - ->append(['age','gongling']) - ->select(); - - - return $data; - } - - - // 职务关联模型 - public function jsZhiwu() - { - return $this->belongsTo('\app\system\model\Category','zhiwu','id'); - } - - - // 职称关联模型 - public function jsZhicheng() - { - return $this->belongsTo('\app\system\model\Category','zhicheng','id'); - } - - // 学历关联模型 - public function jsXueli() - { - return $this->belongsTo('\app\system\model\Category','xueli','id'); - } - - // 单位关联模型 - public function jsDanwei() - { - return $this->belongsTo('\app\system\model\School','danwei','id'); - } - - // 学科关联模型 - public function jsSubject() - { - return $this->belongsTo('\app\teach\model\Subject','subject','id'); - } - - - // 生日修改器 - public function setShengriAttr($value) - { - return strtotime($value); - } - - // 生日获取器 - public function getShengriAttr($value) - { - return date('Y-m-d',$value); - } - - // 参加工作时间获取器 - public function getWorktimeAttr($value) - { - return date('Y-m-d',$value); - } - - // 参加工作时间修改器 - public function setWorktimeAttr($value) - { - return strtotime($value); - } - - - // 性别获取器 - public function getSexAttr($value) - { - $sex = array('0'=>'女','1'=>'男','2'=>'未知'); - return $sex[$value]; - } - - - - // 年龄获取器 - public function getAgeAttr() - { - return getAgeByBirth($this->getdata('shengri'),2); - } - - - // 工龄获取器 - public function getGonglingAttr() - { - return getAgeByBirth($this->getdata('worktime'),2); - } - - - - - -} diff --git a/application/renshi/validate/Student.php b/application/renshi/validate/Student.php deleted file mode 100644 index ed6c5440..00000000 --- a/application/renshi/validate/Student.php +++ /dev/null @@ -1,32 +0,0 @@ - ['规则1','规则2'...] - * - * @var array - */ - protected $rule = [ - 'xingming|姓名' => 'require|chs|length:2,8', - 'sex|性别' => 'require|number', - 'shengri|出生日期' => 'date', - 'shenfenzhenghao|身份证号' => "require|idCard", - 'school|学校' => 'require|number', - 'ruxuenian|年级' => 'require|number', - 'banji|班级' => 'require|number' - ]; - - /** - * 定义错误信息 - * 格式:'字段名.规则名' => '错误信息' - * - * @var array - */ - protected $message = []; -} diff --git a/application/renshi/validate/Teacher.php b/application/renshi/validate/Teacher.php deleted file mode 100644 index bfa381b8..00000000 --- a/application/renshi/validate/Teacher.php +++ /dev/null @@ -1,37 +0,0 @@ - ['规则1','规则2'...] - * - * @var array - */ - protected $rule = [ - 'xingming|姓名' => 'require|chs|length:2,8', - 'quanpin|姓名全拼' => 'require|alpha|length:1,30', - 'shoupin|姓名首拼' => 'require|alpha|length:1,5', - 'sex|性别' => 'require|number|max:2', - 'danwei|单位' => 'require|number', - 'shengri|出生日期' => 'date', - 'zhiwu|职务' => 'number', - 'zhicheng|职称' => 'number', - 'xueli|学历' => 'number', - 'biye|毕业院校' => 'length:1,50', - 'zhuanye|专业' => 'length:1,20', - 'worktime|参加工作时间' => 'date', - ]; - - /** - * 定义错误信息 - * 格式:'字段名.规则名' => '错误信息' - * - * @var array - */ - protected $message = []; -} diff --git a/application/renshi/view/index/create.html b/application/renshi/view/index/create.html deleted file mode 100644 index a9580fde..00000000 --- a/application/renshi/view/index/create.html +++ /dev/null @@ -1,193 +0,0 @@ -{extend name="common@create" /} - -{block name="form"} -
-
- -
- -
-
-
-
- -
- -
-
- -
-
-
-
- -
- - -
-
-
- -
- -
-
-
- -
- {php} $schoollist = schlist('校级','区级');{/php} - -
-
-
- -
- {php} $category = getCategory(107);{/php} - -
-
-
- -
- {php} $category = getCategory(106);{/php} - -
-
-
- -
- {php} $category = getCategory(105);{/php} - -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
-
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/renshi/view/index/create_all.html b/application/renshi/view/index/create_all.html deleted file mode 100644 index bb756e30..00000000 --- a/application/renshi/view/index/create_all.html +++ /dev/null @@ -1,78 +0,0 @@ -{extend name="common@create" /} - -{block name="form"} -
- -
-
-
- -
- -
-
-
- -
- {php} $schoollist = schlist('校级','区级');{/php} - -
-
-
- -
-
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/renshi/view/index/index.html b/application/renshi/view/index/index.html deleted file mode 100644 index 621cdbaf..00000000 --- a/application/renshi/view/index/index.html +++ /dev/null @@ -1,161 +0,0 @@ - -{extend name="common@list" /} -{block name="jsset"} - -{/block} -{block name="nav"} - - 师生名单 - 教师管理 - 教师列表 - -{/block} -{block name="search"} -
- -
- -
-
-
- -
- {php} $schoollist = schlist('校级','校级');{/php} - {volist name="schoollist" id="vo"} - - {/volist} -
-
-
- -
- {php} $category = getCategory(107);{/php} - {volist name="category" id="vo"} - - {/volist} -
-
-
- -
- {php} $category = getCategory(105);{/php} - {volist name="category" id="vo"} - - {/volist} -
-
-{/block} -{block name="table"} -
-{/block} -{block name="myjs"} - - - - - - -{/block} \ No newline at end of file diff --git a/application/renshi/view/index/read.html b/application/renshi/view/index/read.html deleted file mode 100644 index 7785c110..00000000 --- a/application/renshi/view/index/read.html +++ /dev/null @@ -1,188 +0,0 @@ - - - - - {php}echo session('webtitle'){/php} - - - - {load href="__STATIC__/xadmin/css/font.css" /} - {load href="__STATIC__/xadmin/css/xadmin.css" /} - {load href="__STATIC__/xadmin/js/jquery.min.js" /} - {load href="__STATIC__/xadmin/lib/layui/layui.js" /} - {load href="__STATIC__/xadmin/js/xadmin.js" /} - {load href="__STATIC__/xadmin/js/cookie.js" /} - {load href="__STATIC__/xadmin/js/md5.min.js" /} - {$list.webtitle} - - -
- -
- 个人信息 -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
姓名{$list.xingming}        {$list.quanpin}        {$list.shoupin}
性别{$list.sex}
出生日期{$list.shengri}        {$list.age}周岁
参加工作时间{$list.worktime}        {$list.gongling}年工龄
职务{$list.js_zhiwu.title}
职称{$list.js_zhicheng.title}
单位{$list.js_danwei.title}
毕业院校{$list.biye}
专业{$list.zhuanye}
学历{$list.js_xueli.title}
-
-
- - -
- 历年获奖情况 -
-
-
-
-
- 历年参与课题情况 -
-
-
-
-
- - - \ No newline at end of file diff --git a/application/renshi/view/student/create.html b/application/renshi/view/student/create.html deleted file mode 100644 index 841b73f7..00000000 --- a/application/renshi/view/student/create.html +++ /dev/null @@ -1,220 +0,0 @@ -{extend name="common@create" /} - -{block name="form"} -
-
- -
- -
-
-
- -
- -
-
-
- -
- - -
-
-
- -
- -
-
-
- -
- {php} $schoollist = schlist('校级','校级');{/php} - -
-
-
- -
- {php} $njlist = nianjiList();{/php} - -
-
-
- -
- {php} - if(isset($list['data'])){ - // 获取参数 - $rxn = $list['data']['stu_banji']['ruxuenian']; - $sch = $list['data']['school']; - // 获取班级列表 - $banji = new \app\teach\model\Banji; - $banjilist = $banji - ->where('ruxuenian',$rxn) - ->where('school',$sch) - ->field('id,paixu,ruxuenian') - ->append(['banTitle']) - ->select(); - }else{ - $banjilist=array(); - } - {/php} - -
-
-
- -
-
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/renshi/view/student/create_all.html b/application/renshi/view/student/create_all.html deleted file mode 100644 index 82d654b5..00000000 --- a/application/renshi/view/student/create_all.html +++ /dev/null @@ -1,78 +0,0 @@ -{extend name="common@create" /} - -{block name="form"} -
- -
-
-
- -
- -
-
-
- -
- {php} $schoollist = schlist('校级','校级');{/php} - -
-
-
- -
-
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/renshi/view/student/index.html b/application/renshi/view/student/index.html deleted file mode 100644 index 5e7b07a1..00000000 --- a/application/renshi/view/student/index.html +++ /dev/null @@ -1,165 +0,0 @@ - -{extend name="common@list" /} -{block name="jsset"} - -{/block} -{block name="nav"} - - 师生名单 - 学生管理 - 学生列表 - -{/block} -{block name="search"} -
- -
- -
-
-
- -
- {php} $schoollist = schlist('校级','校级');{/php} - {volist name="schoollist" id="vo"} - - {/volist} -
-
-
- -
- {php} $njlist = nianjiList();{/php} - {foreach $njlist as $key=>$vo} - - {/foreach} -
-
-
- -
- {php} - $banji = new \app\teach\model\Banji; - $ruxuenian = array_keys($njlist); - $paixu = $banji->where('status',1) - ->where('ruxuenian','in',$ruxuenian) - ->max('paixu'); - $bjlist = banjinamelist(); - {/php} - {for start="1" end="$paixu+1" } - - {/for} -
-
-{/block} -{block name="table"} -
-{/block} -{block name="myjs"} - - - - - - -{/block} \ No newline at end of file diff --git a/application/rongyu/common.php b/application/rongyu/common.php deleted file mode 100644 index 3e582f69..00000000 --- a/application/rongyu/common.php +++ /dev/null @@ -1,7 +0,0 @@ -assign('list',$list); - - // 渲染模板 - return $this->fetch(); - } - - /** - * 显示单位荣誉列表 - * - * @return \think\Response - */ - public function ajaxData() - { - // 获取参数 - $src = $this->request - ->only([ - 'page'=>'1', - 'limit'=>'10', - 'field'=>'update_time', - 'type'=>'desc', - 'fzschool'=>array(), - 'hjschool'=>array(), - 'category'=>array(), - 'searchval'=>'' - ],'POST'); - - - // 实例化 - $dwry = new dwry; - - // 查询要显示的数据 - $data = $dwry->search($src); - // 获取符合条件记录总数 - $cnt = $data->count(); - // 获取当前页数据 - $limit_start = $src['page'] * $src['limit'] - $src['limit']; - $limit_length = $src['limit']; - $data = $data->slice($limit_start,$limit_length); - - // 重组返回内容 - $data = [ - 'code'=> 0 , // ajax请求次数,作为标识符 - 'msg'=>"", // 获取到的结果数(每页显示数量) - 'count'=>$cnt, // 符合条件的总数据量 - 'data'=>$data, //获取到的数据结果 - ]; - - - return json($data); - } - - /** - * 显示创建资源表单页. - * - * @return \think\Response - */ - public function create() - { - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'添加单位荣誉', - 'butname'=>'添加', - 'formpost'=>'POST', - 'url'=>'/dwry', - ); - - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - } - - /** - * 保存新建的资源 - * - * @param \think\Request $request - * @return \think\Response - */ - public function save() - { - // 获取表单数据 - $list = request()->only(['url','project','title','teachers'=>array(),'hjschool','category','fzshijian','fzschool','jiangxiang'],'post'); - - // 实例化验证模型 - $validate = new \app\rongyu\validate\DwRongyu; - // 验证表单数据 - $result = $validate->scene('add')->check($list); - $msg = $validate->getError(); - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]); - } - - // 保存数据 - $data = dwry::create($list); - - - // 重组教师id - $teachers = array(); - foreach ($list['teachers'] as $key => $value) { - $teachers[]['teacherid'] = $value; - } - - - $data->cyDwry()->saveAll($teachers); - - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - /** - * 批量上传单位荣誉图片 - * - * @param \think\Request $request - * @return \think\Response - */ - // 批量添加 - public function createAll() - { - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'批量上传荣誉图片', - 'butname'=>'批传', - 'formpost'=>'POST', - 'url'=>'/dwry/createall', - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch(); - } - - // 保存批传 - public function saveall() - { - // 获取文件信息 - $list['text'] = $this->request->post('text'); - $list['serurl'] = $this->request->post('serurl'); - - // 获取表单上传文件 - $file = request()->file('file'); - // 上传文件并返回结果 - $data = upload($list,$file); - - if($data['val'] != 1) - { - $data=['msg'=>'添加失败','val'=>0]; - } - - $data = dwry::create([ - 'url'=>$data['url'] - ,'title'=>'批传单位荣誉图片' - ]); - - $data ? $data=['msg'=>'批传成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - return json($data); - } - - /** - * 上传荣誉图片并保存 - * - * @param \think\Request $request - * @return \think\Response - */ - public function upload() - { - - // 获取文件信息 - $list['text'] = $this->request->post('text'); - $list['serurl'] = $this->request->post('serurl'); - - // 获取表单上传文件 - $file = request()->file('file'); - // 上传文件并返回结果 - $data = upload($list,$file); - - return json($data); - } - - /** - * 显示指定的资源 - * - * @param int $id - * @return \think\Response - */ - public function read($id) - { - // - } - - /** - * 显示编辑资源表单页. - * - * @param int $id - * @return \think\Response - */ - public function edit($id) - { - // 获取学生信息 - $list['data'] = dwry::where('id',$id) - ->field('id,title,project,category,hjschool,fzshijian,fzschool,jiangxiang,url') - ->with([ - 'cyDwry'=>function($query){ - $query->field('rongyuid,teacherid') - ->with(['teacher'=>function($query){ - $query->field('id,xingming'); - }]); - }, - ]) - ->find(); - - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'编辑单位荣誉', - 'butname'=>'修改', - 'formpost'=>'PUT', - 'url'=>'/dwry/'.$id, - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - - } - - /** - * 保存更新的资源 - * - * @param \think\Request $request - * @param int $id - * @return \think\Response - */ - public function update($id) - { - // 获取表单数据 - $list = request()->only(['title','project','category','hjschool','fzshijian','fzschool','jiangxiang','teachers'=>array(),'url'],'put'); - $list['id'] = $id; - - - // 实例化验证类 - $validate = new \app\rongyu\validate\DwRongyu; - // 验证表单数据 - $result = $validate->scene('edit')->check($list); - $msg = $validate->getError(); - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]);; - } - - - // 更新数据 - $dwry = new dwry(); - $data = dwry::update($list); - - // 删除原来的参与教师 - $data->cyDwry()->where('rongyuid',$id)->delete(true); - - // 声明参与教师数组 - $canyulist = []; - // 循环组成参与教师 - foreach ($list['teachers'] as $key => $value) { - $canyulist[] = [ - 'teacherid' => $value, - ]; - } - // 更新参考教师 - $data->cyDwry()->saveAll($canyulist); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - /** - * 删除指定资源 - * - * @param int $id - * @return \think\Response - */ - public function delete($id) - { - - if($id == 'm') - { - $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 - } - - $data = dwry::destroy($id); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - // 设置荣誉状态 - public function setStatus() - { - - // 获取id变量 - $id = request()->post('id'); - $value = request()->post('value'); - - // 获取学生信息 - $data = dwry::where('id',$id)->update(['status'=>$value]); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - -} diff --git a/application/rongyu/controller/Error.php b/application/rongyu/controller/Error.php deleted file mode 100644 index 9d798a66..00000000 --- a/application/rongyu/controller/Error.php +++ /dev/null @@ -1,11 +0,0 @@ -assign('list',$list); - - // 渲染模板 - return $this->fetch(); - } - - /** - * 显示教师荣誉册列表 - * - * @return \think\Response - */ - public function ajaxData() - { - // 获取参数 - $src = $this->request - ->only([ - 'page'=>'1', - 'limit'=>'10', - 'field'=>'update_time', - 'type'=>'desc', - 'fzschool'=>array(), - 'hjschool'=>array(), - 'category'=>array(), - 'searchval'=>'' - ],'POST'); - - - // 实例化 - $jsry = new jsry; - - // 查询要显示的数据 - $data = $jsry->search($src); - // 获取符合条件记录总数 - $cnt = $data->count(); - // 获取当前页数据 - $limit_start = $src['page'] * $src['limit'] - $src['limit']; - $limit_length = $src['limit']; - $data = $data->slice($limit_start,$limit_length); - - // 重组返回内容 - $data = [ - 'code'=> 0 , // ajax请求次数,作为标识符 - 'msg'=>"", // 获取到的结果数(每页显示数量) - 'count'=>$cnt, // 符合条件的总数据量 - 'data'=>$data, //获取到的数据结果 - ]; - - - return json($data); - } - - /** - * 显示创建资源表单页. - * - * @return \think\Response - */ - public function create() - { - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'添加荣誉册', - 'butname'=>'添加', - 'formpost'=>'POST', - 'url'=>'/jsry', - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - } - - /** - * 保存新建的资源 - * - * @param \think\Request $request - * @return \think\Response - */ - public function save() - { - // 获取表单数据 - $list = request()->only(['title','category','fzshijian','fzschool'],'post'); - - // 实例化验证模型 - $validate = new \app\rongyu\validate\JsRongyu; - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]); - } - - // 保存数据 - $data = jsry::create($list); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - /** - * 显示指定的资源 - * - * @param int $id - * @return \think\Response - */ - public function read($id) - { - - } - - /** - * 显示编辑资源表单页. - * - * @param int $id - * @return \think\Response - */ - public function edit($id) - { - // 获取荣誉册信息 - $list['data'] = jsry::where('id',$id) - ->field('id,title,category,fzshijian,fzschool') - ->find(); - - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'编辑荣誉册', - 'butname'=>'修改', - 'formpost'=>'PUT', - 'url'=>'/jsry/'.$id, - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - } - - /** - * 保存更新的资源 - * - * @param \think\Request $request - * @param int $id - * @return \think\Response - */ - public function update($id) - { - // 获取表单数据 - $list = request()->only(['title','category','fzshijian','fzschool'],'put'); - $list['id'] = $id; - - - // 实例化验证类 - $validate = new \app\rongyu\validate\JsRongyu; - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]);; - } - - - // 更新数据 - $data = jsry::update($list); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - /** - * 删除指定资源 - * - * @param int $id - * @return \think\Response - */ - public function delete($id) - { - - if($id == 'm') - { - $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 - } - - $data = jsry::destroy($id); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - // 设置荣誉状态 - public function setStatus() - { - - // 获取id变量 - $id = request()->post('id'); - $value = request()->post('value'); - - // 获取学生信息 - $data = jsry::where('id',$id)->update(['status'=>$value]); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } -} diff --git a/application/rongyu/controller/JsRongyuInfo.php b/application/rongyu/controller/JsRongyuInfo.php deleted file mode 100644 index 0efff6c1..00000000 --- a/application/rongyu/controller/JsRongyuInfo.php +++ /dev/null @@ -1,586 +0,0 @@ -assign('list',$list); - - // 渲染模板 - return $this->fetch(); - } - -/** - *荣誉册中荣誉信息列表 - * - * @return \think\Response - */ - public function rongyuList($rongyuce) - { - // 荣誉数据模型 - $ry = new \app\rongyu\model\JsRongyu; - // 设置要给模板赋值的信息 - $list['webtitle'] = $ry->where('id',$rongyuce)->value('title') . ' 荣誉'; - $list['rongyuce'] = $rongyuce; - - // 模板赋值 - $this->assign('list',$list); - - // 渲染模板 - return $this->fetch(); - } - - - /** - * 显示教师荣誉册列表 - * - * @return \think\Response - */ - public function ajaxData() - { - - // 获取参数 - $src = $this->request - ->only([ - 'page'=>'1', - 'limit'=>'10', - 'field'=>'update_time', - 'type'=>'desc', - 'fzschool'=>array(), - 'hjschool'=>array(), - 'category'=>array(), - 'rongyuce'=>'', - 'subject'=>array(), - 'searchval'=>'' - ],'POST'); - - - // 实例化 - $ryinfo = new ryinfo; - - // 查询要显示的数据 - $data = $ryinfo->search($src); - // 获取符合条件记录总数 - $cnt = $data->count(); - // 获取当前页数据 - $limit_start = $src['page'] * $src['limit'] - $src['limit']; - $limit_length = $src['limit']; - $data = $data->slice($limit_start,$limit_length); - - // 重组返回内容 - $data = [ - 'code'=> 0 , // ajax请求次数,作为标识符 - 'msg'=>"", // 获取到的结果数(每页显示数量) - 'count'=>$cnt, // 符合条件的总数据量 - 'data'=>$data, //获取到的数据结果 - ]; - - - return json($data); - } - - /** - * 显示创建资源表单页. - * - * @return \think\Response - */ - public function create($rongyuce = 0) - { - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'添加荣誉', - 'butname'=>'添加', - 'formpost'=>'POST', - 'url'=>'/jsryinfo', - 'rongyuce'=>$rongyuce - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - } - - /**留备用 - * 保存新建的资源 - * - * @param \think\Request $request - * @return \think\Response - */ - public function save() - { - - // 获取表单数据 - $list = request()->only(['rongyuce','title','bianhao','category','hjschool','subject','hjshijian','jiangxiang','hjteachers','cyteachers','pic'],'put'); - - // 判断获奖时间是否为空,如果为空,则使用荣誉册时间 - if($list['hjshijian'] == "") - { - $ryce = new \app\rongyu\model\JsRongyu; - $ryceinfo = $ryce::where('id',$list['rongyuce']) - ->field('id,fzshijian') - ->find(); - $list['hjshijian'] = $ryceinfo->fzshijian; - } - - // 实例化验证类 - $validate = new \app\rongyu\validate\JsRongyuInfo; - // 验证表单数据 - $result = $validate->scene('add')->check($list); - $msg = $validate->getError(); - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]); - } - - - // 更新数据 - $data = ryinfo::create($list); - - // 声明教师数组 - $teacherlist = []; - // 循环组成获奖教师信息 - foreach ($list['hjteachers'] as $key => $value) { - $canyulist[] = [ - 'teacherid' => $value, - 'category' => 1, - ]; - } - if(!empty($list['cyteachers'])){ - // 循环组成参与教师信息 - foreach ($list['cyteachers'] as $key => $value) { - $canyulist[] = [ - 'teacherid' => $value, - 'category' => 2, - ]; - } - } - - - // 添加新的获奖人与参与人信息 - $data->allJsry()->saveAll($canyulist); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - /** - * 批量上传教师荣誉册图片 - * - * @param \think\Request $request - * @return \think\Response - */ - public function createAll($rongyuce) - { - - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'批量上传教师荣誉册图片', - 'butname'=>'批传', - 'formpost'=>'POST', - 'url'=>'/jsryinfoaddall/'.$rongyuce, - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch(); - } - - // 保存批传 - public function saveall($rongyuce) - { - // 获取文件信息 - $list['text'] = $this->request->post('text'); - $list['serurl'] = $this->request->post('serurl'); - - // 获取表单上传文件 - $file = request()->file('file'); - // 上传文件并返回结果 - $data = upload($list,$file); - - if($data['val'] != 1) - { - $data=['msg'=>'添加失败','val'=>0]; - } - - $data = ryinfo::create([ - 'pic'=>$data['url'] - ,'title'=>'批传教师荣誉' - ,'rongyuce'=>$rongyuce - ]); - - $data ? $data=['msg'=>'批传成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - return json($data); - } - - - - /** - * 上传荣誉图片并保存 - * - * @param \think\Request $request - * @return \think\Response - */ - public function upload() - { - // 获取文件信息 - $list['text'] = $this->request->post('text'); - $list['serurl'] = $this->request->post('serurl'); - - // 获取表单上传文件 - $file = request()->file('file'); - // 上传文件并返回结果 - $data = upload($list,$file); - - return json($data); - } - - /** - * 荣誉册中荣誉信息列表 - * - * @param int $id - * @return \think\Response - */ - public function read($id) - { - - } - - /** - * 显示编辑资源表单页. - * - * @param int $id - * @return \think\Response - */ - public function edit($id) - { - // 获取荣誉信息 - $list['data'] = ryinfo::where('id',$id) - ->field('id,rongyuce,title,bianhao,hjschool,subject,jiangxiang,hjshijian,pic') - ->with([ - 'hjJsry'=>function($query){ - $query->field('rongyuid,teacherid') - ->with(['teacher'=>function($query){ - $query->field('id,xingming'); - }]); - }, - 'cyJsry'=>function($query){ - $query->field('rongyuid,teacherid') - ->with(['teacher'=>function($query){ - $query->field('id,xingming'); - }]); - }, - 'ryTuce'=>function($query){ - $query->field('id,fzshijian'); - } - ]) - ->find(); - - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'编辑荣誉', - 'butname'=>'修改', - 'formpost'=>'PUT', - 'url'=>'/jsryinfo/'.$id, - 'rongyuce'=>$id - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - } - - /** - * 保存更新的资源 - * - * @param \think\Request $request - * @param int $id - * @return \think\Response - */ - public function update($id) - { - // 获取表单数据 - $list = request()->only(['bianhao','title','category','hjschool','subject','hjshijian','jiangxiang','hjteachers','cyteachers','pic'],'put'); - $list['id'] = $id; - // 判断获奖时间是否为空,如果为空,则使用荣誉册时间 - if($list['hjshijian'] == "") - { - $ryinfo = ryinfo::where('id',$id) - ->field('id,rongyuce') - ->with([ - 'ryTuce'=>function($query){ - $query->field('id,fzshijian'); - } - ]) - ->find(); - $list['hjshijian'] = $ryinfo->ry_tuce->fzshijian; - } - - - // 实例化验证类 - $validate = new \app\rongyu\validate\JsRongyuInfo; - // 验证表单数据 - $result = $validate->scene('edit')->check($list); - $msg = $validate->getError(); - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]); - } - - - // 更新数据 - $data = ryinfo::update($list); - - // 删除原来的获奖人与参与人信息 - $data->allJsry()->where('rongyuid',$id)->delete(true); - // 声明教师数组 - $teacherlist = []; - // 循环组成获奖教师信息 - foreach ($list['hjteachers'] as $key => $value) { - $canyulist[] = [ - 'teacherid' => $value, - 'category' => 1, - ]; - } - if(!empty($list['cyteachers'])){ - // 循环组成参与教师信息 - foreach ($list['cyteachers'] as $key => $value) { - $canyulist[] = [ - 'teacherid' => $value, - 'category' => 2, - ]; - } - } - - - // 添加新的获奖人与参与人信息 - $data->allJsry()->saveAll($canyulist); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - /** - * 删除指定资源 - * - * @param int $id - * @return \think\Response - */ - public function delete($id) - { - - if($id == 'm') - { - $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 - } - - $data = ryinfo::destroy($id); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - // 设置荣誉状态 - public function setStatus() - { - - // 获取id变量 - $id = request()->post('id'); - $value = request()->post('value'); - - // 获取学生信息 - $data = ryinfo::where('id',$id)->update(['status'=>$value]); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - // 下载荣誉信息 - public function outXlsx($rongyuce) - { - - $ryinfo = new ryinfo(); - $list = $ryinfo->srcTuceRy($rongyuce); - - // halt($list); - - if($list->isEmpty()) - { - $this->error('兄弟,没有要下载的信息呀~'); - return ''; - }else{ - $filename = $list[0]['ryTuce']['title']; - $fzschool = $list[0]['ryTuce']['fz_school']['title']; - $fzshijian = strtotime($list[0]['ryTuce']['fzshijian']); - $fzshijian = date('Ym',$fzshijian); - } - - //通过工厂模式创建内容 - $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load("uploads/rongyu_teacher/js_rongyu.xlsx"); - $worksheet = $spreadsheet->getActiveSheet(); - - $worksheet->getCell('A1')->setValue($filename); - $worksheet->getCell('A2')->setValue('发证单位:'.$fzschool); - $worksheet->getCell('G2')->setValue('发证时间:'.$list[0]['ryTuce']['fzshijian']); - // 循环为excel每行赋值 - foreach ($list as $key => $value) { - $myrowid = $key + 4; - $worksheet->getCell('A'.$myrowid)->setValue($key+1); - $worksheet->getCell('B'.$myrowid)->setValue($value->title); - $worksheet->getCell('C'.$myrowid)->setValue($value->hjJsName); - if($value->hj_school){ - $worksheet->getCell('D'.$myrowid)->setValue($value->hj_school->jiancheng); - } - if($value->ry_subject){ - $worksheet->getCell('E'.$myrowid)->setValue($value->ry_subject->title); - } - $worksheet->getCell('F'.$myrowid)->setValue($value->cyJsName); - if($value->jx_category){ - $worksheet->getCell('G'.$myrowid)->setValue($value->jx_category->title); - } - $worksheet->getCell('H'.$myrowid)->setValue($value->bianhao); - } - - // 给单元格加边框 - $styleArray = [ - 'borders' => [ - 'allBorders' => [ - 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN, - 'color' => ['argb' => '00000000'], - ], - ], - ]; - - if($key+4>9) - { - - $worksheet->getStyle('A10:I'.($key+4))->applyFromArray($styleArray); - // 设置行高 - for($i = 10; $i<=($key+4); $i++){ - $worksheet->getRowDimension($i)->setRowHeight(30); - } - - } - - $worksheet->getStyle('A4')->applyFromArray($styleArray); - - - //告诉浏览器输出07Excel文件 - header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); - //告诉浏览器输出浏览器名称 - header('Content-Disposition: attachment;filename="'. $filename .$fzshijian.'.xlsx"'); - //禁止缓存 - header('Cache-Control: max-age=0'); - $writer = new Xlsx($spreadsheet); - $writer->save('php://output'); - // ob_end_clean(); - // ob_start(); - // 释放内存 - $spreadsheet->disconnectWorksheets(); - unset($spreadsheet); - - // return '下载后请关闭窗口'; - } - - - // 搜索教师荣誉 - public function ryTeacher($id) - { - // 获取DT的传值 - $getdt = request()->param(); - - //得到排序的方式 - $order = $getdt['order'][0]['dir']; - //得到排序字段的下标 - $order_column = $getdt['order'][0]['column']; - //根据排序字段的下标得到排序字段 - $order_field = $getdt['columns'][$order_column]['name']; - if($order_field=='') - { - $order_field = $getdt['columns'][$order_column]['data']; - } - //得到limit参数 - $limit_start = $getdt['start']; - $limit_length = $getdt['length']; - - //得到搜索的关键词 - $search = [ - 'teacherid'=>$id, - 'order'=>$order, - 'order_field'=>$order_field - ]; - - - // 实例化 - $ryinfo = new ryinfo; - - // 获取荣誉总数 - $cnt = $ryinfo->select()->count(); - - // 查询数据 - $data = $ryinfo->srcTeacher($search); - $datacnt = $data->count(); - - // 获取当前页数据 - $data = $data->slice($limit_start,$limit_length); - - - // 重组返回内容 - $data = [ - 'draw'=> $getdt["draw"] , // ajax请求次数,作为标识符 - 'recordsTotal'=>$cnt, // 获取到的结果数(每页显示数量) - 'recordsFiltered'=>$datacnt, // 符合条件的总数据量 - 'data'=>$data, //获取到的数据结果 - ]; - - return json($data); - } - - - - - -} diff --git a/application/rongyu/model/DwRongyu.php b/application/rongyu/model/DwRongyu.php deleted file mode 100644 index e6dc5074..00000000 --- a/application/rongyu/model/DwRongyu.php +++ /dev/null @@ -1,113 +0,0 @@ -order([$src['field'] =>$src['type']]) - ->when(count($hjschool)>0,function($query) use($hjschool){ - $query->where('hjschool','in',$hjschool); - }) - ->when(count($fzschool)>0,function($query) use($fzschool){ - $query->where('fzschool','in',$fzschool); - }) - ->when(count($category)>0,function($query) use($category){ - $query->where('category','in',$category); - }) - ->when(strlen($searchval)>0,function($query) use($searchval){ - $query->where('title|jiancheng','like','%'.$searchval.'%'); - }) - ->with( - [ - 'hjSchool'=>function($query){ - $query->field('id,jiancheng'); - }, - 'fzSchool'=>function($query){ - $query->field('id,jiancheng,jibie') - ->with([ - 'dwJibie'=>function($query){ - $query->field('id,title'); - }, - ]); - }, - 'lxCategory'=>function($query){ - $query->field('id,title'); - }, - 'jxCategory'=>function($query){ - $query->field('id,title'); - } - ] - ) - ->select(); - return $data; - } - - - // 获奖单位关联 - public function hjSchool() - { - return $this->belongsTo('\app\system\model\School','hjschool','id'); - } - - // 颁奖单位关联 - public function fzSchool() - { - return $this->belongsTo('\app\system\model\School','fzschool','id'); - } - - // 荣誉类型 - public function lxCategory() - { - return $this->belongsTo('\app\system\model\Category','category','id'); - } - - // 奖项 - public function jxCategory() - { - return $this->belongsTo('\app\system\model\Category','jiangxiang','id'); - } - - // 参与人 - public function cyDwry() - { - return $this->hasMany('\app\rongyu\model\DwRongyuCanyu','rongyuid','id'); - } - - - // 发证时间修改器 - public function setFzshijianAttr($value) - { - return strtotime($value); - } - - // 发证时间获取器 - public function getFzshijianAttr($value) - { - // 判断发证时间是否为空 - if ($value>0) - { - $value = date('Y-m-d',$value); - }else{ - $value = ""; - } - - // 返回发证时间 - return $value; - } - -} diff --git a/application/rongyu/model/DwRongyuCanyu.php b/application/rongyu/model/DwRongyuCanyu.php deleted file mode 100644 index ff66ffd1..00000000 --- a/application/rongyu/model/DwRongyuCanyu.php +++ /dev/null @@ -1,25 +0,0 @@ -belongsTo('\app\rongyu\model\DwRongyu','rongyuid','id'); - } - - // 教师关联 - public function teacher() - { - return $this->belongsTo('\app\renshi\model\Teacher','teacherid','id'); - } - -} diff --git a/application/rongyu/model/JsRongyu.php b/application/rongyu/model/JsRongyu.php deleted file mode 100644 index 1ee185c4..00000000 --- a/application/rongyu/model/JsRongyu.php +++ /dev/null @@ -1,99 +0,0 @@ -order([$src['field'] =>$src['type']]) - ->when(count($fzschool)>0,function($query) use($fzschool){ - $query->where('fzschool','in',$fzschool); - }) - ->when(count($category)>0,function($query) use($category){ - $query->where('category','in',$category); - }) - ->when(strlen($searchval)>0,function($query) use($searchval){ - $query->where('title','like','%'.$searchval.'%'); - }) - ->with( - [ - 'fzSchool'=>function($query){ - $query->field('id,jiancheng,jibie') - ->with(['dwJibie'=>function($q){ - $q->field('id,title'); - }]); - }, - 'lxCategory'=>function($query){ - $query->field('id,title'); - }, - - ] - ) - ->withCount(['ryInfo'=>'count']) - ->select(); - - - return $data; - } - - - // 颁奖单位关联 - public function fzSchool() - { - return $this->belongsTo('\app\system\model\School','fzschool','id'); - } - - // 荣誉类型关联 - public function lxCategory() - { - return $this->belongsTo('\app\system\model\Category','category','id'); - } - - - // 荣誉信息关联 - public function ryInfo() - { - return $this->hasMany('JsRongyuInfo','rongyuce','id'); - } - - - // 荣誉级别 - public function getCntAttr() - { - return $this->ryInfo->count(); - } - - - // 发证时间修改器 - public function setFzshijianAttr($value) - { - return strtotime($value); - } - - // 发证时间获取器 - public function getFzshijianAttr($value) - { - if ($value>0) - { - $value = date('Y-m-d',$value); - }else{ - $value = ""; - } - return $value; - } - - - -} diff --git a/application/rongyu/model/JsRongyuCanyu.php b/application/rongyu/model/JsRongyuCanyu.php deleted file mode 100644 index b7a90777..00000000 --- a/application/rongyu/model/JsRongyuCanyu.php +++ /dev/null @@ -1,22 +0,0 @@ -belongsTo('\app\rongyu\model\JsRongyu','rongyuid','id'); - } - - // 教师关联 - public function teacher() - { - return $this->belongsTo('\app\renshi\model\Teacher','teacherid','id'); - } -} diff --git a/application/rongyu/model/JsRongyuInfo.php b/application/rongyu/model/JsRongyuInfo.php deleted file mode 100644 index 7d3d4978..00000000 --- a/application/rongyu/model/JsRongyuInfo.php +++ /dev/null @@ -1,299 +0,0 @@ -order([$src['field'] =>$src['type']]) - ->when(count($hjschool)>0,function($query) use($hjschool){ - $query->where('hjschool','in',$hjschool); - }) - ->when(count($fzschool)>0,function($query) use($fzschool){ - $query->where('rongyuce','in',function($q) use($fzschool){ - $q->name('JsRongyu')->where('fzschool','in',$fzschool)->field('id'); - }); - - }) - ->when(count($category)>0,function($query) use($category){ - $query->where('rongyuce','in',function($q) use($category){ - $q->name('JsRongyu')->where('category','in',$category)->field('id'); - }); - }) - ->when(count($subject)>0,function($query) use($subject){ - $query->where('rongyuce','in',function($q) use($subject){ - $q->name('JsRongyu')->where('subject','in',$subject)->field('id'); - }); - }) - ->when(strlen($rongyuce)>0,function($query) use($rongyuce){ - $query->where('rongyuce',$rongyuce); - }) - ->when(strlen($searchval)>0,function($query) use($searchval){ - $query->where(function($z) use($searchval){ - $z->whereOr('title|bianhao','like','%'.$searchval.'%') - ->whereOr('id','in',function($q) use($searchval){ - $q->name('JsRongyuCanyu') - ->distinct(true) - ->where('teacherid','in',function($w) use($searchval){ - $w->name('Teacher') - ->where('xingming','like','%'.$searchval.'%') - ->field('id'); - }) - ->field('rongyuid'); - }); - }); - }) - ->with( - [ - 'hjSchool'=>function($query){ - $query->field('id,jiancheng'); - }, - 'rySubject'=>function($query){ - $query->field('id,title'); - }, - 'jxCategory'=>function($query){ - $query->field('id,title'); - }, - 'ryTuce'=>function($query){ - $query->field('id,title,fzschool') - ->with([ - 'fzSchool'=>function($q){ - $q->field('id,title'); - } - ]); - }, - 'hjJsry'=>function($query){ - $query->field('rongyuid,teacherid') - ->with(['teacher'=>function($query){ - $query->field('id,xingming'); - }]); - }, - 'cyJsry'=>function($query){ - $query->field('rongyuid,teacherid') - ->with(['teacher'=>function($query){ - $query->field('id,xingming'); - }]); - }, - ] - ) - // ->append(['hjJsName','cyJsName']) - ->select(); - - - return $data; - } - - - // 获取需要下载的荣誉信息 - public function srcTuceRy($id) - { - // 查询数据 - $data =$this->where('rongyuce',$id) - ->field('id,rongyuce,title,bianhao,hjschool,subject,jiangxiang,hjshijian,pic') - ->with([ - 'hjJsry'=>function($query){ - $query->field('rongyuid,teacherid') - ->with(['teacher'=>function($query){ - $query->field('id,xingming'); - }]); - }, - 'cyJsry'=>function($query){ - $query->field('rongyuid,teacherid') - ->with(['teacher'=>function($query){ - $query->field('id,xingming'); - }]); - }, - 'ryTuce'=>function($query){ - $query->field('id,title,fzshijian,fzschool') - ->with(['fzSchool'=>function($q){ - $q->field('id,title'); - }]); - }, - 'rySubject'=>function($query){ - $query->field('id,title'); - }, - 'hjSchool'=>function($query){ - $query->field('id,jiancheng'); - }, - 'jxCategory'=>function($query){ - $query->field('id,title'); - } - ]) - ->order(['hjschool']) - ->append(['hjJsName','cyJsName']) - ->select(); - - return $data; - } - - - //搜索单位获奖荣誉 - public function srcTeacher($search) - { - // 获取参数 - $teacherid = $search['teacherid']; - $order_field = $search['order_field']; - $order = $search['order']; - - $data = $this->order([$order_field =>$order]) - ->where('id','in',function($query) use($teacherid){ - $query->name('JsRongyuCanyu') - ->where('category',1) - ->where('teacherid',$teacherid) - ->field('rongyuid'); - }) - ->where('status',1) - ->with( - [ - 'hjSchool'=>function($query){ - $query->field('id,jiancheng'); - }, - 'rySubject'=>function($query){ - $query->field('id,title'); - }, - 'jxCategory'=>function($query){ - $query->field('id,title'); - }, - 'ryTuce'=>function($query){ - $query->field('id,title') - ->with([ - 'fzSchool'=>function($query){ - $query->field('id,title,jibie') - ->with(['']); - } - ]); - }, - 'hjJsry'=>function($query){ - $query->field('rongyuid,teacherid') - ->with(['teacher'=>function($query){ - $query->field('id,xingming'); - }]); - }, - ] - ) - ->append(['hjJsName','cyJsName']) - ->select(); - - - return $data; - } - - - // 荣誉图册关联 - public function ryTuce() - { - return $this->belongsTo('\app\rongyu\model\JsRongyu','rongyuce','id'); - } - - - // 获奖单位关联 - public function hjSchool() - { - return $this->belongsTo('\app\system\model\School','hjschool','id'); - } - - // 颁奖单位关联 - public function fzSchool() - { - return $this->belongsTo('\app\system\model\School','fzschool','id'); - } - - // 荣誉所属学科 - public function rySubject() - { - return $this->belongsTo('\app\teach\model\Subject','subject','id'); - } - - // 奖项关联 - public function jxCategory() - { - return $this->belongsTo('\app\system\model\Category','jiangxiang','id'); - } - - // 获奖人信息关联 - public function hjJsry() - { - return $this->hasMany('\app\rongyu\model\JsRongyuCanyu','rongyuid','id')->where('category',1); - } - - - // 获奖人与参与教师关联 - public function allJsry() - { - return $this->hasMany('\app\rongyu\model\JsRongyuCanyu','rongyuid','id'); - } - - - // 参与人关联 - public function cyJsry() - { - return $this->hasMany('\app\rongyu\model\JsRongyuCanyu','rongyuid','id')->where('category',2); - } - - - // 荣誉级别 - public function getJibieAttr() - { - $jibie = ''; - - if($this->fzschool){ - $jibie = $this->fzSchool->jibie; - } - - return $jibie; - } - - - // 发证时间修改器 - public function setHjshijianAttr($value) - { - return strtotime($value); - } - - // 发证时间获取器 - public function getHjshijianAttr($value) - { - if ($value>0) - { - $value = date('Y-m-d',$value); - }else{ - $value = ""; - } - return $value; - } - - // 获奖教师名整理 - public function getHjJsNameAttr($value) - { - $teacherList = $this->getAttr('hjJsry'); - $teachNames = teacherNames($teacherList); - - return $teachNames; - - } - - // 获奖教师名整理 - public function getCyJsNameAttr($value) - { - $teacherList = $this->getAttr('cyJsry'); - $teachNames = teacherNames($teacherList); - - return $teachNames; - - } -} diff --git a/application/rongyu/validate/DwRongyu.php b/application/rongyu/validate/DwRongyu.php deleted file mode 100644 index 37726887..00000000 --- a/application/rongyu/validate/DwRongyu.php +++ /dev/null @@ -1,41 +0,0 @@ - ['规则1','规则2'...] - * - * @var array - */ - protected $rule = [ - // 'url|请先上传荣誉图片' => 'require', - 'id|请先上传荣誉图片' => 'require', - 'title|荣誉标题' => 'length:1,50', - 'category|荣誉类型' => 'require|number', - 'hjschool|获奖单位' => 'require|number', - 'fzshijian|发证时间' => 'require|date', - 'fzschool|发证单位' => 'require|number', - 'jiangxiang|奖项' => 'require|number', - 'teachers|参与人' =>'array', - ]; - - - /** - * 定义错误信息 - * 格式:'字段名.规则名' => '错误信息' - * - * @var array - */ - protected $message = []; - - // 验证场景 - protected $scene = [ - 'add' => ['title','category','hjschool','fzshijian','fzschool','jiangxiang'], - 'edit' => ['id','title','category','hjschool','fzshijian','fzschool','jiangxiang' ], - ]; -} diff --git a/application/rongyu/validate/JsRongyu.php b/application/rongyu/validate/JsRongyu.php deleted file mode 100644 index b43aeffc..00000000 --- a/application/rongyu/validate/JsRongyu.php +++ /dev/null @@ -1,29 +0,0 @@ - ['规则1','规则2'...] - * - * @var array - */ - protected $rule = [ - 'title|荣誉册标题' => 'require|length:1,50', - 'category|荣誉类型' => 'require|number', - 'fzshijian|发证时间' => 'require|date', - 'fzschool|颁奖单位' => 'require|number', - ]; - - /** - * 定义错误信息 - * 格式:'字段名.规则名' => '错误信息' - * - * @var array - */ - protected $message = []; -} diff --git a/application/rongyu/validate/JsRongyuInfo.php b/application/rongyu/validate/JsRongyuInfo.php deleted file mode 100644 index 9dd96086..00000000 --- a/application/rongyu/validate/JsRongyuInfo.php +++ /dev/null @@ -1,40 +0,0 @@ - ['规则1','规则2'...] - * - * @var array - */ - protected $rule = [ - 'id|请先上传图片' => 'require', - 'rongyuce|荣誉册ID丢失' => 'require', - 'title|荣册标题' => 'require|length:1,50', - 'hjteachers|获奖人' => 'require|array', - 'hjschool|荣誉所在单位' => 'require|number', - 'subject|荣誉所属学科' => 'require|number', - 'hjshijian|发证时间' => 'require|date', - 'jiangxiang|奖项' => 'require|number', - 'cyteachers|参与人' => 'array', - ]; - - /** - * 定义错误信息 - * 格式:'字段名.规则名' => '错误信息' - * - * @var array - */ - protected $message = []; - - // 验证场景 - protected $scene = [ - 'add' => ['rongyuce','title','hjteachers','hjschool','subject','hjshijian','jiangxiang','cyteachers','pic'], - 'edit' => ['id','title','hjteachers','hjschool','subject','hjshijian','jiangxiang','cyteachers','pic'], - ]; -} diff --git a/application/rongyu/view/dw_rongyu/create.html b/application/rongyu/view/dw_rongyu/create.html deleted file mode 100644 index 0ac1b505..00000000 --- a/application/rongyu/view/dw_rongyu/create.html +++ /dev/null @@ -1,256 +0,0 @@ -{extend name="common@create" /} -{block name="jscss"} - -{/block} -{block name="form"} -
- {eq name="$list.set.formpost" value="PUT" } - {if strlen($list.data.url)>0} - - {else /} - - {/if} - {/eq} -
-
-
- -
-
- -
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
-
- -
- {present name="$list.data.cy_dwry"} - {volist name="$list.data.cy_dwry" id="vo"} -
-
- {$vo.teacher.xingming} -
-
- {/volist} - {/present} -
-
-
- -
- {php} $category = getCategory(112);{/php} - -
-
-
- -
- {php} $school = schlist('校级','区级');{/php} - -
-
-
- -
- -
-
-
- -
- {php} $school = schlist('区级','其它级');{/php} - -
-
-
- -
- {php} $category = getCategory(113);{/php} - -
-
-
- -
-
-{/block} - -{block name="myjs"} - - -{/block} - diff --git a/application/rongyu/view/dw_rongyu/create_all.html b/application/rongyu/view/dw_rongyu/create_all.html deleted file mode 100644 index 930ed1f9..00000000 --- a/application/rongyu/view/dw_rongyu/create_all.html +++ /dev/null @@ -1,43 +0,0 @@ -{extend name="common@create" /} - -{block name="form"} -
- -
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/rongyu/view/dw_rongyu/index.html b/application/rongyu/view/dw_rongyu/index.html deleted file mode 100644 index bec3b9a7..00000000 --- a/application/rongyu/view/dw_rongyu/index.html +++ /dev/null @@ -1,164 +0,0 @@ - -{extend name="common@list" /} -{block name="jsset"} - -{/block} -{block name="nav"} - - 荣誉管理 - 单位荣誉 - -{/block} -{block name="search"} -
- -
- -
-
-
- -
- {php} $category = getCategory(112);{/php} - {volist name="category" id="vo"} - - {/volist} -
-
-
- -
- {php} $school = schlist('区级','其它级'); {/php} - {volist name="school" id="vo"} - - {/volist} -
-
-
- -
- {php} $school = schlist('校级','区级'); {/php} - {volist name="school" id="vo"} - - {/volist} -
-
-{/block} -{block name="table"} -
-{/block} -{block name="myjs"} - - - - - - -{/block} \ No newline at end of file diff --git a/application/rongyu/view/js_rongyu/create.html b/application/rongyu/view/js_rongyu/create.html deleted file mode 100644 index 2612eab9..00000000 --- a/application/rongyu/view/js_rongyu/create.html +++ /dev/null @@ -1,84 +0,0 @@ -{extend name="common@create" /} -{block name="jscss"} -{/block} -{block name="form"} -
-
- -
- -
-
-
- -
- {php} $category = getCategory(114);{/php} - -
-
-
- -
- {php} $school = schlist('区级','其它级');{/php} - -
-
-
- -
- -
-
-
- -
-
-{/block} - -{block name="myjs"} - - -{/block} - diff --git a/application/rongyu/view/js_rongyu/index.html b/application/rongyu/view/js_rongyu/index.html deleted file mode 100644 index db3c8d2b..00000000 --- a/application/rongyu/view/js_rongyu/index.html +++ /dev/null @@ -1,138 +0,0 @@ - -{extend name="common@list" /} -{block name="jsset"} - -{/block} -{block name="nav"} - - 荣誉管理 - 荣誉册 - -{/block} -{block name="search"} -
- -
- -
-
-
- -
- {php} $category = getCategory(114);{/php} - {volist name="category" id="vo"} - - {/volist} -
-
-
- -
- {php} $school = schlist('区级','其它级'); {/php} - {volist name="school" id="vo"} - - {/volist} -
-
-{/block} -{block name="table"} -
-{/block} -{block name="myjs"} - - - - - - -{/block} \ No newline at end of file diff --git a/application/rongyu/view/js_rongyu_info/create.html b/application/rongyu/view/js_rongyu_info/create.html deleted file mode 100644 index f893467a..00000000 --- a/application/rongyu/view/js_rongyu_info/create.html +++ /dev/null @@ -1,264 +0,0 @@ -{extend name="common@create" /} -{block name="jscss"} - -{/block} -{block name="form"} -
- {eq name="$list.set.formpost" value="PUT" } - {if strlen($list.data.pic)>0} - - {else /} - - {/if} - {/eq} -
-
-
- -
-
- -
-
- -
-
-
-
- -
- -
-
-
- -
- -
-
-
- -
-
- -
- {present name="$list.data.hj_jsry"} - {volist name="$list.data.hj_jsry" id="vo"} -
-
- {$vo.teacher.xingming} -
-
- {/volist} - {/present} -
-
-
- -
-
- -
- {present name="$list.data.cy_jsry"} - {volist name="$list.data.cy_jsry" id="vo"} -
-
- {$vo.teacher.xingming} -
-
- {/volist} - {/present} -
-
-
- -
- {php} $school = schlist('校级','区级');{/php} - -
-
-
- -
- {php} - $subject = new \app\teach\model\Subject; - $subjectlist = $subject->where('status',1)->order(['paixu'])->select(); - {/php} - -
-
-
- -
- {php} $jiangxiang = getCategory(113);{/php} - -
-
-
- -
- -
-
- -
- -
-
-{/block} - -{block name="myjs"} - - -{/block} - diff --git a/application/rongyu/view/js_rongyu_info/create_all.html b/application/rongyu/view/js_rongyu_info/create_all.html deleted file mode 100644 index 81105ca9..00000000 --- a/application/rongyu/view/js_rongyu_info/create_all.html +++ /dev/null @@ -1,43 +0,0 @@ -{extend name="common@create" /} - -{block name="form"} -
- -
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/rongyu/view/js_rongyu_info/index.html b/application/rongyu/view/js_rongyu_info/index.html deleted file mode 100644 index 187c04eb..00000000 --- a/application/rongyu/view/js_rongyu_info/index.html +++ /dev/null @@ -1,152 +0,0 @@ - -{extend name="common@list" /} -{block name="jsset"} - -{/block} -{block name="nav"} - - 荣誉管理 - 荣誉册 - 荣誉列表 - -{/block} -{block name="search"} -
- -
- -
-
-
- -
- {php} $category = getCategory(114);{/php} - {volist name="category" id="vo"} - - {/volist} -
-
-
- -
- {php} $school = schlist('区级','其它级'); {/php} - {volist name="school" id="vo"} - - {/volist} -
-
-
- -
- {php} $school = schlist('校级','区级'); {/php} - {volist name="school" id="vo"} - - {/volist} -
-
-{/block} -{block name="table"} -
-{/block} -{block name="myjs"} - - - - - - -{/block} \ No newline at end of file diff --git a/application/rongyu/view/js_rongyu_info/rongyu_list.html b/application/rongyu/view/js_rongyu_info/rongyu_list.html deleted file mode 100644 index 9f4258cb..00000000 --- a/application/rongyu/view/js_rongyu_info/rongyu_list.html +++ /dev/null @@ -1,164 +0,0 @@ - -{extend name="common@list" /} -{block name="jsset"} - -{/block} -{block name="nav"} - - 荣誉管理 - 荣誉册 - 荣誉列表 - -{/block} -{block name="search"} -
- -
- -
-
-
- -
- {php} - $sbj = new \app\teach\model\Subject; - $subject = $sbj->field('id,title')->where('status',1)->order('paixu')->select(); - {/php} - {volist name="subject" id="vo"} - - {/volist} -
-
-
- -
- {php} $school = schlist('校级','区级'); {/php} - {volist name="school" id="vo"} - - {/volist} -
-
- -{/block} -{block name="table"} -
-{/block} -{block name="myjs"} - - - - - - -{/block} \ No newline at end of file diff --git a/application/system/common.php b/application/system/common.php deleted file mode 100644 index b3d9bbc7..00000000 --- a/application/system/common.php +++ /dev/null @@ -1 +0,0 @@ -assign('list',$list); - - // 渲染模板 - return $this->fetch(); - } - - - // 获取单位列表数据 - public function ajaxData() - { - // 获取参数 - $src = $this->request - ->only([ - 'page'=>'1', - 'limit'=>'10', - 'field'=>'id', - 'type'=>'asc', - 'pid'=>'', - 'searchval'=>'' - ],'POST'); - - // 实例化 - $cg = new CG; - - // 查询要显示的数据 - $data = $cg->search($src); - // 获取记录总数 - $cnt = $data->count(); - // 获取当前页数据 - // $data = $data->page(1,10); - // dump($data); - - $limit_start = $src['page'] * $src['limit']-$src['limit']; - $limit_length = $src['limit']; - $data = $data->slice($limit_start,$limit_length); - - // 重组返回内容 - $data = [ - 'code'=> 0 , // ajax请求次数,作为标识符 - 'msg'=>"", // 获取到的结果数(每页显示数量) - 'count'=>$cnt, // 符合条件的总数据量 - 'data'=>$data, //获取到的数据结果 - ]; - - return json($data); - } - - - - // 添加类别 - public function create() - { - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'添加类别', - 'butname'=>'添加', - 'formpost'=>'POST', - 'url'=>'/category', - ); - - - // 模板赋值 - $this->assign('list',$list); - - // 渲染 - return $this->fetch(); - } - - - - // 保存信息 - public function save() - { - - // 实例化验证模型 - $validate = new \app\system\validate\Category; - - - // 获取表单数据 - $list = request()->only(['title','pid','paixu'],'post'); - - - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]);; - } - - // 保存数据 - $data = CG::create($list); - - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - // 编辑类别 - public function edit($id) - { - // 获取单位信息 - $list['data'] = CG::field('id,title,pid,paixu') - ->find($id); - - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'编辑类别', - 'butname'=>'修改', - 'formpost'=>'PUT', - 'url'=>'/category/'.$id, - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - } - - // 更新类别信息 - public function update($id) - { - $validate = new \app\system\validate\Category; - - // 获取表单数据 - $list = request()->only(['title','pid','paixu'],'put'); - - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]);; - } - - - $data = CG::where('id',$id)->update($list); - - // 根据更新结果设置返回提示信息 - $data>=0 ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - // 删除类别 - public function delete($id) - { - if($id == 'm') - { - $id = request()->delete('ids'); - } - - $data = CG::destroy($id); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - // 设置类别状态 - public function setStatus() - { - - // 获取id变量 - $id = request()->post('id'); - $value = request()->post('value'); - - // 获取类别信息 - $data = CG::where('id',$id)->update(['status'=>$value]); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } -} diff --git a/application/system/controller/Encrypt.php b/application/system/controller/Encrypt.php deleted file mode 100644 index 0c432227..00000000 --- a/application/system/controller/Encrypt.php +++ /dev/null @@ -1,68 +0,0 @@ -assign('list',$list); - - // 渲染模板 - return $this->fetch(); - } - - // 获取单位列表数据 - public function ajaxData() - { - // 获取参数 - $src = $this->request - ->only([ - 'page'=>'1', - 'limit'=>'10', - 'field'=>'id', - 'type'=>'desc', - ],'POST'); - - - // 实例化 - $fl = new FL; - - // 查询要显示的数据 - $data = $fl->search($src); - // 获取符合条件记录总数 - $cnt = $data->count(); - // 获取当前页数据 - $limit_start = $src['page'] * $src['limit'] - $src['limit']; - $limit_length = $src['limit']; - $data = $data->slice($limit_start,$limit_length); - - // 重组返回内容 - $data = [ - 'code'=> 0 , // ajax请求次数,作为标识符 - 'msg'=>"", // 获取到的结果数(每页显示数量) - 'count'=>$cnt, // 符合条件的总数据量 - 'data'=>$data, //获取到的数据结果 - ]; - - - return json($data); - } - - - // 下载文件 - public function download($id) - { - // 实例化文件数据模型 - $fl = new FL; - // 查询文件信息 - $filist = $fl->where('id',$id)->find(); - - // 下载文件 - $download = new \think\response\Download('uploads\\'.$filist->url); - - return $download->name($filist->oldname); - - } - - - - /** - * 删除指定资源 - * - * @param int $id - * @return \think\Response - */ - public function delete($id) - { - if($id == 'm') - { - $id = request()->delete('ids'); - } - - $data = FL::destroy($id); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } -} diff --git a/application/system/controller/School.php b/application/system/controller/School.php deleted file mode 100644 index 1b3827cb..00000000 --- a/application/system/controller/School.php +++ /dev/null @@ -1,209 +0,0 @@ -assign('list',$list); - - // 渲染模板 - return $this->fetch(); - } - - - // 获取单位列表数据 - public function ajaxData() - { - // 获取参数 - $src = $this->request - ->only([ - 'page'=>'1', - 'limit'=>'10', - 'field'=>'paixu', - 'type'=>'asc', - 'jibie'=>array(), - 'xingzhi'=>array(), - 'searchval'=>'' - ],'POST'); - - - // 实例化 - $sch = new sch; - - // 查询要显示的数据 - $data = $sch->search($src); - // 获取符合条件记录总数 - $cnt = $data->count(); - // 获取当前页数据 - $limit_start = $src['page'] * $src['limit'] - $src['limit']; - $limit_length = $src['limit']; - $data = $data->slice($limit_start,$limit_length); - - // 重组返回内容 - $data = [ - 'code'=> 0 , // ajax请求次数,作为标识符 - 'msg'=>"", // 获取到的结果数(每页显示数量) - 'count'=>$cnt, // 符合条件的总数据量 - 'data'=>$data, //获取到的数据结果 - ]; - - - return json($data); - } - - - - // 添加单位 - public function create() - { - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'添加单位', - 'butname'=>'添加', - 'formpost'=>'POST', - 'url'=>'/school', - ); - - - // 模板赋值 - $this->assign('list',$list); - - // 渲染 - return $this->fetch(); - } - - - - // 保存信息 - public function save() - { - - // 实例化验证模型 - $validate = new \app\system\validate\School; - - - // 获取表单数据 - $list = request() - ->only(['title','jiancheng','biaoshi','xingzhi','jibie','xueduan','paixu'=>999],'post'); - - - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]);; - } - - // 保存数据 - $data = sch::create($list); - - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - // 编辑单位 - public function edit($id) - { - // 获取单位信息 - $list['data'] = sch::field('id,title,jiancheng,biaoshi,xingzhi,jibie,status,xueduan,paixu') - ->get($id); - - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'编辑单位', - 'butname'=>'修改', - 'formpost'=>'PUT', - 'url'=>'/school/'.$id, - ); - - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - } - - // 更新单位信息 - public function update($id) - { - $validate = new \app\system\validate\School; - - // 获取表单数据 - $list = request() - ->only(['title','jiancheng','biaoshi','xingzhi','jibie','xueduan','paixu'=>999],'put'); - - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]);; - } - - - $data = sch::where('id',$id)->update($list); - - // 根据更新结果设置返回提示信息 - $data>=0 ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - // 删除单位 - public function delete($id) - { - if($id == 'm') - { - $id = request()->delete('ids'); - } - - $data = sch::destroy($id); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - // 设置单位状态 - public function setStatus() - { - // 获取id变量 - $id = request()->post('id'); - $value = request()->post('value'); - - // 获取单位信息 - $data = sch::where('id',$id)->update(['status'=>$value]); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } -} diff --git a/application/system/controller/SystemBase.php b/application/system/controller/SystemBase.php deleted file mode 100644 index 6cc81991..00000000 --- a/application/system/controller/SystemBase.php +++ /dev/null @@ -1,66 +0,0 @@ -order(['id'=>'desc']) - ->find(); - - $list['set'] = array( - 'webtitle'=>'设置系统信息', - 'butname'=>'设置', - 'formpost'=>'PUT', - 'url'=>'/sysbase/'.$list['data']['id'], - ); - - - // 模板赋值 - $this->assign('list',$list); - - // 渲染模板 - return $this->fetch(); - } - - - // 更新资源 - public function update($id) - { - $validate = new \app\system\validate\SystemBase; - - // 获取表单数据 - $list = request()->only(['webtitle','keywords','description','thinks','danwei'],'put'); - $list['id'] = $id; - - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]);; - } - - - $data = sysbasemod::where('id',$id)->update($list); - - // 根据更新结果设置返回提示信息 - $data>=0 ? $data=['msg'=>'设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - -} diff --git a/application/system/model/Category.php b/application/system/model/Category.php deleted file mode 100644 index a4561a86..00000000 --- a/application/system/model/Category.php +++ /dev/null @@ -1,52 +0,0 @@ -belongsTo('Category','pid','id'); - } - - - // 子类型关联 - public function glCid() - { - return $this->hasMany('Category','pid','id'); - } - - - // 查询所有类别 - public function search($src) - { - // 整理变量 - $pid = $src['pid']; - $searchval = $src['searchval']; - - // 查询数据 - $data = $this - ->order([$src['field'] =>$src['type']]) - ->when(strlen($pid)>0,function($query) use($pid){ - $query->whereOr('pid','in',$pid); - }) - ->when(strlen($searchval)>0,function($query) use($searchval){ - $query->where('title','like','%'.$searchval.'%'); - }) - ->with( - [ - 'glPid'=>function($query){ - $query->field('id,title'); - } - ] - ) - ->select(); - return $data; - } -} diff --git a/application/system/model/Fields.php b/application/system/model/Fields.php deleted file mode 100644 index f2e5ed19..00000000 --- a/application/system/model/Fields.php +++ /dev/null @@ -1,54 +0,0 @@ -where('hash',$str)->find(); - if($list){ - $hasHash = 1; - } - return $hasHash; - } - - - // 查询所有单位 - public function search($src) - { - // 查询数据 - $data = $this - ->order([$src['field'] =>$src['type']]) - ->with([ - 'flUser'=>function($query){ - $query->withField('id,xingming,school') - ->with([ - 'adSchool'=>function($q){ - $q->withField('id,jiancheng'); - } - ]); - } - ]) - ->select(); - - return $data; - } - - // 上传人数据关联 - public function flUser() - { - return $this->belongsTo('\app\admin\model\Admin','userid','id'); - } - -} diff --git a/application/system/model/School.php b/application/system/model/School.php deleted file mode 100644 index f6c81b30..00000000 --- a/application/system/model/School.php +++ /dev/null @@ -1,81 +0,0 @@ -hasMany('\app\renshi\model\Teacher','danwei','id'); - } - - // 单位性质数据模型关联 - public function dwXingzhi() - { - return $this->belongsTo('\app\system\model\Category','xingzhi','id'); - } - - - // 单位级别数模型关联 - public function dwJibie() - { - return $this->belongsTo('\app\system\model\Category','jibie','id'); - } - - - // 单位学段数模型关联 - public function dwXueduan() - { - return $this->belongsTo('\app\system\model\Category','xueduan','id'); - } - - - - // 查询所有单位 - public function search($src) - { - // 整理变量 - $xingzhi = $src['xingzhi']; - $jibie = $src['jibie']; - $searchval = $src['searchval']; - - // 查询数据 - $data = $this - ->order([$src['field'] =>$src['type']]) - ->when(count($xingzhi)>0,function($query) use($xingzhi){ - $query->where('xingzhi','in',$xingzhi); - }) - ->when(count($jibie)>0,function($query) use($jibie){ - $query->where('jibie','in',$jibie); - }) - ->when(strlen($searchval)>0,function($query) use($searchval){ - $query->where('title|jiancheng','like','%'.$searchval.'%'); - }) - ->with( - [ - 'dwXingzhi'=>function($query){ - $query->field('id,title'); - }, - 'dwJibie'=>function($query){ - $query->field('id,title'); - }, - 'dwXueduan'=>function($query){ - $query->field('id,title'); - }, - ] - ) - ->withCount( - [ - 'dwTeacher'=>function($query){ - $query->where('status',1); - } - ] - ) - ->select(); - return $data; - } -} diff --git a/application/system/model/SystemBase.php b/application/system/model/SystemBase.php deleted file mode 100644 index 96867ced..00000000 --- a/application/system/model/SystemBase.php +++ /dev/null @@ -1,10 +0,0 @@ - ['规则1','规则2'...] - * - * @var array - */ - protected $rule = [ - 'title|规则名' => 'require|chs|length:2,50', - 'paixu|排序' => 'number|max:999', - ]; - - /** - * 定义错误信息 - * 格式:'字段名.规则名' => '错误信息' - * - * @var array - */ - protected $message = []; -} diff --git a/application/system/validate/School.php b/application/system/validate/School.php deleted file mode 100644 index 8e465c26..00000000 --- a/application/system/validate/School.php +++ /dev/null @@ -1,33 +0,0 @@ - ['规则1','规则2'...] - * - * @var array - */ - protected $rule = [ - 'title|单位名称' => 'require|chs|length:2,25', - 'jiancheng|单位简称' => 'require|chs|length:1,6', - 'biaoshi|单位标识' => 'number', - 'jibie|级别 ' => 'number', - 'xingzhi|性质' => 'number', - 'xueduan|学段' => 'number', - 'paixu|排序 ' => 'number|max:999', - - ]; - - /** - * 定义错误信息 - * 格式:'字段名.规则名' => '错误信息' - * - * @var array - */ - protected $message = []; -} diff --git a/application/system/validate/SystemBase.php b/application/system/validate/SystemBase.php deleted file mode 100644 index 283a7a5e..00000000 --- a/application/system/validate/SystemBase.php +++ /dev/null @@ -1,30 +0,0 @@ - ['规则1','规则2'...] - * - * @var array - */ - protected $rule = [ - 'webtitle|标题' => 'require|length:2,50', - 'keywords|关键字' => 'require|length:2,60', - 'description|描述' => 'require|length:1,100', - 'thinks|感谢' => 'require|length:1,80', - 'danwei|单位' => 'require|length:2,80', - ]; - - /** - * 定义错误信息 - * 格式:'字段名.规则名' => '错误信息' - * - * @var array - */ - protected $message = []; -} diff --git a/application/system/view/category/create.html b/application/system/view/category/create.html deleted file mode 100644 index dd54e9bc..00000000 --- a/application/system/view/category/create.html +++ /dev/null @@ -1,53 +0,0 @@ -{extend name="common@create" /} - -{block name="form"} -
-
- -
- -
-
-
- -
- {php} $category = getCategory(0);{/php} - -
-
-
- -
- -
-
-
- -
-
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/system/view/category/index.html b/application/system/view/category/index.html deleted file mode 100644 index 58511f67..00000000 --- a/application/system/view/category/index.html +++ /dev/null @@ -1,108 +0,0 @@ - -{extend name="common@list" /} -{block name="jsset"} - -{/block} -{block name="nav"} - - 系统管理 - 类别管理 - 类别列表 - -{/block} -{block name="search"} -
- -
- -
-
-
- -
- - {php} $pid = getCategory(0);{/php} - {volist name="pid" id="vo"} - - {/volist} -
-
-{/block} -{block name="table"} -
-{/block} -{block name="myjs"} - - - - - - -{/block} \ No newline at end of file diff --git a/application/system/view/fields/create.html b/application/system/view/fields/create.html deleted file mode 100644 index 64368451..00000000 --- a/application/system/view/fields/create.html +++ /dev/null @@ -1,111 +0,0 @@ -{extend name="common@create" /} - -{block name="form"} -
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- {php} $category = getCategory(101);{/php} - -
-
-
- -
- {php} $category = getCategory(102);{/php} - -
-
-
- -
- {php} $category = getCategory(103);{/php} - -
-
-
- -
- -
-
-
- -
-
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/system/view/fields/index.html b/application/system/view/fields/index.html deleted file mode 100644 index f73739cc..00000000 --- a/application/system/view/fields/index.html +++ /dev/null @@ -1,117 +0,0 @@ - -{extend name="common@list" /} -{block name="jsset"} - -{/block} -{block name="nav"} - - 系统管理 - 文件管理 - 文件列表 - -{/block} -{block name="search"} -
- -
- -
-
-
- -
- {php} $category = getCategory(102);{/php} - {volist name="category" id="vo"} - - {/volist} -
-
-
- -
- {php} $category = getCategory(101);{/php} - {volist name="category" id="vo"} - - {/volist} -
-
-{/block} -{block name="table"} -
-{/block} -{block name="myjs"} - - - - - - -{/block} \ No newline at end of file diff --git a/application/system/view/school/create.html b/application/system/view/school/create.html deleted file mode 100644 index 64368451..00000000 --- a/application/system/view/school/create.html +++ /dev/null @@ -1,111 +0,0 @@ -{extend name="common@create" /} - -{block name="form"} -
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- {php} $category = getCategory(101);{/php} - -
-
-
- -
- {php} $category = getCategory(102);{/php} - -
-
-
- -
- {php} $category = getCategory(103);{/php} - -
-
-
- -
- -
-
-
- -
-
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/system/view/school/index.html b/application/system/view/school/index.html deleted file mode 100644 index 26297765..00000000 --- a/application/system/view/school/index.html +++ /dev/null @@ -1,135 +0,0 @@ - -{extend name="common@list" /} -{block name="jsset"} - -{/block} -{block name="nav"} - - 系统管理 - 单位管理 - 单位列表 - -{/block} -{block name="search"} -
- -
- -
-
-
- -
- {php} $category = getCategory(102);{/php} - {volist name="category" id="vo"} - - {/volist} -
-
-
- -
- {php} $category = getCategory(101);{/php} - {volist name="category" id="vo"} - - {/volist} -
-
-{/block} -{block name="table"} -
-{/block} -{block name="myjs"} - - - - - - -{/block} \ No newline at end of file diff --git a/application/system/view/system_base/edit.html b/application/system/view/system_base/edit.html deleted file mode 100644 index 744aa21f..00000000 --- a/application/system/view/system_base/edit.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - {$list.set.webtitle} - - - - {load href="__STATIC__/xadmin/css/font.css" /} - {load href="__STATIC__/xadmin/css/xadmin.css" /} - {load href="__STATIC__/xadmin/js/jquery.min.js" /} - {load href="__STATIC__/xadmin/lib/layui/layui.js" /} - {load href="__STATIC__/xadmin/js/xadmin.js" /} - {load href="__STATIC__/xadmin/js/cookie.js" /} - - - - -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
-
-
- - - \ No newline at end of file diff --git a/application/tags.php b/application/tags.php deleted file mode 100644 index 4b18d105..00000000 --- a/application/tags.php +++ /dev/null @@ -1,28 +0,0 @@ - -// +---------------------------------------------------------------------- - -// 应用行为扩展定义文件 -return [ - // 应用初始化 - 'app_init' => [], - // 应用开始 - 'app_begin' => [], - // 模块初始化 - 'module_init' => [], - // 操作开始执行 - 'action_begin' => [], - // 视图内容过滤 - 'view_filter' => [], - // 日志写入 - 'log_write' => [], - // 应用结束 - 'app_end' => [], -]; diff --git a/application/teach/common.php b/application/teach/common.php deleted file mode 100644 index 8bf3131c..00000000 --- a/application/teach/common.php +++ /dev/null @@ -1,5 +0,0 @@ -assign('list',$list); - - // 渲染模板 - return $this->fetch(); - } - - - - // 获取班级信息列表 - public function ajaxData() - { - // 获取参数 - $src = $this->request - ->only([ - 'page'=>'1', - 'limit'=>'10', - 'field'=>'update_time', - 'type'=>'asc', - 'school'=>'', - 'ruxuenian'=>'', - 'searchval'=>'' - ],'POST'); - - - // 实例化 - $bj = new BJ; - - // 查询要显示的数据 - $data = $bj->search($src); - // 获取符合条件记录总数 - $cnt = $data->count(); - // 获取当前页数据 - $limit_start = $src['page'] * $src['limit'] - $src['limit']; - $limit_length = $src['limit']; - $data = $data->slice($limit_start,$limit_length); - - // 重组返回内容 - $data = [ - 'code'=> 0 , // ajax请求次数,作为标识符 - 'msg'=>"", // 获取到的结果数(每页显示数量) - 'count'=>$cnt, // 符合条件的总数据量 - 'data'=>$data, //获取到的数据结果 - ]; - - return json($data); - } - - - - // 创建班级 - public function create() - { - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'添加班级', - 'butname'=>'添加', - 'formpost'=>'POST', - 'url'=>'/banji', - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - } - - - - // 保存信息 - public function save() - { - // 实例化验证模型 - $validate = new \app\teach\validate\Banji; - - - // 获取表单数据 - $list = request()->only(['school','ruxuenian','bjsum'],'post'); - - - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]); - } - - $paixumax = BJ::where('school',$list['school']) - ->where('ruxuenian',$list['ruxuenian']) - ->max('paixu'); - - if($paixumax + $list['bjsum'] > 25){ - $list['bjsum'] = 25 - $paixumax; - } - - $i = 1; - while($i<=$list['bjsum']) - { - $bjarr[] = array( - 'school'=>$list['school'], - 'ruxuenian'=>$list['ruxuenian'], - 'paixu'=>$paixumax+$i - ); - $i++; - } - - // 实例化班级数据模型类 - $bj = new BJ(); - - // 保存数据 - $data = $bj->saveAll($bjarr); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - // - public function read($id) - { - // - } - - - - - // 修改班级信息 - public function edit($id) - { - - // 获取班级信息 - $list = BJ::field('id,school,ruxuenian,paixu') - ->get($id); - - - $this->assign('list',$list); - - return $this->fetch(); - } - - - - - - // 更新班级信息 - public function update($id) - { - $validate = new \app\teach\validate\Xueqi; - - // 获取表单数据 - $list = request()->only(['title','xuenian','category','bfdate','enddate'],'put'); - - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]);; - } - - - // 更新数据 - $xq = new XQ(); - $data = $xq->save($list,['id'=>$id]); - // $data = BJ::where('id',$id)->update($list); - - // 根据更新结果设置返回提示信息 - $data>=0 ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - - - // 删除班级 - public function delete($id) - { - - if($id == 'm') - { - $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 - } - - $data = BJ::destroy($id); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - // 设置班级状态 - public function setStatus() - { - - // 获取id变量 - $id = request()->post('id'); - $value = request()->post('value'); - - // 获取班级信息 - $data = BJ::where('id',$id)->update(['status'=>$value]); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - public function yidong($id) - { - // 获取操作参数 - $caozuo = input('post.cz'); - - // 获取当前班级信息 - $thisbj = BJ::get($id); - - // 获取别一个班级信息 - if( $caozuo > 0 ) - { - $bjinfo = BJ::where('school',$thisbj->getData('school')) - ->where('ruxuenian',$thisbj->ruxuenian) - ->where('paixu','>=',$thisbj->paixu) - ->order(['paixu']) - ->limit('2') - ->field('id,paixu') - ->select(); - }else{ - $bjinfo = BJ::where('school',$thisbj->getData('school')) - ->where('ruxuenian',$thisbj->ruxuenian) - ->where('paixu','<=',$thisbj->paixu) - ->order(['paixu'=>'desc']) - ->limit('2') - ->field('id,paixu') - ->select(); - } - if($bjinfo->count() == 2) - { - // 更改班级位置 - foreach ($bjinfo as $key => $value) { - $value->paixu = $value->paixu + $caozuo; - $caozuo = $caozuo * -1; - } - $bjinfo = $bjinfo->toArray(); - - // 实例化班级数据模型 - $bj = new BJ(); - // 更新数据 - $data = $bj->saveAll($bjinfo); - $data ? $data = ['msg'=>'移动成功','val'=>1] : $data = ['msg'=>'数据处理错误','val'=>0]; - }else{ - $data = ['msg'=>'已经到头啦~','val'=>0]; - } - - // 返回处理结果 - return json($data); - - } - - - // 根据单位年级获取班级列表 - public function mybanji($school,$ruxuenian) - { - // 获取变量 - $school = input('post.school'); - $ruxuenian = input('post.ruxuenian'); - // 获取班级id列表 - $list = BJ::where('school',$school) - ->where('ruxuenian','in',$ruxuenian) - ->order('paixu') - ->field('id,ruxuenian,paixu') - ->where('status',1) - ->append(['banTitle']) - ->select(); - - return json($list); - } - - - // 获取该学校各年级的班级名和id - public function banjilist($school,$ruxuenian) - { - // 获取年级名对应的入学年 - $njanmelist = nianjiList(); - $bjnamelist = banjinamelist(); - $njlist = array_keys($njanmelist); - - if(is_array($ruxuenian)==false) - { - $ruxuenian = array($ruxuenian); - } - - // 查询年级数据 - $list = BJ:: where('school',$school) - ->where('ruxuenian','in',$ruxuenian) - ->where('status',1) - ->group('ruxuenian') - ->field('ruxuenian') - ->with([ - 'njBanji'=>function($query)use($school){ - $query->where('status',1) - ->where('school',$school) - ->field('id,ruxuenian,paixu') - ->where('status',1) - ->order('paixu') - ->append(['banjiTitle','banTitle']); - } - ]) - ->select(); - // 返回数据 - return json($list); - - } - - - -} diff --git a/application/teach/controller/Error.php b/application/teach/controller/Error.php deleted file mode 100644 index f028576d..00000000 --- a/application/teach/controller/Error.php +++ /dev/null @@ -1,11 +0,0 @@ -assign('list',$list); - - // 渲染模板 - return $this->fetch(); - } - - - // 获取学期信息列表 - public function ajaxData() - { - - // 获取参数 - $src = $this->request - ->only([ - 'page'=>'1', - 'limit'=>'10', - 'field'=>'update_time', - 'type'=>'asc', - 'xingzhi'=>array(), - 'searchval'=>'' - ],'POST'); - - // 实例化 - $sj = new SJ; - - // 查询要显示的数据 - $data = $sj->search($src); - // 获取符合条件记录总数 - $cnt = $data->count(); - // 获取当前页数据 - $limit_start = $src['page'] * $src['limit'] - $src['limit']; - $limit_length = $src['limit']; - $data = $data->slice($limit_start,$limit_length); - - // 重组返回内容 - $data = [ - 'code'=> 0 , // ajax请求次数,作为标识符 - 'msg'=>"", // 获取到的结果数(每页显示数量) - 'count'=>$cnt, // 符合条件的总数据量 - 'data'=>$data, //获取到的数据结果 - ]; - - return json($data); - } - - - - // 创建学期 - public function create() - { - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'添加学科', - 'butname'=>'添加', - 'formpost'=>'POST', - 'url'=>'/subject', - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - } - - - - // 保存信息 - public function save() - { - // 实例化验证模型 - $validate = new \app\teach\validate\Subject; - - - // 获取表单数据 - $list = request()->only(['title','jiancheng','category','kaoshi','paixu','lieming'],'post'); - - - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]); - } - - // 保存数据 - $data = SJ::create($list); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - // - public function read($id) - { - // - } - - - - - // 修改学期信息 - public function edit($id) - { - - // 获取学期信息 - $list['data'] = SJ::field('id,title,jiancheng,category,kaoshi,lieming,paixu,status') - ->find($id); - - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'编辑学科', - 'butname'=>'修改', - 'formpost'=>'PUT', - 'url'=>'/subject/'.$id, - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - } - - - - - - // 更新学期信息 - public function update($id) - { - $validate = new \app\teach\validate\Subject; - - // 获取表单数据 - $list = request()->only(['title','jiancheng','category','kaoshi','lieming','paixu'],'put'); - - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]);; - } - - - // 更新数据 - $data = SJ::where('id',$id)->update($list); - - // 根据更新结果设置返回提示信息 - $data>=0 ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - - - // 删除学期 - public function delete($id) - { - - if($id == 'm') - { - $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 - } - - $data = SJ::destroy($id); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - // 设置学期状态 - public function setStatus() - { - - // 获取id变量 - $id = request()->post('id'); - $value = request()->post('value'); - - // 获取学期信息 - $data = SJ::where('id',$id)->update(['status'=>$value]); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - // 学科列表 - public function subjectlist(){ - $data = SJ::where('status',1) - ->where('kaoshi',1) - ->field('id,title,jiancheng,lieming') - ->select(); - return $data; - } - -} diff --git a/application/teach/controller/Xueqi.php b/application/teach/controller/Xueqi.php deleted file mode 100644 index f66ce439..00000000 --- a/application/teach/controller/Xueqi.php +++ /dev/null @@ -1,222 +0,0 @@ -assign('list',$list); - - // 渲染模板 - return $this->fetch(); - } - - - // 获取学期信息列表 - public function ajaxData() - { - - // 获取参数 - $src = $this->request - ->only([ - 'page'=>'1', - 'limit'=>'10', - 'field'=>'id', - 'type'=>'desc', - 'searchval'=>'' - ],'POST'); - - - // 实例化 - $xq = new XQ; - - // 查询要显示的数据 - $data = $xq->search($src); - // 获取符合条件记录总数 - $cnt = $data->count(); - // 获取当前页数据 - $limit_start = $src['page'] * $src['limit'] - $src['limit']; - $limit_length = $src['limit']; - $data = $data->slice($limit_start,$limit_length); - - // 重组返回内容 - $data = [ - 'code'=> 0 , // ajax请求次数,作为标识符 - 'msg'=>"", // 获取到的结果数(每页显示数量) - 'count'=>$cnt, // 符合条件的总数据量 - 'data'=>$data, //获取到的数据结果 - ]; - - return json($data); - } - - - - // 创建学期 - public function create() - { - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'添加学期', - 'butname'=>'添加', - 'formpost'=>'POST', - 'url'=>'/xueqi', - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - } - - - - // 保存信息 - public function save() - { - // 实例化验证模型 - $validate = new \app\teach\validate\Xueqi; - - - // 获取表单数据 - $list = request()->only(['title','xuenian','category','bfdate','enddate'],'post'); - - - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]); - } - - // 保存数据 - $data = XQ::create($list); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - // - public function read($id) - { - // - } - - - - - // 修改学期信息 - public function edit($id) - { - - // 获取学期信息 - $list['data'] = XQ::field('id,title,xuenian,category,bfdate,enddate') - ->get($id); - - // 设置页面标题 - $list['set'] = array( - 'webtitle'=>'编辑学期', - 'butname'=>'修改', - 'formpost'=>'PUT', - 'url'=>'/xueqi/'.$id, - ); - - // 模板赋值 - $this->assign('list',$list); - // 渲染 - return $this->fetch('create'); - } - - - - - - // 更新学期信息 - public function update($id) - { - $validate = new \app\teach\validate\Xueqi; - - // 获取表单数据 - $list = request()->only(['title','xuenian','category','bfdate','enddate'],'put'); - - // 验证表单数据 - $result = $validate->check($list); - $msg = $validate->getError(); - - // 如果验证不通过则停止保存 - if(!$result){ - return json(['msg'=>$msg,'val'=>0]);; - } - - - // 更新数据 - $xq = new XQ(); - $data = $xq->save($list,['id'=>$id]); - // $data = XQ::where('id',$id)->update($list); - - // 根据更新结果设置返回提示信息 - $data>=0 ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - - - // 删除学期 - public function delete($id) - { - - if($id == 'm') - { - $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据 - } - - $data = XQ::destroy($id); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } - - - - // 设置学期状态 - public function setStatus() - { - - // 获取id变量 - $id = request()->post('id'); - $value = request()->post('value'); - - // 获取学期信息 - $data = XQ::where('id',$id)->update(['status'=>$value]); - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } -} diff --git a/application/teach/model/Banji.php b/application/teach/model/Banji.php deleted file mode 100644 index 61bd5843..00000000 --- a/application/teach/model/Banji.php +++ /dev/null @@ -1,120 +0,0 @@ -order([$src['field'] =>$src['type']]) - ->when(strlen($school)>0,function($query) use($school){ - $query->where('school',$school); - }) - ->when(strlen($ruxuenian)>0,function($query) use($ruxuenian){ - $query->where('ruxuenian',$ruxuenian); - }) - ->when(strlen($searchval)>0,function($query) use($searchval){ - $query->where('title','like','%'.$searchval.'%'); - }) - ->with( - [ - 'glSchool'=>function($query){ - $query->field('id,title'); - }, - ] - ) - ->withCount([ - 'glStudent'=>function($query){ - $query->where('status',1); - } - ]) - ->append(['banjiTitle']) - ->select(); - return $data; - } - - - // 学校关联模型 - public function glSchool(){ - return $this->belongsTo('\app\system\model\School','school','id'); - } - - // 学校关联模型 - public function glStudent(){ - return $this->hasMany('\app\renshi\model\Student','banji','id'); - } - - - // 班级名获取器 - public function getNumTitleAttr() - { - $njname = nianjilist(); - // $bjname = banjinamelist(); - $nj = $this->getAttr('ruxuenian'); - $bj = $this->getAttr('paixu'); - - $numnj = array_flip(array_keys($njname)); - - if(array_key_exists($nj,$numnj)) - { - $numname = ($numnj[$nj] + 1).'级'.$bj.'班'; - }else{ - $numname = $nj.'级'.$bj.'班'; - } - - - return $numname; - } - - - - // 班级名获取器 - public function getBanjiTitleAttr() - { - $njname = nianjilist(); - $bjname = banjinamelist(); - $nj = $this->getAttr('ruxuenian'); - $bj = $this->getAttr('paixu'); - - $njkeys = array_keys($njname); - $bjkeys = array_keys($bjname); - - in_array($nj,$njkeys) ? $title = $njname[$nj] : $title = $nj.'届'; - in_array($bj,$bjkeys) ? $title = $title.$bjname[$bj] : $title = $title.$bj.'班'; - - return $title; - } - - // 班级名获取器 - public function getBanTitleAttr() - { - $bjname = banjinamelist(); - $bj = $this->getAttr('paixu'); - - $bjkeys = array_keys($bjname); - - in_array($bj,$bjkeys) ? $title = $bjname[$bj] : $title = $bj.'班'; - - return $title; - } - - - // 年级-班级关联表 - public function njBanji() - { - return $this->hasMany('Banji','ruxuenian','ruxuenian'); - } - -} diff --git a/application/teach/model/Subject.php b/application/teach/model/Subject.php deleted file mode 100644 index be5840d5..00000000 --- a/application/teach/model/Subject.php +++ /dev/null @@ -1,42 +0,0 @@ -order([$src['field'] =>$src['type']]) - ->when(strlen($searchval)>0,function($query) use($searchval){ - $query->where('title|jiancheng','like','%'.$searchval.'%'); - }) - ->with([ - 'sujCategory'=>function($query){ - $query->field('id,title'); - } - ]) - ->select(); - return $data; - } - - // 大类别关联 - public function sujCategory() - { - return $this->belongsTo('\app\system\model\Category','category','id'); - } - - - // 是否参加考试获取器 - public function getKaoshiAttr($value){ - $kaoshi = array(0=>'否',1=>'是'); - return $kaoshi[$value]; - } -} diff --git a/application/teach/model/Xueqi.php b/application/teach/model/Xueqi.php deleted file mode 100644 index 4db1ac45..00000000 --- a/application/teach/model/Xueqi.php +++ /dev/null @@ -1,62 +0,0 @@ -belongsTo('\app\system\model\Category','category','id'); - } - - // 查询所有单位 - public function search($src) - { - // 整理变量 - $searchval = $src['searchval']; - - // 查询数据 - $data = $this - ->order([$src['field'] =>$src['type']]) - ->when(strlen($searchval)>0,function($query) use($searchval){ - $query->where('title|xuenian','like','%'.$searchval.'%'); - }) - ->with( - [ - 'glCategory'=>function($query){ - $query->field('id,title'); - }, - ] - ) - ->select(); - return $data; - } -} diff --git a/application/teach/validate/Banji.php b/application/teach/validate/Banji.php deleted file mode 100644 index 1bd80124..00000000 --- a/application/teach/validate/Banji.php +++ /dev/null @@ -1,28 +0,0 @@ - ['规则1','规则2'...] - * - * @var array - */ - protected $rule = [ - 'school|学校' => 'require|number', - 'ruxuenian|年级' => 'require|number', - 'bjsum|班级数' => 'require|number' - ]; - - /** - * 定义错误信息 - * 格式:'字段名.规则名' => '错误信息' - * - * @var array - */ - protected $message = []; -} diff --git a/application/teach/validate/Subject.php b/application/teach/validate/Subject.php deleted file mode 100644 index c934c7db..00000000 --- a/application/teach/validate/Subject.php +++ /dev/null @@ -1,30 +0,0 @@ - ['规则1','规则2'...] - * - * @var array - */ - protected $rule = [ - 'title|名称' => 'require|length:1,25', - 'jiancheng|简称' => 'require|length:1,6', - 'lieming|列标识' => 'require', - 'category|分类' => 'require|number', - 'paixu|排序' => 'number', - ]; - - /** - * 定义错误信息 - * 格式:'字段名.规则名' => '错误信息' - * - * @var array - */ - protected $message = []; -} diff --git a/application/teach/validate/Xueqi.php b/application/teach/validate/Xueqi.php deleted file mode 100644 index fa750332..00000000 --- a/application/teach/validate/Xueqi.php +++ /dev/null @@ -1,30 +0,0 @@ - ['规则1','规则2'...] - * - * @var array - */ - protected $rule = [ - 'title|标题' => 'require|length:2,25', - 'xuenian|学年' => 'require|length:1,15', - 'category|分类' => 'require|number', - 'bfdate|时间' => 'require|date', - 'enddate|时间' => 'require|date', - ]; - - /** - * 定义错误信息 - * 格式:'字段名.规则名' => '错误信息' - * - * @var array - */ - protected $message = []; -} diff --git a/application/teach/view/banji/create.html b/application/teach/view/banji/create.html deleted file mode 100644 index 7f0e43d6..00000000 --- a/application/teach/view/banji/create.html +++ /dev/null @@ -1,55 +0,0 @@ -{extend name="common@create" /} - -{block name="form"} -
-
- -
- {php} $schoollist = schlist('校级','校级');{/php} - -
-
-
- -
- -
-
-
- -
- -
-
-
- -
-
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/teach/view/banji/index.html b/application/teach/view/banji/index.html deleted file mode 100644 index 58cbf1f1..00000000 --- a/application/teach/view/banji/index.html +++ /dev/null @@ -1,130 +0,0 @@ - -{extend name="common@list" /} -{block name="jsset"} - -{/block} -{block name="nav"} - - 教务管理 - 班级管理 - 班级列表 - -{/block} -{block name="search"} -
- -
- -
-
-
- -
- {php} - $schoollist = schlist('校级','校级'); - {/php} - - {volist name="schoollist" id="vo"} - - {/volist} -
-
-
- -
- - {foreach :nianjiList() as $key=>$vo } - - {/foreach} -
-
-{/block} -{block name="table"} -
-{/block} -{block name="myjs"} - - - - - - -{/block} \ No newline at end of file diff --git a/application/teach/view/subject/create.html b/application/teach/view/subject/create.html deleted file mode 100644 index 1cc40c4a..00000000 --- a/application/teach/view/subject/create.html +++ /dev/null @@ -1,93 +0,0 @@ -{extend name="common@create" /} - -{block name="form"} -
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- {php} $category = getCategory(110);{/php} - -
-
-
- -
- - -
-
-
- -
- -
-
-
- -
-
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/teach/view/subject/index.html b/application/teach/view/subject/index.html deleted file mode 100644 index 7fb061ce..00000000 --- a/application/teach/view/subject/index.html +++ /dev/null @@ -1,102 +0,0 @@ - -{extend name="common@list" /} -{block name="jsset"} - -{/block} -{block name="nav"} - - 系统管理 - 教务管理 - 学科列表 - -{/block} -{block name="search"} -
- -
- -
-
-{/block} -{block name="table"} -
-{/block} -{block name="myjs"} - - - - - - - -{/block} \ No newline at end of file diff --git a/application/teach/view/xueqi/create.html b/application/teach/view/xueqi/create.html deleted file mode 100644 index 7fd22178..00000000 --- a/application/teach/view/xueqi/create.html +++ /dev/null @@ -1,86 +0,0 @@ -{extend name="common@create" /} - -{block name="form"} -
-
- -
- -
-
-
- -
- -
-
-
- -
- {php} $category = getCategory(108);{/php} - -
-
-
-
- -
- -
-
- -
-
-
-
- -
-
-{/block} - -{block name="myjs"} - -{/block} - diff --git a/application/teach/view/xueqi/index.html b/application/teach/view/xueqi/index.html deleted file mode 100644 index 2e5f88ce..00000000 --- a/application/teach/view/xueqi/index.html +++ /dev/null @@ -1,102 +0,0 @@ - -{extend name="common@list" /} -{block name="jsset"} - -{/block} -{block name="nav"} - - 系统管理 - 教务管理 - 学期列表 - -{/block} -{block name="search"} -
- -
- -
-
-{/block} -{block name="table"} -
-{/block} -{block name="myjs"} - - - - - - -{/block} \ No newline at end of file diff --git a/build.php b/build.php deleted file mode 100644 index 34ba3c84..00000000 --- a/build.php +++ /dev/null @@ -1,26 +0,0 @@ - -// +---------------------------------------------------------------------- - -return [ - // 生成应用公共文件 - '__file__' => ['common.php'], - - // 定义demo模块的自动生成 (按照实际定义的文件名生成) - 'demo' => [ - '__file__' => ['common.php'], - '__dir__' => ['behavior', 'controller', 'model', 'view'], - 'controller' => ['Index', 'Test', 'UserType'], - 'model' => ['User', 'UserType'], - 'view' => ['index/index'], - ], - - // 其他更多的模块定义 -]; diff --git a/composer.json b/composer.json deleted file mode 100644 index 366a2f31..00000000 --- a/composer.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "topthink/think", - "description": "the new thinkphp framework", - "type": "project", - "keywords": [ - "framework", - "thinkphp", - "ORM" - ], - "homepage": "http://thinkphp.cn/", - "license": "Apache-2.0", - "authors": [ - { - "name": "liu21st", - "email": "liu21st@gmail.com" - } - ], - "require": { - "php": ">=5.6.0", - "topthink/framework": "5.1.*", - "topthink/think-migration": "^2.0", - "php4world/auth": "^1.0", - "topthink/think-captcha": "^2.0", - "whitehat101/apr1-md5": "^1.0", - "topthink/think-helper": "^1.0", - "phpoffice/phpspreadsheet": "^1.5", - "phpoffice/phpword": "^0.15.0", - "endroid/qr-code": "^3.4" - }, - "autoload": { - "psr-4": { - "app\\": "application" - } - }, - "extra": { - "think-path": "thinkphp" - }, - "config": { - "preferred-install": "dist" - } -} diff --git a/composer.lock b/composer.lock deleted file mode 100644 index 3519cdb0..00000000 --- a/composer.lock +++ /dev/null @@ -1,1402 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "3ac5af7f55f26be7998237dfaf297a3c", - "packages": [ - { - "name": "bacon/bacon-qr-code", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/Bacon/BaconQrCode.git", - "reference": "5a91b62b9d37cee635bbf8d553f4546057250bee" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/5a91b62b9d37cee635bbf8d553f4546057250bee", - "reference": "5a91b62b9d37cee635bbf8d553f4546057250bee", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-iconv": "*", - "php": "^5.4|^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8" - }, - "suggest": { - "ext-gd": "to generate QR code images" - }, - "type": "library", - "autoload": { - "psr-0": { - "BaconQrCode": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-2-Clause" - ], - "authors": [ - { - "name": "Ben Scholzen 'DASPRiD'", - "email": "mail@dasprids.de", - "homepage": "http://www.dasprids.de", - "role": "Developer" - } - ], - "description": "BaconQrCode is a QR code generator for PHP.", - "homepage": "https://github.com/Bacon/BaconQrCode", - "time": "2017-10-17T09:59:25+00:00" - }, - { - "name": "endroid/installer", - "version": "1.0.7", - "source": { - "type": "git", - "url": "https://github.com/endroid/installer.git", - "reference": "2db0498b3a1cdb95db75309ea3087739f8017e62" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/endroid/installer/zipball/2db0498b3a1cdb95db75309ea3087739f8017e62", - "reference": "2db0498b3a1cdb95db75309ea3087739f8017e62", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "composer-plugin-api": "^1.1", - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^5.7|^6.0" - }, - "type": "composer-plugin", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "class": "Endroid\\Installer\\Installer" - }, - "autoload": { - "psr-4": { - "Endroid\\Installer\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jeroen van den Enden", - "email": "info@endroid.nl" - } - ], - "time": "2018-10-13T18:47:03+00:00" - }, - { - "name": "endroid/qr-code", - "version": "3.4.9", - "source": { - "type": "git", - "url": "https://github.com/endroid/qr-code.git", - "reference": "4752fc7cc7f658c17049919af33872e9b7d5e64d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/endroid/qr-code/zipball/4752fc7cc7f658c17049919af33872e9b7d5e64d", - "reference": "4752fc7cc7f658c17049919af33872e9b7d5e64d", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "bacon/bacon-qr-code": "^1.0.3", - "endroid/installer": "^1.0.3", - "ext-gd": "*", - "khanamiryan/qrcode-detector-decoder": "^1.0.2", - "myclabs/php-enum": "^1.5", - "php": ">=7.1", - "symfony/options-resolver": "^2.7|^3.0|^4.0", - "symfony/property-access": "^2.7|^3.0|^4.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7|^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Endroid\\QrCode\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jeroen van den Enden", - "email": "info@endroid.nl" - } - ], - "description": "Endroid QR Code", - "homepage": "https://github.com/endroid/qr-code", - "keywords": [ - "bundle", - "code", - "endroid", - "php", - "qr", - "qrcode" - ], - "time": "2018-11-26T11:53:30+00:00" - }, - { - "name": "khanamiryan/qrcode-detector-decoder", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/khanamiryan/php-qrcode-detector-decoder.git", - "reference": "a75482d3bc804e3f6702332bfda6cccbb0dfaa76" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/khanamiryan/php-qrcode-detector-decoder/zipball/a75482d3bc804e3f6702332bfda6cccbb0dfaa76", - "reference": "a75482d3bc804e3f6702332bfda6cccbb0dfaa76", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^5.6|^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7" - }, - "type": "library", - "autoload": { - "psr-4": { - "Zxing\\": "lib/" - }, - "files": [ - "lib/Common/customFunctions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ashot Khanamiryan", - "email": "a.khanamiryan@gmail.com", - "homepage": "https://github.com/khanamiryan", - "role": "Developer" - } - ], - "description": "QR code decoder / reader", - "homepage": "https://github.com/khanamiryan/php-qrcode-detector-decoder/", - "keywords": [ - "barcode", - "qr", - "zxing" - ], - "time": "2018-04-26T11:41:33+00:00" - }, - { - "name": "markbaker/complex", - "version": "1.4.7", - "source": { - "type": "git", - "url": "https://github.com/MarkBaker/PHPComplex.git", - "reference": "1ea674a8308baf547cbcbd30c5fcd6d301b7c000" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/1ea674a8308baf547cbcbd30c5fcd6d301b7c000", - "reference": "1ea674a8308baf547cbcbd30c5fcd6d301b7c000", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^5.6.0|^7.0.0" - }, - "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3", - "phpcompatibility/php-compatibility": "^8.0", - "phpdocumentor/phpdocumentor": "2.*", - "phploc/phploc": "2.*", - "phpmd/phpmd": "2.*", - "phpunit/phpunit": "^4.8.35|^5.4.0", - "sebastian/phpcpd": "2.*", - "squizlabs/php_codesniffer": "^3.3.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Complex\\": "classes/src/" - }, - "files": [ - "classes/src/functions/abs.php", - "classes/src/functions/acos.php", - "classes/src/functions/acosh.php", - "classes/src/functions/acot.php", - "classes/src/functions/acoth.php", - "classes/src/functions/acsc.php", - "classes/src/functions/acsch.php", - "classes/src/functions/argument.php", - "classes/src/functions/asec.php", - "classes/src/functions/asech.php", - "classes/src/functions/asin.php", - "classes/src/functions/asinh.php", - "classes/src/functions/atan.php", - "classes/src/functions/atanh.php", - "classes/src/functions/conjugate.php", - "classes/src/functions/cos.php", - "classes/src/functions/cosh.php", - "classes/src/functions/cot.php", - "classes/src/functions/coth.php", - "classes/src/functions/csc.php", - "classes/src/functions/csch.php", - "classes/src/functions/exp.php", - "classes/src/functions/inverse.php", - "classes/src/functions/ln.php", - "classes/src/functions/log2.php", - "classes/src/functions/log10.php", - "classes/src/functions/negative.php", - "classes/src/functions/pow.php", - "classes/src/functions/rho.php", - "classes/src/functions/sec.php", - "classes/src/functions/sech.php", - "classes/src/functions/sin.php", - "classes/src/functions/sinh.php", - "classes/src/functions/sqrt.php", - "classes/src/functions/tan.php", - "classes/src/functions/tanh.php", - "classes/src/functions/theta.php", - "classes/src/operations/add.php", - "classes/src/operations/subtract.php", - "classes/src/operations/multiply.php", - "classes/src/operations/divideby.php", - "classes/src/operations/divideinto.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mark Baker", - "email": "mark@lange.demon.co.uk" - } - ], - "description": "PHP Class for working with complex numbers", - "homepage": "https://github.com/MarkBaker/PHPComplex", - "keywords": [ - "complex", - "mathematics" - ], - "time": "2018-10-13T23:28:42+00:00" - }, - { - "name": "myclabs/php-enum", - "version": "1.6.4", - "source": { - "type": "git", - "url": "https://github.com/myclabs/php-enum.git", - "reference": "550d2334d77f91b0816a5cbd6965272fe20146b8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/php-enum/zipball/550d2334d77f91b0816a5cbd6965272fe20146b8", - "reference": "550d2334d77f91b0816a5cbd6965272fe20146b8", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.4" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35|^5.7|^6.0", - "squizlabs/php_codesniffer": "1.*" - }, - "type": "library", - "autoload": { - "psr-4": { - "MyCLabs\\Enum\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP Enum contributors", - "homepage": "https://github.com/myclabs/php-enum/graphs/contributors" - } - ], - "description": "PHP Enum implementation", - "homepage": "http://github.com/myclabs/php-enum", - "keywords": [ - "enum" - ], - "time": "2018-10-30T14:36:18+00:00" - }, - { - "name": "pclzip/pclzip", - "version": "2.8.2", - "source": { - "type": "git", - "url": "https://github.com/ivanlanin/pclzip.git", - "reference": "19dd1de9d3f5fc4d7d70175b4c344dee329f45fd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ivanlanin/pclzip/zipball/19dd1de9d3f5fc4d7d70175b4c344dee329f45fd", - "reference": "19dd1de9d3f5fc4d7d70175b4c344dee329f45fd", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "type": "library", - "autoload": { - "classmap": [ - "pclzip.lib.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-2.1" - ], - "authors": [ - { - "name": "Vincent Blavet" - } - ], - "description": "A PHP library that offers compression and extraction functions for Zip formatted archives", - "homepage": "http://www.phpconcept.net/pclzip", - "keywords": [ - "php", - "zip" - ], - "time": "2014-06-05T11:42:24+00:00" - }, - { - "name": "php4world/auth", - "version": "v1.0.3", - "source": { - "type": "git", - "url": "https://github.com/php4world/auth.git", - "reference": "e356cad8de77c3e27f78875685b309d561c0fa94" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php4world/auth/zipball/e356cad8de77c3e27f78875685b309d561c0fa94", - "reference": "e356cad8de77c3e27f78875685b309d561c0fa94", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "topthink/framework": "5.1.*" - }, - "type": "library", - "autoload": { - "psr-4": { - "php4world\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "php4world", - "email": "76422937@qq.com" - } - ], - "description": "ThinkPHP5.1 Auth Class.", - "time": "2018-06-30T09:39:06+00:00" - }, - { - "name": "phpoffice/common", - "version": "0.2.9", - "source": { - "type": "git", - "url": "https://github.com/PHPOffice/Common.git", - "reference": "edb5d32b1e3400a35a5c91e2539ed6f6ce925e4d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHPOffice/Common/zipball/edb5d32b1e3400a35a5c91e2539ed6f6ce925e4d", - "reference": "edb5d32b1e3400a35a5c91e2539ed6f6ce925e4d", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "pclzip/pclzip": "^2.8", - "php": ">=5.3.0" - }, - "require-dev": { - "phpdocumentor/phpdocumentor": "2.*", - "phploc/phploc": "2.*", - "phpmd/phpmd": "2.*", - "phpunit/phpunit": "^4.8.36 || ^7.0", - "sebastian/phpcpd": "2.*", - "squizlabs/php_codesniffer": "2.*" - }, - "type": "library", - "autoload": { - "psr-4": { - "PhpOffice\\Common\\": "src/Common/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL" - ], - "authors": [ - { - "name": "Mark Baker" - }, - { - "name": "Franck Lefevre", - "homepage": "http://rootslabs.net" - } - ], - "description": "PHPOffice Common", - "homepage": "http://phpoffice.github.io", - "keywords": [ - "common", - "component", - "office", - "php" - ], - "time": "2018-07-13T14:12:34+00:00" - }, - { - "name": "phpoffice/phpspreadsheet", - "version": "1.5.0", - "source": { - "type": "git", - "url": "https://github.com/PHPOffice/PhpSpreadsheet.git", - "reference": "2dfd06c59825914a1a325f2a2ed13634b9d8c411" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/2dfd06c59825914a1a325f2a2ed13634b9d8c411", - "reference": "2dfd06c59825914a1a325f2a2ed13634b9d8c411", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-ctype": "*", - "ext-dom": "*", - "ext-gd": "*", - "ext-iconv": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-simplexml": "*", - "ext-xml": "*", - "ext-xmlreader": "*", - "ext-xmlwriter": "*", - "ext-zip": "*", - "ext-zlib": "*", - "markbaker/complex": "^1.4.1", - "php": "^5.6|^7.0", - "psr/simple-cache": "^1.0" - }, - "require-dev": { - "dompdf/dompdf": "^0.8.0", - "friendsofphp/php-cs-fixer": "@stable", - "jpgraph/jpgraph": "^4.0", - "mpdf/mpdf": "^7.0.0", - "phpunit/phpunit": "^5.7", - "squizlabs/php_codesniffer": "^3.3", - "tecnickcom/tcpdf": "^6.2" - }, - "suggest": { - "dompdf/dompdf": "Option for rendering PDF with PDF Writer", - "jpgraph/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers", - "mpdf/mpdf": "Option for rendering PDF with PDF Writer", - "tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer" - }, - "type": "library", - "autoload": { - "psr-4": { - "PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-2.1-or-later" - ], - "authors": [ - { - "name": "Maarten Balliauw", - "homepage": "http://blog.maartenballiauw.be" - }, - { - "name": "Erik Tilt" - }, - { - "name": "Franck Lefevre", - "homepage": "http://rootslabs.net" - }, - { - "name": "Mark Baker", - "homepage": "http://markbakeruk.net" - } - ], - "description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine", - "homepage": "https://github.com/PHPOffice/PhpSpreadsheet", - "keywords": [ - "OpenXML", - "excel", - "gnumeric", - "ods", - "php", - "spreadsheet", - "xls", - "xlsx" - ], - "time": "2018-10-21T10:04:54+00:00" - }, - { - "name": "phpoffice/phpword", - "version": "0.15.0", - "source": { - "type": "git", - "url": "https://github.com/PHPOffice/PHPWord.git", - "reference": "dfa2f36cad2b632b7ab1c56473e4f5db9a7caf7f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHPOffice/PHPWord/zipball/dfa2f36cad2b632b7ab1c56473e4f5db9a7caf7f", - "reference": "dfa2f36cad2b632b7ab1c56473e4f5db9a7caf7f", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-xml": "*", - "php": "^5.3.3 || ^7.0", - "phpoffice/common": "^0.2.9", - "zendframework/zend-escaper": "^2.2" - }, - "require-dev": { - "dompdf/dompdf": "0.8.*", - "ext-gd": "*", - "ext-zip": "*", - "friendsofphp/php-cs-fixer": "^2.2", - "mpdf/mpdf": "5.7.4 || 6.* || 7.*", - "php-coveralls/php-coveralls": "1.1.0 || ^2.0", - "phploc/phploc": "2.* || 3.* || 4.*", - "phpmd/phpmd": "2.*", - "phpunit/phpunit": "^4.8.36 || ^7.0", - "squizlabs/php_codesniffer": "^2.9", - "tecnickcom/tcpdf": "6.*" - }, - "suggest": { - "dompdf/dompdf": "Allows writing PDF", - "ext-gd2": "Allows adding images", - "ext-xmlwriter": "Allows writing OOXML and ODF", - "ext-xsl": "Allows applying XSL style sheet to headers, to main document part, and to footers of an OOXML template", - "ext-zip": "Allows writing OOXML and ODF" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-develop": "0.16-dev" - } - }, - "autoload": { - "psr-4": { - "PhpOffice\\PhpWord\\": "src/PhpWord" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-3.0" - ], - "authors": [ - { - "name": "Mark Baker" - }, - { - "name": "Gabriel Bull", - "email": "me@gabrielbull.com", - "homepage": "http://gabrielbull.com/" - }, - { - "name": "Ivan Lanin", - "homepage": "http://ivan.lanin.org" - }, - { - "name": "Roman Syroeshko", - "homepage": "http://ru.linkedin.com/pub/roman-syroeshko/34/a53/994/" - }, - { - "name": "Franck Lefevre", - "homepage": "https://rootslabs.net/blog/" - }, - { - "name": "Antoine de Troostembergh" - } - ], - "description": "PHPWord - A pure PHP library for reading and writing word processing documents (OOXML, ODF, RTF, HTML, PDF)", - "homepage": "http://phpoffice.github.io", - "keywords": [ - "ISO IEC 29500", - "OOXML", - "Office Open XML", - "OpenDocument", - "OpenXML", - "PhpOffice", - "PhpWord", - "Rich Text Format", - "WordprocessingML", - "doc", - "docx", - "html", - "odf", - "odt", - "office", - "pdf", - "php", - "reader", - "rtf", - "template", - "template processor", - "word", - "writer" - ], - "time": "2018-07-14T16:59:43+00:00" - }, - { - "name": "psr/simple-cache", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/simple-cache.git", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\SimpleCache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interfaces for simple caching", - "keywords": [ - "cache", - "caching", - "psr", - "psr-16", - "simple-cache" - ], - "time": "2017-10-23T01:57:42+00:00" - }, - { - "name": "symfony/inflector", - "version": "v4.1.8", - "source": { - "type": "git", - "url": "https://github.com/symfony/inflector.git", - "reference": "8da789363973920dd7df6753822810592138e5ba" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/inflector/zipball/8da789363973920dd7df6753822810592138e5ba", - "reference": "8da789363973920dd7df6753822810592138e5ba", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^7.1.3", - "symfony/polyfill-ctype": "~1.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Inflector\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Inflector Component", - "homepage": "https://symfony.com", - "keywords": [ - "inflection", - "pluralize", - "singularize", - "string", - "symfony", - "words" - ], - "time": "2018-11-11T19:51:29+00:00" - }, - { - "name": "symfony/options-resolver", - "version": "v4.1.8", - "source": { - "type": "git", - "url": "https://github.com/symfony/options-resolver.git", - "reference": "31e5523373cb06163079ef46d0a2d507d70fe064" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/31e5523373cb06163079ef46d0a2d507d70fe064", - "reference": "31e5523373cb06163079ef46d0a2d507d70fe064", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\OptionsResolver\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony OptionsResolver Component", - "homepage": "https://symfony.com", - "keywords": [ - "config", - "configuration", - "options" - ], - "time": "2018-11-11T19:51:29+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.10.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", - "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - }, - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "time": "2018-08-06T14:22:27+00:00" - }, - { - "name": "symfony/property-access", - "version": "v4.1.8", - "source": { - "type": "git", - "url": "https://github.com/symfony/property-access.git", - "reference": "10edb6c4b6f496a2ed40a788ebbd280b421985ae" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/property-access/zipball/10edb6c4b6f496a2ed40a788ebbd280b421985ae", - "reference": "10edb6c4b6f496a2ed40a788ebbd280b421985ae", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^7.1.3", - "symfony/inflector": "~3.4|~4.0" - }, - "require-dev": { - "symfony/cache": "~3.4|~4.0" - }, - "suggest": { - "psr/cache-implementation": "To cache access methods." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\PropertyAccess\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony PropertyAccess Component", - "homepage": "https://symfony.com", - "keywords": [ - "access", - "array", - "extraction", - "index", - "injection", - "object", - "property", - "property path", - "reflection" - ], - "time": "2018-11-26T12:16:25+00:00" - }, - { - "name": "topthink/framework", - "version": "v5.1.39", - "source": { - "type": "git", - "url": "https://github.com/top-think/framework.git", - "reference": "5762858f3d58faafb3a39427f8788884b2927007" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/top-think/framework/zipball/5762858f3d58faafb3a39427f8788884b2927007", - "reference": "5762858f3d58faafb3a39427f8788884b2927007", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.6.0", - "topthink/think-installer": "2.*" - }, - "require-dev": { - "johnkary/phpunit-speedtrap": "^1.0", - "mikey179/vfsstream": "~1.6", - "phpdocumentor/reflection-docblock": "^2.0", - "phploc/phploc": "2.*", - "phpunit/phpunit": "^5.0|^6.0", - "sebastian/phpcpd": "2.*", - "squizlabs/php_codesniffer": "2.*" - }, - "type": "think-framework", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "liu21st", - "email": "liu21st@gmail.com" - }, - { - "name": "yunwuxin", - "email": "448901948@qq.com" - } - ], - "description": "the new thinkphp framework", - "homepage": "http://thinkphp.cn/", - "keywords": [ - "framework", - "orm", - "thinkphp" - ], - "time": "2019-11-17T23:22:02+00:00" - }, - { - "name": "topthink/think-captcha", - "version": "v2.0.2", - "source": { - "type": "git", - "url": "https://github.com/top-think/think-captcha.git", - "reference": "54c8a51552f99ff9ea89ea9c272383a8f738ceee" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/top-think/think-captcha/zipball/54c8a51552f99ff9ea89ea9c272383a8f738ceee", - "reference": "54c8a51552f99ff9ea89ea9c272383a8f738ceee", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "topthink/framework": "5.1.*" - }, - "type": "library", - "autoload": { - "psr-4": { - "think\\captcha\\": "src/" - }, - "files": [ - "src/helper.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "yunwuxin", - "email": "448901948@qq.com" - } - ], - "description": "captcha package for thinkphp5", - "time": "2017-12-31T16:37:49+00:00" - }, - { - "name": "topthink/think-helper", - "version": "v1.0.6", - "source": { - "type": "git", - "url": "https://github.com/top-think/think-helper.git", - "reference": "0c99dc625b0d2d4124e1b6ca15a3ad6f0125963f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/top-think/think-helper/zipball/0c99dc625b0d2d4124e1b6ca15a3ad6f0125963f", - "reference": "0c99dc625b0d2d4124e1b6ca15a3ad6f0125963f", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "type": "library", - "autoload": { - "psr-4": { - "think\\helper\\": "src" - }, - "files": [ - "src/helper.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "yunwuxin", - "email": "448901948@qq.com" - } - ], - "description": "The ThinkPHP5 Helper Package", - "time": "2017-04-05T07:15:37+00:00" - }, - { - "name": "topthink/think-installer", - "version": "v2.0.0", - "source": { - "type": "git", - "url": "https://github.com/top-think/think-installer.git", - "reference": "f5400a12c60e513911aef41fe443fa6920952675" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/top-think/think-installer/zipball/f5400a12c60e513911aef41fe443fa6920952675", - "reference": "f5400a12c60e513911aef41fe443fa6920952675", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "composer-plugin-api": "^1.0" - }, - "require-dev": { - "composer/composer": "1.0.*@dev" - }, - "type": "composer-plugin", - "extra": { - "class": "think\\composer\\Plugin" - }, - "autoload": { - "psr-4": { - "think\\composer\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "yunwuxin", - "email": "448901948@qq.com" - } - ], - "time": "2018-05-11T06:45:42+00:00" - }, - { - "name": "topthink/think-migration", - "version": "v2.0.3", - "source": { - "type": "git", - "url": "https://github.com/top-think/think-migration.git", - "reference": "70c89850ca29c2eab988c7c3475d1d5331901bb8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/top-think/think-migration/zipball/70c89850ca29c2eab988c7c3475d1d5331901bb8", - "reference": "70c89850ca29c2eab988c7c3475d1d5331901bb8", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "topthink/framework": "5.1.*" - }, - "type": "library", - "autoload": { - "psr-4": { - "Phinx\\": "phinx/src/Phinx", - "think\\migration\\": "src" - }, - "files": [ - "src/config.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "yunwuxin", - "email": "448901948@qq.com" - } - ], - "time": "2017-12-31T16:32:22+00:00" - }, - { - "name": "whitehat101/apr1-md5", - "version": "v1.0.0", - "source": { - "type": "git", - "url": "https://github.com/whitehat101/apr1-md5.git", - "reference": "8b261c9fc0481b4e9fa9d01c6ca70867b5d5e819" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/whitehat101/apr1-md5/zipball/8b261c9fc0481b4e9fa9d01c6ca70867b5d5e819", - "reference": "8b261c9fc0481b4e9fa9d01c6ca70867b5d5e819", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.3.0" - }, - "require-dev": { - "phpunit/phpunit": "4.0.*" - }, - "type": "library", - "autoload": { - "psr-4": { - "WhiteHat101\\Crypt\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jeremy Ebler", - "email": "jebler@gmail.com" - } - ], - "description": "Apache's APR1-MD5 algorithm in pure PHP", - "homepage": "https://github.com/whitehat101/apr1-md5", - "keywords": [ - "MD5", - "apr1" - ], - "time": "2015-02-11T11:06:42+00:00" - }, - { - "name": "zendframework/zend-escaper", - "version": "2.6.0", - "source": { - "type": "git", - "url": "https://github.com/zendframework/zend-escaper.git", - "reference": "31d8aafae982f9568287cb4dce987e6aff8fd074" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-escaper/zipball/31d8aafae982f9568287cb4dce987e6aff8fd074", - "reference": "31d8aafae982f9568287cb4dce987e6aff8fd074", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2", - "zendframework/zend-coding-standard": "~1.0.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6.x-dev", - "dev-develop": "2.7.x-dev" - } - }, - "autoload": { - "psr-4": { - "Zend\\Escaper\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "Securely and safely escape HTML, HTML attributes, JavaScript, CSS, and URLs", - "keywords": [ - "ZendFramework", - "escaper", - "zf" - ], - "time": "2018-04-25T15:48:53+00:00" - } - ], - "packages-dev": [], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": ">=5.6.0" - }, - "platform-dev": [] -} diff --git a/config/app.php b/config/app.php deleted file mode 100644 index 20d2bc29..00000000 --- a/config/app.php +++ /dev/null @@ -1,160 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 应用设置 -// +---------------------------------------------------------------------- - -return [ - // 应用名称 - 'app_name' => '', - // 应用地址 - 'app_host' => '', - // 应用调试模式 - 'app_debug' => true, - // 应用Trace - 'app_trace' => false, - // 是否支持多模块 - 'app_multi_module' => true, - // 入口自动绑定模块 - 'auto_bind_module' => false, - // 注册的根命名空间 - 'root_namespace' => [], - // 默认输出类型 - 'default_return_type' => 'html', - // 默认AJAX 数据返回格式,可选json xml ... - 'default_ajax_return' => 'json', - // 默认JSONP格式返回的处理方法 - 'default_jsonp_handler' => 'jsonpReturn', - // 默认JSONP处理方法 - 'var_jsonp_handler' => 'callback', - // 默认时区 - 'default_timezone' => 'Asia/Shanghai', - // 是否开启多语言 - 'lang_switch_on' => false, - // 默认全局过滤方法 用逗号分隔多个 - 'default_filter' => '', - // 默认语言 - 'default_lang' => 'zh-cn', - // 应用类库后缀 - 'class_suffix' => false, - // 控制器类后缀 - 'controller_suffix' => false, - - // +---------------------------------------------------------------------- - // | 模块设置 - // +---------------------------------------------------------------------- - - // 默认模块名 - 'default_module' => 'index', - // 禁止访问模块 - 'deny_module_list' => ['common'], - // 默认控制器名 - 'default_controller' => 'Index', - // 默认操作名 - 'default_action' => 'index', - // 默认验证器 - 'default_validate' => '', - // 默认的空模块名 - 'empty_module' => 'home', - // 默认的空控制器名 - 'empty_controller' => 'Error', - // 操作方法前缀 - 'use_action_prefix' => false, - // 操作方法后缀 - 'action_suffix' => '', - // 自动搜索控制器 - 'controller_auto_search' => false, - - // +---------------------------------------------------------------------- - // | URL设置 - // +---------------------------------------------------------------------- - - // PATHINFO变量名 用于兼容模式 - 'var_pathinfo' => 's', - // 兼容PATH_INFO获取 - 'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'], - // pathinfo分隔符 - 'pathinfo_depr' => '/', - // HTTPS代理标识 - 'https_agent_name' => '', - // IP代理获取标识 - 'http_agent_ip' => 'X-REAL-IP', - // URL伪静态后缀 - 'url_html_suffix' => 'html', - // URL普通方式参数 用于自动生成 - 'url_common_param' => false, - // URL参数方式 0 按名称成对解析 1 按顺序解析 - 'url_param_type' => 0, - // 是否开启路由延迟解析 - 'url_lazy_route' => false, - // 是否强制使用路由 - 'url_route_must' => false, - // 合并路由规则 - 'route_rule_merge' => false, - // 路由是否完全匹配 - 'route_complete_match' => false, - // 使用注解路由 - 'route_annotation' => false, - // 域名根,如thinkphp.cn - 'url_domain_root' => '', - // 是否自动转换URL中的控制器和操作名 - 'url_convert' => true, - // 默认的访问控制器层 - 'url_controller_layer' => 'controller', - // 表单请求类型伪装变量 - 'var_method' => '_method', - // 表单ajax伪装变量 - 'var_ajax' => '_ajax', - // 表单pjax伪装变量 - 'var_pjax' => '_pjax', - // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则 - 'request_cache' => false, - // 请求缓存有效期 - 'request_cache_expire' => null, - // 全局请求缓存排除规则 - 'request_cache_except' => [], - // 是否开启路由缓存 - 'route_check_cache' => false, - // 路由缓存的Key自定义设置(闭包),默认为当前URL和请求类型的md5 - 'route_check_cache_key' => '', - // 路由缓存类型及参数 - 'route_cache_option' => [], - - // 默认跳转页面对应的模板文件 - 'dispatch_success_tmpl' => Env::get('think_path') . '../public/error/success.tpl', - 'dispatch_error_tmpl' => Env::get('think_path') . '../public/error/error.tpl', - - // 异常页面的模板文件 - 'exception_tmpl' => Env::get('think_path') . 'tpl/think_exception.tpl', - - // 错误显示信息,非调试模式有效 - 'error_message' => '页面错误!请稍后再试~', - // 显示错误信息 - 'show_error_msg' => false, - // 异常处理handle类 留空使用 \think\exception\Handle - 'exception_handle' => '', - // 版本号 - 'chengji' => [ - 'version' => '1.5', - ], - // Auth权限验证公共配置 - 'auth' => [ - 'auth_on' => 1, // 权限开关 - 'auth_type' => 1, // 认证方式,1为实时认证;2为登录认证。 - 'auth_group' => 'cj_auth_group', // 用户组数据不带前缀表名 - 'auth_group_access' => 'cj_auth_group_access', // 用户-用户组关系不带前缀表 - 'auth_rule' => 'cj_auth_rule', // 权限规则不带前缀表 - 'auth_user' => 'cj_member', // 用户信息不带前缀表 - 'administrator' => [1,2], // 超级管理员列表 - ], - -]; diff --git a/config/cache.php b/config/cache.php deleted file mode 100644 index 985dbb1c..00000000 --- a/config/cache.php +++ /dev/null @@ -1,25 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 缓存设置 -// +---------------------------------------------------------------------- - -return [ - // 驱动方式 - 'type' => 'File', - // 缓存保存目录 - 'path' => '', - // 缓存前缀 - 'prefix' => '', - // 缓存有效期 0表示永久缓存 - 'expire' => 0, -]; diff --git a/config/chengji/app.php b/config/chengji/app.php deleted file mode 100644 index 3779064a..00000000 --- a/config/chengji/app.php +++ /dev/null @@ -1,5 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 控制台配置 -// +---------------------------------------------------------------------- -return [ - 'name' => 'Think Console', - 'version' => '0.1', - 'user' => null, - 'auto_path' => env('app_path') . 'command' . DIRECTORY_SEPARATOR, -]; diff --git a/config/cookie.php b/config/cookie.php deleted file mode 100644 index 02f9935d..00000000 --- a/config/cookie.php +++ /dev/null @@ -1,30 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | Cookie设置 -// +---------------------------------------------------------------------- -return [ - // cookie 名称前缀 - 'prefix' => 'think_', - // cookie 保存时间 - 'expire' => 259200, - // cookie 保存路径 - 'path' => '/', - // cookie 有效域名 - 'domain' => '', - // cookie 启用安全传输 - 'secure' => false, - // httponly设置 - 'httponly' => '', - // 是否使用 setcookie - 'setcookie' => true, -]; diff --git a/config/database.php b/config/database.php deleted file mode 100644 index b558421f..00000000 --- a/config/database.php +++ /dev/null @@ -1,63 +0,0 @@ - -// +---------------------------------------------------------------------- - -return [ - // 数据库类型 - 'type' => 'mysql', - // 服务器地址 - 'hostname' => '127.0.0.1', - // 数据库名 - 'database' => 'chengji', - // 用户名 - 'username' => 'root', - // 密码 - 'password' => '', - // 端口 - 'hostport' => '', - // 连接dsn - 'dsn' => '', - // 数据库连接参数 - 'params' => [], - // 数据库编码默认采用utf8 - 'charset' => 'utf8', - // 数据库表前缀 - 'prefix' => 'cj_', - // 数据库调试模式 - 'debug' => true, - // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) - 'deploy' => 0, - // 数据库读写是否分离 主从式有效 - 'rw_separate' => false, - // 读写分离后 主服务器数量 - 'master_num' => 1, - // 指定从服务器序号 - 'slave_no' => '', - // 自动读取主库数据 - 'read_master' => false, - // 是否严格检查字段是否存在 - 'fields_strict' => true, - // 数据集返回类型 - 'resultset_type' => 'array', - // 自动写入时间戳字段 - 'auto_timestamp' => false, - // 时间字段取出后的默认时间格式 - 'datetime_format' => 'Y-m-d H:i:s', - // 是否需要进行SQL性能分析 - 'sql_explain' => false, - // Builder类 - 'builder' => '', - // Query类 - 'query' => '\\think\\db\\Query', - // 是否需要断线重连 - 'break_reconnect' => false, - // 断线标识字符串 - 'break_match_str' => [], -]; diff --git a/config/kaoshi/app.php b/config/kaoshi/app.php deleted file mode 100644 index 3779064a..00000000 --- a/config/kaoshi/app.php +++ /dev/null @@ -1,5 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 日志设置 -// +---------------------------------------------------------------------- -return [ - // 日志记录方式,内置 file socket 支持扩展 - 'type' => 'File', - // 日志保存目录 - 'path' => '', - // 日志记录级别 - 'level' => [], - // 单文件日志写入 - 'single' => false, - // 独立日志级别 - 'apart_level' => [], - // 最大日志文件数量 - 'max_files' => 0, - // 是否关闭日志写入 - 'close' => false, -]; diff --git a/config/middleware.php b/config/middleware.php deleted file mode 100644 index fe15ec3d..00000000 --- a/config/middleware.php +++ /dev/null @@ -1,18 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 中间件配置 -// +---------------------------------------------------------------------- -return [ - // 默认中间件命名空间 - 'default_namespace' => 'app\\http\\middleware\\', -]; diff --git a/config/renshi/app.php b/config/renshi/app.php deleted file mode 100644 index 3779064a..00000000 --- a/config/renshi/app.php +++ /dev/null @@ -1,5 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 会话设置 -// +---------------------------------------------------------------------- - -return [ - 'id' => '', - // SESSION_ID的提交变量,解决flash上传跨域 - 'var_session_id' => '', - // SESSION 前缀 - 'prefix' => 'think', - // 驱动方式 支持redis memcache memcached - 'type' => '', - // 是否自动开启 SESSION - 'auto_start' => true, - // 过期时间 - 'expire' => 10800, -]; diff --git a/config/shcool/app.php b/config/shcool/app.php deleted file mode 100644 index 3779064a..00000000 --- a/config/shcool/app.php +++ /dev/null @@ -1,5 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | 模板设置 -// +---------------------------------------------------------------------- - -return [ - // 模板引擎类型 支持 php think 支持扩展 - 'type' => 'Think', - // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法 - 'auto_rule' => 1, - // 模板路径 - 'view_path' => '', - // 模板后缀 - 'view_suffix' => 'html', - // 模板文件名分隔符 - 'view_depr' => DIRECTORY_SEPARATOR, - // 模板引擎普通标签开始标记 - 'tpl_begin' => '{', - // 模板引擎普通标签结束标记 - 'tpl_end' => '}', - // 标签库标签开始标记 - 'taglib_begin' => '{', - // 标签库标签结束标记 - 'taglib_end' => '}', - // 全局替换 - 'tpl_replace_string' => [ - '__UPLOAD__'=>'/uploads', - '__STATIC__'=>'/static', -] -]; diff --git a/config/test/app.php b/config/test/app.php deleted file mode 100644 index 3779064a..00000000 --- a/config/test/app.php +++ /dev/null @@ -1,5 +0,0 @@ - -// +---------------------------------------------------------------------- - -// +---------------------------------------------------------------------- -// | Trace设置 开启 app_trace 后 有效 -// +---------------------------------------------------------------------- -return [ - // 内置Html Console 支持扩展 - 'type' => 'Html', -]; diff --git a/database/migrations/20181010035225_system_base.php b/database/migrations/20181010035225_system_base.php deleted file mode 100644 index c16fee03..00000000 --- a/database/migrations/20181010035225_system_base.php +++ /dev/null @@ -1,46 +0,0 @@ -table('system_base'); - - // 给当前表添加字段 - $table - ->addColumn('create_time','integer',['limit'=>11,'null'=>false,'comment'=>'创建时间']) - ->addColumn('update_time','integer',['limit'=>11,'null'=>false,'comment'=>'更新时间']) - ->addColumn('webtitle','string',['limit'=>50,'null'=>false,'comment'=>'网站名称']) - ->addColumn('keywords','string',['limit'=>60,'null'=>false,'comment'=>'关键词']) - ->addColumn('description','string',['limit'=>100,'null'=>false,'comment'=>'网站说明']) - ->addColumn('thinks','string',['limit'=>80,'null'=>false,'comment'=>'网站感谢']) - ->addColumn('danwei','string',['limit'=>20,'null'=>false,'comment'=>'使用单位']) - ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) - ->create(); - } -} diff --git a/database/migrations/20181010075304_auth_group.php b/database/migrations/20181010075304_auth_group.php deleted file mode 100644 index df3ee077..00000000 --- a/database/migrations/20181010075304_auth_group.php +++ /dev/null @@ -1,44 +0,0 @@ -table('auth_group'); - - // 添加当前表字段 - $table - ->addColumn('title','string',['limit'=>100,'default'=>'','null'=>false,'comment'=>'用户组中文名称']) - ->addColumn('rules','string',['limit'=>10000,'default'=>'','null'=>false,'comment'=>'用户组拥有的规则id']) - ->addColumn('miaoshu','string',['limit'=>200,'default'=>'','null'=>false,'comment'=>'用户组功能描述']) - ->addColumn('status','boolean',['default'=>true,'null'=>false,'comment'=>'用户组状态']) - ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) - ->addIndex(array('title'), array('unique' => true)) - ->create(); - } -} diff --git a/database/migrations/20181010075517_auth_group_access.php b/database/migrations/20181010075517_auth_group_access.php deleted file mode 100644 index d0022844..00000000 --- a/database/migrations/20181010075517_auth_group_access.php +++ /dev/null @@ -1,41 +0,0 @@ -table('auth_group_access'); - - // 添加当前表字段 - $table - ->addColumn('uid','integer',['limit'=>11,'null'=>false,'comment'=>'用户id']) - ->addColumn('group_id','integer',['limit'=>11,'null'=>false,'comment'=>'用户组id']) - ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) - ->create(); - } -} diff --git a/database/migrations/20181010075553_auth_rule.php b/database/migrations/20181010075553_auth_rule.php deleted file mode 100644 index c6b6ed73..00000000 --- a/database/migrations/20181010075553_auth_rule.php +++ /dev/null @@ -1,49 +0,0 @@ -table('auth_rule'); - - // 添加当前表字段 - $table - ->addColumn('name','string',['limit'=>80,'null'=>false,'comment'=>'规则唯一标识']) - ->addColumn('title','string',['limit'=>80,'null'=>false,'comment'=>'规则中文名']) - ->addColumn('status','boolean',['default'=>1,'null'=>false,'comment'=>'规则状态']) - ->addColumn('condition','string',['limit'=>100,'null'=>true,'comment'=>'规则表达式']) - ->addColumn('paixu','integer',['limit'=>11,'default'=>999,'null'=>false,'comment'=>'排序']) - ->addColumn('ismenu','boolean',['limit'=>1,'default'=>0,'null'=>false,'comment'=>'是否是菜单']) - ->addColumn('font','string',['limit'=>40,'null'=>true,'comment'=>'菜单字体']) - ->addColumn('url','string',['limit'=>40,'null'=>true,'comment'=>'菜单地址']) - ->addColumn('pid','integer',['limit'=>3,'default'=>0,'null'=>true,'comment'=>'父ID']) - ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) - ->addIndex(array('name'), array('unique' => true)) - ->create(); - } -} diff --git a/database/migrations/20181012140355_member.php b/database/migrations/20181012140355_member.php deleted file mode 100644 index 6bbce953..00000000 --- a/database/migrations/20181012140355_member.php +++ /dev/null @@ -1,56 +0,0 @@ -table('admin'); - - // 添加当前表字段 - $table - ->addColumn('xingming','string',['limit'=>15,'null'=>false,'comment'=>'用户姓名']) - ->addColumn('sex','boolean',['limit'=>1,'default'=>'2','null'=>false,'comment'=>'0=女,1=男,2=未知']) - ->addColumn('shengri','integer',['limit'=>11,'null'=>true,'comment'=>'出生日期']) - ->addColumn('username','string',['limit'=>20,'null'=>false,'comment'=>'用户帐号']) - ->addColumn('password','string',['limit'=>37,'null'=>false,'comment'=>'登录密码']) - ->addColumn('school','integer',['limit'=>11,'null'=>false,'comment'=>'所在单位']) - ->addColumn('phone','string',['limit'=>11,'null'=>true,'comment'=>'联系方式']) - ->addColumn('denglucishu','integer',['limit'=>5,'default'=>0,'null'=>false,'comment'=>'登录次数']) - ->addColumn('lastip','string',['limit'=>55,'default'=>'127.0.0.1','null'=>false,'comment'=>'最后一次登录IP']) - ->addColumn('ip','string',['limit'=>55,'default'=>'127.0.0.1','null'=>false,'comment'=>'登录IP']) - ->addColumn('lasttime','integer',['limit'=>11,'default'=>'0','null'=>false,'comment'=>'最后登录时间']) - ->addColumn('thistime','integer',['limit'=>11,'default'=>'0','null'=>false,'comment'=>'本次登录时间']) - ->addColumn('status','boolean',['limit'=>1,'default'=>'1','null'=>false,'comment'=>'0=禁用,1=正常']) - ->addColumn('create_time','integer',['limit'=>11,'default'=>'1539158918','null'=>false,'comment'=>'创建时间']) - ->addColumn('update_time','integer',['limit'=>11,'default'=>'1539158918','null'=>false,'comment'=>'更新时间']) - ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) - ->addColumn('beizhu','string',['limit'=>80,'null'=>true,'comment'=>'备注']) - ->addIndex(array('username'), array('unique' => true)) - ->create(); - } -} diff --git a/database/migrations/20181025041505_category.php b/database/migrations/20181025041505_category.php deleted file mode 100644 index 0bf013aa..00000000 --- a/database/migrations/20181025041505_category.php +++ /dev/null @@ -1,44 +0,0 @@ -table('category'); - - // 添加当前表字段 - $table - ->addColumn('title','string',['limit'=>50,'null'=>false,'comment'=>'类型标题']) - ->addColumn('pid','integer',['limit'=>4,'default'=>'0','null'=>false,'comment'=>'父级ID']) - ->addColumn('status','boolean',['limit'=>1,'default'=>'1','null'=>false,'comment'=>'0=禁用,1=正常']) - ->addColumn('paixu','integer',['limit'=>4,'default'=>'999','null'=>false,'comment'=>'排序']) - ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) - ->addColumn('beizhu','string',['limit'=>80,'null'=>true,'comment'=>'备注']) - ->create(); - } -} diff --git a/database/migrations/20181026002455_school.php b/database/migrations/20181026002455_school.php deleted file mode 100644 index ef0a534c..00000000 --- a/database/migrations/20181026002455_school.php +++ /dev/null @@ -1,52 +0,0 @@ -table('school'); - - // 添加当前表字段 - $table - ->addColumn('title','string',['limit'=>25,'null'=>false,'comment'=>'单位名称']) - ->addColumn('jiancheng','string',['limit'=>6,'null'=>false,'comment'=>'单位简称']) - ->addColumn('biaoshi','string',['limit'=>11,'null'=>true,'comment'=>'单位标识']) - ->addColumn('xingzhi','integer',['limit'=>11,'null'=>true,'comment'=>'单位性质']) - ->addColumn('jibie','integer',['limit'=>11,'null'=>true,'comment'=>'单位级别']) - ->addColumn('xueduan','integer',['limit'=>11,'null'=>true,'comment'=>'学段']) - ->addColumn('status','boolean',['limit'=>1,'default'=>'1','null'=>false,'comment'=>'0=禁用,1=正常']) - ->addColumn('paixu','integer',['limit'=>4,'default'=>'999','null'=>false,'comment'=>'排序']) - ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) - ->addColumn('create_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) - ->addColumn('update_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) - ->addColumn('beizhu','string',['limit'=>80,'null'=>true,'comment'=>'备注']) - ->addIndex(array('title'), array('unique' => true)) - ->addIndex(array('jiancheng'), array('unique' => true)) - ->create(); - } -} diff --git a/database/migrations/20181028023517_teacher.php b/database/migrations/20181028023517_teacher.php deleted file mode 100644 index f5180c5b..00000000 --- a/database/migrations/20181028023517_teacher.php +++ /dev/null @@ -1,56 +0,0 @@ -table('teacher'); - - // 添加当前表字段 - $table - ->addColumn('xingming','string',['limit'=>8,'null'=>false,'comment'=>'姓名']) - ->addColumn('sex','boolean',['limit'=>1,'default'=>1,'null'=>false,'comment'=>'性别']) - ->addColumn('shengri','integer',['limit'=>11,'null'=>true,'comment'=>'生日']) - ->addColumn('worktime','integer',['limit'=>11,'null'=>true,'comment'=>'工作时间']) - ->addColumn('zhiwu','integer',['limit'=>11,'null'=>true,'comment'=>'职务']) - ->addColumn('zhicheng','integer',['limit'=>11,'null'=>true,'comment'=>'职称']) - ->addColumn('danwei','integer',['limit'=>11,'null'=>false,'comment'=>'现工作单位']) - ->addColumn('biye','string',['limit'=>50,'null'=>true,'comment'=>'毕业学校']) - ->addColumn('zhuanye','string',['limit'=>20,'null'=>true,'comment'=>'专业']) - ->addColumn('xueli','integer',['limit'=>11,'null'=>true,'comment'=>'学历']) - ->addColumn('subject','integer',['limit'=>11,'null'=>true,'comment'=>'学科']) - ->addColumn('quanpin','string',['limit'=>30,'null'=>false,'comment'=>'全拼']) - ->addColumn('shoupin','string',['limit'=>5,'null'=>false,'comment'=>'简拼']) - ->addColumn('status','boolean',['limit'=>1,'default'=>true,'null'=>false,'comment'=>'状态']) - ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) - ->addColumn('create_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) - ->addColumn('update_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) - ->addColumn('beizhu','string',['limit'=>80,'null'=>true,'comment'=>'备注']) - ->create(); - } -} diff --git a/database/migrations/20181028024920_xueqi.php b/database/migrations/20181028024920_xueqi.php deleted file mode 100644 index a8183c35..00000000 --- a/database/migrations/20181028024920_xueqi.php +++ /dev/null @@ -1,48 +0,0 @@ -table('xueqi'); - - // 添加当前表字段 - $table - ->addColumn('title','string',['limit'=>25,'null'=>false,'comment'=>'学期标题']) - ->addColumn('xuenian','string',['limit'=>15,'null'=>false,'comment'=>'学年标题']) - ->addColumn('category','string',['limit'=>11,'null'=>false,'comment'=>'学期分类']) - ->addColumn('bfdate','integer',['limit'=>11,'null'=>false,'comment'=>'开始日期']) - ->addColumn('enddate','integer',['limit'=>11,'null'=>false,'comment'=>'结束日期']) - ->addColumn('status','boolean',['limit'=>1,'default'=>'1','null'=>false,'comment'=>'0=禁用,1=正常']) - ->addColumn('create_time','integer',['limit'=>11,'null'=>true,'comment'=>'创建时间']) - ->addColumn('update_time','integer',['limit'=>11,'null'=>true,'comment'=>'更新时间']) - ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) - ->addColumn('beizhu','string',['limit'=>80,'null'=>true,'comment'=>'备注']) - ->create(); - } -} diff --git a/database/migrations/20181028025648_kaoshi.php b/database/migrations/20181028025648_kaoshi.php deleted file mode 100644 index 9a4eb8e0..00000000 --- a/database/migrations/20181028025648_kaoshi.php +++ /dev/null @@ -1,49 +0,0 @@ -table('kaoshi'); - - // 添加当前表字段 - $table - ->addColumn('title','string',['limit'=>25,'null'=>false,'comment'=>'考试名称']) - ->addColumn('zuzhi','integer',['limit'=>11,'null'=>false,'comment'=>'组织考试单位']) - ->addColumn('xueqi','integer',['limit'=>11,'null'=>false,'comment'=>'学期']) - ->addColumn('category','integer',['limit'=>11,'null'=>false,'comment'=>'类别']) - ->addColumn('bfdate','integer',['limit'=>11,'null'=>false,'comment'=>'开始日期']) - ->addColumn('enddate','integer',['limit'=>11,'default'=>0,'null'=>false,'comment'=>'结束日期']) - ->addColumn('status','boolean',['limit'=>1,'default'=>'1','null'=>false,'comment'=>'0=禁用,1=正常']) - ->addColumn('create_time','integer',['limit'=>11,'null'=>true,'comment'=>'创建时间']) - ->addColumn('update_time','integer',['limit'=>11,'null'=>true,'comment'=>'更新时间']) - ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) - ->addColumn('beizhu','string',['limit'=>80,'null'=>true,'comment'=>'备注']) - ->create(); - } -} diff --git a/database/migrations/20181030024954_subject.php b/database/migrations/20181030024954_subject.php deleted file mode 100644 index fb7be608..00000000 --- a/database/migrations/20181030024954_subject.php +++ /dev/null @@ -1,52 +0,0 @@ -table('subject'); - - // 添加当前表字段 - $table - ->addColumn('title','string',['limit'=>25,'null'=>false,'comment'=>'学科名称']) - ->addColumn('jiancheng','string',['limit'=>6,'null'=>false,'comment'=>'简称']) - ->addColumn('lieming','string',['limit'=>46,'null'=>false,'comment'=>'列名']) - ->addColumn('category','string',['limit'=>11,'null'=>false,'comment'=>'大学科类别']) - ->addColumn('kaoshi','boolean',['limit'=>1,'null'=>0,'default'=>false,'comment'=>'是否参与考试']) - ->addColumn('paixu','integer',['limit'=>4,'default'=>'999','null'=>false,'comment'=>'排序']) - ->addColumn('status','boolean',['limit'=>1,'default'=>1,'null'=>false,'comment'=>'0=禁用,1=正常']) - ->addColumn('create_time','integer',['limit'=>11,'null'=>true,'comment'=>'创建时间']) - ->addColumn('update_time','integer',['limit'=>11,'null'=>true,'comment'=>'更新时间']) - ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) - ->addColumn('beizhu','string',['limit'=>80,'null'=>true,'comment'=>'备注']) - ->addIndex(array('lieming'), array('unique' => true)) - ->addIndex(array('title'), array('unique' => true)) - ->addIndex(array('jiancheng'), array('unique' => true)) - ->create(); - } -} diff --git a/database/migrations/20181030072708_kaoshi_nianji.php b/database/migrations/20181030072708_kaoshi_nianji.php deleted file mode 100644 index 9fe28a0e..00000000 --- a/database/migrations/20181030072708_kaoshi_nianji.php +++ /dev/null @@ -1,44 +0,0 @@ -table('kaoshi_nianji'); - - // 添加当前表字段 - $table - ->addColumn('kaoshiid','integer',['limit'=>11,'null'=>false,'comment'=>'考试id']) - ->addColumn('nianji','integer',['limit'=>80,'null'=>false,'comment'=>'年级']) - ->addColumn('nianjiname','string',['limit'=>10,'null'=>false,'comment'=>'年级名']) - ->addColumn('create_time','integer',['limit'=>11,'null'=>true,'comment'=>'创建时间']) - ->addColumn('update_time','integer',['limit'=>11,'null'=>true,'comment'=>'更新时间']) - ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) - ->create(); - } -} diff --git a/database/migrations/20181030072733_kaoshi_subject.php b/database/migrations/20181030072733_kaoshi_subject.php deleted file mode 100644 index 25b1de78..00000000 --- a/database/migrations/20181030072733_kaoshi_subject.php +++ /dev/null @@ -1,47 +0,0 @@ -table('kaoshi_subject'); - - // 添加当前表字段 - $table - ->addColumn('kaoshiid','integer',['limit'=>11,'null'=>false,'comment'=>'考试id']) - ->addColumn('subjectid','integer',['limit'=>11,'null'=>false,'comment'=>'学科id']) - ->addColumn('lieming','string',['limit'=>11,'null'=>false,'comment'=>'列名']) - ->addColumn('manfen','integer',['limit'=>3,'null'=>false,'comment'=>'满分']) - ->addColumn('youxiu','integer',['limit'=>3,'null'=>false,'comment'=>'优秀']) - ->addColumn('jige','integer',['limit'=>3,'null'=>false,'comment'=>'及格']) - ->addColumn('create_time','integer',['limit'=>11,'null'=>true,'comment'=>'创建时间']) - ->addColumn('update_time','integer',['limit'=>11,'null'=>true,'comment'=>'更新时间']) - ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) - ->create(); - } -} diff --git a/database/migrations/20181101040801_fields.php b/database/migrations/20181101040801_fields.php deleted file mode 100644 index 863a65f1..00000000 --- a/database/migrations/20181101040801_fields.php +++ /dev/null @@ -1,50 +0,0 @@ -table('fields'); - - // 添加当前表字段 - $table - ->addColumn('text','string',['limit'=>100,'null'=>false,'comment'=>'文件内容']) - ->addColumn('oldname','string',['limit'=>100,'null'=>false,'comment'=>'原文件名']) - ->addColumn('bianjitime','integer',['limit'=>11,'null'=>true,'comment'=>'最后编辑时间']) - ->addColumn('newname','string',['limit'=>100,'null'=>false,'comment'=>'新文件名']) - ->addColumn('category','string',['limit'=>100,'null'=>false,'comment'=>'文件类型']) - ->addColumn('fieldsize','integer',['limit'=>11,'null'=>false,'comment'=>'文件大小']) - ->addColumn('hash','string',['limit'=>100,'null'=>false,'comment'=>'散列值']) - ->addColumn('userid','integer',['limit'=>11,'null'=>false,'comment'=>'用户ID']) - ->addColumn('url','string',['limit'=>100,'null'=>true,'comment'=>'文件储存位置']) - ->addColumn('create_time','integer',['limit'=>11,'null'=>true,'comment'=>'创建时间']) - ->addColumn('update_time','integer',['limit'=>11,'null'=>true,'comment'=>'更新时间']) - ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) - ->create(); - } -} diff --git a/database/migrations/20181102003411_student.php b/database/migrations/20181102003411_student.php deleted file mode 100644 index bb300881..00000000 --- a/database/migrations/20181102003411_student.php +++ /dev/null @@ -1,49 +0,0 @@ -table('student'); - - // 添加当前表字段 - $table - ->addColumn('xingming','string',['limit'=>5,'null'=>false,'comment'=>'姓名']) - ->addColumn('sex','boolean',['limit'=>1,'default'=>1,'null'=>false,'comment'=>'性别']) - ->addColumn('shengri','integer',['limit'=>11,'null'=>false,'comment'=>'生日']) - ->addColumn('shenfenzhenghao','string',['limit'=>18,'null'=>false,'comment'=>'身份证号']) - ->addColumn('school','integer',['limit'=>11,'null'=>false,'comment'=>'学校']) - ->addColumn('banji','integer',['limit'=>11,'null'=>false,'comment'=>'班级']) - ->addColumn('create_time','integer',['limit'=>11,'null'=>true,'comment'=>'创建时间']) - ->addColumn('update_time','integer',['limit'=>11,'null'=>true,'comment'=>'更新时间']) - ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) - ->addColumn('status','boolean',['limit'=>1,'default'=>'1','null'=>false,'comment'=>'0=禁用,1=正常']) - ->addIndex(array('shenfenzhenghao'), array('unique' => true)) - ->create(); - } -} diff --git a/database/migrations/20181102004156_banji.php b/database/migrations/20181102004156_banji.php deleted file mode 100644 index c5aa0899..00000000 --- a/database/migrations/20181102004156_banji.php +++ /dev/null @@ -1,45 +0,0 @@ -table('banji'); - - // 添加当前表字段 - $table - ->addColumn('school','integer',['limit'=>11,'null'=>false,'comment'=>'学校']) - ->addColumn('ruxuenian','integer',['limit'=>4,'null'=>true,'comment'=>'学段']) - ->addColumn('paixu','integer',['limit'=>3,'null'=>true,'comment'=>'排序']) - ->addColumn('create_time','integer',['limit'=>11,'null'=>true,'comment'=>'创建时间']) - ->addColumn('update_time','integer',['limit'=>11,'null'=>true,'comment'=>'更新时间']) - ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) - ->addColumn('status','boolean',['limit'=>1,'default'=>'1','null'=>false,'comment'=>'0=禁用,1=正常']) - ->create(); - } -} diff --git a/database/migrations/20181114055804_kaohao.php b/database/migrations/20181114055804_kaohao.php deleted file mode 100644 index 2301ed59..00000000 --- a/database/migrations/20181114055804_kaohao.php +++ /dev/null @@ -1,49 +0,0 @@ -table('kaohao'); - - // 添加当前表字段 - $table - ->addColumn('kaoshi','integer',['limit'=>11,'null'=>false,'comment'=>'考试']) - ->addColumn('school','integer',['limit'=>11,'null'=>false,'comment'=>'学校']) - ->addColumn('ruxuenian','integer',['limit'=>4,'null'=>false,'comment'=>'入学年']) - ->addColumn('nianji','string',['limit'=>4,'null'=>false,'comment'=>'年级']) - ->addColumn('banji','integer',['limit'=>11,'null'=>false,'comment'=>'班级']) - ->addColumn('student','integer',['limit'=>11,'null'=>false,'comment'=>'学生']) - ->addColumn('create_time','integer',['limit'=>11,'null'=>true,'comment'=>'创建时间']) - ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) - ->addColumn('update_time','integer',['limit'=>11,'null'=>true,'comment'=>'更新时间']) - ->addColumn('status','boolean',['limit'=>1,'default'=>'1','null'=>false,'comment'=>'0=禁用,1=正常']) - ->addIndex(array('kaoshi','student'), array('unique' => true)) - ->create(); - } -} diff --git a/database/migrations/20181218041034_dw_rongyu.php b/database/migrations/20181218041034_dw_rongyu.php deleted file mode 100644 index 75be9191..00000000 --- a/database/migrations/20181218041034_dw_rongyu.php +++ /dev/null @@ -1,51 +0,0 @@ -table('dw_rongyu'); - - // 添加当前表字段 - $table - ->addColumn('project','string',['limit'=>50,'null'=>false,'comment'=>'项目名称']) - ->addColumn('title','string',['limit'=>50,'null'=>false,'comment'=>'荣誉内容名称']) - ->addColumn('hjschool','integer',['limit'=>11,'null'=>false,'comment'=>'获奖单位']) - ->addColumn('fzschool','integer',['limit'=>11,'null'=>false,'comment'=>'发证单位']) - ->addColumn('fzshijian','integer',['limit'=>11,'null'=>false,'comment'=>'发证时间']) - ->addColumn('url','string',['limit'=>100,'null'=>false,'comment'=>'荣誉图片']) - ->addColumn('jiangxiang','integer',['limit'=>11,'null'=>false,'comment'=>'奖项']) - ->addColumn('category','integer',['limit'=>15,'null'=>false,'comment'=>'荣誉类型']) - ->addColumn('create_time','integer',['limit'=>11,'null'=>true,'comment'=>'创建时间']) - ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) - ->addColumn('update_time','integer',['limit'=>11,'null'=>true,'comment'=>'更新时间']) - ->addColumn('status','boolean',['limit'=>1,'default'=>'1','null'=>false,'comment'=>'0=禁用,1=正常']) - ->create(); - - } -} diff --git a/database/migrations/20181221041509_js_rongyu.php b/database/migrations/20181221041509_js_rongyu.php deleted file mode 100644 index c6932593..00000000 --- a/database/migrations/20181221041509_js_rongyu.php +++ /dev/null @@ -1,46 +0,0 @@ -table('js_rongyu'); - - // 添加当前表字段 - $table - ->addColumn('title','string',['limit'=>50,'null'=>false,'comment'=>'荣誉册名称']) - ->addColumn('fzschool','integer',['limit'=>11,'null'=>false,'comment'=>'发证单位']) - ->addColumn('fzshijian','integer',['limit'=>11,'null'=>false,'comment'=>'发证时间']) - ->addColumn('category','integer',['limit'=>15,'null'=>false,'comment'=>'类型']) - ->addColumn('create_time','integer',['limit'=>11,'null'=>true,'comment'=>'创建时间']) - ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) - ->addColumn('update_time','integer',['limit'=>11,'null'=>true,'comment'=>'更新时间']) - ->addColumn('status','boolean',['limit'=>1,'default'=>'1','null'=>false,'comment'=>'0=禁用,1=正常']) - ->create(); - } -} diff --git a/database/migrations/20181221041523_js_rongyu_info.php b/database/migrations/20181221041523_js_rongyu_info.php deleted file mode 100644 index fc7a8885..00000000 --- a/database/migrations/20181221041523_js_rongyu_info.php +++ /dev/null @@ -1,50 +0,0 @@ -table('js_rongyu_info'); - - // 添加当前表字段 - $table - ->addColumn('title','string',['limit'=>50,'null'=>false,'comment'=>'获奖内容标题']) - ->addColumn('rongyuce','integer',['limit'=>11,'null'=>false,'comment'=>'荣誉册']) - ->addColumn('bianhao','string',['limit'=>15,'null'=>true,'comment'=>'证书编号']) - ->addColumn('hjschool','integer',['limit'=>11,'null'=>false,'comment'=>'证书所属单位']) - ->addColumn('subject','integer',['limit'=>11,'null'=>false,'comment'=>'所属学科']) - ->addColumn('jiangxiang','integer',['limit'=>11,'null'=>false,'comment'=>'荣誉奖项']) - ->addColumn('pic','string',['limit'=>100,'null'=>false,'comment'=>'证书图片']) - ->addColumn('hjshijian','integer',['limit'=>11,'null'=>false,'comment'=>'获奖时间']) - ->addColumn('create_time','integer',['limit'=>11,'null'=>true,'comment'=>'创建时间']) - ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) - ->addColumn('update_time','integer',['limit'=>11,'null'=>true,'comment'=>'更新时间']) - ->addColumn('status','boolean',['limit'=>1,'default'=>'1','null'=>false,'comment'=>'0=禁用,1=正常']) - ->create(); - } -} diff --git a/database/migrations/20181227061353_dw_rongyu_canyu.php b/database/migrations/20181227061353_dw_rongyu_canyu.php deleted file mode 100644 index ac8d1a74..00000000 --- a/database/migrations/20181227061353_dw_rongyu_canyu.php +++ /dev/null @@ -1,41 +0,0 @@ -table('dw_rongyu_canyu'); - - // 添加当前表字段 - $table - ->addColumn('rongyuid','integer',['limit'=>11,'null'=>false,'comment'=>'荣誉id']) - ->addColumn('teacherid','integer',['limit'=>11,'null'=>false,'comment'=>'获奖单位']) - ->create(); - - } -} diff --git a/database/migrations/20190214052203_js_rongyu_canyu.php b/database/migrations/20190214052203_js_rongyu_canyu.php deleted file mode 100644 index b9be8a0f..00000000 --- a/database/migrations/20190214052203_js_rongyu_canyu.php +++ /dev/null @@ -1,41 +0,0 @@ -table('js_rongyu_canyu'); - - // 添加当前表字段 - $table - ->addColumn('category','integer',['limit'=>1,'null'=>false,'default'=>0,'comment'=>'获奖人或参与人,1=>获奖人,2=>参与人']) - ->addColumn('rongyuid','integer',['limit'=>11,'null'=>false,'comment'=>'荣誉id'])// rongyuid应该改成rongyuinfoid - ->addColumn('teacherid','integer',['limit'=>11,'null'=>false,'comment'=>'教师id']) - ->create(); - } -} diff --git a/database/migrations/20190218055858_keti.php b/database/migrations/20190218055858_keti.php deleted file mode 100644 index 21b6858c..00000000 --- a/database/migrations/20190218055858_keti.php +++ /dev/null @@ -1,47 +0,0 @@ -table('keti'); - - // 添加当前表字段 - $table - ->addColumn('title','string',['limit'=>60,'null'=>false,'default'=>0,'comment'=>'课题册名称']) - ->addColumn('lxshijian','integer',['limit'=>11,'null'=>false,'comment'=>'立项时间']) - ->addColumn('lxdanweiid','integer',['limit'=>11,'null'=>false,'comment'=>'立项单位id']) - ->addColumn('category','integer',['limit'=>11,'null'=>false,'comment'=>'课题类型']) - ->addColumn('create_time','integer',['limit'=>11,'null'=>true,'comment'=>'创建时间']) - ->addColumn('update_time','integer',['limit'=>11,'null'=>true,'comment'=>'更新时间']) - ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) - ->addColumn('beizhu','string',['limit'=>80,'null'=>true,'comment'=>'备注']) - ->addColumn('status','boolean',['limit'=>1,'default'=>'1','null'=>false,'comment'=>'0=禁用,1=正常']) - ->create(); - } -} diff --git a/database/migrations/20190222040223_keti_info.php b/database/migrations/20190222040223_keti_info.php deleted file mode 100644 index 8e5522c2..00000000 --- a/database/migrations/20190222040223_keti_info.php +++ /dev/null @@ -1,54 +0,0 @@ -table('keti_info'); - - // 添加当前表字段 - $table - ->addColumn('title','string',['limit'=>60,'null'=>false,'comment'=>'课题名称']) - ->addColumn('ketice','integer',['limit'=>11,'null'=>false,'default'=>0,'comment'=>'课题册id']) - ->addColumn('bianhao','string',['limit'=>11,'null'=>false,'comment'=>'课题编号']) - ->addColumn('lxpic','string',['limit'=>100,'null'=>false,'comment'=>'立项证书图片']) - ->addColumn('subject','integer',['limit'=>11,'null'=>false,'comment'=>'学科分类']) - ->addColumn('fzdanweiid','integer',['limit'=>11,'null'=>false,'comment'=>'负责单位id']) - ->addColumn('category','integer',['limit'=>11,'null'=>false,'comment'=>'研究类型']) - ->addColumn('jhjtshijian','integer',['limit'=>11,'null'=>false,'comment'=>'计划结题时间']) - ->addColumn('jtshijian','integer',['limit'=>11,'null'=>false,'comment'=>'结题时间']) - ->addColumn('jddengji','integer',['limit'=>1,'null'=>false,'default'=>0,'comment'=>'鉴定等级:0=>研究中,1=>合格,2=>优秀,3=>流失']) - ->addColumn('jtpic','string',['limit'=>100,'null'=>false,'comment'=>'结题证书图片']) - ->addColumn('create_time','integer',['limit'=>11,'null'=>true,'comment'=>'创建时间']) - ->addColumn('update_time','integer',['limit'=>11,'null'=>true,'comment'=>'更新时间']) - ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) - ->addColumn('status','boolean',['limit'=>1,'default'=>'1','null'=>false,'comment'=>'0=禁用,1=正常']) - ->addColumn('beizhu','string',['limit'=>200,'null'=>true,'comment'=>'备注']) - ->create(); - } -} diff --git a/database/migrations/20190222041040_keti_canyu.php b/database/migrations/20190222041040_keti_canyu.php deleted file mode 100644 index 490f80ef..00000000 --- a/database/migrations/20190222041040_keti_canyu.php +++ /dev/null @@ -1,41 +0,0 @@ -table('keti_canyu'); - - // 添加当前表字段 - $table - ->addColumn('category','integer',['limit'=>1,'null'=>false,'default'=>0,'comment'=>'1=>课题主持人,2=>课题参与人']) - ->addColumn('ketiinfoid','integer',['limit'=>11,'null'=>false,'comment'=>'课题信息id']) - ->addColumn('teacherid','integer',['limit'=>11,'null'=>false,'comment'=>'教师id']) - ->create(); - } -} diff --git a/database/migrations/20190430034853_chengji.php b/database/migrations/20190430034853_chengji.php deleted file mode 100644 index 8515eea2..00000000 --- a/database/migrations/20190430034853_chengji.php +++ /dev/null @@ -1,47 +0,0 @@ -table('chengji'); - - // 添加当前表字段 - $table - ->addColumn('kaohao_id','integer',['limit'=>11,'null'=>false,'comment'=>'考试']) - ->addColumn('subject_id','integer',['limit'=>4,'null'=>false,'comment'=>'学科']) - ->addColumn('user_id','string',['limit'=>4,'null'=>false,'comment'=>'学生']) - ->addColumn('defen','decimal',['precision'=>4,'scale'=>1,'default'=>Null,'null'=>false,'comment'=>'得分']) - ->addColumn('create_time','integer',['limit'=>11,'null'=>true,'comment'=>'创建时间']) - ->addColumn('delete_time','integer',['limit'=>11,'null'=>true,'comment'=>'删除时间']) - ->addColumn('update_time','integer',['limit'=>11,'null'=>true,'comment'=>'更新时间']) - ->addColumn('status','boolean',['limit'=>1,'default'=>'1','null'=>false,'comment'=>'0=禁用,1=正常']) - ->addIndex(array('kaohao_id','subject_id'), array('unique' => true)) - ->create(); - } -} diff --git a/database/seeds/Admin.php b/database/seeds/Admin.php deleted file mode 100644 index fef5f5f1..00000000 --- a/database/seeds/Admin.php +++ /dev/null @@ -1,39 +0,0 @@ - 1, - 'xingming' => '超级管理员1', - 'username' => 'admin', - 'school' => 1, - 'password' => '$apr1$RSUodBwI$zOhVq9RQWfQDOW2sbeCDS1', - ], - [ - 'id' => 2, - 'xingming' => '超级管理员2', - 'username' => 'admin1', - 'school' => 1, - 'password' => '$apr1$RSUodBwI$zOhVq9RQWfQDOW2sbeCDS1', - ], - - ]; - // 保存数据 - $this->table('admin')->insert($rows)->save(); - } - -} \ No newline at end of file diff --git a/database/seeds/Category.php b/database/seeds/Category.php deleted file mode 100644 index daee202e..00000000 --- a/database/seeds/Category.php +++ /dev/null @@ -1,158 +0,0 @@ -101,'title'=>'单位性质','pid'=>0,'paixu' =>1], - ['id'=>102,'title'=>'单位级别','pid'=>0,'paixu' =>2], - ['id'=>103,'title'=>'大学段','pid'=>0,'paixu' =>3], - ['id'=>104,'title'=>'小学段','pid'=>0,'paixu' =>4], - ['id'=>105,'title'=>'学历','pid'=>0,'paixu'=>5], - ['id'=>106,'title'=>'职称','pid'=>0,'paixu'=>6], - ['id'=>107,'title'=>'职务','pid'=>0,'paixu'=>7], - ['id'=>108,'title'=>'学期','pid'=>0,'paixu'=>8], - ['id'=>109,'title'=>'考试','pid'=>0,'paixu'=>9], - ['id'=>110,'title'=>'学科','pid'=>0,'paixu'=>10], - ['id'=>111,'title'=>'文件','pid'=>0,'paixu'=>11], - ['id'=>112,'title'=>'单位荣誉类型','pid'=>0,'paixu'=>12], - ['id'=>113,'title'=>'荣誉奖项','pid'=>0,'paixu'=>13], - ['id'=>114,'title'=>'教师荣誉类型','pid'=>0,'paixu'=>14], - ['id'=>115,'title'=>'课题立项类型','pid'=>0,'paixu'=>15], - ['id'=>116,'title'=>'课题研究所属学科分类','pid'=>0,'paixu'=>16,], - ['id'=>117,'title'=>'研究类型','pid'=>0,'paixu'=>17,], - - - // 二级类别 - // 大学科 - ['id'=>1011001,'title'=>'语文','pid'=>110,'paixu'=>2], - ['id'=>1011002,'title'=>'数学','pid'=>110,'paixu'=>3], - ['id'=>1011003,'title'=>'外语','pid'=>110,'paixu'=>4], - ['id'=>1011004,'title'=>'品德','pid'=>110,'paixu'=>5], - ['id'=>1011005,'title'=>'历史与社会','pid'=>110,'paixu'=>6], - ['id'=>1011006,'title'=>'科学','pid'=>110,'paixu'=>7], - ['id'=>1011007,'title'=>'体育与健康','pid'=>110,'paixu'=>8], - ['id'=>1011008,'title'=>'艺术','pid'=>110,'paixu'=>9], - ['id'=>1011009,'title'=>'综合实践活动','pid'=>110,'paixu'=>10], - ['id'=>1011010,'title'=>'地方/校本课程','pid'=>110,'paixu'=>11], - ['id'=>1011011,'title'=>'幼儿园全科','pid'=>110,'paixu'=>12], - ['id'=>1011012,'title'=>'其它','pid'=>110,'paixu'=>13], - - // 文件 - ['id'=>1011101,'title'=>'教师名单','pid'=>111,'paixu'=>1], - ['id'=>1011102,'title'=>'学生名单','pid'=>111,'paixu'=>2], - ['id'=>1011103,'title'=>'考试成绩','pid'=>111,'paixu'=>3], - - // 单位性质 - ['id'=>20000000,'title'=>'幼儿园','pid'=>101,'paixu'=>1], - ['title'=>'小学','pid'=>101,'paixu'=>2], - ['title'=>'九年一贯','pid'=>101,'paixu'=>3], - ['title'=>'初中','pid'=>101,'paixu'=>4], - ['title'=>'高中','pid'=>101,'paixu'=>5], - ['title'=>'中等职业技术学校','pid'=>101,'paixu'=>6], - ['title'=>'科研机构(教师进修学校)','pid'=>101,'paixu'=>7], - ['title'=>'教育行政部门','pid'=>101,'paixu'=>8], - ['title'=>'其他教育机构','pid'=>101,'paixu'=>9], - // 单位级别 - ['title'=>'班级','pid'=>102,'paixu'=>1], - ['title'=>'教研组','pid'=>102,'paixu'=>2], - ['title'=>'校级','pid'=>102,'paixu'=>3], - ['title'=>'区级','pid'=>102,'paixu'=>4], - ['title'=>'市级','pid'=>102,'paixu'=>5], - ['title'=>'省级','pid'=>102,'paixu'=>6], - ['title'=>'部级','pid'=>102,'paixu'=>7], - ['title'=>'其它级','pid'=>102,'paixu'=>8], - // 大学段 - ['title'=>'幼儿园','pid'=>103,'paixu'=>1], - ['title'=>'小学','pid'=>103,'paixu'=>2], - ['title'=>'中小学','pid'=>103,'paixu'=>3], - ['title'=>'初中','pid'=>103,'paixu'=>4], - ['title'=>'高中','pid'=>103,'paixu'=>5], - ['title'=>'其他学段','pid'=>103,'paixu'=>6], - // 大学段 - ['title'=>'低年级','pid'=>104,'paixu'=>1], - ['title'=>'中年级','pid'=>104,'paixu'=>2], - ['title'=>'高级年','pid'=>104,'paixu'=>3], - ['title'=>'其他学段','pid'=>104,'paixu'=>4], - // 学历 - ['title'=>'高中/中专','pid'=>105,'paixu'=>1], - ['title'=>'专科','pid'=>105,'paixu'=>2], - ['title'=>'本科','pid'=>105,'paixu'=>3], - ['title'=>'硕士研究生','pid'=>105,'paixu'=>4], - ['title'=>'博士研究生','pid'=>105,'paixu'=>5], - ['title'=>'其他学历','pid'=>105,'paixu'=>6], - // 职称 - ['title'=>'正高级','pid'=>106,'paixu'=>1], - ['title'=>'高级','pid'=>106,'paixu'=>2], - ['title'=>'一级','pid'=>106,'paixu'=>3], - ['title'=>'二级','pid'=>106,'paixu'=>4], - ['title'=>'三级','pid'=>106,'paixu'=>5], - ['title'=>'其他','pid'=>106,'paixu'=>6], - // 职务 - ['title'=>'书记','pid'=>107,'paixu'=>1], - ['title'=>'校长','pid'=>107,'paixu'=>1], - ['title'=>'副书记','pid'=>107,'paixu'=>2], - ['title'=>'副校长','pid'=>107,'paixu'=>2], - ['title'=>'主任','pid'=>107,'paixu'=>3], - ['title'=>'教研组长','pid'=>107,'paixu'=>4], - ['title'=>'教师','pid'=>107,'paixu'=>5], - ['title'=>'其他','pid'=>107,'paixu'=>6], - // 学期 - ['title'=>'第一学期','pid'=>108,'paixu'=>1], - ['title'=>'第二学期','pid'=>108,'paixu'=>2], - // 考试分类 - ['title'=>'期末考试','pid'=>109,'paixu'=>1], - ['title'=>'期中考试','pid'=>109,'paixu'=>2], - ['title'=>'单项测试','pid'=>109,'paixu'=>3], - // 单位荣誉分类 - ['title'=>'科研','pid'=>112,'paixu'=>1], - ['title'=>'特色','pid'=>112,'paixu'=>2], - // 单位荣誉奖项 - ['title'=>'先进(个人/单位)','pid'=>113,'paixu'=>1], - ['title'=>'一等奖','pid'=>113,'paixu'=>2], - ['title'=>'二等奖','pid'=>113,'paixu'=>3], - ['title'=>'三等奖','pid'=>113,'paixu'=>4], - ['title'=>'优秀奖','pid'=>113,'paixu'=>5], - ['title'=>'百十佳','pid'=>113,'paixu'=>6], - ['title'=>'指导奖','pid'=>113,'paixu'=>7], - ['title'=>'其他','pid'=>113,'paixu'=>8], - // 教师荣誉分类 - ['title'=>'优质课','pid'=>114,'paixu'=>1], - ['title'=>'技能大赛','pid'=>114,'paixu'=>2], - ['title'=>'论文','pid'=>114,'paixu'=>3], - ['title'=>'教科研','pid'=>114,'paixu'=>4], - ['title'=>'荣誉称号','pid'=>114,'paixu'=>4], - // 课题立项类型 - ['title'=>'一般课题','pid'=>115,'paixu'=>1], - ['title'=>'专项课题','pid'=>115,'paixu'=>2], - ['title'=>'重大或重点课题','pid'=>115,'paixu'=>3], - ['title'=>'子课题','pid'=>115,'paixu'=>4], - // 课题研究所属学科分类 - ['title'=>'A. 教育政策研究(含教育发展战略)','pid'=>116,'paixu'=>1], - ['title'=>'B. 基础教育','pid'=>116,'paixu'=>2], - ['title'=>'C. 职业教育与成人教育(含终身教育、社会教育)','pid'=>116,'paixu'=>3], - ['title'=>'D.其他','pid'=>116,'paixu'=>3], - // 研究类型 - ['title'=>'A.基础研究','pid'=>117,'paixu'=>1], - ['title'=>'B.应用研究','pid'=>117,'paixu'=>2], - ['title'=>'C.综合研究','pid'=>117,'paixu'=>3], - - - ]; - // 保存数据 - $this->table('category')->insert($rows)->save(); - } -} \ No newline at end of file diff --git a/database/seeds/Rule.php b/database/seeds/Rule.php deleted file mode 100644 index f8a6a18c..00000000 --- a/database/seeds/Rule.php +++ /dev/null @@ -1,283 +0,0 @@ -1,'title' =>'成绩采集','name'=>'chengji','paixu' =>1,'ismenu' =>1,'font'=>''], - ['id'=>3,'title' =>'考试管理','name'=>'kaoshi','paixu' =>3,'ismenu' =>1,'font'=>''], - ['id'=>4,'title' =>'师生名单','name'=>'renshi','paixu' =>4,'ismenu' =>1,'font'=>''], - ['id'=>5,'title' =>'教务管理','name'=>'teach','paixu' =>5,'ismenu' =>1,'font'=>''], - ['id'=>6,'title' =>'管理员管理','name'=>'admin','paixu' =>8,'ismenu' =>1,'font'=>''], - ['id'=>7,'title'=>'系统管理','name' =>'system','paixu' =>9,'ismenu' =>1,'font' =>''], - ['id'=>8,'title'=>'荣誉管理','name' =>'rongyu','paixu' =>6,'ismenu' =>1,'font' =>'','status'=>0], - ['id'=>9,'title'=>'课题管理','name' =>'keti','paixu' =>7,'ismenu' =>1,'font' =>'','status'=>0], - // 二级菜单 - // 成绩采集 - ['id'=>101,'title'=>'扫码录入','name'=>'chengji/Index/malu','paixu'=>1,'ismenu' =>1,'pid' =>1,'url'=>'/chengji/malu',], - ['id'=>102,'title'=>'表格录入','name'=>'chengji/Index/biaolu','paixu'=>2,'ismenu' =>1,'pid' =>1,'url'=>'/chengji/biaolu',], - // 成绩统计 - ['id'=>201,'title'=>'班级成绩','name'=>'tongji/Index/banji','paixu'=>1,'ismenu' =>1,'pid' =>2,'url'=>'/tongji',], - // 考试管理 - ['id'=>301,'title'=>'考试列表','name'=>'kaoshi/Index/index','paixu'=>1,'ismenu' =>1,'pid' =>3,'url'=>'/kaoshi',], - ['id'=>302,'title'=>'考试操作','name'=>'Kaoshi/Index/MoreAction','paixu'=>2,'ismenu' =>0,'pid' =>3], - - // 师生名单 - ['id'=>401,'title'=>'学生列表','name'=>'renshi/Student/index','paixu'=>1,'ismenu' =>1,'pid' =>4,'url'=>'/student',], - ['id'=>402,'title'=>'教师列表','name'=>'renshi/Index/index','paixu'=>2,'ismenu' =>1,'pid' =>4,'url'=>'/teacher',], - - // 教务管理 - ['id'=>501,'title'=>'学期列表','name'=>'teach/Xueqi/index','paixu'=>1,'ismenu' =>1,'pid' =>5,'url'=>'/xueqi',], - ['id'=>502,'title'=>'班级列表','name'=>'teach/Banji/index','paixu'=>2,'ismenu' =>1,'pid' =>5,'url'=>'/banji',], - ['id'=>503,'title'=>'学科列表','name'=>'teach/Subject/index','paixu'=>3,'ismenu' =>1,'pid' =>5,'url'=>'/subject',], - - - // 管理员管理 - ['id'=>601,'title'=>'管理员列表','name'=>'admin/Index/index','paixu'=>1,'ismenu' =>1,'pid' =>6,'url'=>'/admin',], - ['id'=>602,'title'=>'权限列表','name'=>'admin/AuthRule/index','paixu'=>2,'ismenu' =>1,'pid' =>6,'url'=>'/authrule',], - ['id'=>603,'title'=>'角色列表','name'=>'admin/AuthGroup/index','paixu'=>3,'ismenu' =>1,'pid' =>6,'url'=>'/authgroup',], - - // 系统设置 - ['id'=>701,'title'=>'类别管理','name'=>'system/Category/index','paixu'=>1,'ismenu' =>1,'pid' =>7,'url'=>'/category',], - ['id'=>702,'title'=>'单位管理','name'=>'system/School/index','paixu'=>2,'ismenu' =>1,'pid' =>7,'url'=>'/school',], - ['id'=>703,'title'=>'文件管理','name'=>'system/Fields/index','paixu'=>3,'ismenu' =>1,'pid' =>7,'url'=>'/fields',], - ['id'=>704,'title'=>'系统设置','name'=>'system/SystemBase/edit','paixu'=>10,'ismenu' =>1,'pid' =>7,'url'=>'/sysbase/1/edit',], - - - - // 荣誉管理 - ['id'=>801,'title'=>'单位荣誉','name'=>'rongyu/DwRongyu/index','paixu'=>1,'ismenu' =>1,'pid' =>8,'url'=>'/dwry',], - ['id'=>802,'title'=>'教师荣誉册','name'=>'rongyu/JsRongyu/index','paixu'=>2,'ismenu' =>1,'pid' =>8,'url'=>'/jsry',], - ['id'=>803,'title'=>'教师荣誉信息','name'=>'rongyu/JsRongyuInfo/index','paixu'=>3,'ismenu' =>1,'pid' =>8,'url'=>'/jsryinfo',], - // ['id'=>804,'title'=>'学生荣誉','name'=>'rongyu/StuRongyu/index','paixu'=>7,'ismenu' =>1,'pid' =>8,'url'=>'/xsry','status'=>0], - - // 荣誉管理 - ['id'=>901,'title'=>'课题册','name'=>'keti/Index/index','paixu'=>1,'ismenu' =>1,'pid' =>9,'url'=>'/kt',], - ['id'=>902,'title'=>'课题列表','name'=>'keti/KetiInfo/index','paixu'=>2,'ismenu' =>1,'pid' =>9,'url'=>'/ktinfo',], - - - - - // 三级-权限 - - - // 扫码录入 - ['title'=>'扫码查询','name'=>'Chengji/Index/read','paixu' =>1,'pid'=>101,'id'=>1000000], - ['title'=>'扫码保存','name'=>'Chengji/Index/malusave','paixu' =>2,'pid'=>101], - // 表格录入 - ['title'=>'表格保存','name'=>'Chengji/Index/saveAll','paixu' =>3,'pid'=>102], - ['title'=>'表格上传','name'=>'Chengji/Index/upload','paixu' =>4,'pid'=>102], - ['title'=>'成绩更新','name'=>'Chengji/Index/update','paixu' =>5,'pid'=>102], - - - // 考试管理 - ['title'=>'添加','name'=>'Kaoshi/Index/create','paixu' =>1,'pid'=>301], - ['title'=>'删除','name'=>'Kaoshi/Index/delete','paixu'=>2,'pid'=>301], - ['title'=>'编辑','name'=>'Kaoshi/Index/edit','paixu'=>3,'pid'=>301,], - ['title'=>'更新','name'=>'Kaoshi/Index/update','paixu'=>4,'pid'=>301,], - ['title'=>'保存','name'=>'Kaoshi/Index/save','paixu'=>5,'pid'=>301,], - ['title'=>'状态','name'=>'Kaoshi/Index/setStatus','paixu'=>6,'pid'=>301], - ['title'=>'设置','name'=>'Kaoshi/Index/kaoshiset','paixu'=>7,'pid'=>301], - // 考试操作 - ['title'=>'生成考号','name'=>'kaoshi/Kaohao/index','paixu'=>1,'pid'=>302], - ['title'=>'已录成绩数量','name'=>'Chengji/Tongji/yiluCnt','paixu'=>2,'pid'=>302], - ['title'=>'保存考号','name'=>'kaoshi/Kaohao/save','paixu'=>3,'pid'=>302], - ['title'=>'考号删除','name'=>'kaoshi/Kaohao/delete','paixu'=>4,'pid'=>302], - ['title'=>'下载试卷标签信息','name'=>'kaoshi/Kaohao/biaoqian','paixu'=>5,'pid'=>302], - ['title'=>'下载成绩采集表','name'=>'kaoshi/Kaohao/caiji','paixu'=>6,'pid'=>302], - ['title'=>'成绩列表','name'=>'Chengji/Index/index','paixu'=>7,'pid'=>302], - ['title'=>'录入人信息','name'=>'Chengji/Index/readAdd','paixu'=>8,'pid'=>302], - ['title'=>'删除成绩','name'=>'Chengji/Index/delete','paixu'=>9,'pid'=>302], - ['title'=>'成绩状态','name'=>'Chengji/Index/setStatus','paixu'=>10,'pid'=>302], - // 学生成绩 - ['title'=>'下载学生成绩','name'=>'chengji/Index/dwChengji','paixu'=>21,'pid'=>302], - // 班级成绩 - ['title'=>'班级成绩统计','name'=>'Chengji/Bjtongji/biaoge','paixu'=>41,'pid'=>302], - ['title'=>'下载班级成绩统计表','name'=>'chengji/Bjtongji/dwBanji','paixu'=>42,'pid'=>302], - // 年级成绩 - ['title'=>'年级成绩统计','name'=>'Chengji/Njtongji/biaoge','paixu'=>61,'pid'=>302], - ['title'=>'下载年级成绩统计表','name'=>'chengji/Njtongji/dwNianji','paixu'=>62,'pid'=>302], - - - - // 师生管理 - // 学生管理权限 - ['title'=>'添加','name'=>'renshi/Student/create','paixu' =>1,'pid'=>401], - ['title'=>'保存','name'=>'renshi/Student/save','paixu'=>2,'pid'=>401,], - ['title'=>'删除','name'=>'renshi/Student/delete','paixu'=>3,'pid'=>401], - ['title'=>'编辑','name'=>'renshi/Student/edit','paixu'=>4,'pid'=>401,], - ['title'=>'更新','name'=>'renshi/Student/update','paixu'=>5,'pid'=>401,], - ['title'=>'查看','name'=>'renshi/Student/read','paixu'=>6,'pid'=>401,], - ['title'=>'状态','name'=>'renshi/Student/setStatus','paixu'=>7,'pid'=>401], - ['title'=>'下载模板','name'=>'renshi/Student/download','paixu'=>8,'pid'=>401], - ['title'=>'批量上传','name'=>'renshi/Student/createAll','paixu'=>9,'pid'=>401], - ['title'=>'批量保存','name'=>'renshi/Student/saveAll','paixu'=>10,'pid'=>401], - ['title'=>'校对','name'=>'renshi/Student/jiaodui','paixu'=>11,'pid'=>401], - ['title'=>'校对删除','name'=>'renshi/Student/jiaoduiDel','paixu'=>12,'pid'=>401], - - // 教师管理权限 - ['title'=>'添加','name'=>'renshi/Index/create','paixu' =>1,'pid'=>402], - ['title'=>'保存','name'=>'renshi/Index/save','paixu' =>2,'pid'=>402], - ['title'=>'删除','name'=>'renshi/Index/delete','paixu'=>3,'pid'=>402], - ['title'=>'编辑','name'=>'renshi/Index/edit','paixu'=>7,'pid'=>402,], - ['title'=>'更新','name'=>'renshi/Index/update','paixu' =>5,'pid'=>402], - ['title'=>'查看','name'=>'renshi/Index/read','paixu'=>6,'pid'=>402,], - ['title'=>'状态','name'=>'renshi/Index/setStatus','paixu'=>7,'pid'=>402], - ['title'=>'查询教师','name'=>'renshi/Index/srcTeacher','paixu'=>8,'pid'=>402], - ['title'=>'批量上传','name'=>'renshi/Index/createAll','paixu'=>9,'pid'=>402], - ['title'=>'批量保存','name'=>'renshi/Index/saveAll','paixu'=>10,'pid'=>402], - ['title'=>'表格模板下载','name'=>'renshi/Index/download','paixu'=>11,'pid'=>402], - ['title'=>'姓名转换VBA下载','name'=>'renshi/Index/downloadVba','paixu'=>12,'pid'=>402], - - - // 教务管理 - // 学期管理权限 - ['title'=>'添加','name'=>'teach/Xueqi/create','paixu' =>1,'pid'=>501], - ['title'=>'保存','name'=>'teach/Xueqi/save','paixu' =>2,'pid'=>501], - ['title'=>'删除','name'=>'teach/Xueqi/delete','paixu'=>3,'pid'=>501], - ['title'=>'编辑','name'=>'teach/Xueqi/edit','paixu'=>4,'pid'=>501,], - ['title'=>'更新','name'=>'teach/Xueqi/update','paixu' =>5,'pid'=>501], - ['title'=>'查看','name'=>'teach/Xueqi/read','paixu'=>6,'pid'=>501,], - ['title'=>'状态','name'=>'teach/Xueqi/setStatus','paixu'=>7,'pid'=>501], - // 班级列表权限 - ['title'=>'添加','name'=>'teach/Banji/create','paixu' =>1,'pid'=>502], - ['title'=>'保存','name'=>'teach/Banji/save','paixu' =>2,'pid'=>502], - ['title'=>'移动','name'=>'teach/Banji/yidong','paixu'=>3,'pid'=>502], - ['title'=>'状态','name'=>'teach/Banji/setStatus','paixu'=>4,'pid'=>502], - // 学科列表权限 - ['title'=>'添加','name'=>'teach/Subject/create','paixu' =>1,'pid'=>503], - ['title'=>'保存','name'=>'teach/Subject/save','paixu' =>2,'pid'=>503], - ['title'=>'删除','name'=>'teach/Subject/delete','paixu'=>3,'pid'=>503], - ['title'=>'编辑','name'=>'teach/Subject/edit','paixu'=>4,'pid'=>503,], - ['title'=>'更新','name'=>'teach/Subject/update','paixu' =>5,'pid'=>503], - ['title'=>'查看','name'=>'teach/Subject/read','paixu'=>6,'pid'=>503,], - ['title'=>'状态','name'=>'teach/Subject/setStatus','paixu'=>7,'pid'=>503], - - - //管理员管理 - // 管理员列表权限 - ['title'=>'添加','name'=>'admin/Index/create','paixu' =>1,'pid'=>601], - ['title'=>'保存','name'=>'admin/Index/save','paixu' =>2,'pid'=>601], - ['title'=>'删除','name'=>'admin/Index/delete','paixu'=>3,'pid'=>601], - ['title'=>'编辑','name'=>'admin/Index/edit','paixu'=>4,'pid'=>601,], - ['title'=>'更新','name'=>'admin/Index/update','paixu' =>5,'pid'=>601], - ['title'=>'查看','name'=>'admin/Index/read','paixu'=>6,'pid'=>601,], - ['title'=>'状态','name'=>'admin/Index/setStatus','paixu'=>7,'pid'=>601], - ['title'=>'重置密码','name'=>'admin/Index/resetpassword','paixu' =>8,'pid'=>601], - // 权限列表权限 - ['title'=>'添加','name'=>'admin/AuthRule/create','paixu' =>1,'pid'=>602], - ['title'=>'保存','name'=>'admin/AuthRule/save','paixu' =>2,'pid'=>602], - ['title'=>'删除','name'=>'admin/AuthRule/delete','paixu'=>3,'pid'=>602], - ['title'=>'编辑','name'=>'admin/AuthRule/edit','paixu'=>4,'pid'=>602,], - ['title'=>'更新','name'=>'admin/AuthRule/update','paixu' =>5,'pid'=>602], - ['title'=>'查看','name'=>'admin/AuthRule/read','paixu'=>6,'pid'=>602,], - ['title'=>'状态','name'=>'admin/AuthRule/setStatus','paixu'=>7,'pid'=>602], - // 角色列表权限 - ['title'=>'添加','name'=>'admin/AuthGroup/create','paixu' =>1,'pid'=>603], - ['title'=>'保存','name'=>'admin/AuthGroup/save','paixu' =>2,'pid'=>603], - ['title'=>'删除','name'=>'admin/AuthGroup/delete','paixu'=>3,'pid'=>603], - ['title'=>'编辑','name'=>'admin/AuthGroup/edit','paixu'=>4,'pid'=>603,], - ['title'=>'更新','name'=>'admin/AuthGroup/update','paixu' =>5,'pid'=>603], - ['title'=>'查看','name'=>'admin/AuthGroup/read','paixu'=>6,'pid'=>603,], - ['title'=>'状态','name'=>'admin/AuthGroup/setStatus','paixu'=>7,'pid'=>603], - - // 系统设置 - // 类别管理权限 - ['title'=>'添加','name'=>'system/Category/create','paixu' =>1,'pid'=>701], - ['title'=>'保存','name'=>'system/Category/save','paixu' =>2,'pid'=>701], - ['title'=>'删除','name'=>'system/Category/delete','paixu'=>3,'pid'=>701], - ['title'=>'编辑','name'=>'system/Category/edit','paixu'=>4,'pid'=>701,], - ['title'=>'更新','name'=>'system/Category/update','paixu' =>5,'pid'=>701], - ['title'=>'查看','name'=>'system/Category/read','paixu'=>6,'pid'=>701,], - ['title'=>'状态','name'=>'system/Category/setStatus','paixu'=>7,'pid'=>701], - // 单位管理权限 - ['title'=>'添加','name'=>'system/School/create','paixu' =>1,'pid'=>702], - ['title'=>'保存','name'=>'system/School/save','paixu' =>2,'pid'=>702], - ['title'=>'删除','name'=>'system/School/delete','paixu'=>3,'pid'=>702], - ['title'=>'编辑','name'=>'system/School/edit','paixu'=>4,'pid'=>702], - ['title'=>'更新','name'=>'system/School/update','paixu' =>5,'pid'=>702], - ['title'=>'查看','name'=>'system/School/read','paixu'=>6,'pid'=>702,], - ['title'=>'状态','name'=>'system/School/setStatus','paixu'=>7,'pid'=>702], - // 文件管理权限 - ['title'=>'删除','name'=>'system/Fields/delete','paixu'=>1,'pid'=>703], - ['title'=>'下载','name'=>'system/Fields/download','paixu'=>2,'pid'=>703,], - // 系统设置 - ['title'=>'更新','name'=>'system/SystemBase/update','paixu'=>1,'pid' =>704], - - // 荣誉管理 - // 单位荣誉管理 - ['title'=>'添加','name'=>'rongyu/DwRongyu/create','paixu' =>1,'pid'=>801], - ['title'=>'保存','name'=>'rongyu/DwRongyu/save','paixu' =>2,'pid'=>801], - ['title'=>'删除','name'=>'rongyu/DwRongyu/delete','paixu'=>3,'pid'=>801], - ['title'=>'编辑','name'=>'rongyu/DwRongyu/edit','paixu'=>4,'pid'=>801,], - ['title'=>'更新','name'=>'rongyu/DwRongyu/update','paixu' =>5,'pid'=>801], - ['title'=>'查看','name'=>'rongyu/DwRongyu/read','paixu'=>6,'pid'=>801,], - ['title'=>'状态','name'=>'rongyu/DwRongyu/setStatus','paixu'=>7,'pid'=>801], - ['title'=>'批量上传','name'=>'rongyu/DwRongyu/createAll','paixu'=>8,'pid'=>801], - ['title'=>'批量保存','name'=>'rongyu/DwRongyu/saveAll','paixu'=>9,'pid'=>801], - // 教师荣誉册管理 - ['title'=>'添加','name'=>'rongyu/JsRongyu/create','paixu' =>1,'pid'=>802], - ['title'=>'保存','name'=>'rongyu/JsRongyu/save','paixu' =>2,'pid'=>802], - ['title'=>'删除','name'=>'rongyu/JsRongyu/delete','paixu'=>3,'pid'=>802], - ['title'=>'编辑','name'=>'rongyu/JsRongyu/edit','paixu'=>7,'pid'=>802,], - ['title'=>'更新','name'=>'rongyu/JsRongyu/update','paixu' =>8,'pid'=>802], - ['title'=>'查看','name'=>'rongyu/JsRongyu/read','paixu'=>6,'pid'=>802,], - ['title'=>'状态','name'=>'rongyu/JsRongyu/setStatus','paixu'=>7,'pid'=>802], - ['title'=>'查看荣誉信息','name'=>'rongyu/JsRongyuInfo/rongyuList','paixu'=>6,'pid'=>802], - ['title'=>'下载表格','name'=>'rongyu/JsRongyuInfo/outXlsx','paixu'=>8,'pid'=>802], - - - // 教师荣誉信息管理 - ['title'=>'添加','name'=>'rongyu/JsRongyuInfo/create','paixu' =>1,'pid'=>803], - ['title'=>'保存','name'=>'rongyu/JsRongyuInfo/save','paixu' =>2,'pid'=>803], - ['title'=>'删除','name'=>'rongyu/JsRongyuInfo/delete','paixu'=>3,'pid'=>803], - ['title'=>'编辑','name'=>'rongyu/JsRongyuInfo/edit','paixu'=>4,'pid'=>803,], - ['title'=>'更新','name'=>'rongyu/JsRongyuInfo/update','paixu' =>5,'pid'=>803], - ['title'=>'查看','name'=>'rongyu/JsRongyuInfo/read','paixu'=>6,'pid'=>803,], - ['title'=>'状态','name'=>'rongyu/JsRongyuInfo/setStatus','paixu'=>7,'pid'=>803], - ['title'=>'批量上传','name'=>'rongyu/JsRongyuInfo/createAll','paixu'=>8,'pid'=>803], - ['title'=>'批量保存','name'=>'rongyu/JsRongyuInfo/saveAll','paixu'=>9,'pid'=>803], - - - // 课题管理 - // 课题册 - ['title'=>'添加','name'=>'keti/index/create','paixu' =>1,'pid'=>901], - ['title'=>'保存','name'=>'keti/index/save','paixu' =>2,'pid'=>901], - ['title'=>'删除','name'=>'keti/index/delete','paixu'=>3,'pid'=>901], - ['title'=>'编辑','name'=>'keti/index/edit','paixu'=>4,'pid'=>901,], - ['title'=>'更新','name'=>'keti/index/update','paixu' =>5,'pid'=>901], - ['title'=>'课题信息','name'=>'keti/ketiinfo/KetiCe','paixu'=>6,'pid'=>901,], - ['title'=>'查看','name'=>'keti/index/read','paixu'=>7,'pid'=>901,], - ['title'=>'状态','name'=>'keti/index/setStatus','paixu'=>8,'pid'=>901], - ['title'=>'查看课题信息','name'=>'keti/ketiinfo/ketiList','paixu'=>9,'pid'=>901], - // 课题信息 - ['title'=>'添加','name'=>'keti/ketiinfo/create','paixu' =>1,'pid'=>902], - ['title'=>'保存','name'=>'keti/ketiinfo/save','paixu' =>2,'pid'=>902], - ['title'=>'删除','name'=>'keti/ketiinfo/delete','paixu'=>3,'pid'=>902], - ['title'=>'编辑','name'=>'keti/ketiinfo/edit','paixu'=>4,'pid'=>902,], - ['title'=>'更新','name'=>'keti/ketiinfo/update','paixu' =>5,'pid'=>902], - ['title'=>'查看','name'=>'keti/ketiinfo/read','paixu'=>6,'pid'=>902,], - ['title'=>'状态','name'=>'keti/ketiinfo/setStatus','paixu'=>7,'pid'=>902], - ['title'=>'批量上传','name'=>'keti/ketiinfo/createAll','paixu'=>8,'pid'=>902], - ['title'=>'批量保存','name'=>'keti/ketiinfo/saveAll','paixu'=>9,'pid'=>902], - ['title'=>'结题','name'=>'keti/ketiinfo/jieTi','paixu'=>10,'pid'=>902], - ['title'=>'下载','name'=>'keti/KetiInfo/outXlsx','paixu'=>11,'pid'=>902], - - ]; - // 保存数据 - $this->table('auth_rule')->insert($rows)->save(); - } -} \ No newline at end of file diff --git a/database/seeds/School.php b/database/seeds/School.php deleted file mode 100644 index d42e150e..00000000 --- a/database/seeds/School.php +++ /dev/null @@ -1,30 +0,0 @@ -1, - 'title'=>'大连长兴岛经济区教研科研培训中心', - 'jiancheng'=>'教科培中心', - 'biaoshi'=>'', - 'jibie'=>'3', - ], - ]; - // 保存数据 - $this->table('school')->insert($rows)->save(); - } -} \ No newline at end of file diff --git a/database/seeds/Subject.php b/database/seeds/Subject.php deleted file mode 100644 index bff88c58..00000000 --- a/database/seeds/Subject.php +++ /dev/null @@ -1,48 +0,0 @@ -'语文','jiancheng'=>'语','category'=>1011001,'lieming'=>'yuwen','kaoshi'=>1,'paixu'=>1], - ['title'=>'数学','jiancheng'=>'数','category'=>1011002,'lieming'=>'shuxue','kaoshi'=>1,'paixu'=>2], - ['title'=>'外语','jiancheng'=>'外','category'=>1011003,'lieming'=>'waiyu','kaoshi'=>1,'paixu'=>3], - ['title'=>'体育与健康','jiancheng'=>'体','category'=>1011007,'lieming'=>'tiyu','paixu'=>4], - ['title'=>'科学','jiancheng'=>'科','category'=>1011006,'lieming'=>'kexue','paixu'=>5], - ['title'=>'生物','jiancheng'=>'生','category'=>1011006,'lieming'=>'shengwu','paixu'=>6], - ['title'=>'物理','jiancheng'=>'理','category'=>1011006,'lieming'=>'wuli','kaoshi'=>1,'paixu'=>7], - ['title'=>'化学','jiancheng'=>'化','category'=>1011006,'lieming'=>'huaxue','kaoshi'=>1,'paixu'=>8], - ['title'=>'音乐','jiancheng'=>'音','category'=>1011008,'lieming'=>'yinyue','paixu'=>9], - ['title'=>'美术','jiancheng'=>'美','category'=>1011008,'lieming'=>'meishu','paixu'=>10], - ['title'=>'信息技术','jiancheng'=>'信息','category'=>1011009,'lieming'=>'xinxi','paixu'=>11], - ['title'=>'研究性学习/社区服务、实践','jiancheng'=>'社区','lieming'=>'shequ','category'=>1011009,'paixu'=>12], - ['title'=>'劳动与技术','jiancheng'=>'劳动','category'=>1011009,'lieming'=>'laodong','paixu'=>13], - ['title'=>'品德与生活/社会','jiancheng'=>'品德','category'=>1011004,'lieming'=>'pinshe','paixu'=>14], - ['title'=>'思想品德','jiancheng'=>'品社','category'=>1011004,'lieming'=>'sixiang','paixu'=>15], - ['title'=>'历史','jiancheng'=>'史','category'=>1011005,'lieming'=>'lishi','paixu'=>16], - ['title'=>'地理','jiancheng'=>'地理','category'=>1011005,'lieming'=>'dili','paixu'=>17], - ['title'=>'地方课程','jiancheng'=>'地方','lieming'=>'difang','category'=>1011010,'paixu'=>18], - ['title'=>'校本课程','jiancheng'=>'校本','lieming'=>'xiaoben','category'=>1011010,'paixu'=>19], - ['title'=>'幼儿园全科','jiancheng'=>'幼儿园','lieming'=>'youeryuan','category'=>1011011,'paixu'=>20], - ['title'=>'德育','jiancheng'=>'德','lieming'=>'deyu','category'=>1011010,'paixu'=>21], - ['title'=>'心理健康','jiancheng'=>'心','lieming'=>'xinli','category'=>1011010,'paixu'=>22], - ['title'=>'写字','jiancheng'=>'写','lieming'=>'xiezi','category'=>1011010,'paixu'=>23], - ['title'=>'其他','jiancheng'=>'其他','lieming'=>'qita','category'=>1011012,'paixu'=>100], - - ]; - // 保存数据 - $this->table('subject')->insert($rows)->save(); - } -} \ No newline at end of file diff --git a/database/seeds/SystemBase.php b/database/seeds/SystemBase.php deleted file mode 100644 index 152be05d..00000000 --- a/database/seeds/SystemBase.php +++ /dev/null @@ -1,30 +0,0 @@ - time(), - 'update_time' => time(), - 'webtitle' => '学生成绩统计系统', - 'keywords' => '成绩统计,成绩管理,成绩分析', - 'description' => '适合的才是好用的。', - 'thinks' => 'ThinkPHP,X-admin,百度Echarts,jquery。', - 'danwei' => '大连长兴岛经济区教科培中心', - ]; - // 保存数据 - $this->table('system_base')->insert($rows)->save(); - } -} \ No newline at end of file diff --git a/public/.htaccess b/public/.htaccess deleted file mode 100644 index d9ee23c9..00000000 --- a/public/.htaccess +++ /dev/null @@ -1,8 +0,0 @@ - - Options +FollowSymlinks -Multiviews - RewriteEngine On - - RewriteCond %{REQUEST_FILENAME} !-d - RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L] - diff --git a/public/error/error.tpl b/public/error/error.tpl deleted file mode 100644 index 4ecac4fa..00000000 --- a/public/error/error.tpl +++ /dev/null @@ -1,27 +0,0 @@ - - - - - 后台登录-X-admin2.1 - - - - - - - - - 系统提示 - - -
-
-
-

-

,啥都看不到了…

-
-
-
-
- - \ No newline at end of file diff --git a/public/error/success.tpl b/public/error/success.tpl deleted file mode 100644 index 64a26d3a..00000000 --- a/public/error/success.tpl +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - -{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui/css/H-ui.min.css" /} -{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui.admin/css/H-ui.admin.css" /} -{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/Hui-iconfont/1.0.8/iconfont.css" /} - -系统提示 - - -
-

- 系统提示 -

-

{$msg}

- -
- - \ No newline at end of file diff --git a/public/examples/20190524162731.png b/public/examples/20190524162731.png deleted file mode 100644 index 264652ea..00000000 Binary files a/public/examples/20190524162731.png and /dev/null differ diff --git a/public/examples/20190524164321.png b/public/examples/20190524164321.png deleted file mode 100644 index c8157636..00000000 Binary files a/public/examples/20190524164321.png and /dev/null differ diff --git a/public/examples/20190524164409.png b/public/examples/20190524164409.png deleted file mode 100644 index 4bd79648..00000000 Binary files a/public/examples/20190524164409.png and /dev/null differ diff --git a/public/examples/20190524164451.png b/public/examples/20190524164451.png deleted file mode 100644 index eb638df3..00000000 Binary files a/public/examples/20190524164451.png and /dev/null differ diff --git a/public/examples/timg.jpg b/public/examples/timg.jpg deleted file mode 100644 index 1d9acfc7..00000000 Binary files a/public/examples/timg.jpg and /dev/null differ diff --git a/public/favicon.ico b/public/favicon.ico deleted file mode 100644 index 3d2ec742..00000000 Binary files a/public/favicon.ico and /dev/null differ diff --git a/public/index.php b/public/index.php deleted file mode 100644 index 22dc1583..00000000 --- a/public/index.php +++ /dev/null @@ -1,21 +0,0 @@ - -// +---------------------------------------------------------------------- - -// [ 应用入口文件 ] -namespace think; - -// 加载基础文件 -require __DIR__ . '/../thinkphp/base.php'; - -// 支持事先使用静态方法设置Request对象和Config对象 - -// 执行应用并响应 -Container::get('app')->run()->send(); diff --git a/public/router.php b/public/router.php deleted file mode 100644 index 4f916b40..00000000 --- a/public/router.php +++ /dev/null @@ -1,17 +0,0 @@ - -// +---------------------------------------------------------------------- -// $Id$ - -if (is_file($_SERVER["DOCUMENT_ROOT"] . $_SERVER["SCRIPT_NAME"])) { - return false; -} else { - require __DIR__ . "/index.php"; -} diff --git a/public/static/echarts/echarts-gl.js b/public/static/echarts/echarts-gl.js deleted file mode 100644 index 09910548..00000000 --- a/public/static/echarts/echarts-gl.js +++ /dev/null @@ -1,56990 +0,0 @@ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(require("echarts")); - else if(typeof define === 'function' && define.amd) - define(["echarts"], factory); - else if(typeof exports === 'object') - exports["echarts-gl"] = factory(require("echarts")); - else - root["echarts-gl"] = factory(root["echarts"]); -})(this, function(__WEBPACK_EXTERNAL_MODULE_0__) { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { -/******/ configurable: false, -/******/ enumerable: true, -/******/ get: getter -/******/ }); -/******/ } -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 106); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports) { - -module.exports = __WEBPACK_EXTERNAL_MODULE_0__; - -/***/ }), -/* 1 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_claygl_src_Mesh__ = __webpack_require__(40); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_claygl_src_Renderer__ = __webpack_require__(52); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_claygl_src_Texture2D__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_claygl_src_Texture__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__ = __webpack_require__(8); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_claygl_src_Material__ = __webpack_require__(19); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_claygl_src_Node__ = __webpack_require__(35); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_claygl_src_Geometry__ = __webpack_require__(15); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_8_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_claygl_src_Scene__ = __webpack_require__(36); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_zrender_lib_core_LRU__ = __webpack_require__(60); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_zrender_lib_core_LRU___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_10_zrender_lib_core_LRU__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_claygl_src_util_texture__ = __webpack_require__(61); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__EChartsSurface__ = __webpack_require__(124); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13_claygl_src_light_AmbientCubemap__ = __webpack_require__(125); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14_claygl_src_light_AmbientSH__ = __webpack_require__(129); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15_claygl_src_util_sh__ = __webpack_require__(130); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__retrieve__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17_claygl_src_geometry_Sphere__ = __webpack_require__(132); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18_claygl_src_geometry_Plane__ = __webpack_require__(43); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19_claygl_src_geometry_Cube__ = __webpack_require__(76); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20_claygl_src_light_Ambient__ = __webpack_require__(133); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21_claygl_src_light_Directional__ = __webpack_require__(134); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22_claygl_src_light_Point__ = __webpack_require__(135); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23_claygl_src_light_Spot__ = __webpack_require__(136); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24_claygl_src_camera_Perspective__ = __webpack_require__(41); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25_claygl_src_camera_Orthographic__ = __webpack_require__(37); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26_claygl_src_math_Vector2__ = __webpack_require__(26); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_27_claygl_src_math_Vector3__ = __webpack_require__(3); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_28_claygl_src_math_Vector4__ = __webpack_require__(137); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29_claygl_src_math_Quaternion__ = __webpack_require__(56); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_30_claygl_src_math_Matrix2__ = __webpack_require__(138); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_31_claygl_src_math_Matrix2d__ = __webpack_require__(139); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_32_claygl_src_math_Matrix3__ = __webpack_require__(140); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_33_claygl_src_math_Matrix4__ = __webpack_require__(9); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_34_claygl_src_math_Plane__ = __webpack_require__(74); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_35_claygl_src_math_Ray__ = __webpack_require__(54); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_36_claygl_src_math_BoundingBox__ = __webpack_require__(18); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_37_claygl_src_math_Frustum__ = __webpack_require__(59); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_38__animatableMixin__ = __webpack_require__(141); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_39_claygl_src_shader_source_util_glsl_js__ = __webpack_require__(146); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_40_claygl_src_shader_source_prez_glsl_js__ = __webpack_require__(71); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_41__shader_common_glsl_js__ = __webpack_require__(147); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_42__shader_color_glsl_js__ = __webpack_require__(148); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_43__shader_lambert_glsl_js__ = __webpack_require__(149); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_44__shader_realistic_glsl_js__ = __webpack_require__(150); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_45__shader_hatching_glsl_js__ = __webpack_require__(151); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_46__shader_shadow_glsl_js__ = __webpack_require__(152); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// Math - - - - - - - - - - - - - - - - - -// Some common shaders - - - - - - - - - - -__WEBPACK_IMPORTED_MODULE_8_echarts_lib_echarts___default.a.util.extend(__WEBPACK_IMPORTED_MODULE_6_claygl_src_Node__["a" /* default */].prototype, __WEBPACK_IMPORTED_MODULE_38__animatableMixin__["a" /* default */]); - -__WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].import(__WEBPACK_IMPORTED_MODULE_39_claygl_src_shader_source_util_glsl_js__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].import(__WEBPACK_IMPORTED_MODULE_40_claygl_src_shader_source_prez_glsl_js__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].import(__WEBPACK_IMPORTED_MODULE_41__shader_common_glsl_js__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].import(__WEBPACK_IMPORTED_MODULE_42__shader_color_glsl_js__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].import(__WEBPACK_IMPORTED_MODULE_43__shader_lambert_glsl_js__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].import(__WEBPACK_IMPORTED_MODULE_44__shader_realistic_glsl_js__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].import(__WEBPACK_IMPORTED_MODULE_45__shader_hatching_glsl_js__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].import(__WEBPACK_IMPORTED_MODULE_46__shader_shadow_glsl_js__["a" /* default */]); - -function isValueNone(value) { - return !value || value === 'none'; -} - -function isValueImage(value) { - return value instanceof HTMLCanvasElement - || value instanceof HTMLImageElement - || value instanceof Image; -} - -function isECharts(value) { - return value.getZr && value.setOption; -} - -// Overwrite addToScene and removeFromScene -var oldAddToScene = __WEBPACK_IMPORTED_MODULE_9_claygl_src_Scene__["a" /* default */].prototype.addToScene; -var oldRemoveFromScene = __WEBPACK_IMPORTED_MODULE_9_claygl_src_Scene__["a" /* default */].prototype.removeFromScene; - -__WEBPACK_IMPORTED_MODULE_9_claygl_src_Scene__["a" /* default */].prototype.addToScene = function (node) { - oldAddToScene.call(this, node); - - if (this.__zr) { - var zr = this.__zr; - node.traverse(function (child) { - child.__zr = zr; - if (child.addAnimatorsToZr) { - child.addAnimatorsToZr(zr); - } - }); - } -}; - -__WEBPACK_IMPORTED_MODULE_9_claygl_src_Scene__["a" /* default */].prototype.removeFromScene = function (node) { - oldRemoveFromScene.call(this, node); - - node.traverse(function (child) { - var zr = child.__zr; - child.__zr = null; - if (zr && child.removeAnimatorsFromZr) { - child.removeAnimatorsFromZr(zr); - } - }); -}; - -/** - * @param {string} textureName - * @param {string|HTMLImageElement|HTMLCanvasElement} imgValue - * @param {module:echarts/ExtensionAPI} api - * @param {Object} [textureOpts] - */ -__WEBPACK_IMPORTED_MODULE_5_claygl_src_Material__["a" /* default */].prototype.setTextureImage = function (textureName, imgValue, api, textureOpts) { - if (!this.shader) { - return; - } - - var zr = api.getZr(); - var material = this; - var texture; - material.autoUpdateTextureStatus = false; - // disableTexture first - material.disableTexture(textureName); - if (!isValueNone(imgValue)) { - texture = graphicGL.loadTexture(imgValue, api, textureOpts, function (texture) { - material.enableTexture(textureName); - zr && zr.refresh(); - }); - // Set texture immediately for other code to verify if have this texture. - material.set(textureName, texture); - } - - return texture; -}; - -var graphicGL = {}; - -graphicGL.Renderer = __WEBPACK_IMPORTED_MODULE_1_claygl_src_Renderer__["a" /* default */]; - -graphicGL.Node = __WEBPACK_IMPORTED_MODULE_6_claygl_src_Node__["a" /* default */]; - -graphicGL.Mesh = __WEBPACK_IMPORTED_MODULE_0_claygl_src_Mesh__["a" /* default */]; - -graphicGL.Shader = __WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */]; - -graphicGL.Material = __WEBPACK_IMPORTED_MODULE_5_claygl_src_Material__["a" /* default */]; - -graphicGL.Texture = __WEBPACK_IMPORTED_MODULE_3_claygl_src_Texture__["a" /* default */]; - -graphicGL.Texture2D = __WEBPACK_IMPORTED_MODULE_2_claygl_src_Texture2D__["a" /* default */]; - -// Geometries -graphicGL.Geometry = __WEBPACK_IMPORTED_MODULE_7_claygl_src_Geometry__["a" /* default */]; -graphicGL.SphereGeometry = __WEBPACK_IMPORTED_MODULE_17_claygl_src_geometry_Sphere__["a" /* default */]; -graphicGL.PlaneGeometry = __WEBPACK_IMPORTED_MODULE_18_claygl_src_geometry_Plane__["a" /* default */]; -graphicGL.CubeGeometry = __WEBPACK_IMPORTED_MODULE_19_claygl_src_geometry_Cube__["a" /* default */]; - -// Lights -graphicGL.AmbientLight = __WEBPACK_IMPORTED_MODULE_20_claygl_src_light_Ambient__["a" /* default */]; -graphicGL.DirectionalLight = __WEBPACK_IMPORTED_MODULE_21_claygl_src_light_Directional__["a" /* default */]; -graphicGL.PointLight = __WEBPACK_IMPORTED_MODULE_22_claygl_src_light_Point__["a" /* default */]; -graphicGL.SpotLight = __WEBPACK_IMPORTED_MODULE_23_claygl_src_light_Spot__["a" /* default */]; - -// Cameras -graphicGL.PerspectiveCamera = __WEBPACK_IMPORTED_MODULE_24_claygl_src_camera_Perspective__["a" /* default */]; -graphicGL.OrthographicCamera = __WEBPACK_IMPORTED_MODULE_25_claygl_src_camera_Orthographic__["a" /* default */]; - -// Math -graphicGL.Vector2 = __WEBPACK_IMPORTED_MODULE_26_claygl_src_math_Vector2__["a" /* default */]; -graphicGL.Vector3 = __WEBPACK_IMPORTED_MODULE_27_claygl_src_math_Vector3__["a" /* default */]; -graphicGL.Vector4 = __WEBPACK_IMPORTED_MODULE_28_claygl_src_math_Vector4__["a" /* default */]; - -graphicGL.Quaternion = __WEBPACK_IMPORTED_MODULE_29_claygl_src_math_Quaternion__["a" /* default */]; - -graphicGL.Matrix2 = __WEBPACK_IMPORTED_MODULE_30_claygl_src_math_Matrix2__["a" /* default */]; -graphicGL.Matrix2d = __WEBPACK_IMPORTED_MODULE_31_claygl_src_math_Matrix2d__["a" /* default */]; -graphicGL.Matrix3 = __WEBPACK_IMPORTED_MODULE_32_claygl_src_math_Matrix3__["a" /* default */]; -graphicGL.Matrix4 = __WEBPACK_IMPORTED_MODULE_33_claygl_src_math_Matrix4__["a" /* default */]; - -graphicGL.Plane = __WEBPACK_IMPORTED_MODULE_34_claygl_src_math_Plane__["a" /* default */]; -graphicGL.Ray = __WEBPACK_IMPORTED_MODULE_35_claygl_src_math_Ray__["a" /* default */]; -graphicGL.BoundingBox = __WEBPACK_IMPORTED_MODULE_36_claygl_src_math_BoundingBox__["a" /* default */]; -graphicGL.Frustum = __WEBPACK_IMPORTED_MODULE_37_claygl_src_math_Frustum__["a" /* default */]; - -// Texture utilities - -var blankImage = __WEBPACK_IMPORTED_MODULE_11_claygl_src_util_texture__["a" /* default */].createBlank('rgba(255,255,255,0)').image; - - -function nearestPowerOfTwo(val) { - return Math.pow(2, Math.round(Math.log(val) / Math.LN2)); -} -function convertTextureToPowerOfTwo(texture) { - if ((texture.wrapS === __WEBPACK_IMPORTED_MODULE_3_claygl_src_Texture__["a" /* default */].REPEAT || texture.wrapT === __WEBPACK_IMPORTED_MODULE_3_claygl_src_Texture__["a" /* default */].REPEAT) - && texture.image - ) { - // var canvas = document.createElement('canvas'); - var width = nearestPowerOfTwo(texture.width); - var height = nearestPowerOfTwo(texture.height); - if (width !== texture.width || height !== texture.height) { - var canvas = document.createElement('canvas'); - canvas.width = width; - canvas.height = height; - var ctx = canvas.getContext('2d'); - ctx.drawImage(texture.image, 0, 0, width, height); - texture.image = canvas; - } - } -} -/** - * @param {string|HTMLImageElement|HTMLCanvasElement} imgValue - * @param {module:echarts/ExtensionAPI} api - * @param {Object} [textureOpts] - * @param {Function} cb - */ -// TODO Promise, test -graphicGL.loadTexture = function (imgValue, api, textureOpts, cb) { - if (typeof textureOpts === 'function') { - cb = textureOpts; - textureOpts = {}; - } - textureOpts = textureOpts || {}; - - var keys = Object.keys(textureOpts).sort(); - var prefix = ''; - for (var i = 0; i < keys.length; i++) { - prefix += keys[i] + '_' + textureOpts[keys[i]] + '_'; - } - - var textureCache = api.__textureCache = api.__textureCache || new __WEBPACK_IMPORTED_MODULE_10_zrender_lib_core_LRU___default.a(20); - - if (isECharts(imgValue)) { - var id = imgValue.__textureid__; - var textureObj = textureCache.get(prefix + id); - if (!textureObj) { - var surface = new __WEBPACK_IMPORTED_MODULE_12__EChartsSurface__["a" /* default */](imgValue); - surface.onupdate = function () { - api.getZr().refresh(); - }; - textureObj = { - texture: surface.getTexture() - }; - for (var i = 0; i < keys.length; i++) { - textureObj.texture[keys[i]] = textureOpts[keys[i]]; - } - id = imgValue.__textureid__ || '__ecgl_ec__' + textureObj.texture.__uid__; - imgValue.__textureid__ = id; - textureCache.put(prefix + id, textureObj); - cb && cb(textureObj.texture); - } - else { - textureObj.texture.surface.setECharts(imgValue); - - cb && cb(textureObj.texture); - } - return textureObj.texture; - } - else if (isValueImage(imgValue)) { - var id = imgValue.__textureid__; - var textureObj = textureCache.get(prefix + id); - if (!textureObj) { - textureObj = { - texture: new graphicGL.Texture2D({ - image: imgValue - }) - }; - for (var i = 0; i < keys.length; i++) { - textureObj.texture[keys[i]] = textureOpts[keys[i]]; - } - id = imgValue.__textureid__ || '__ecgl_image__' + textureObj.texture.__uid__; - imgValue.__textureid__ = id; - textureCache.put(prefix + id, textureObj); - - convertTextureToPowerOfTwo(textureObj.texture); - // TODO Next tick? - cb && cb(textureObj.texture); - } - return textureObj.texture; - } - else { - var textureObj = textureCache.get(prefix + imgValue); - if (textureObj) { - if (textureObj.callbacks) { - // Add to pending callbacks - textureObj.callbacks.push(cb); - } - else { - // TODO Next tick? - cb && cb(textureObj.texture); - } - } - else { - // Maybe base64 - if (imgValue.match(/.hdr$|^data:application\/octet-stream/)) { - textureObj = { - callbacks: [cb] - }; - var texture = __WEBPACK_IMPORTED_MODULE_11_claygl_src_util_texture__["a" /* default */].loadTexture(imgValue, { - exposure: textureOpts.exposure, - fileType: 'hdr' - }, function () { - texture.dirty(); - textureObj.callbacks.forEach(function (cb) { - cb && cb(texture); - }); - textureObj.callbacks = null; - }); - textureObj.texture = texture; - textureCache.put(prefix + imgValue, textureObj); - } - else { - var texture = new graphicGL.Texture2D({ - image: new Image() - }); - for (var i = 0; i < keys.length; i++) { - texture[keys[i]] = textureOpts[keys[i]]; - } - - textureObj = { - texture: texture, - callbacks: [cb] - }; - var originalImage = texture.image; - originalImage.onload = function () { - texture.image = originalImage; - convertTextureToPowerOfTwo(texture); - - texture.dirty(); - textureObj.callbacks.forEach(function (cb) { - cb && cb(texture); - }); - textureObj.callbacks = null; - }; - originalImage.src = imgValue; - // Use blank image as place holder. - texture.image = blankImage; - - textureCache.put(prefix + imgValue, textureObj); - } - } - - return textureObj.texture; - } -}; - -/** - * Create ambientCubemap and ambientSH light. respectively to have specular and diffuse light - * @return {Object} { specular, diffuse } - */ -graphicGL.createAmbientCubemap = function (opt, renderer, api, cb) { - opt = opt || {}; - var textureUrl = opt.texture; - var exposure = __WEBPACK_IMPORTED_MODULE_16__retrieve__["a" /* default */].firstNotNull(opt.exposure, 1.0); - - var ambientCubemap = new __WEBPACK_IMPORTED_MODULE_13_claygl_src_light_AmbientCubemap__["a" /* default */]({ - intensity: __WEBPACK_IMPORTED_MODULE_16__retrieve__["a" /* default */].firstNotNull(opt.specularIntensity, 1.0) - }); - var ambientSH = new __WEBPACK_IMPORTED_MODULE_14_claygl_src_light_AmbientSH__["a" /* default */]({ - intensity: __WEBPACK_IMPORTED_MODULE_16__retrieve__["a" /* default */].firstNotNull(opt.diffuseIntensity, 1.0), - coefficients: [0.844, 0.712, 0.691, -0.037, 0.083, 0.167, 0.343, 0.288, 0.299, -0.041, -0.021, -0.009, -0.003, -0.041, -0.064, -0.011, -0.007, -0.004, -0.031, 0.034, 0.081, -0.060, -0.049, -0.060, 0.046, 0.056, 0.050] - }); - - - ambientCubemap.cubemap = graphicGL.loadTexture(textureUrl, api, { - exposure: exposure - }, function () { - // TODO Performance when multiple view - ambientCubemap.cubemap.flipY = false; - if (true) { - var time = Date.now(); - } - ambientCubemap.prefilter(renderer, 32); - if (true) { - var dTime = Date.now() - time; - console.log('Prefilter environment map: ' + dTime + 'ms'); - } - ambientSH.coefficients = __WEBPACK_IMPORTED_MODULE_15_claygl_src_util_sh__["a" /* default */].projectEnvironmentMap(renderer, ambientCubemap.cubemap, { - lod: 1 - }); - - cb && cb(); - - // TODO Refresh ? - }); - - return { - specular: ambientCubemap, - diffuse: ambientSH - }; -}; - -/** - * Create a blank texture for placeholder - */ -graphicGL.createBlankTexture = __WEBPACK_IMPORTED_MODULE_11_claygl_src_util_texture__["a" /* default */].createBlank; - -/** - * If value is image - * @param {*} - * @return {boolean} - */ -graphicGL.isImage = isValueImage; - -graphicGL.additiveBlend = function (gl) { - gl.blendEquation(gl.FUNC_ADD); - gl.blendFunc(gl.SRC_ALPHA, gl.ONE); -}; - -/** - * @param {string|Array.} colorStr - * @param {Array.} [rgba] - * @return {Array.} rgba - */ -graphicGL.parseColor = function (colorStr, rgba) { - if (colorStr instanceof Array) { - if (!rgba) { - rgba = []; - } - // Color has been parsed. - rgba[0] = colorStr[0]; - rgba[1] = colorStr[1]; - rgba[2] = colorStr[2]; - if (colorStr.length > 3) { - rgba[3] = colorStr[3]; - } - else { - rgba[3] = 1; - } - return rgba; - } - - rgba = __WEBPACK_IMPORTED_MODULE_8_echarts_lib_echarts___default.a.color.parse(colorStr || '#000', rgba) || [0, 0, 0, 0]; - rgba[0] /= 255; - rgba[1] /= 255; - rgba[2] /= 255; - return rgba; -}; - -/** - * Convert alpha beta rotation to direction. - * @param {number} alpha - * @param {number} beta - * @return {Array.} - */ -graphicGL.directionFromAlphaBeta = function (alpha, beta) { - var theta = alpha / 180 * Math.PI + Math.PI / 2; - var phi = -beta / 180 * Math.PI + Math.PI / 2; - - var dir = []; - var r = Math.sin(theta); - dir[0] = r * Math.cos(phi); - dir[1] = -Math.cos(theta); - dir[2] = r * Math.sin(phi); - - return dir; -}; -/** - * Get shadow resolution from shadowQuality configuration - */ -graphicGL.getShadowResolution = function (shadowQuality) { - var shadowResolution = 1024; - switch (shadowQuality) { - case 'low': - shadowResolution = 512; - break; - case 'medium': - break; - case 'high': - shadowResolution = 2048; - break; - case 'ultra': - shadowResolution = 4096; - break; - } - return shadowResolution; -}; - -/** - * Shading utilities - */ -graphicGL.COMMON_SHADERS = ['lambert', 'color', 'realistic', 'hatching']; - -/** - * Create shader including vertex and fragment - * @param {string} prefix. - */ -graphicGL.createShader = function (prefix) { - var vertexShaderStr = __WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].source(prefix + '.vertex'); - var fragmentShaderStr = __WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].source(prefix + '.fragment'); - if (!vertexShaderStr) { - console.error('Vertex shader of \'%s\' not exits', prefix); - } - if (!fragmentShaderStr) { - console.error('Fragment shader of \'%s\' not exits', prefix); - } - var shader = new __WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */](vertexShaderStr, fragmentShaderStr); - shader.name = prefix; - return shader; -}; - -graphicGL.createMaterial = function (prefix, defines) { - if (!(defines instanceof Array)) { - defines = [defines]; - } - var shader = graphicGL.createShader(prefix); - var material = new __WEBPACK_IMPORTED_MODULE_5_claygl_src_Material__["a" /* default */]({ - shader: shader - }); - defines.forEach(function (defineName) { - if (typeof defineName === 'string') { - material.define(defineName); - } - }); - return material; -}; -/** - * Set material from model. - * @param {clay.Material} material - * @param {module:echarts/model/Model} model - * @param {module:echarts/ExtensionAPI} api - */ -graphicGL.setMaterialFromModel = function (shading, material, model, api) { - material.autoUpdateTextureStatus = false; - - var materialModel = model.getModel(shading + 'Material'); - var detailTexture = materialModel.get('detailTexture'); - var uvRepeat = __WEBPACK_IMPORTED_MODULE_16__retrieve__["a" /* default */].firstNotNull(materialModel.get('textureTiling'), 1.0); - var uvOffset = __WEBPACK_IMPORTED_MODULE_16__retrieve__["a" /* default */].firstNotNull(materialModel.get('textureOffset'), 0.0); - if (typeof uvRepeat === 'number') { - uvRepeat = [uvRepeat, uvRepeat]; - } - if (typeof uvOffset === 'number') { - uvOffset = [uvOffset, uvOffset]; - } - var repeatParam = (uvRepeat[0] > 1 || uvRepeat[1] > 1) ? graphicGL.Texture.REPEAT : graphicGL.Texture.CLAMP_TO_EDGE; - var textureOpt = { - anisotropic: 8, - wrapS: repeatParam, - wrapT: repeatParam - }; - if (shading === 'realistic') { - var roughness = materialModel.get('roughness'); - var metalness = materialModel.get('metalness'); - if (metalness != null) { - // Try to treat as a texture, TODO More check - if (isNaN(metalness)) { - material.setTextureImage('metalnessMap', metalness, api, textureOpt); - metalness = __WEBPACK_IMPORTED_MODULE_16__retrieve__["a" /* default */].firstNotNull(materialModel.get('metalnessAdjust'), 0.5); - } - } - else { - // Default metalness. - metalness = 0; - } - if (roughness != null) { - // Try to treat as a texture, TODO More check - if (isNaN(roughness)) { - material.setTextureImage('roughnessMap', roughness, api, textureOpt); - roughness = __WEBPACK_IMPORTED_MODULE_16__retrieve__["a" /* default */].firstNotNull(materialModel.get('roughnessAdjust'), 0.5); - } - } - else { - // Default roughness. - roughness = 0.5; - } - var normalTextureVal = materialModel.get('normalTexture'); - material.setTextureImage('detailMap', detailTexture, api, textureOpt); - material.setTextureImage('normalMap', normalTextureVal, api, textureOpt); - material.set({ - roughness: roughness, - metalness: metalness, - detailUvRepeat: uvRepeat, - detailUvOffset: uvOffset - }); - // var normalTexture = material.get('normalMap'); - // if (normalTexture) { - // PENDING - // normalTexture.format = Texture.SRGB; - // } - } - else if (shading === 'lambert') { - material.setTextureImage('detailMap', detailTexture, api, textureOpt); - material.set({ - detailUvRepeat: uvRepeat, - detailUvOffset: uvOffset - }); - } - else if (shading === 'color') { - material.setTextureImage('detailMap', detailTexture, api, textureOpt); - material.set({ - detailUvRepeat: uvRepeat, - detailUvOffset: uvOffset - }); - } - else if (shading === 'hatching') { - var tams = materialModel.get('hatchingTextures') || []; - if (tams.length < 6) { - if (true) { - console.error('Invalid hatchingTextures.'); - } - } - for (var i = 0; i < 6; i++) { - material.setTextureImage('hatch' + (i + 1), tams[i], api, { - anisotropic: 8, - wrapS: graphicGL.Texture.REPEAT, - wrapT: graphicGL.Texture.REPEAT - }); - } - material.set({ - detailUvRepeat: uvRepeat, - detailUvOffset: uvOffset - }); - } -}; - -graphicGL.updateVertexAnimation = function ( - mappingAttributes, previousMesh, currentMesh, seriesModel -) { - var enableAnimation = seriesModel.get('animation'); - var duration = seriesModel.get('animationDurationUpdate'); - var easing = seriesModel.get('animationEasingUpdate'); - var shadowDepthMaterial = currentMesh.shadowDepthMaterial; - - if (enableAnimation && previousMesh && duration > 0 - // Only animate when bar count are not changed - && previousMesh.geometry.vertexCount === currentMesh.geometry.vertexCount - ) { - currentMesh.material.define('vertex', 'VERTEX_ANIMATION'); - currentMesh.ignorePreZ = true; - if (shadowDepthMaterial) { - shadowDepthMaterial.define('vertex', 'VERTEX_ANIMATION'); - } - for (var i = 0; i < mappingAttributes.length; i++) { - currentMesh.geometry.attributes[mappingAttributes[i][0]].value = - previousMesh.geometry.attributes[mappingAttributes[i][1]].value; - } - currentMesh.geometry.dirty(); - currentMesh.__percent = 0; - currentMesh.material.set('percent', 0); - currentMesh.stopAnimation(); - currentMesh.animate() - .when(duration, { - __percent: 1 - }) - .during(function () { - currentMesh.material.set('percent', currentMesh.__percent); - if (shadowDepthMaterial) { - shadowDepthMaterial.set('percent', currentMesh.__percent); - } - }) - .done(function () { - currentMesh.ignorePreZ = false; - currentMesh.material.undefine('vertex', 'VERTEX_ANIMATION'); - if (shadowDepthMaterial) { - shadowDepthMaterial.undefine('vertex', 'VERTEX_ANIMATION'); - } - }) - .start(easing); - } - else { - currentMesh.material.undefine('vertex', 'VERTEX_ANIMATION'); - if (shadowDepthMaterial) { - shadowDepthMaterial.undefine('vertex', 'VERTEX_ANIMATION'); - } - } -}; - -/* harmony default export */ __webpack_exports__["a"] = (graphicGL); - -/***/ }), -/* 2 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); - - -var retrieve = { - - firstNotNull: function () { - for (var i = 0, len = arguments.length; i < len; i++) { - if (arguments[i] != null) { - return arguments[i]; - } - } - }, - - /** - * @param {module:echarts/data/List} data - * @param {Object} payload Contains dataIndex (means rawIndex) / dataIndexInside / name - * each of which can be Array or primary type. - * @return {number|Array.} dataIndex If not found, return undefined/null. - */ - queryDataIndex: function (data, payload) { - if (payload.dataIndexInside != null) { - return payload.dataIndexInside; - } - else if (payload.dataIndex != null) { - return __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.isArray(payload.dataIndex) - ? __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.map(payload.dataIndex, function (value) { - return data.indexOfRawIndex(value); - }) - : data.indexOfRawIndex(payload.dataIndex); - } - else if (payload.name != null) { - return __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.isArray(payload.name) - ? __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.map(payload.name, function (value) { - return data.indexOfName(value); - }) - : data.indexOfName(payload.name); - } - } -}; - -/* harmony default export */ __webpack_exports__["a"] = (retrieve); - -/***/ }), -/* 3 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__ = __webpack_require__(12); - - -/** - * @constructor - * @alias clay.Vector3 - * @param {number} x - * @param {number} y - * @param {number} z - */ -var Vector3 = function(x, y, z) { - - x = x || 0; - y = y || 0; - z = z || 0; - - /** - * Storage of Vector3, read and write of x, y, z will change the values in array - * All methods also operate on the array instead of x, y, z components - * @name array - * @type {Float32Array} - * @memberOf clay.Vector3# - */ - this.array = __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].fromValues(x, y, z); - - /** - * Dirty flag is used by the Node to determine - * if the matrix is updated to latest - * @name _dirty - * @type {boolean} - * @memberOf clay.Vector3# - */ - this._dirty = true; -}; - -Vector3.prototype = { - - constructor: Vector3, - - /** - * Add b to self - * @param {clay.Vector3} b - * @return {clay.Vector3} - */ - add: function (b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].add(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Set x, y and z components - * @param {number} x - * @param {number} y - * @param {number} z - * @return {clay.Vector3} - */ - set: function (x, y, z) { - this.array[0] = x; - this.array[1] = y; - this.array[2] = z; - this._dirty = true; - return this; - }, - - /** - * Set x, y and z components from array - * @param {Float32Array|number[]} arr - * @return {clay.Vector3} - */ - setArray: function (arr) { - this.array[0] = arr[0]; - this.array[1] = arr[1]; - this.array[2] = arr[2]; - - this._dirty = true; - return this; - }, - - /** - * Clone a new Vector3 - * @return {clay.Vector3} - */ - clone: function () { - return new Vector3(this.x, this.y, this.z); - }, - - /** - * Copy from b - * @param {clay.Vector3} b - * @return {clay.Vector3} - */ - copy: function (b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].copy(this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Cross product of self and b, written to a Vector3 out - * @param {clay.Vector3} a - * @param {clay.Vector3} b - * @return {clay.Vector3} - */ - cross: function (a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].cross(this.array, a.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Alias for distance - * @param {clay.Vector3} b - * @return {number} - */ - dist: function (b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].dist(this.array, b.array); - }, - - /** - * Distance between self and b - * @param {clay.Vector3} b - * @return {number} - */ - distance: function (b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].distance(this.array, b.array); - }, - - /** - * Alias for divide - * @param {clay.Vector3} b - * @return {clay.Vector3} - */ - div: function (b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].div(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Divide self by b - * @param {clay.Vector3} b - * @return {clay.Vector3} - */ - divide: function (b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].divide(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Dot product of self and b - * @param {clay.Vector3} b - * @return {number} - */ - dot: function (b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].dot(this.array, b.array); - }, - - /** - * Alias of length - * @return {number} - */ - len: function () { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].len(this.array); - }, - - /** - * Calculate the length - * @return {number} - */ - length: function () { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].length(this.array); - }, - /** - * Linear interpolation between a and b - * @param {clay.Vector3} a - * @param {clay.Vector3} b - * @param {number} t - * @return {clay.Vector3} - */ - lerp: function (a, b, t) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].lerp(this.array, a.array, b.array, t); - this._dirty = true; - return this; - }, - - /** - * Minimum of self and b - * @param {clay.Vector3} b - * @return {clay.Vector3} - */ - min: function (b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].min(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Maximum of self and b - * @param {clay.Vector3} b - * @return {clay.Vector3} - */ - max: function (b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].max(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Alias for multiply - * @param {clay.Vector3} b - * @return {clay.Vector3} - */ - mul: function (b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].mul(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Mutiply self and b - * @param {clay.Vector3} b - * @return {clay.Vector3} - */ - multiply: function (b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].multiply(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Negate self - * @return {clay.Vector3} - */ - negate: function () { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].negate(this.array, this.array); - this._dirty = true; - return this; - }, - - /** - * Normalize self - * @return {clay.Vector3} - */ - normalize: function () { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].normalize(this.array, this.array); - this._dirty = true; - return this; - }, - - /** - * Generate random x, y, z components with a given scale - * @param {number} scale - * @return {clay.Vector3} - */ - random: function (scale) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].random(this.array, scale); - this._dirty = true; - return this; - }, - - /** - * Scale self - * @param {number} scale - * @return {clay.Vector3} - */ - scale: function (s) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].scale(this.array, this.array, s); - this._dirty = true; - return this; - }, - - /** - * Scale b and add to self - * @param {clay.Vector3} b - * @param {number} scale - * @return {clay.Vector3} - */ - scaleAndAdd: function (b, s) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].scaleAndAdd(this.array, this.array, b.array, s); - this._dirty = true; - return this; - }, - - /** - * Alias for squaredDistance - * @param {clay.Vector3} b - * @return {number} - */ - sqrDist: function (b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].sqrDist(this.array, b.array); - }, - - /** - * Squared distance between self and b - * @param {clay.Vector3} b - * @return {number} - */ - squaredDistance: function (b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].squaredDistance(this.array, b.array); - }, - - /** - * Alias for squaredLength - * @return {number} - */ - sqrLen: function () { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].sqrLen(this.array); - }, - - /** - * Squared length of self - * @return {number} - */ - squaredLength: function () { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].squaredLength(this.array); - }, - - /** - * Alias for subtract - * @param {clay.Vector3} b - * @return {clay.Vector3} - */ - sub: function (b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].sub(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Subtract b from self - * @param {clay.Vector3} b - * @return {clay.Vector3} - */ - subtract: function (b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].subtract(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Transform self with a Matrix3 m - * @param {clay.Matrix3} m - * @return {clay.Vector3} - */ - transformMat3: function (m) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].transformMat3(this.array, this.array, m.array); - this._dirty = true; - return this; - }, - - /** - * Transform self with a Matrix4 m - * @param {clay.Matrix4} m - * @return {clay.Vector3} - */ - transformMat4: function (m) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].transformMat4(this.array, this.array, m.array); - this._dirty = true; - return this; - }, - /** - * Transform self with a Quaternion q - * @param {clay.Quaternion} q - * @return {clay.Vector3} - */ - transformQuat: function (q) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].transformQuat(this.array, this.array, q.array); - this._dirty = true; - return this; - }, - - /** - * Trasnform self into projection space with m - * @param {clay.Matrix4} m - * @return {clay.Vector3} - */ - applyProjection: function (m) { - var v = this.array; - m = m.array; - - // Perspective projection - if (m[15] === 0) { - var w = -1 / v[2]; - v[0] = m[0] * v[0] * w; - v[1] = m[5] * v[1] * w; - v[2] = (m[10] * v[2] + m[14]) * w; - } - else { - v[0] = m[0] * v[0] + m[12]; - v[1] = m[5] * v[1] + m[13]; - v[2] = m[10] * v[2] + m[14]; - } - this._dirty = true; - - return this; - }, - - eulerFromQuat: function(q, order) { - Vector3.eulerFromQuat(this, q, order); - }, - - eulerFromMat3: function (m, order) { - Vector3.eulerFromMat3(this, m, order); - }, - - toString: function() { - return '[' + Array.prototype.join.call(this.array, ',') + ']'; - }, - - toArray: function () { - return Array.prototype.slice.call(this.array); - } -}; - -var defineProperty = Object.defineProperty; -// Getter and Setter -if (defineProperty) { - - var proto = Vector3.prototype; - /** - * @name x - * @type {number} - * @memberOf clay.Vector3 - * @instance - */ - defineProperty(proto, 'x', { - get: function () { - return this.array[0]; - }, - set: function (value) { - this.array[0] = value; - this._dirty = true; - } - }); - - /** - * @name y - * @type {number} - * @memberOf clay.Vector3 - * @instance - */ - defineProperty(proto, 'y', { - get: function () { - return this.array[1]; - }, - set: function (value) { - this.array[1] = value; - this._dirty = true; - } - }); - - /** - * @name z - * @type {number} - * @memberOf clay.Vector3 - * @instance - */ - defineProperty(proto, 'z', { - get: function () { - return this.array[2]; - }, - set: function (value) { - this.array[2] = value; - this._dirty = true; - } - }); -} - - -// Supply methods that are not in place - -/** - * @param {clay.Vector3} out - * @param {clay.Vector3} a - * @param {clay.Vector3} b - * @return {clay.Vector3} - */ -Vector3.add = function(out, a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].add(out.array, a.array, b.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Vector3} out - * @param {number} x - * @param {number} y - * @param {number} z - * @return {clay.Vector3} - */ -Vector3.set = function(out, x, y, z) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].set(out.array, x, y, z); - out._dirty = true; -}; - -/** - * @param {clay.Vector3} out - * @param {clay.Vector3} b - * @return {clay.Vector3} - */ -Vector3.copy = function(out, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].copy(out.array, b.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Vector3} out - * @param {clay.Vector3} a - * @param {clay.Vector3} b - * @return {clay.Vector3} - */ -Vector3.cross = function(out, a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].cross(out.array, a.array, b.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Vector3} a - * @param {clay.Vector3} b - * @return {number} - */ -Vector3.dist = function(a, b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].distance(a.array, b.array); -}; - -/** - * @function - * @param {clay.Vector3} a - * @param {clay.Vector3} b - * @return {number} - */ -Vector3.distance = Vector3.dist; - -/** - * @param {clay.Vector3} out - * @param {clay.Vector3} a - * @param {clay.Vector3} b - * @return {clay.Vector3} - */ -Vector3.div = function(out, a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].divide(out.array, a.array, b.array); - out._dirty = true; - return out; -}; - -/** - * @function - * @param {clay.Vector3} out - * @param {clay.Vector3} a - * @param {clay.Vector3} b - * @return {clay.Vector3} - */ -Vector3.divide = Vector3.div; - -/** - * @param {clay.Vector3} a - * @param {clay.Vector3} b - * @return {number} - */ -Vector3.dot = function(a, b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].dot(a.array, b.array); -}; - -/** - * @param {clay.Vector3} a - * @return {number} - */ -Vector3.len = function(b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].length(b.array); -}; - -// Vector3.length = Vector3.len; - -/** - * @param {clay.Vector3} out - * @param {clay.Vector3} a - * @param {clay.Vector3} b - * @param {number} t - * @return {clay.Vector3} - */ -Vector3.lerp = function(out, a, b, t) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].lerp(out.array, a.array, b.array, t); - out._dirty = true; - return out; -}; -/** - * @param {clay.Vector3} out - * @param {clay.Vector3} a - * @param {clay.Vector3} b - * @return {clay.Vector3} - */ -Vector3.min = function(out, a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].min(out.array, a.array, b.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Vector3} out - * @param {clay.Vector3} a - * @param {clay.Vector3} b - * @return {clay.Vector3} - */ -Vector3.max = function(out, a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].max(out.array, a.array, b.array); - out._dirty = true; - return out; -}; -/** - * @param {clay.Vector3} out - * @param {clay.Vector3} a - * @param {clay.Vector3} b - * @return {clay.Vector3} - */ -Vector3.mul = function(out, a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].multiply(out.array, a.array, b.array); - out._dirty = true; - return out; -}; -/** - * @function - * @param {clay.Vector3} out - * @param {clay.Vector3} a - * @param {clay.Vector3} b - * @return {clay.Vector3} - */ -Vector3.multiply = Vector3.mul; -/** - * @param {clay.Vector3} out - * @param {clay.Vector3} a - * @return {clay.Vector3} - */ -Vector3.negate = function(out, a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].negate(out.array, a.array); - out._dirty = true; - return out; -}; -/** - * @param {clay.Vector3} out - * @param {clay.Vector3} a - * @return {clay.Vector3} - */ -Vector3.normalize = function(out, a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].normalize(out.array, a.array); - out._dirty = true; - return out; -}; -/** - * @param {clay.Vector3} out - * @param {number} scale - * @return {clay.Vector3} - */ -Vector3.random = function(out, scale) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].random(out.array, scale); - out._dirty = true; - return out; -}; -/** - * @param {clay.Vector3} out - * @param {clay.Vector3} a - * @param {number} scale - * @return {clay.Vector3} - */ -Vector3.scale = function(out, a, scale) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].scale(out.array, a.array, scale); - out._dirty = true; - return out; -}; -/** - * @param {clay.Vector3} out - * @param {clay.Vector3} a - * @param {clay.Vector3} b - * @param {number} scale - * @return {clay.Vector3} - */ -Vector3.scaleAndAdd = function(out, a, b, scale) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].scaleAndAdd(out.array, a.array, b.array, scale); - out._dirty = true; - return out; -}; -/** - * @param {clay.Vector3} a - * @param {clay.Vector3} b - * @return {number} - */ -Vector3.sqrDist = function(a, b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].sqrDist(a.array, b.array); -}; -/** - * @function - * @param {clay.Vector3} a - * @param {clay.Vector3} b - * @return {number} - */ -Vector3.squaredDistance = Vector3.sqrDist; -/** - * @param {clay.Vector3} a - * @return {number} - */ -Vector3.sqrLen = function(a) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].sqrLen(a.array); -}; -/** - * @function - * @param {clay.Vector3} a - * @return {number} - */ -Vector3.squaredLength = Vector3.sqrLen; - -/** - * @param {clay.Vector3} out - * @param {clay.Vector3} a - * @param {clay.Vector3} b - * @return {clay.Vector3} - */ -Vector3.sub = function(out, a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].subtract(out.array, a.array, b.array); - out._dirty = true; - return out; -}; -/** - * @function - * @param {clay.Vector3} out - * @param {clay.Vector3} a - * @param {clay.Vector3} b - * @return {clay.Vector3} - */ -Vector3.subtract = Vector3.sub; - -/** - * @param {clay.Vector3} out - * @param {clay.Vector3} a - * @param {Matrix3} m - * @return {clay.Vector3} - */ -Vector3.transformMat3 = function(out, a, m) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].transformMat3(out.array, a.array, m.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Vector3} out - * @param {clay.Vector3} a - * @param {clay.Matrix4} m - * @return {clay.Vector3} - */ -Vector3.transformMat4 = function(out, a, m) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].transformMat4(out.array, a.array, m.array); - out._dirty = true; - return out; -}; -/** - * @param {clay.Vector3} out - * @param {clay.Vector3} a - * @param {clay.Quaternion} q - * @return {clay.Vector3} - */ -Vector3.transformQuat = function(out, a, q) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].transformQuat(out.array, a.array, q.array); - out._dirty = true; - return out; -}; - -function clamp(val, min, max) { - return val < min ? min : (val > max ? max : val); -} -var atan2 = Math.atan2; -var asin = Math.asin; -var abs = Math.abs; -/** - * Convert quaternion to euler angle - * Quaternion must be normalized - * From three.js - */ -Vector3.eulerFromQuat = function (out, q, order) { - out._dirty = true; - q = q.array; - - var target = out.array; - var x = q[0], y = q[1], z = q[2], w = q[3]; - var x2 = x * x; - var y2 = y * y; - var z2 = z * z; - var w2 = w * w; - - var order = (order || 'XYZ').toUpperCase(); - - switch (order) { - case 'XYZ': - target[0] = atan2(2 * (x * w - y * z), (w2 - x2 - y2 + z2)); - target[1] = asin(clamp(2 * (x * z + y * w), - 1, 1)); - target[2] = atan2(2 * (z * w - x * y), (w2 + x2 - y2 - z2)); - break; - case 'YXZ': - target[0] = asin(clamp(2 * (x * w - y * z), - 1, 1)); - target[1] = atan2(2 * (x * z + y * w), (w2 - x2 - y2 + z2)); - target[2] = atan2(2 * (x * y + z * w), (w2 - x2 + y2 - z2)); - break; - case 'ZXY': - target[0] = asin(clamp(2 * (x * w + y * z), - 1, 1)); - target[1] = atan2(2 * (y * w - z * x), (w2 - x2 - y2 + z2)); - target[2] = atan2(2 * (z * w - x * y), (w2 - x2 + y2 - z2)); - break; - case 'ZYX': - target[0] = atan2(2 * (x * w + z * y), (w2 - x2 - y2 + z2)); - target[1] = asin(clamp(2 * (y * w - x * z), - 1, 1)); - target[2] = atan2(2 * (x * y + z * w), (w2 + x2 - y2 - z2)); - break; - case 'YZX': - target[0] = atan2(2 * (x * w - z * y), (w2 - x2 + y2 - z2)); - target[1] = atan2(2 * (y * w - x * z), (w2 + x2 - y2 - z2)); - target[2] = asin(clamp(2 * (x * y + z * w), - 1, 1)); - break; - case 'XZY': - target[0] = atan2(2 * (x * w + y * z), (w2 - x2 + y2 - z2)); - target[1] = atan2(2 * (x * z + y * w), (w2 + x2 - y2 - z2)); - target[2] = asin(clamp(2 * (z * w - x * y), - 1, 1)); - break; - default: - console.warn('Unkown order: ' + order); - } - return out; -}; - -/** - * Convert rotation matrix to euler angle - * from three.js - */ -Vector3.eulerFromMat3 = function (out, m, order) { - // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled) - var te = m.array; - var m11 = te[0], m12 = te[3], m13 = te[6]; - var m21 = te[1], m22 = te[4], m23 = te[7]; - var m31 = te[2], m32 = te[5], m33 = te[8]; - var target = out.array; - - var order = (order || 'XYZ').toUpperCase(); - - switch (order) { - case 'XYZ': - target[1] = asin(clamp(m13, -1, 1)); - if (abs(m13) < 0.99999) { - target[0] = atan2(-m23, m33); - target[2] = atan2(-m12, m11); - } - else { - target[0] = atan2(m32, m22); - target[2] = 0; - } - break; - case 'YXZ': - target[0] = asin(-clamp(m23, -1, 1)); - if (abs(m23) < 0.99999) { - target[1] = atan2(m13, m33); - target[2] = atan2(m21, m22); - } - else { - target[1] = atan2(-m31, m11); - target[2] = 0; - } - break; - case 'ZXY': - target[0] = asin(clamp(m32, -1, 1)); - if (abs(m32) < 0.99999) { - target[1] = atan2(-m31, m33); - target[2] = atan2(-m12, m22); - } - else { - target[1] = 0; - target[2] = atan2(m21, m11); - } - break; - case 'ZYX': - target[1] = asin(-clamp(m31, -1, 1)); - if (abs(m31) < 0.99999) { - target[0] = atan2(m32, m33); - target[2] = atan2(m21, m11); - } - else { - target[0] = 0; - target[2] = atan2(-m12, m22); - } - break; - case 'YZX': - target[2] = asin(clamp(m21, -1, 1)); - if (abs(m21) < 0.99999) { - target[0] = atan2(-m23, m22); - target[1] = atan2(-m31, m11); - } - else { - target[0] = 0; - target[1] = atan2(m13, m33); - } - break; - case 'XZY': - target[2] = asin(-clamp(m12, -1, 1)); - if (abs(m12) < 0.99999) { - target[0] = atan2(m32, m22); - target[1] = atan2(m13, m11); - } - else { - target[0] = atan2(-m23, m33); - target[1] = 0; - } - break; - default: - console.warn('Unkown order: ' + order); - } - out._dirty = true; - - return out; -}; - -Object.defineProperties(Vector3, { - /** - * @type {clay.Vector3} - * @readOnly - * @memberOf clay.Vector3 - */ - POSITIVE_X: { - get: function () { - return new Vector3(1, 0, 0); - } - }, - /** - * @type {clay.Vector3} - * @readOnly - * @memberOf clay.Vector3 - */ - NEGATIVE_X: { - get: function () { - return new Vector3(-1, 0, 0); - } - }, - /** - * @type {clay.Vector3} - * @readOnly - * @memberOf clay.Vector3 - */ - POSITIVE_Y: { - get: function () { - return new Vector3(0, 1, 0); - } - }, - /** - * @type {clay.Vector3} - * @readOnly - * @memberOf clay.Vector3 - */ - NEGATIVE_Y: { - get: function () { - return new Vector3(0, -1, 0); - } - }, - /** - * @type {clay.Vector3} - * @readOnly - * @memberOf clay.Vector3 - */ - POSITIVE_Z: { - get: function () { - return new Vector3(0, 0, 1); - } - }, - /** - * @type {clay.Vector3} - * @readOnly - */ - NEGATIVE_Z: { - get: function () { - return new Vector3(0, 0, -1); - } - }, - /** - * @type {clay.Vector3} - * @readOnly - * @memberOf clay.Vector3 - */ - UP: { - get: function () { - return new Vector3(0, 1, 0); - } - }, - /** - * @type {clay.Vector3} - * @readOnly - * @memberOf clay.Vector3 - */ - ZERO: { - get: function () { - return new Vector3(); - } - } -}); - -/* harmony default export */ __webpack_exports__["a"] = (Vector3); - - -/***/ }), -/* 4 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__core_Base__ = __webpack_require__(7); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__core_glenum__ = __webpack_require__(11); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__core_Cache__ = __webpack_require__(57); -/** - * Base class for all textures like compressed texture, texture2d, texturecube - * TODO mapping - */ - - - - -/** - * @constructor - * @alias clay.Texture - * @extends clay.core.Base - */ -var Texture = __WEBPACK_IMPORTED_MODULE_0__core_Base__["a" /* default */].extend( /** @lends clay.Texture# */ { - /** - * Texture width, readonly when the texture source is image - * @type {number} - */ - width: 512, - /** - * Texture height, readonly when the texture source is image - * @type {number} - */ - height: 512, - /** - * Texel data type. - * Possible values: - * + {@link clay.Texture.UNSIGNED_BYTE} - * + {@link clay.Texture.HALF_FLOAT} - * + {@link clay.Texture.FLOAT} - * + {@link clay.Texture.UNSIGNED_INT_24_8_WEBGL} - * + {@link clay.Texture.UNSIGNED_INT} - * @type {number} - */ - type: __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].UNSIGNED_BYTE, - /** - * Format of texel data - * Possible values: - * + {@link clay.Texture.RGBA} - * + {@link clay.Texture.DEPTH_COMPONENT} - * + {@link clay.Texture.DEPTH_STENCIL} - * @type {number} - */ - format: __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].RGBA, - /** - * Texture wrap. Default to be REPEAT. - * Possible values: - * + {@link clay.Texture.CLAMP_TO_EDGE} - * + {@link clay.Texture.REPEAT} - * + {@link clay.Texture.MIRRORED_REPEAT} - * @type {number} - */ - wrapS: __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].REPEAT, - /** - * Texture wrap. Default to be REPEAT. - * Possible values: - * + {@link clay.Texture.CLAMP_TO_EDGE} - * + {@link clay.Texture.REPEAT} - * + {@link clay.Texture.MIRRORED_REPEAT} - * @type {number} - */ - wrapT: __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].REPEAT, - /** - * Possible values: - * + {@link clay.Texture.NEAREST} - * + {@link clay.Texture.LINEAR} - * + {@link clay.Texture.NEAREST_MIPMAP_NEAREST} - * + {@link clay.Texture.LINEAR_MIPMAP_NEAREST} - * + {@link clay.Texture.NEAREST_MIPMAP_LINEAR} - * + {@link clay.Texture.LINEAR_MIPMAP_LINEAR} - * @type {number} - */ - minFilter: __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LINEAR_MIPMAP_LINEAR, - /** - * Possible values: - * + {@link clay.Texture.NEAREST} - * + {@link clay.Texture.LINEAR} - * @type {number} - */ - magFilter: __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LINEAR, - /** - * If enable mimap. - * @type {boolean} - */ - useMipmap: true, - - /** - * Anisotropic filtering, enabled if value is larger than 1 - * @see https://developer.mozilla.org/en-US/docs/Web/API/EXT_texture_filter_anisotropic - * @type {number} - */ - anisotropic: 1, - // pixelStorei parameters, not available when texture is used as render target - // http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml - /** - * If flip in y axis for given image source - * @type {boolean} - * @default true - */ - flipY: true, - - /** - * A flag to indicate if texture source is sRGB - */ - sRGB: true, - /** - * @type {number} - * @default 4 - */ - unpackAlignment: 4, - /** - * @type {boolean} - * @default false - */ - premultiplyAlpha: false, - - /** - * Dynamic option for texture like video - * @type {boolean} - */ - dynamic: false, - - NPOT: false, - - // PENDING - // Init it here to avoid deoptimization when it's assigned in application dynamically - __used: 0 - -}, function () { - this._cache = new __WEBPACK_IMPORTED_MODULE_2__core_Cache__["a" /* default */](); -}, -/** @lends clay.Texture.prototype */ -{ - - getWebGLTexture: function (renderer) { - var _gl = renderer.gl; - var cache = this._cache; - cache.use(renderer.__uid__); - - if (cache.miss('webgl_texture')) { - // In a new gl context, create new texture and set dirty true - cache.put('webgl_texture', _gl.createTexture()); - } - if (this.dynamic) { - this.update(renderer); - } - else if (cache.isDirty()) { - this.update(renderer); - cache.fresh(); - } - - return cache.get('webgl_texture'); - }, - - bind: function () {}, - unbind: function () {}, - - /** - * Mark texture is dirty and update in the next frame - */ - dirty: function () { - if (this._cache) { - this._cache.dirtyAll(); - } - }, - - update: function (renderer) {}, - - // Update the common parameters of texture - updateCommon: function (renderer) { - var _gl = renderer.gl; - _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, this.flipY); - _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this.premultiplyAlpha); - _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, this.unpackAlignment); - - // Use of none-power of two texture - // http://www.khronos.org/webgl/wiki/WebGL_and_OpenGL_Differences - if (this.format === __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].DEPTH_COMPONENT) { - this.useMipmap = false; - } - - var sRGBExt = renderer.getGLExtension('EXT_sRGB'); - // Fallback - if (this.format === Texture.SRGB && !sRGBExt) { - this.format = Texture.RGB; - } - if (this.format === Texture.SRGB_ALPHA && !sRGBExt) { - this.format = Texture.RGBA; - } - - this.NPOT = !this.isPowerOfTwo(); - }, - - getAvailableWrapS: function () { - if (this.NPOT) { - return __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].CLAMP_TO_EDGE; - } - return this.wrapS; - }, - getAvailableWrapT: function () { - if (this.NPOT) { - return __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].CLAMP_TO_EDGE; - } - return this.wrapT; - }, - getAvailableMinFilter: function () { - var minFilter = this.minFilter; - if (this.NPOT || !this.useMipmap) { - if (minFilter === __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].NEAREST_MIPMAP_NEAREST || - minFilter === __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].NEAREST_MIPMAP_LINEAR - ) { - return __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].NEAREST; - } - else if (minFilter === __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LINEAR_MIPMAP_LINEAR || - minFilter === __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LINEAR_MIPMAP_NEAREST - ) { - return __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LINEAR; - } - else { - return minFilter; - } - } - else { - return minFilter; - } - }, - getAvailableMagFilter: function () { - return this.magFilter; - }, - - nextHighestPowerOfTwo: function (x) { - --x; - for (var i = 1; i < 32; i <<= 1) { - x = x | x >> i; - } - return x + 1; - }, - /** - * @param {clay.Renderer} renderer - */ - dispose: function (renderer) { - - var cache = this._cache; - - cache.use(renderer.__uid__); - - var webglTexture = cache.get('webgl_texture'); - if (webglTexture){ - renderer.gl.deleteTexture(webglTexture); - } - cache.deleteContext(renderer.__uid__); - - }, - /** - * Test if image of texture is valid and loaded. - * @return {boolean} - */ - isRenderable: function () {}, - - /** - * Test if texture size is power of two - * @return {boolean} - */ - isPowerOfTwo: function () {} -}); - -Object.defineProperty(Texture.prototype, 'width', { - get: function () { - return this._width; - }, - set: function (value) { - this._width = value; - } -}); -Object.defineProperty(Texture.prototype, 'height', { - get: function () { - return this._height; - }, - set: function (value) { - this._height = value; - } -}); - -/* DataType */ - -/** - * @type {number} - */ -Texture.BYTE = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].BYTE; -/** - * @type {number} - */ -Texture.UNSIGNED_BYTE = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].UNSIGNED_BYTE; -/** - * @type {number} - */ -Texture.SHORT = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].SHORT; -/** - * @type {number} - */ -Texture.UNSIGNED_SHORT = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].UNSIGNED_SHORT; -/** - * @type {number} - */ -Texture.INT = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].INT; -/** - * @type {number} - */ -Texture.UNSIGNED_INT = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].UNSIGNED_INT; -/** - * @type {number} - */ -Texture.FLOAT = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].FLOAT; -/** - * @type {number} - */ -Texture.HALF_FLOAT = 0x8D61; - -/** - * UNSIGNED_INT_24_8_WEBGL for WEBGL_depth_texture extension - * @type {number} - */ -Texture.UNSIGNED_INT_24_8_WEBGL = 34042; - -/* PixelFormat */ -/** - * @type {number} - */ -Texture.DEPTH_COMPONENT = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].DEPTH_COMPONENT; -/** - * @type {number} - */ -Texture.DEPTH_STENCIL = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].DEPTH_STENCIL; -/** - * @type {number} - */ -Texture.ALPHA = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].ALPHA; -/** - * @type {number} - */ -Texture.RGB = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].RGB; -/** - * @type {number} - */ -Texture.RGBA = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].RGBA; -/** - * @type {number} - */ -Texture.LUMINANCE = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LUMINANCE; -/** - * @type {number} - */ -Texture.LUMINANCE_ALPHA = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LUMINANCE_ALPHA; - -/** - * @see https://www.khronos.org/registry/webgl/extensions/EXT_sRGB/ - * @type {number} - */ -Texture.SRGB = 0x8C40; -/** - * @see https://www.khronos.org/registry/webgl/extensions/EXT_sRGB/ - * @type {number} - */ -Texture.SRGB_ALPHA = 0x8C42; - -/* Compressed Texture */ -Texture.COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0; -Texture.COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1; -Texture.COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2; -Texture.COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3; - -/* TextureMagFilter */ -/** - * @type {number} - */ -Texture.NEAREST = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].NEAREST; -/** - * @type {number} - */ -Texture.LINEAR = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LINEAR; - -/* TextureMinFilter */ -/** - * @type {number} - */ -Texture.NEAREST_MIPMAP_NEAREST = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].NEAREST_MIPMAP_NEAREST; -/** - * @type {number} - */ -Texture.LINEAR_MIPMAP_NEAREST = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LINEAR_MIPMAP_NEAREST; -/** - * @type {number} - */ -Texture.NEAREST_MIPMAP_LINEAR = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].NEAREST_MIPMAP_LINEAR; -/** - * @type {number} - */ -Texture.LINEAR_MIPMAP_LINEAR = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LINEAR_MIPMAP_LINEAR; - -/* TextureWrapMode */ -/** - * @type {number} - */ -Texture.REPEAT = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].REPEAT; -/** - * @type {number} - */ -Texture.CLAMP_TO_EDGE = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].CLAMP_TO_EDGE; -/** - * @type {number} - */ -Texture.MIRRORED_REPEAT = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].MIRRORED_REPEAT; - - -/* harmony default export */ __webpack_exports__["a"] = (Texture); - - -/***/ }), -/* 5 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Texture__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__core_glenum__ = __webpack_require__(11); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__core_vendor__ = __webpack_require__(14); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__math_util__ = __webpack_require__(73); - - - - -var isPowerOfTwo = __WEBPACK_IMPORTED_MODULE_3__math_util__["a" /* default */].isPowerOfTwo; - -function nearestPowerOfTwo(val) { - return Math.pow(2, Math.round(Math.log(val) / Math.LN2)); -} -function convertTextureToPowerOfTwo(texture, canvas) { - // var canvas = document.createElement('canvas'); - var width = nearestPowerOfTwo(texture.width); - var height = nearestPowerOfTwo(texture.height); - canvas = canvas || document.createElement('canvas'); - canvas.width = width; - canvas.height = height; - var ctx = canvas.getContext('2d'); - ctx.drawImage(texture.image, 0, 0, width, height); - - return canvas; -} - -/** - * @constructor clay.Texture2D - * @extends clay.Texture - * - * @example - * ... - * var mat = new clay.Material({ - * shader: clay.shader.library.get('clay.phong', 'diffuseMap') - * }); - * var diffuseMap = new clay.Texture2D(); - * diffuseMap.load('assets/textures/diffuse.jpg'); - * mat.set('diffuseMap', diffuseMap); - * ... - * diffuseMap.success(function () { - * // Wait for the diffuse texture loaded - * animation.on('frame', function (frameTime) { - * renderer.render(scene, camera); - * }); - * }); - */ -var Texture2D = __WEBPACK_IMPORTED_MODULE_0__Texture__["a" /* default */].extend(function () { - return /** @lends clay.Texture2D# */ { - /** - * @type {?HTMLImageElement|HTMLCanvasElemnet} - */ - // TODO mark dirty when assigned. - image: null, - /** - * Pixels data. Will be ignored if image is set. - * @type {?Uint8Array|Float32Array} - */ - pixels: null, - /** - * @type {Array.} - * @example - * [{ - * image: mipmap0, - * pixels: null - * }, { - * image: mipmap1, - * pixels: null - * }, ....] - */ - mipmaps: [], - - /** - * If convert texture to power-of-two - * @type {boolean} - */ - convertToPOT: false - }; -}, { - - textureType: 'texture2D', - - update: function (renderer) { - - var _gl = renderer.gl; - _gl.bindTexture(_gl.TEXTURE_2D, this._cache.get('webgl_texture')); - - this.updateCommon(renderer); - - var glFormat = this.format; - var glType = this.type; - - // Convert to pot is only available when using image/canvas/video element. - var convertToPOT = !!(this.convertToPOT - && !this.mipmaps.length && this.image - && (this.wrapS === __WEBPACK_IMPORTED_MODULE_0__Texture__["a" /* default */].REPEAT || this.wrapT === __WEBPACK_IMPORTED_MODULE_0__Texture__["a" /* default */].REPEAT) - && this.NPOT - ); - - _gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, convertToPOT ? this.wrapS : this.getAvailableWrapS()); - _gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, convertToPOT ? this.wrapT : this.getAvailableWrapT()); - - _gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_MAG_FILTER, convertToPOT ? this.magFilter : this.getAvailableMagFilter()); - _gl.texParameteri(_gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, convertToPOT ? this.minFilter : this.getAvailableMinFilter()); - - var anisotropicExt = renderer.getGLExtension('EXT_texture_filter_anisotropic'); - if (anisotropicExt && this.anisotropic > 1) { - _gl.texParameterf(_gl.TEXTURE_2D, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, this.anisotropic); - } - - // Fallback to float type if browser don't have half float extension - if (glType === 36193) { - var halfFloatExt = renderer.getGLExtension('OES_texture_half_float'); - if (!halfFloatExt) { - glType = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].FLOAT; - } - } - - if (this.mipmaps.length) { - var width = this.width; - var height = this.height; - for (var i = 0; i < this.mipmaps.length; i++) { - var mipmap = this.mipmaps[i]; - this._updateTextureData(_gl, mipmap, i, width, height, glFormat, glType, false); - width /= 2; - height /= 2; - } - } - else { - this._updateTextureData(_gl, this, 0, this.width, this.height, glFormat, glType, convertToPOT); - - if (this.useMipmap && (!this.NPOT || convertToPOT)) { - _gl.generateMipmap(_gl.TEXTURE_2D); - } - } - - _gl.bindTexture(_gl.TEXTURE_2D, null); - }, - - _updateTextureData: function (_gl, data, level, width, height, glFormat, glType, convertToPOT) { - if (data.image) { - var imgData = data.image; - if (convertToPOT) { - this._potCanvas = convertTextureToPowerOfTwo(this, this._potCanvas); - imgData = this._potCanvas; - } - _gl.texImage2D(_gl.TEXTURE_2D, level, glFormat, glFormat, glType, imgData); - } - else { - // Can be used as a blank texture when writing render to texture(RTT) - if ( - glFormat <= __WEBPACK_IMPORTED_MODULE_0__Texture__["a" /* default */].COMPRESSED_RGBA_S3TC_DXT5_EXT - && glFormat >= __WEBPACK_IMPORTED_MODULE_0__Texture__["a" /* default */].COMPRESSED_RGB_S3TC_DXT1_EXT - ) { - _gl.compressedTexImage2D(_gl.TEXTURE_2D, level, glFormat, width, height, 0, data.pixels); - } - else { - // Is a render target if pixels is null - _gl.texImage2D(_gl.TEXTURE_2D, level, glFormat, width, height, 0, glFormat, glType, data.pixels); - } - } - }, - - /** - * @param {clay.Renderer} renderer - * @memberOf clay.Texture2D.prototype - */ - generateMipmap: function (renderer) { - var _gl = renderer.gl; - if (this.useMipmap && !this.NPOT) { - _gl.bindTexture(_gl.TEXTURE_2D, this._cache.get('webgl_texture')); - _gl.generateMipmap(_gl.TEXTURE_2D); - } - }, - - isPowerOfTwo: function () { - return isPowerOfTwo(this.width) && isPowerOfTwo(this.height); - }, - - isRenderable: function () { - if (this.image) { - return this.image.nodeName === 'CANVAS' - || this.image.nodeName === 'VIDEO' - || this.image.complete; - } - else { - return !!(this.width && this.height); - } - }, - - bind: function (renderer) { - renderer.gl.bindTexture(renderer.gl.TEXTURE_2D, this.getWebGLTexture(renderer)); - }, - - unbind: function (renderer) { - renderer.gl.bindTexture(renderer.gl.TEXTURE_2D, null); - }, - - load: function (src, crossOrigin) { - var image = __WEBPACK_IMPORTED_MODULE_2__core_vendor__["a" /* default */].createImage(); - if (crossOrigin) { - image.crossOrigin = crossOrigin; - } - var self = this; - image.onload = function () { - self.dirty(); - self.trigger('success', self); - image.onload = null; - }; - image.onerror = function () { - self.trigger('error', self); - image.onerror = null; - }; - - image.src = src; - this.image = image; - - return this; - } -}); - -Object.defineProperty(Texture2D.prototype, 'width', { - get: function () { - if (this.image) { - return this.image.width; - } - return this._width; - }, - set: function (value) { - if (this.image) { - console.warn('Texture from image can\'t set width'); - } - else { - if (this._width !== value) { - this.dirty(); - } - this._width = value; - } - } -}); -Object.defineProperty(Texture2D.prototype, 'height', { - get: function () { - if (this.image) { - return this.image.height; - } - return this._height; - }, - set: function (value) { - if (this.image) { - console.warn('Texture from image can\'t set height'); - } - else { - if (this._height !== value) { - this.dirty(); - } - this._height = value; - } - } -}); - -/* harmony default export */ __webpack_exports__["a"] = (Texture2D); - - -/***/ }), -/* 6 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__glmatrix__ = __webpack_require__(161); -// DEPRECATED - - -/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__glmatrix__["a" /* default */]); - - -/***/ }), -/* 7 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__mixin_extend__ = __webpack_require__(110); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__mixin_notifier__ = __webpack_require__(53); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util__ = __webpack_require__(23); - - - - -/** - * Base class of all objects - * @constructor - * @alias clay.core.Base - * @mixes clay.core.mixin.notifier - */ -var Base = function () { - /** - * @type {number} - */ - this.__uid__ = __WEBPACK_IMPORTED_MODULE_2__util__["a" /* default */].genGUID(); -}; - -Base.__initializers__ = [ - function (opts) { - __WEBPACK_IMPORTED_MODULE_2__util__["a" /* default */].extend(this, opts); - } -]; - -__WEBPACK_IMPORTED_MODULE_2__util__["a" /* default */].extend(Base, __WEBPACK_IMPORTED_MODULE_0__mixin_extend__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_2__util__["a" /* default */].extend(Base.prototype, __WEBPACK_IMPORTED_MODULE_1__mixin_notifier__["a" /* default */]); - -/* harmony default export */ __webpack_exports__["a"] = (Base); - - -/***/ }), -/* 8 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__core_util__ = __webpack_require__(23); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__core_vendor__ = __webpack_require__(14); -/** - * Mainly do the parse and compile of shader string - * Support shader code chunk import and export - * Support shader semantics - * http://www.nvidia.com/object/using_sas.html - * https://github.com/KhronosGroup/collada2json/issues/45 - */ - - - -var uniformRegex = /uniform\s+(bool|float|int|vec2|vec3|vec4|ivec2|ivec3|ivec4|mat2|mat3|mat4|sampler2D|samplerCube)\s+([\s\S]*?);/g; -var attributeRegex = /attribute\s+(float|int|vec2|vec3|vec4)\s+([\s\S]*?);/g; -// Only parse number define. -var defineRegex = /#define\s+(\w+)?(\s+[\d-.]+)?\s*;?\s*\n/g; - -var uniformTypeMap = { - 'bool': '1i', - 'int': '1i', - 'sampler2D': 't', - 'samplerCube': 't', - 'float': '1f', - 'vec2': '2f', - 'vec3': '3f', - 'vec4': '4f', - 'ivec2': '2i', - 'ivec3': '3i', - 'ivec4': '4i', - 'mat2': 'm2', - 'mat3': 'm3', - 'mat4': 'm4' -}; - -function createZeroArray(len) { - var arr = []; - for (var i = 0; i < len; i++) { - arr[i] = 0; - } - return arr; -} - -var uniformValueConstructor = { - 'bool': function () { return true; }, - 'int': function () { return 0; }, - 'float': function () { return 0; }, - 'sampler2D': function () { return null; }, - 'samplerCube': function () { return null; }, - - 'vec2': function () { return createZeroArray(2); }, - 'vec3': function () { return createZeroArray(3); }, - 'vec4': function () { return createZeroArray(4); }, - - 'ivec2': function () { return createZeroArray(2); }, - 'ivec3': function () { return createZeroArray(3); }, - 'ivec4': function () { return createZeroArray(4); }, - - 'mat2': function () { return createZeroArray(4); }, - 'mat3': function () { return createZeroArray(9); }, - 'mat4': function () { return createZeroArray(16); }, - - 'array': function () { return []; } -}; - -var attributeSemantics = [ - 'POSITION', - 'NORMAL', - 'BINORMAL', - 'TANGENT', - 'TEXCOORD', - 'TEXCOORD_0', - 'TEXCOORD_1', - 'COLOR', - // Skinning - // https://github.com/KhronosGroup/glTF/blob/master/specification/README.md#semantics - 'JOINT', - 'WEIGHT' -]; -var uniformSemantics = [ - 'SKIN_MATRIX', - // Information about viewport - 'VIEWPORT_SIZE', - 'VIEWPORT', - 'DEVICEPIXELRATIO', - // Window size for window relative coordinate - // https://www.opengl.org/sdk/docs/man/html/gl_FragCoord.xhtml - 'WINDOW_SIZE', - // Infomation about camera - 'NEAR', - 'FAR', - // Time - 'TIME' -]; -var matrixSemantics = [ - 'WORLD', - 'VIEW', - 'PROJECTION', - 'WORLDVIEW', - 'VIEWPROJECTION', - 'WORLDVIEWPROJECTION', - 'WORLDINVERSE', - 'VIEWINVERSE', - 'PROJECTIONINVERSE', - 'WORLDVIEWINVERSE', - 'VIEWPROJECTIONINVERSE', - 'WORLDVIEWPROJECTIONINVERSE', - 'WORLDTRANSPOSE', - 'VIEWTRANSPOSE', - 'PROJECTIONTRANSPOSE', - 'WORLDVIEWTRANSPOSE', - 'VIEWPROJECTIONTRANSPOSE', - 'WORLDVIEWPROJECTIONTRANSPOSE', - 'WORLDINVERSETRANSPOSE', - 'VIEWINVERSETRANSPOSE', - 'PROJECTIONINVERSETRANSPOSE', - 'WORLDVIEWINVERSETRANSPOSE', - 'VIEWPROJECTIONINVERSETRANSPOSE', - 'WORLDVIEWPROJECTIONINVERSETRANSPOSE' -]; - -var attributeSizeMap = { - // WebGL does not support integer attributes - 'vec4': 4, - 'vec3': 3, - 'vec2': 2, - 'float': 1 -}; - - -var shaderIDCache = {}; -var shaderCodeCache = {}; - -function getShaderID(vertex, fragment) { - var key = 'vertex:' + vertex + 'fragment:' + fragment; - if (shaderIDCache[key]) { - return shaderIDCache[key]; - } - var id = __WEBPACK_IMPORTED_MODULE_0__core_util__["a" /* default */].genGUID(); - shaderIDCache[key] = id; - - shaderCodeCache[id] = { - vertex: vertex, - fragment: fragment - }; - - return id; -} - -function removeComment(code) { - return code.replace(/[ \t]*\/\/.*\n/g, '' ) // remove // - .replace(/[ \t]*\/\*[\s\S]*?\*\//g, '' ); // remove /* */ -} - -function logSyntaxError() { - console.error('Wrong uniform/attributes syntax'); -} - -function parseDeclarations(type, line) { - var speratorsRegexp = /[,=\(\):]/; - var tokens = line - // Convert `symbol: [1,2,3]` to `symbol: vec3(1,2,3)` - .replace(/:\s*\[\s*(.*)\s*\]/g, '=' + type + '($1)') - .replace(/\s+/g, '') - .split(/(?=[,=\(\):])/g); - - var newTokens = []; - for (var i = 0; i < tokens.length; i++) { - if (tokens[i].match(speratorsRegexp)) { - newTokens.push( - tokens[i].charAt(0), - tokens[i].slice(1) - ); - } - else { - newTokens.push(tokens[i]); - } - } - tokens = newTokens; - - var TYPE_SYMBOL = 0; - var TYPE_ASSIGN = 1; - var TYPE_VEC = 2; - var TYPE_ARR = 3; - var TYPE_SEMANTIC = 4; - var TYPE_NORMAL = 5; - - var opType = TYPE_SYMBOL; - var declarations = {}; - var declarationValue = null; - var currentDeclaration; - - addSymbol(tokens[0]); - - function addSymbol(symbol) { - if (!symbol) { - logSyntaxError(); - } - var arrResult = symbol.match(/\[(.*?)\]/); - currentDeclaration = symbol.replace(/\[(.*?)\]/, ''); - declarations[currentDeclaration] = {}; - if (arrResult) { - declarations[currentDeclaration].isArray = true; - declarations[currentDeclaration].arraySize = arrResult[1]; - } - } - - for (var i = 1; i < tokens.length; i++) { - var token = tokens[i]; - if (!token) { // Empty token; - continue; - } - if (token === '=') { - if (opType !== TYPE_SYMBOL - && opType !== TYPE_ARR) { - logSyntaxError(); - break; - } - opType = TYPE_ASSIGN; - - continue; - } - else if (token === ':') { - opType = TYPE_SEMANTIC; - - continue; - } - else if (token === ',') { - if (opType === TYPE_VEC) { - if (!(declarationValue instanceof Array)) { - logSyntaxError(); - break; - } - declarationValue.push(+tokens[++i]); - } - else { - opType = TYPE_NORMAL; - } - - continue; - } - else if (token === ')') { - declarations[currentDeclaration].value = new __WEBPACK_IMPORTED_MODULE_1__core_vendor__["a" /* default */].Float32Array(declarationValue); - declarationValue = null; - opType = TYPE_NORMAL; - continue; - } - else if (token === '(') { - if (opType !== TYPE_VEC) { - logSyntaxError(); - break; - } - if (!(declarationValue instanceof Array)) { - logSyntaxError(); - break; - } - declarationValue.push(+tokens[++i]); - continue; - } - else if (token.indexOf('vec') >= 0) { - if (opType !== TYPE_ASSIGN - // Compatitable with old syntax `symbol: [1,2,3]` - && opType !== TYPE_SEMANTIC) { - logSyntaxError(); - break; - } - opType = TYPE_VEC; - declarationValue = []; - continue; - } - else if (opType === TYPE_ASSIGN) { - if (type === 'bool') { - declarations[currentDeclaration].value = token === 'true'; - } - else { - declarations[currentDeclaration].value = parseFloat(token); - } - declarationValue = null; - continue; - } - else if (opType === TYPE_SEMANTIC) { - var semantic = token; - if (attributeSemantics.indexOf(semantic) >= 0 - || uniformSemantics.indexOf(semantic) >= 0 - || matrixSemantics.indexOf(semantic) >= 0 - ) { - declarations[currentDeclaration].semantic = semantic; - } - else if (semantic === 'ignore' || semantic === 'unconfigurable') { - declarations[currentDeclaration].ignore = true; - } - else { - // Try to parse as a default tvalue. - if (type === 'bool') { - declarations[currentDeclaration].value = semantic === 'true'; - } - else { - declarations[currentDeclaration].value = parseFloat(semantic); - } - } - continue; - } - - // treat as symbol. - addSymbol(token); - opType = TYPE_SYMBOL; - } - - return declarations; -} - - -/** - * @constructor - * @extends clay.core.Base - * @alias clay.Shader - * @param {string} vertex - * @param {string} fragment - * @example - * // Create a phong shader - * var shader = new clay.Shader( - * clay.Shader.source('clay.standard.vertex'), - * clay.Shader.source('clay.standard.fragment') - * ); - */ -function Shader(vertex, fragment) { - // First argument can be { vertex, fragment } - if (typeof vertex === 'object') { - fragment = vertex.fragment; - vertex = vertex.vertex; - } - - vertex = removeComment(vertex); - fragment = removeComment(fragment); - - this._shaderID = getShaderID(vertex, fragment); - - this._vertexCode = Shader.parseImport(vertex); - this._fragmentCode = Shader.parseImport(fragment); - - /** - * @readOnly - */ - this.attributeSemantics = {}; - /** - * @readOnly - */ - this.matrixSemantics = {}; - /** - * @readOnly - */ - this.uniformSemantics = {}; - /** - * @readOnly - */ - this.matrixSemanticKeys = []; - /** - * @readOnly - */ - this.uniformTemplates = {}; - /** - * @readOnly - */ - this.attributes = {}; - /** - * @readOnly - */ - this.textures = {}; - /** - * @readOnly - */ - this.vertexDefines = {}; - /** - * @readOnly - */ - this.fragmentDefines = {}; - - this._parseAttributes(); - this._parseUniforms(); - this._parseDefines(); -} - -Shader.prototype = { - - constructor: Shader, - - // Create a new uniform instance for material - createUniforms: function () { - var uniforms = {}; - - for (var symbol in this.uniformTemplates){ - var uniformTpl = this.uniformTemplates[symbol]; - uniforms[symbol] = { - type: uniformTpl.type, - value: uniformTpl.value() - }; - } - - return uniforms; - }, - - _parseImport: function () { - this._vertexCode = Shader.parseImport(this.vertex); - this._fragmentCode = Shader.parseImport(this.fragment); - }, - - _addSemanticUniform: function (symbol, uniformType, semantic) { - // This case is only for SKIN_MATRIX - // TODO - if (attributeSemantics.indexOf(semantic) >= 0) { - this.attributeSemantics[semantic] = { - symbol: symbol, - type: uniformType - }; - } - else if (matrixSemantics.indexOf(semantic) >= 0) { - var isTranspose = false; - var semanticNoTranspose = semantic; - if (semantic.match(/TRANSPOSE$/)) { - isTranspose = true; - semanticNoTranspose = semantic.slice(0, -9); - } - this.matrixSemantics[semantic] = { - symbol: symbol, - type: uniformType, - isTranspose: isTranspose, - semanticNoTranspose: semanticNoTranspose - }; - } - else if (uniformSemantics.indexOf(semantic) >= 0) { - this.uniformSemantics[semantic] = { - symbol: symbol, - type: uniformType - }; - } - }, - - _addMaterialUniform: function (symbol, type, uniformType, defaultValueFunc, isArray, materialUniforms) { - materialUniforms[symbol] = { - type: uniformType, - value: isArray ? uniformValueConstructor['array'] : (defaultValueFunc || uniformValueConstructor[type]), - semantic: null - }; - }, - - _parseUniforms: function () { - var uniforms = {}; - var self = this; - var shaderType = 'vertex'; - this._uniformList = []; - - this._vertexCode = this._vertexCode.replace(uniformRegex, _uniformParser); - shaderType = 'fragment'; - this._fragmentCode = this._fragmentCode.replace(uniformRegex, _uniformParser); - - self.matrixSemanticKeys = Object.keys(this.matrixSemantics); - - function makeDefaultValueFunc(value) { - return value != null ? function () { return value; } : null; - } - - function _uniformParser(str, type, content) { - var declaredUniforms = parseDeclarations(type, content); - var uniformMainStr = []; - for (var symbol in declaredUniforms) { - - var uniformInfo = declaredUniforms[symbol]; - var semantic = uniformInfo.semantic; - var tmpStr = symbol; - var uniformType = uniformTypeMap[type]; - var defaultValueFunc = makeDefaultValueFunc(declaredUniforms[symbol].value); - if (declaredUniforms[symbol].isArray) { - tmpStr += '[' + declaredUniforms[symbol].arraySize + ']'; - uniformType += 'v'; - } - - uniformMainStr.push(tmpStr); - - self._uniformList.push(symbol); - - if (!uniformInfo.ignore) { - if (type === 'sampler2D' || type === 'samplerCube') { - // Texture is default disabled - self.textures[symbol] = { - shaderType: shaderType, - type: type - }; - } - - if (semantic) { - // TODO Should not declare multiple symbols if have semantic. - self._addSemanticUniform(symbol, uniformType, semantic); - } - else { - self._addMaterialUniform( - symbol, type, uniformType, defaultValueFunc, - declaredUniforms[symbol].isArray, uniforms - ); - } - } - } - return uniformMainStr.length > 0 - ? 'uniform ' + type + ' ' + uniformMainStr.join(',') + ';\n' : ''; - } - - this.uniformTemplates = uniforms; - }, - - _parseAttributes: function () { - var attributes = {}; - var self = this; - this._vertexCode = this._vertexCode.replace(attributeRegex, _attributeParser); - - function _attributeParser(str, type, content) { - var declaredAttributes = parseDeclarations(type, content); - - var size = attributeSizeMap[type] || 1; - var attributeMainStr = []; - for (var symbol in declaredAttributes) { - var semantic = declaredAttributes[symbol].semantic; - attributes[symbol] = { - // TODO Can only be float - type: 'float', - size: size, - semantic: semantic || null - }; - // TODO Should not declare multiple symbols if have semantic. - if (semantic) { - if (attributeSemantics.indexOf(semantic) < 0) { - throw new Error('Unkown semantic "' + semantic + '"'); - } - else { - self.attributeSemantics[semantic] = { - symbol: symbol, - type: type - }; - } - } - attributeMainStr.push(symbol); - } - - return 'attribute ' + type + ' ' + attributeMainStr.join(',') + ';\n'; - } - - this.attributes = attributes; - }, - - _parseDefines: function () { - var self = this; - var shaderType = 'vertex'; - this._vertexCode = this._vertexCode.replace(defineRegex, _defineParser); - shaderType = 'fragment'; - this._fragmentCode = this._fragmentCode.replace(defineRegex, _defineParser); - - function _defineParser(str, symbol, value) { - var defines = shaderType === 'vertex' ? self.vertexDefines : self.fragmentDefines; - if (!defines[symbol]) { // Haven't been defined by user - if (value === 'false') { - defines[symbol] = false; - } - else if (value === 'true') { - defines[symbol] = true; - } - else { - defines[symbol] = value - // If can parse to float - ? (isNaN(parseFloat(value)) ? value.trim() : parseFloat(value)) - : null; - } - } - return ''; - } - }, - - /** - * Clone a new shader - * @return {clay.Shader} - */ - clone: function () { - var code = shaderCodeCache[this._shaderID]; - var shader = new Shader(code.vertex, code.fragment); - return shader; - } -}; - -if (Object.defineProperty) { - Object.defineProperty(Shader.prototype, 'shaderID', { - get: function () { - return this._shaderID; - } - }); - Object.defineProperty(Shader.prototype, 'vertex', { - get: function () { - return this._vertexCode; - } - }); - Object.defineProperty(Shader.prototype, 'fragment', { - get: function () { - return this._fragmentCode; - } - }); - Object.defineProperty(Shader.prototype, 'uniforms', { - get: function () { - return this._uniformList; - } - }); -} - -var importRegex = /(@import)\s*([0-9a-zA-Z_\-\.]*)/g; -Shader.parseImport = function (shaderStr) { - shaderStr = shaderStr.replace(importRegex, function (str, importSymbol, importName) { - var str = Shader.source(importName); - if (str) { - // Recursively parse - return Shader.parseImport(str); - } - else { - console.error('Shader chunk "' + importName + '" not existed in library'); - return ''; - } - }); - return shaderStr; -}; - -var exportRegex = /(@export)\s*([0-9a-zA-Z_\-\.]*)\s*\n([\s\S]*?)@end/g; - -/** - * Import shader source - * @param {string} shaderStr - * @memberOf clay.Shader - */ -Shader['import'] = function (shaderStr) { - shaderStr.replace(exportRegex, function (str, exportSymbol, exportName, code) { - var code = code.replace(/(^[\s\t\xa0\u3000]+)|([\u3000\xa0\s\t]+\x24)/g, ''); - if (code) { - var parts = exportName.split('.'); - var obj = Shader.codes; - var i = 0; - var key; - while (i < parts.length - 1) { - key = parts[i++]; - if (!obj[key]) { - obj[key] = {}; - } - obj = obj[key]; - } - key = parts[i]; - obj[key] = code; - } - return code; - }); -}; - -/** - * Library to store all the loaded shader codes - * @type {Object} - * @readOnly - * @memberOf clay.Shader - */ -Shader.codes = {}; - -/** - * Get shader source - * @param {string} name - * @return {string} - */ -Shader.source = function (name) { - var parts = name.split('.'); - var obj = Shader.codes; - var i = 0; - while (obj && i < parts.length) { - var key = parts[i++]; - obj = obj[key]; - } - if (typeof obj !== 'string') { - // FIXME Use default instead - console.error('Shader "' + name + '" not existed in library'); - return ''; - } - return obj; -}; - -/* harmony default export */ __webpack_exports__["a"] = (Shader); - - -/***/ }), -/* 9 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__ = __webpack_require__(21); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__ = __webpack_require__(12); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__glmatrix_quat__ = __webpack_require__(55); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__glmatrix_mat3__ = __webpack_require__(34); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Vector3__ = __webpack_require__(3); - - - - - - -/** - * @constructor - * @alias clay.Matrix4 - */ -var Matrix4 = function() { - - this._axisX = new __WEBPACK_IMPORTED_MODULE_4__Vector3__["a" /* default */](); - this._axisY = new __WEBPACK_IMPORTED_MODULE_4__Vector3__["a" /* default */](); - this._axisZ = new __WEBPACK_IMPORTED_MODULE_4__Vector3__["a" /* default */](); - - /** - * Storage of Matrix4 - * @name array - * @type {Float32Array} - * @memberOf clay.Matrix4# - */ - this.array = __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].create(); - - /** - * @name _dirty - * @type {boolean} - * @memberOf clay.Matrix4# - */ - this._dirty = true; -}; - -Matrix4.prototype = { - - constructor: Matrix4, - - /** - * Set components from array - * @param {Float32Array|number[]} arr - */ - setArray: function (arr) { - for (var i = 0; i < this.array.length; i++) { - this.array[i] = arr[i]; - } - this._dirty = true; - return this; - }, - /** - * Calculate the adjugate of self, in-place - * @return {clay.Matrix4} - */ - adjoint: function() { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].adjoint(this.array, this.array); - this._dirty = true; - return this; - }, - - /** - * Clone a new Matrix4 - * @return {clay.Matrix4} - */ - clone: function() { - return (new Matrix4()).copy(this); - }, - - /** - * Copy from b - * @param {clay.Matrix4} b - * @return {clay.Matrix4} - */ - copy: function(a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].copy(this.array, a.array); - this._dirty = true; - return this; - }, - - /** - * Calculate matrix determinant - * @return {number} - */ - determinant: function() { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].determinant(this.array); - }, - - /** - * Set upper 3x3 part from quaternion - * @param {clay.Quaternion} q - * @return {clay.Matrix4} - */ - fromQuat: function(q) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].fromQuat(this.array, q.array); - this._dirty = true; - return this; - }, - - /** - * Set from a quaternion rotation and a vector translation - * @param {clay.Quaternion} q - * @param {clay.Vector3} v - * @return {clay.Matrix4} - */ - fromRotationTranslation: function(q, v) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].fromRotationTranslation(this.array, q.array, v.array); - this._dirty = true; - return this; - }, - - /** - * Set from Matrix2d, it is used when converting a 2d shape to 3d space. - * In 3d space it is equivalent to ranslate on xy plane and rotate about z axis - * @param {clay.Matrix2d} m2d - * @return {clay.Matrix4} - */ - fromMat2d: function(m2d) { - Matrix4.fromMat2d(this, m2d); - return this; - }, - - /** - * Set from frustum bounds - * @param {number} left - * @param {number} right - * @param {number} bottom - * @param {number} top - * @param {number} near - * @param {number} far - * @return {clay.Matrix4} - */ - frustum: function (left, right, bottom, top, near, far) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].frustum(this.array, left, right, bottom, top, near, far); - this._dirty = true; - return this; - }, - - /** - * Set to a identity matrix - * @return {clay.Matrix4} - */ - identity: function() { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].identity(this.array); - this._dirty = true; - return this; - }, - - /** - * Invert self - * @return {clay.Matrix4} - */ - invert: function() { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].invert(this.array, this.array); - this._dirty = true; - return this; - }, - - /** - * Set as a matrix with the given eye position, focal point, and up axis - * @param {clay.Vector3} eye - * @param {clay.Vector3} center - * @param {clay.Vector3} up - * @return {clay.Matrix4} - */ - lookAt: function(eye, center, up) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].lookAt(this.array, eye.array, center.array, up.array); - this._dirty = true; - return this; - }, - - /** - * Alias for mutiply - * @param {clay.Matrix4} b - * @return {clay.Matrix4} - */ - mul: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].mul(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Alias for multiplyLeft - * @param {clay.Matrix4} a - * @return {clay.Matrix4} - */ - mulLeft: function(a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].mul(this.array, a.array, this.array); - this._dirty = true; - return this; - }, - - /** - * Multiply self and b - * @param {clay.Matrix4} b - * @return {clay.Matrix4} - */ - multiply: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].multiply(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Multiply a and self, a is on the left - * @param {clay.Matrix3} a - * @return {clay.Matrix3} - */ - multiplyLeft: function(a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].multiply(this.array, a.array, this.array); - this._dirty = true; - return this; - }, - - /** - * Set as a orthographic projection matrix - * @param {number} left - * @param {number} right - * @param {number} bottom - * @param {number} top - * @param {number} near - * @param {number} far - * @return {clay.Matrix4} - */ - ortho: function(left, right, bottom, top, near, far) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].ortho(this.array, left, right, bottom, top, near, far); - this._dirty = true; - return this; - }, - /** - * Set as a perspective projection matrix - * @param {number} fovy - * @param {number} aspect - * @param {number} near - * @param {number} far - * @return {clay.Matrix4} - */ - perspective: function(fovy, aspect, near, far) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].perspective(this.array, fovy, aspect, near, far); - this._dirty = true; - return this; - }, - - /** - * Rotate self by rad about axis. - * Equal to right-multiply a rotaion matrix - * @param {number} rad - * @param {clay.Vector3} axis - * @return {clay.Matrix4} - */ - rotate: function(rad, axis) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].rotate(this.array, this.array, rad, axis.array); - this._dirty = true; - return this; - }, - - /** - * Rotate self by a given radian about X axis. - * Equal to right-multiply a rotaion matrix - * @param {number} rad - * @return {clay.Matrix4} - */ - rotateX: function(rad) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].rotateX(this.array, this.array, rad); - this._dirty = true; - return this; - }, - - /** - * Rotate self by a given radian about Y axis. - * Equal to right-multiply a rotaion matrix - * @param {number} rad - * @return {clay.Matrix4} - */ - rotateY: function(rad) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].rotateY(this.array, this.array, rad); - this._dirty = true; - return this; - }, - - /** - * Rotate self by a given radian about Z axis. - * Equal to right-multiply a rotaion matrix - * @param {number} rad - * @return {clay.Matrix4} - */ - rotateZ: function(rad) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].rotateZ(this.array, this.array, rad); - this._dirty = true; - return this; - }, - - /** - * Scale self by s - * Equal to right-multiply a scale matrix - * @param {clay.Vector3} s - * @return {clay.Matrix4} - */ - scale: function(v) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].scale(this.array, this.array, v.array); - this._dirty = true; - return this; - }, - - /** - * Translate self by v. - * Equal to right-multiply a translate matrix - * @param {clay.Vector3} v - * @return {clay.Matrix4} - */ - translate: function(v) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].translate(this.array, this.array, v.array); - this._dirty = true; - return this; - }, - - /** - * Transpose self, in-place. - * @return {clay.Matrix2} - */ - transpose: function() { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].transpose(this.array, this.array); - this._dirty = true; - return this; - }, - - /** - * Decompose a matrix to SRT - * @param {clay.Vector3} [scale] - * @param {clay.Quaternion} rotation - * @param {clay.Vector} position - * @see http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.matrix.decompose.aspx - */ - decomposeMatrix: (function() { - - var x = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].create(); - var y = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].create(); - var z = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].create(); - - var m3 = __WEBPACK_IMPORTED_MODULE_3__glmatrix_mat3__["a" /* default */].create(); - - return function(scale, rotation, position) { - - var el = this.array; - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].set(x, el[0], el[1], el[2]); - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].set(y, el[4], el[5], el[6]); - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].set(z, el[8], el[9], el[10]); - - var sx = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].length(x); - var sy = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].length(y); - var sz = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].length(z); - - // if determine is negative, we need to invert one scale - var det = this.determinant(); - if (det < 0) { - sx = -sx; - } - - if (scale) { - scale.set(sx, sy, sz); - } - - position.set(el[12], el[13], el[14]); - - __WEBPACK_IMPORTED_MODULE_3__glmatrix_mat3__["a" /* default */].fromMat4(m3, el); - // Not like mat4, mat3 in glmatrix seems to be row-based - // Seems fixed in gl-matrix 2.2.2 - // https://github.com/toji/gl-matrix/issues/114 - // mat3.transpose(m3, m3); - - m3[0] /= sx; - m3[1] /= sx; - m3[2] /= sx; - - m3[3] /= sy; - m3[4] /= sy; - m3[5] /= sy; - - m3[6] /= sz; - m3[7] /= sz; - m3[8] /= sz; - - __WEBPACK_IMPORTED_MODULE_2__glmatrix_quat__["a" /* default */].fromMat3(rotation.array, m3); - __WEBPACK_IMPORTED_MODULE_2__glmatrix_quat__["a" /* default */].normalize(rotation.array, rotation.array); - - rotation._dirty = true; - position._dirty = true; - }; - })(), - - toString: function() { - return '[' + Array.prototype.join.call(this.array, ',') + ']'; - }, - - toArray: function () { - return Array.prototype.slice.call(this.array); - } -}; - -var defineProperty = Object.defineProperty; - -if (defineProperty) { - var proto = Matrix4.prototype; - /** - * Z Axis of local transform - * @name z - * @type {clay.Vector3} - * @memberOf clay.Matrix4 - * @instance - */ - defineProperty(proto, 'z', { - get: function () { - var el = this.array; - this._axisZ.set(el[8], el[9], el[10]); - return this._axisZ; - }, - set: function (v) { - // TODO Here has a problem - // If only set an item of vector will not work - var el = this.array; - v = v.array; - el[8] = v[0]; - el[9] = v[1]; - el[10] = v[2]; - - this._dirty = true; - } - }); - - /** - * Y Axis of local transform - * @name y - * @type {clay.Vector3} - * @memberOf clay.Matrix4 - * @instance - */ - defineProperty(proto, 'y', { - get: function () { - var el = this.array; - this._axisY.set(el[4], el[5], el[6]); - return this._axisY; - }, - set: function (v) { - var el = this.array; - v = v.array; - el[4] = v[0]; - el[5] = v[1]; - el[6] = v[2]; - - this._dirty = true; - } - }); - - /** - * X Axis of local transform - * @name x - * @type {clay.Vector3} - * @memberOf clay.Matrix4 - * @instance - */ - defineProperty(proto, 'x', { - get: function () { - var el = this.array; - this._axisX.set(el[0], el[1], el[2]); - return this._axisX; - }, - set: function (v) { - var el = this.array; - v = v.array; - el[0] = v[0]; - el[1] = v[1]; - el[2] = v[2]; - - this._dirty = true; - } - }) -} - -/** - * @param {clay.Matrix4} out - * @param {clay.Matrix4} a - * @return {clay.Matrix4} - */ -Matrix4.adjoint = function(out, a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].adjoint(out.array, a.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix4} out - * @param {clay.Matrix4} a - * @return {clay.Matrix4} - */ -Matrix4.copy = function(out, a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].copy(out.array, a.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix4} a - * @return {number} - */ -Matrix4.determinant = function(a) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].determinant(a.array); -}; - -/** - * @param {clay.Matrix4} out - * @return {clay.Matrix4} - */ -Matrix4.identity = function(out) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].identity(out.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix4} out - * @param {number} left - * @param {number} right - * @param {number} bottom - * @param {number} top - * @param {number} near - * @param {number} far - * @return {clay.Matrix4} - */ -Matrix4.ortho = function(out, left, right, bottom, top, near, far) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].ortho(out.array, left, right, bottom, top, near, far); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix4} out - * @param {number} fovy - * @param {number} aspect - * @param {number} near - * @param {number} far - * @return {clay.Matrix4} - */ -Matrix4.perspective = function(out, fovy, aspect, near, far) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].perspective(out.array, fovy, aspect, near, far); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix4} out - * @param {clay.Vector3} eye - * @param {clay.Vector3} center - * @param {clay.Vector3} up - * @return {clay.Matrix4} - */ -Matrix4.lookAt = function(out, eye, center, up) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].lookAt(out.array, eye.array, center.array, up.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix4} out - * @param {clay.Matrix4} a - * @return {clay.Matrix4} - */ -Matrix4.invert = function(out, a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].invert(out.array, a.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix4} out - * @param {clay.Matrix4} a - * @param {clay.Matrix4} b - * @return {clay.Matrix4} - */ -Matrix4.mul = function(out, a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].mul(out.array, a.array, b.array); - out._dirty = true; - return out; -}; - -/** - * @function - * @param {clay.Matrix4} out - * @param {clay.Matrix4} a - * @param {clay.Matrix4} b - * @return {clay.Matrix4} - */ -Matrix4.multiply = Matrix4.mul; - -/** - * @param {clay.Matrix4} out - * @param {clay.Quaternion} q - * @return {clay.Matrix4} - */ -Matrix4.fromQuat = function(out, q) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].fromQuat(out.array, q.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix4} out - * @param {clay.Quaternion} q - * @param {clay.Vector3} v - * @return {clay.Matrix4} - */ -Matrix4.fromRotationTranslation = function(out, q, v) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].fromRotationTranslation(out.array, q.array, v.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix4} m4 - * @param {clay.Matrix2d} m2d - * @return {clay.Matrix4} - */ -Matrix4.fromMat2d = function(m4, m2d) { - m4._dirty = true; - var m2d = m2d.array; - var m4 = m4.array; - - m4[0] = m2d[0]; - m4[4] = m2d[2]; - m4[12] = m2d[4]; - - m4[1] = m2d[1]; - m4[5] = m2d[3]; - m4[13] = m2d[5]; - - return m4; -}; - -/** - * @param {clay.Matrix4} out - * @param {clay.Matrix4} a - * @param {number} rad - * @param {clay.Vector3} axis - * @return {clay.Matrix4} - */ -Matrix4.rotate = function(out, a, rad, axis) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].rotate(out.array, a.array, rad, axis.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix4} out - * @param {clay.Matrix4} a - * @param {number} rad - * @return {clay.Matrix4} - */ -Matrix4.rotateX = function(out, a, rad) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].rotateX(out.array, a.array, rad); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix4} out - * @param {clay.Matrix4} a - * @param {number} rad - * @return {clay.Matrix4} - */ -Matrix4.rotateY = function(out, a, rad) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].rotateY(out.array, a.array, rad); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix4} out - * @param {clay.Matrix4} a - * @param {number} rad - * @return {clay.Matrix4} - */ -Matrix4.rotateZ = function(out, a, rad) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].rotateZ(out.array, a.array, rad); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix4} out - * @param {clay.Matrix4} a - * @param {clay.Vector3} v - * @return {clay.Matrix4} - */ -Matrix4.scale = function(out, a, v) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].scale(out.array, a.array, v.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix4} out - * @param {clay.Matrix4} a - * @return {clay.Matrix4} - */ -Matrix4.transpose = function(out, a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].transpose(out.array, a.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix4} out - * @param {clay.Matrix4} a - * @param {clay.Vector3} v - * @return {clay.Matrix4} - */ -Matrix4.translate = function(out, a, v) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat4__["a" /* default */].translate(out.array, a.array, v.array); - out._dirty = true; - return out; -}; - -/* harmony default export */ __webpack_exports__["a"] = (Matrix4); - - -/***/ }), -/* 10 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__core_Base__ = __webpack_require__(7); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Texture__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__TextureCube__ = __webpack_require__(27); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__core_glenum__ = __webpack_require__(11); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__core_Cache__ = __webpack_require__(57); - - - - - - -var KEY_FRAMEBUFFER = 'framebuffer'; -var KEY_RENDERBUFFER = 'renderbuffer'; -var KEY_RENDERBUFFER_WIDTH = KEY_RENDERBUFFER + '_width'; -var KEY_RENDERBUFFER_HEIGHT = KEY_RENDERBUFFER + '_height'; -var KEY_RENDERBUFFER_ATTACHED = KEY_RENDERBUFFER + '_attached'; -var KEY_DEPTHTEXTURE_ATTACHED = 'depthtexture_attached'; - -var GL_FRAMEBUFFER = __WEBPACK_IMPORTED_MODULE_3__core_glenum__["a" /* default */].FRAMEBUFFER; -var GL_RENDERBUFFER = __WEBPACK_IMPORTED_MODULE_3__core_glenum__["a" /* default */].RENDERBUFFER; -var GL_DEPTH_ATTACHMENT = __WEBPACK_IMPORTED_MODULE_3__core_glenum__["a" /* default */].DEPTH_ATTACHMENT; -var GL_COLOR_ATTACHMENT0 = __WEBPACK_IMPORTED_MODULE_3__core_glenum__["a" /* default */].COLOR_ATTACHMENT0; -/** - * @constructor clay.FrameBuffer - * @extends clay.core.Base - */ -var FrameBuffer = __WEBPACK_IMPORTED_MODULE_0__core_Base__["a" /* default */].extend( -/** @lends clay.FrameBuffer# */ -{ - /** - * If use depth buffer - * @type {boolean} - */ - depthBuffer: true, - - /** - * @type {Object} - */ - viewport: null, - - _width: 0, - _height: 0, - - _textures: null, - - _boundRenderer: null, -}, function () { - // Use cache - this._cache = new __WEBPACK_IMPORTED_MODULE_4__core_Cache__["a" /* default */](); - - this._textures = {}; -}, - -/**@lends clay.FrameBuffer.prototype. */ -{ - /** - * Get attached texture width - * {number} - */ - // FIXME Can't use before #bind - getTextureWidth: function () { - return this._width; - }, - - /** - * Get attached texture height - * {number} - */ - getTextureHeight: function () { - return this._height; - }, - - /** - * Bind the framebuffer to given renderer before rendering - * @param {clay.Renderer} renderer - */ - bind: function (renderer) { - - if (renderer.__currentFrameBuffer) { - // Already bound - if (renderer.__currentFrameBuffer === this) { - return; - } - - console.warn('Renderer already bound with another framebuffer. Unbind it first'); - } - renderer.__currentFrameBuffer = this; - - var _gl = renderer.gl; - - _gl.bindFramebuffer(GL_FRAMEBUFFER, this._getFrameBufferGL(renderer)); - this._boundRenderer = renderer; - var cache = this._cache; - - cache.put('viewport', renderer.viewport); - - var hasTextureAttached = false; - var width; - var height; - for (var attachment in this._textures) { - hasTextureAttached = true; - var obj = this._textures[attachment]; - if (obj) { - // TODO Do width, height checking, make sure size are same - width = obj.texture.width; - height = obj.texture.height; - // Attach textures - this._doAttach(renderer, obj.texture, attachment, obj.target); - } - } - - this._width = width; - this._height = height; - - if (!hasTextureAttached && this.depthBuffer) { - console.error('Must attach texture before bind, or renderbuffer may have incorrect width and height.') - } - - if (this.viewport) { - renderer.setViewport(this.viewport); - } - else { - renderer.setViewport(0, 0, width, height, 1); - } - - var attachedTextures = cache.get('attached_textures'); - if (attachedTextures) { - for (var attachment in attachedTextures) { - if (!this._textures[attachment]) { - var target = attachedTextures[attachment]; - this._doDetach(_gl, attachment, target); - } - } - } - if (!cache.get(KEY_DEPTHTEXTURE_ATTACHED) && this.depthBuffer) { - // Create a new render buffer - if (cache.miss(KEY_RENDERBUFFER)) { - cache.put(KEY_RENDERBUFFER, _gl.createRenderbuffer()); - } - var renderbuffer = cache.get(KEY_RENDERBUFFER); - - if (width !== cache.get(KEY_RENDERBUFFER_WIDTH) - || height !== cache.get(KEY_RENDERBUFFER_HEIGHT)) { - _gl.bindRenderbuffer(GL_RENDERBUFFER, renderbuffer); - _gl.renderbufferStorage(GL_RENDERBUFFER, _gl.DEPTH_COMPONENT16, width, height); - cache.put(KEY_RENDERBUFFER_WIDTH, width); - cache.put(KEY_RENDERBUFFER_HEIGHT, height); - _gl.bindRenderbuffer(GL_RENDERBUFFER, null); - } - if (!cache.get(KEY_RENDERBUFFER_ATTACHED)) { - _gl.framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, renderbuffer); - cache.put(KEY_RENDERBUFFER_ATTACHED, true); - } - } - }, - - /** - * Unbind the frame buffer after rendering - * @param {clay.Renderer} renderer - */ - unbind: function (renderer) { - // Remove status record on renderer - renderer.__currentFrameBuffer = null; - - var _gl = renderer.gl; - - _gl.bindFramebuffer(GL_FRAMEBUFFER, null); - this._boundRenderer = null; - - this._cache.use(renderer.__uid__); - var viewport = this._cache.get('viewport'); - // Reset viewport; - if (viewport) { - renderer.setViewport(viewport); - } - - this.updateMipmap(renderer); - }, - - // Because the data of texture is changed over time, - // Here update the mipmaps of texture each time after rendered; - updateMipmap: function (renderer) { - var _gl = renderer.gl; - for (var attachment in this._textures) { - var obj = this._textures[attachment]; - if (obj) { - var texture = obj.texture; - // FIXME some texture format can't generate mipmap - if (!texture.NPOT && texture.useMipmap - && texture.minFilter === __WEBPACK_IMPORTED_MODULE_1__Texture__["a" /* default */].LINEAR_MIPMAP_LINEAR) { - var target = texture.textureType === 'textureCube' ? __WEBPACK_IMPORTED_MODULE_3__core_glenum__["a" /* default */].TEXTURE_CUBE_MAP : __WEBPACK_IMPORTED_MODULE_3__core_glenum__["a" /* default */].TEXTURE_2D; - _gl.bindTexture(target, texture.getWebGLTexture(renderer)); - _gl.generateMipmap(target); - _gl.bindTexture(target, null); - } - } - } - }, - - - // 0x8CD5, 36053, FRAMEBUFFER_COMPLETE - // 0x8CD6, 36054, FRAMEBUFFER_INCOMPLETE_ATTACHMENT - // 0x8CD7, 36055, FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT - // 0x8CD9, 36057, FRAMEBUFFER_INCOMPLETE_DIMENSIONS - // 0x8CDD, 36061, FRAMEBUFFER_UNSUPPORTED - checkStatus: function (_gl) { - return _gl.checkFramebufferStatus(GL_FRAMEBUFFER); - }, - - _getFrameBufferGL: function (renderer) { - var cache = this._cache; - cache.use(renderer.__uid__); - - if (cache.miss(KEY_FRAMEBUFFER)) { - cache.put(KEY_FRAMEBUFFER, renderer.gl.createFramebuffer()); - } - - return cache.get(KEY_FRAMEBUFFER); - }, - - /** - * Attach a texture(RTT) to the framebuffer - * @param {clay.Texture} texture - * @param {number} [attachment=gl.COLOR_ATTACHMENT0] - * @param {number} [target=gl.TEXTURE_2D] - */ - attach: function (texture, attachment, target) { - - if (!texture.width) { - throw new Error('The texture attached to color buffer is not a valid.'); - } - // TODO width and height check - - // If the depth_texture extension is enabled, developers - // Can attach a depth texture to the depth buffer - // http://blog.tojicode.com/2012/07/using-webgldepthtexture.html - attachment = attachment || GL_COLOR_ATTACHMENT0; - target = target || __WEBPACK_IMPORTED_MODULE_3__core_glenum__["a" /* default */].TEXTURE_2D; - - var boundRenderer = this._boundRenderer; - var _gl = boundRenderer && boundRenderer.gl; - var attachedTextures; - - if (_gl) { - var cache = this._cache; - cache.use(boundRenderer.__uid__); - attachedTextures = cache.get('attached_textures'); - } - - // Check if texture attached - var previous = this._textures[attachment]; - if (previous && previous.target === target - && previous.texture === texture - && (attachedTextures && attachedTextures[attachment] != null) - ) { - return; - } - - var canAttach = true; - if (boundRenderer) { - canAttach = this._doAttach(boundRenderer, texture, attachment, target); - // Set viewport again incase attached to different size textures. - if (!this.viewport) { - boundRenderer.setViewport(0, 0, texture.width, texture.height, 1); - } - } - - if (canAttach) { - this._textures[attachment] = this._textures[attachment] || {}; - this._textures[attachment].texture = texture; - this._textures[attachment].target = target; - } - }, - - _doAttach: function (renderer, texture, attachment, target) { - var _gl = renderer.gl; - // Make sure texture is always updated - // Because texture width or height may be changed and in this we can't be notified - // FIXME awkward; - var webglTexture = texture.getWebGLTexture(renderer); - // Assume cache has been used. - var attachedTextures = this._cache.get('attached_textures'); - if (attachedTextures && attachedTextures[attachment]) { - var obj = attachedTextures[attachment]; - // Check if texture and target not changed - if (obj.texture === texture && obj.target === target) { - return; - } - } - attachment = +attachment; - - var canAttach = true; - if (attachment === GL_DEPTH_ATTACHMENT || attachment === __WEBPACK_IMPORTED_MODULE_3__core_glenum__["a" /* default */].DEPTH_STENCIL_ATTACHMENT) { - var extension = renderer.getGLExtension('WEBGL_depth_texture'); - - if (!extension) { - console.error('Depth texture is not supported by the browser'); - canAttach = false; - } - if (texture.format !== __WEBPACK_IMPORTED_MODULE_3__core_glenum__["a" /* default */].DEPTH_COMPONENT - && texture.format !== __WEBPACK_IMPORTED_MODULE_3__core_glenum__["a" /* default */].DEPTH_STENCIL - ) { - console.error('The texture attached to depth buffer is not a valid.'); - canAttach = false; - } - - // Dispose render buffer created previous - if (canAttach) { - var renderbuffer = this._cache.get(KEY_RENDERBUFFER); - if (renderbuffer) { - _gl.framebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, null); - _gl.deleteRenderbuffer(renderbuffer); - this._cache.put(KEY_RENDERBUFFER, false); - } - - this._cache.put(KEY_RENDERBUFFER_ATTACHED, false); - this._cache.put(KEY_DEPTHTEXTURE_ATTACHED, true); - } - } - - // Mipmap level can only be 0 - _gl.framebufferTexture2D(GL_FRAMEBUFFER, attachment, target, webglTexture, 0); - - if (!attachedTextures) { - attachedTextures = {}; - this._cache.put('attached_textures', attachedTextures); - } - attachedTextures[attachment] = attachedTextures[attachment] || {}; - attachedTextures[attachment].texture = texture; - attachedTextures[attachment].target = target; - - return canAttach; - }, - - _doDetach: function (_gl, attachment, target) { - // Detach a texture from framebuffer - // https://github.com/KhronosGroup/WebGL/blob/master/conformance-suites/1.0.0/conformance/framebuffer-test.html#L145 - _gl.framebufferTexture2D(GL_FRAMEBUFFER, attachment, target, null, 0); - - // Assume cache has been used. - var attachedTextures = this._cache.get('attached_textures'); - if (attachedTextures && attachedTextures[attachment]) { - attachedTextures[attachment] = null; - } - - if (attachment === GL_DEPTH_ATTACHMENT || attachment === __WEBPACK_IMPORTED_MODULE_3__core_glenum__["a" /* default */].DEPTH_STENCIL_ATTACHMENT) { - this._cache.put(KEY_DEPTHTEXTURE_ATTACHED, false); - } - }, - - /** - * Detach a texture - * @param {number} [attachment=gl.COLOR_ATTACHMENT0] - * @param {number} [target=gl.TEXTURE_2D] - */ - detach: function (attachment, target) { - // TODO depth extension check ? - this._textures[attachment] = null; - if (this._boundRenderer) { - var cache = this._cache; - cache.use(this._boundRenderer.__uid__); - this._doDetach(this._boundRenderer.gl, attachment, target); - } - }, - /** - * Dispose - * @param {WebGLRenderingContext} _gl - */ - dispose: function (renderer) { - - var _gl = renderer.gl; - var cache = this._cache; - - cache.use(renderer.__uid__); - - var renderBuffer = cache.get(KEY_RENDERBUFFER); - if (renderBuffer) { - _gl.deleteRenderbuffer(renderBuffer); - } - var frameBuffer = cache.get(KEY_FRAMEBUFFER); - if (frameBuffer) { - _gl.deleteFramebuffer(frameBuffer); - } - cache.deleteContext(renderer.__uid__); - - // Clear cache for reusing - this._textures = {}; - - } -}); - -FrameBuffer.DEPTH_ATTACHMENT = GL_DEPTH_ATTACHMENT; -FrameBuffer.COLOR_ATTACHMENT0 = GL_COLOR_ATTACHMENT0; -FrameBuffer.STENCIL_ATTACHMENT = __WEBPACK_IMPORTED_MODULE_3__core_glenum__["a" /* default */].STENCIL_ATTACHMENT; -FrameBuffer.DEPTH_STENCIL_ATTACHMENT = __WEBPACK_IMPORTED_MODULE_3__core_glenum__["a" /* default */].DEPTH_STENCIL_ATTACHMENT; - -/* harmony default export */ __webpack_exports__["a"] = (FrameBuffer); - - -/***/ }), -/* 11 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/** - * @namespace clay.core.glenum - * @see http://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14 - */ -/* harmony default export */ __webpack_exports__["a"] = ({ - /* ClearBufferMask */ - DEPTH_BUFFER_BIT : 0x00000100, - STENCIL_BUFFER_BIT : 0x00000400, - COLOR_BUFFER_BIT : 0x00004000, - - /* BeginMode */ - POINTS : 0x0000, - LINES : 0x0001, - LINE_LOOP : 0x0002, - LINE_STRIP : 0x0003, - TRIANGLES : 0x0004, - TRIANGLE_STRIP : 0x0005, - TRIANGLE_FAN : 0x0006, - - /* AlphaFunction (not supported in ES20) */ - /* NEVER */ - /* LESS */ - /* EQUAL */ - /* LEQUAL */ - /* GREATER */ - /* NOTEQUAL */ - /* GEQUAL */ - /* ALWAYS */ - - /* BlendingFactorDest */ - ZERO : 0, - ONE : 1, - SRC_COLOR : 0x0300, - ONE_MINUS_SRC_COLOR : 0x0301, - SRC_ALPHA : 0x0302, - ONE_MINUS_SRC_ALPHA : 0x0303, - DST_ALPHA : 0x0304, - ONE_MINUS_DST_ALPHA : 0x0305, - - /* BlendingFactorSrc */ - /* ZERO */ - /* ONE */ - DST_COLOR : 0x0306, - ONE_MINUS_DST_COLOR : 0x0307, - SRC_ALPHA_SATURATE : 0x0308, - /* SRC_ALPHA */ - /* ONE_MINUS_SRC_ALPHA */ - /* DST_ALPHA */ - /* ONE_MINUS_DST_ALPHA */ - - /* BlendEquationSeparate */ - FUNC_ADD : 0x8006, - BLEND_EQUATION : 0x8009, - BLEND_EQUATION_RGB : 0x8009, /* same as BLEND_EQUATION */ - BLEND_EQUATION_ALPHA : 0x883D, - - /* BlendSubtract */ - FUNC_SUBTRACT : 0x800A, - FUNC_REVERSE_SUBTRACT : 0x800B, - - /* Separate Blend Functions */ - BLEND_DST_RGB : 0x80C8, - BLEND_SRC_RGB : 0x80C9, - BLEND_DST_ALPHA : 0x80CA, - BLEND_SRC_ALPHA : 0x80CB, - CONSTANT_COLOR : 0x8001, - ONE_MINUS_CONSTANT_COLOR : 0x8002, - CONSTANT_ALPHA : 0x8003, - ONE_MINUS_CONSTANT_ALPHA : 0x8004, - BLEND_COLOR : 0x8005, - - /* Buffer Objects */ - ARRAY_BUFFER : 0x8892, - ELEMENT_ARRAY_BUFFER : 0x8893, - ARRAY_BUFFER_BINDING : 0x8894, - ELEMENT_ARRAY_BUFFER_BINDING : 0x8895, - - STREAM_DRAW : 0x88E0, - STATIC_DRAW : 0x88E4, - DYNAMIC_DRAW : 0x88E8, - - BUFFER_SIZE : 0x8764, - BUFFER_USAGE : 0x8765, - - CURRENT_VERTEX_ATTRIB : 0x8626, - - /* CullFaceMode */ - FRONT : 0x0404, - BACK : 0x0405, - FRONT_AND_BACK : 0x0408, - - /* DepthFunction */ - /* NEVER */ - /* LESS */ - /* EQUAL */ - /* LEQUAL */ - /* GREATER */ - /* NOTEQUAL */ - /* GEQUAL */ - /* ALWAYS */ - - /* EnableCap */ - /* TEXTURE_2D */ - CULL_FACE : 0x0B44, - BLEND : 0x0BE2, - DITHER : 0x0BD0, - STENCIL_TEST : 0x0B90, - DEPTH_TEST : 0x0B71, - SCISSOR_TEST : 0x0C11, - POLYGON_OFFSET_FILL : 0x8037, - SAMPLE_ALPHA_TO_COVERAGE : 0x809E, - SAMPLE_COVERAGE : 0x80A0, - - /* ErrorCode */ - NO_ERROR : 0, - INVALID_ENUM : 0x0500, - INVALID_VALUE : 0x0501, - INVALID_OPERATION : 0x0502, - OUT_OF_MEMORY : 0x0505, - - /* FrontFaceDirection */ - CW : 0x0900, - CCW : 0x0901, - - /* GetPName */ - LINE_WIDTH : 0x0B21, - ALIASED_POINT_SIZE_RANGE : 0x846D, - ALIASED_LINE_WIDTH_RANGE : 0x846E, - CULL_FACE_MODE : 0x0B45, - FRONT_FACE : 0x0B46, - DEPTH_RANGE : 0x0B70, - DEPTH_WRITEMASK : 0x0B72, - DEPTH_CLEAR_VALUE : 0x0B73, - DEPTH_FUNC : 0x0B74, - STENCIL_CLEAR_VALUE : 0x0B91, - STENCIL_FUNC : 0x0B92, - STENCIL_FAIL : 0x0B94, - STENCIL_PASS_DEPTH_FAIL : 0x0B95, - STENCIL_PASS_DEPTH_PASS : 0x0B96, - STENCIL_REF : 0x0B97, - STENCIL_VALUE_MASK : 0x0B93, - STENCIL_WRITEMASK : 0x0B98, - STENCIL_BACK_FUNC : 0x8800, - STENCIL_BACK_FAIL : 0x8801, - STENCIL_BACK_PASS_DEPTH_FAIL : 0x8802, - STENCIL_BACK_PASS_DEPTH_PASS : 0x8803, - STENCIL_BACK_REF : 0x8CA3, - STENCIL_BACK_VALUE_MASK : 0x8CA4, - STENCIL_BACK_WRITEMASK : 0x8CA5, - VIEWPORT : 0x0BA2, - SCISSOR_BOX : 0x0C10, - /* SCISSOR_TEST */ - COLOR_CLEAR_VALUE : 0x0C22, - COLOR_WRITEMASK : 0x0C23, - UNPACK_ALIGNMENT : 0x0CF5, - PACK_ALIGNMENT : 0x0D05, - MAX_TEXTURE_SIZE : 0x0D33, - MAX_VIEWPORT_DIMS : 0x0D3A, - SUBPIXEL_BITS : 0x0D50, - RED_BITS : 0x0D52, - GREEN_BITS : 0x0D53, - BLUE_BITS : 0x0D54, - ALPHA_BITS : 0x0D55, - DEPTH_BITS : 0x0D56, - STENCIL_BITS : 0x0D57, - POLYGON_OFFSET_UNITS : 0x2A00, - /* POLYGON_OFFSET_FILL */ - POLYGON_OFFSET_FACTOR : 0x8038, - TEXTURE_BINDING_2D : 0x8069, - SAMPLE_BUFFERS : 0x80A8, - SAMPLES : 0x80A9, - SAMPLE_COVERAGE_VALUE : 0x80AA, - SAMPLE_COVERAGE_INVERT : 0x80AB, - - /* GetTextureParameter */ - /* TEXTURE_MAG_FILTER */ - /* TEXTURE_MIN_FILTER */ - /* TEXTURE_WRAP_S */ - /* TEXTURE_WRAP_T */ - - COMPRESSED_TEXTURE_FORMATS : 0x86A3, - - /* HintMode */ - DONT_CARE : 0x1100, - FASTEST : 0x1101, - NICEST : 0x1102, - - /* HintTarget */ - GENERATE_MIPMAP_HINT : 0x8192, - - /* DataType */ - BYTE : 0x1400, - UNSIGNED_BYTE : 0x1401, - SHORT : 0x1402, - UNSIGNED_SHORT : 0x1403, - INT : 0x1404, - UNSIGNED_INT : 0x1405, - FLOAT : 0x1406, - - /* PixelFormat */ - DEPTH_COMPONENT : 0x1902, - ALPHA : 0x1906, - RGB : 0x1907, - RGBA : 0x1908, - LUMINANCE : 0x1909, - LUMINANCE_ALPHA : 0x190A, - - /* PixelType */ - /* UNSIGNED_BYTE */ - UNSIGNED_SHORT_4_4_4_4 : 0x8033, - UNSIGNED_SHORT_5_5_5_1 : 0x8034, - UNSIGNED_SHORT_5_6_5 : 0x8363, - - /* Shaders */ - FRAGMENT_SHADER : 0x8B30, - VERTEX_SHADER : 0x8B31, - MAX_VERTEX_ATTRIBS : 0x8869, - MAX_VERTEX_UNIFORM_VECTORS : 0x8DFB, - MAX_VARYING_VECTORS : 0x8DFC, - MAX_COMBINED_TEXTURE_IMAGE_UNITS : 0x8B4D, - MAX_VERTEX_TEXTURE_IMAGE_UNITS : 0x8B4C, - MAX_TEXTURE_IMAGE_UNITS : 0x8872, - MAX_FRAGMENT_UNIFORM_VECTORS : 0x8DFD, - SHADER_TYPE : 0x8B4F, - DELETE_STATUS : 0x8B80, - LINK_STATUS : 0x8B82, - VALIDATE_STATUS : 0x8B83, - ATTACHED_SHADERS : 0x8B85, - ACTIVE_UNIFORMS : 0x8B86, - ACTIVE_ATTRIBUTES : 0x8B89, - SHADING_LANGUAGE_VERSION : 0x8B8C, - CURRENT_PROGRAM : 0x8B8D, - - /* StencilFunction */ - NEVER : 0x0200, - LESS : 0x0201, - EQUAL : 0x0202, - LEQUAL : 0x0203, - GREATER : 0x0204, - NOTEQUAL : 0x0205, - GEQUAL : 0x0206, - ALWAYS : 0x0207, - - /* StencilOp */ - /* ZERO */ - KEEP : 0x1E00, - REPLACE : 0x1E01, - INCR : 0x1E02, - DECR : 0x1E03, - INVERT : 0x150A, - INCR_WRAP : 0x8507, - DECR_WRAP : 0x8508, - - /* StringName */ - VENDOR : 0x1F00, - RENDERER : 0x1F01, - VERSION : 0x1F02, - - /* TextureMagFilter */ - NEAREST : 0x2600, - LINEAR : 0x2601, - - /* TextureMinFilter */ - /* NEAREST */ - /* LINEAR */ - NEAREST_MIPMAP_NEAREST : 0x2700, - LINEAR_MIPMAP_NEAREST : 0x2701, - NEAREST_MIPMAP_LINEAR : 0x2702, - LINEAR_MIPMAP_LINEAR : 0x2703, - - /* TextureParameterName */ - TEXTURE_MAG_FILTER : 0x2800, - TEXTURE_MIN_FILTER : 0x2801, - TEXTURE_WRAP_S : 0x2802, - TEXTURE_WRAP_T : 0x2803, - - /* TextureTarget */ - TEXTURE_2D : 0x0DE1, - TEXTURE : 0x1702, - - TEXTURE_CUBE_MAP : 0x8513, - TEXTURE_BINDING_CUBE_MAP : 0x8514, - TEXTURE_CUBE_MAP_POSITIVE_X : 0x8515, - TEXTURE_CUBE_MAP_NEGATIVE_X : 0x8516, - TEXTURE_CUBE_MAP_POSITIVE_Y : 0x8517, - TEXTURE_CUBE_MAP_NEGATIVE_Y : 0x8518, - TEXTURE_CUBE_MAP_POSITIVE_Z : 0x8519, - TEXTURE_CUBE_MAP_NEGATIVE_Z : 0x851A, - MAX_CUBE_MAP_TEXTURE_SIZE : 0x851C, - - /* TextureUnit */ - TEXTURE0 : 0x84C0, - TEXTURE1 : 0x84C1, - TEXTURE2 : 0x84C2, - TEXTURE3 : 0x84C3, - TEXTURE4 : 0x84C4, - TEXTURE5 : 0x84C5, - TEXTURE6 : 0x84C6, - TEXTURE7 : 0x84C7, - TEXTURE8 : 0x84C8, - TEXTURE9 : 0x84C9, - TEXTURE10 : 0x84CA, - TEXTURE11 : 0x84CB, - TEXTURE12 : 0x84CC, - TEXTURE13 : 0x84CD, - TEXTURE14 : 0x84CE, - TEXTURE15 : 0x84CF, - TEXTURE16 : 0x84D0, - TEXTURE17 : 0x84D1, - TEXTURE18 : 0x84D2, - TEXTURE19 : 0x84D3, - TEXTURE20 : 0x84D4, - TEXTURE21 : 0x84D5, - TEXTURE22 : 0x84D6, - TEXTURE23 : 0x84D7, - TEXTURE24 : 0x84D8, - TEXTURE25 : 0x84D9, - TEXTURE26 : 0x84DA, - TEXTURE27 : 0x84DB, - TEXTURE28 : 0x84DC, - TEXTURE29 : 0x84DD, - TEXTURE30 : 0x84DE, - TEXTURE31 : 0x84DF, - ACTIVE_TEXTURE : 0x84E0, - - /* TextureWrapMode */ - REPEAT : 0x2901, - CLAMP_TO_EDGE : 0x812F, - MIRRORED_REPEAT : 0x8370, - - /* Uniform Types */ - FLOAT_VEC2 : 0x8B50, - FLOAT_VEC3 : 0x8B51, - FLOAT_VEC4 : 0x8B52, - INT_VEC2 : 0x8B53, - INT_VEC3 : 0x8B54, - INT_VEC4 : 0x8B55, - BOOL : 0x8B56, - BOOL_VEC2 : 0x8B57, - BOOL_VEC3 : 0x8B58, - BOOL_VEC4 : 0x8B59, - FLOAT_MAT2 : 0x8B5A, - FLOAT_MAT3 : 0x8B5B, - FLOAT_MAT4 : 0x8B5C, - SAMPLER_2D : 0x8B5E, - SAMPLER_CUBE : 0x8B60, - - /* Vertex Arrays */ - VERTEX_ATTRIB_ARRAY_ENABLED : 0x8622, - VERTEX_ATTRIB_ARRAY_SIZE : 0x8623, - VERTEX_ATTRIB_ARRAY_STRIDE : 0x8624, - VERTEX_ATTRIB_ARRAY_TYPE : 0x8625, - VERTEX_ATTRIB_ARRAY_NORMALIZED : 0x886A, - VERTEX_ATTRIB_ARRAY_POINTER : 0x8645, - VERTEX_ATTRIB_ARRAY_BUFFER_BINDING : 0x889F, - - /* Shader Source */ - COMPILE_STATUS : 0x8B81, - - /* Shader Precision-Specified Types */ - LOW_FLOAT : 0x8DF0, - MEDIUM_FLOAT : 0x8DF1, - HIGH_FLOAT : 0x8DF2, - LOW_INT : 0x8DF3, - MEDIUM_INT : 0x8DF4, - HIGH_INT : 0x8DF5, - - /* Framebuffer Object. */ - FRAMEBUFFER : 0x8D40, - RENDERBUFFER : 0x8D41, - - RGBA4 : 0x8056, - RGB5_A1 : 0x8057, - RGB565 : 0x8D62, - DEPTH_COMPONENT16 : 0x81A5, - STENCIL_INDEX : 0x1901, - STENCIL_INDEX8 : 0x8D48, - DEPTH_STENCIL : 0x84F9, - - RENDERBUFFER_WIDTH : 0x8D42, - RENDERBUFFER_HEIGHT : 0x8D43, - RENDERBUFFER_INTERNAL_FORMAT : 0x8D44, - RENDERBUFFER_RED_SIZE : 0x8D50, - RENDERBUFFER_GREEN_SIZE : 0x8D51, - RENDERBUFFER_BLUE_SIZE : 0x8D52, - RENDERBUFFER_ALPHA_SIZE : 0x8D53, - RENDERBUFFER_DEPTH_SIZE : 0x8D54, - RENDERBUFFER_STENCIL_SIZE : 0x8D55, - - FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE : 0x8CD0, - FRAMEBUFFER_ATTACHMENT_OBJECT_NAME : 0x8CD1, - FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL : 0x8CD2, - FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE : 0x8CD3, - - COLOR_ATTACHMENT0 : 0x8CE0, - DEPTH_ATTACHMENT : 0x8D00, - STENCIL_ATTACHMENT : 0x8D20, - DEPTH_STENCIL_ATTACHMENT : 0x821A, - - NONE : 0, - - FRAMEBUFFER_COMPLETE : 0x8CD5, - FRAMEBUFFER_INCOMPLETE_ATTACHMENT : 0x8CD6, - FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT : 0x8CD7, - FRAMEBUFFER_INCOMPLETE_DIMENSIONS : 0x8CD9, - FRAMEBUFFER_UNSUPPORTED : 0x8CDD, - - FRAMEBUFFER_BINDING : 0x8CA6, - RENDERBUFFER_BINDING : 0x8CA7, - MAX_RENDERBUFFER_SIZE : 0x84E8, - - INVALID_FRAMEBUFFER_OPERATION : 0x0506, - - /* WebGL-specific enums */ - UNPACK_FLIP_Y_WEBGL : 0x9240, - UNPACK_PREMULTIPLY_ALPHA_WEBGL : 0x9241, - CONTEXT_LOST_WEBGL : 0x9242, - UNPACK_COLORSPACE_CONVERSION_WEBGL : 0x9243, - BROWSER_DEFAULT_WEBGL : 0x9244, -}); - - -/***/ }), -/* 12 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__common__ = __webpack_require__(20); - -/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - - -/** - * @class 3 Dimensional Vector - * @name vec3 - */ - -var vec3 = {}; - -/** - * Creates a new, empty vec3 - * - * @returns {vec3} a new 3D vector - */ -vec3.create = function() { - var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" /* GLMAT_ARRAY_TYPE */](3); - out[0] = 0; - out[1] = 0; - out[2] = 0; - return out; -}; - -/** - * Creates a new vec3 initialized with values from an existing vector - * - * @param {vec3} a vector to clone - * @returns {vec3} a new 3D vector - */ -vec3.clone = function(a) { - var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" /* GLMAT_ARRAY_TYPE */](3); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - return out; -}; - -/** - * Creates a new vec3 initialized with the given values - * - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @returns {vec3} a new 3D vector - */ -vec3.fromValues = function(x, y, z) { - var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" /* GLMAT_ARRAY_TYPE */](3); - out[0] = x; - out[1] = y; - out[2] = z; - return out; -}; - -/** - * Copy the values from one vec3 to another - * - * @param {vec3} out the receiving vector - * @param {vec3} a the source vector - * @returns {vec3} out - */ -vec3.copy = function(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - return out; -}; - -/** - * Set the components of a vec3 to the given values - * - * @param {vec3} out the receiving vector - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @returns {vec3} out - */ -vec3.set = function(out, x, y, z) { - out[0] = x; - out[1] = y; - out[2] = z; - return out; -}; - -/** - * Adds two vec3's - * - * @param {vec3} out the receiving vector - * @param {vec3} a the first operand - * @param {vec3} b the second operand - * @returns {vec3} out - */ -vec3.add = function(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - out[2] = a[2] + b[2]; - return out; -}; - -/** - * Subtracts vector b from vector a - * - * @param {vec3} out the receiving vector - * @param {vec3} a the first operand - * @param {vec3} b the second operand - * @returns {vec3} out - */ -vec3.subtract = function(out, a, b) { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - out[2] = a[2] - b[2]; - return out; -}; - -/** - * Alias for {@link vec3.subtract} - * @function - */ -vec3.sub = vec3.subtract; - -/** - * Multiplies two vec3's - * - * @param {vec3} out the receiving vector - * @param {vec3} a the first operand - * @param {vec3} b the second operand - * @returns {vec3} out - */ -vec3.multiply = function(out, a, b) { - out[0] = a[0] * b[0]; - out[1] = a[1] * b[1]; - out[2] = a[2] * b[2]; - return out; -}; - -/** - * Alias for {@link vec3.multiply} - * @function - */ -vec3.mul = vec3.multiply; - -/** - * Divides two vec3's - * - * @param {vec3} out the receiving vector - * @param {vec3} a the first operand - * @param {vec3} b the second operand - * @returns {vec3} out - */ -vec3.divide = function(out, a, b) { - out[0] = a[0] / b[0]; - out[1] = a[1] / b[1]; - out[2] = a[2] / b[2]; - return out; -}; - -/** - * Alias for {@link vec3.divide} - * @function - */ -vec3.div = vec3.divide; - -/** - * Returns the minimum of two vec3's - * - * @param {vec3} out the receiving vector - * @param {vec3} a the first operand - * @param {vec3} b the second operand - * @returns {vec3} out - */ -vec3.min = function(out, a, b) { - out[0] = Math.min(a[0], b[0]); - out[1] = Math.min(a[1], b[1]); - out[2] = Math.min(a[2], b[2]); - return out; -}; - -/** - * Returns the maximum of two vec3's - * - * @param {vec3} out the receiving vector - * @param {vec3} a the first operand - * @param {vec3} b the second operand - * @returns {vec3} out - */ -vec3.max = function(out, a, b) { - out[0] = Math.max(a[0], b[0]); - out[1] = Math.max(a[1], b[1]); - out[2] = Math.max(a[2], b[2]); - return out; -}; - -/** - * Scales a vec3 by a scalar number - * - * @param {vec3} out the receiving vector - * @param {vec3} a the vector to scale - * @param {Number} b amount to scale the vector by - * @returns {vec3} out - */ -vec3.scale = function(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - out[2] = a[2] * b; - return out; -}; - -/** - * Adds two vec3's after scaling the second operand by a scalar value - * - * @param {vec3} out the receiving vector - * @param {vec3} a the first operand - * @param {vec3} b the second operand - * @param {Number} scale the amount to scale b by before adding - * @returns {vec3} out - */ -vec3.scaleAndAdd = function(out, a, b, scale) { - out[0] = a[0] + (b[0] * scale); - out[1] = a[1] + (b[1] * scale); - out[2] = a[2] + (b[2] * scale); - return out; -}; - -/** - * Calculates the euclidian distance between two vec3's - * - * @param {vec3} a the first operand - * @param {vec3} b the second operand - * @returns {Number} distance between a and b - */ -vec3.distance = function(a, b) { - var x = b[0] - a[0], - y = b[1] - a[1], - z = b[2] - a[2]; - return Math.sqrt(x*x + y*y + z*z); -}; - -/** - * Alias for {@link vec3.distance} - * @function - */ -vec3.dist = vec3.distance; - -/** - * Calculates the squared euclidian distance between two vec3's - * - * @param {vec3} a the first operand - * @param {vec3} b the second operand - * @returns {Number} squared distance between a and b - */ -vec3.squaredDistance = function(a, b) { - var x = b[0] - a[0], - y = b[1] - a[1], - z = b[2] - a[2]; - return x*x + y*y + z*z; -}; - -/** - * Alias for {@link vec3.squaredDistance} - * @function - */ -vec3.sqrDist = vec3.squaredDistance; - -/** - * Calculates the length of a vec3 - * - * @param {vec3} a vector to calculate length of - * @returns {Number} length of a - */ -vec3.length = function (a) { - var x = a[0], - y = a[1], - z = a[2]; - return Math.sqrt(x*x + y*y + z*z); -}; - -/** - * Alias for {@link vec3.length} - * @function - */ -vec3.len = vec3.length; - -/** - * Calculates the squared length of a vec3 - * - * @param {vec3} a vector to calculate squared length of - * @returns {Number} squared length of a - */ -vec3.squaredLength = function (a) { - var x = a[0], - y = a[1], - z = a[2]; - return x*x + y*y + z*z; -}; - -/** - * Alias for {@link vec3.squaredLength} - * @function - */ -vec3.sqrLen = vec3.squaredLength; - -/** - * Negates the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {vec3} a vector to negate - * @returns {vec3} out - */ -vec3.negate = function(out, a) { - out[0] = -a[0]; - out[1] = -a[1]; - out[2] = -a[2]; - return out; -}; - -/** - * Returns the inverse of the components of a vec3 - * - * @param {vec3} out the receiving vector - * @param {vec3} a vector to invert - * @returns {vec3} out - */ -vec3.inverse = function(out, a) { - out[0] = 1.0 / a[0]; - out[1] = 1.0 / a[1]; - out[2] = 1.0 / a[2]; - return out; -}; - -/** - * Normalize a vec3 - * - * @param {vec3} out the receiving vector - * @param {vec3} a vector to normalize - * @returns {vec3} out - */ -vec3.normalize = function(out, a) { - var x = a[0], - y = a[1], - z = a[2]; - var len = x*x + y*y + z*z; - if (len > 0) { - //TODO: evaluate use of glm_invsqrt here? - len = 1 / Math.sqrt(len); - out[0] = a[0] * len; - out[1] = a[1] * len; - out[2] = a[2] * len; - } - return out; -}; - -/** - * Calculates the dot product of two vec3's - * - * @param {vec3} a the first operand - * @param {vec3} b the second operand - * @returns {Number} dot product of a and b - */ -vec3.dot = function (a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; -}; - -/** - * Computes the cross product of two vec3's - * - * @param {vec3} out the receiving vector - * @param {vec3} a the first operand - * @param {vec3} b the second operand - * @returns {vec3} out - */ -vec3.cross = function(out, a, b) { - var ax = a[0], ay = a[1], az = a[2], - bx = b[0], by = b[1], bz = b[2]; - - out[0] = ay * bz - az * by; - out[1] = az * bx - ax * bz; - out[2] = ax * by - ay * bx; - return out; -}; - -/** - * Performs a linear interpolation between two vec3's - * - * @param {vec3} out the receiving vector - * @param {vec3} a the first operand - * @param {vec3} b the second operand - * @param {Number} t interpolation amount between the two inputs - * @returns {vec3} out - */ -vec3.lerp = function (out, a, b, t) { - var ax = a[0], - ay = a[1], - az = a[2]; - out[0] = ax + t * (b[0] - ax); - out[1] = ay + t * (b[1] - ay); - out[2] = az + t * (b[2] - az); - return out; -}; - -/** - * Generates a random vector with the given scale - * - * @param {vec3} out the receiving vector - * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned - * @returns {vec3} out - */ -vec3.random = function (out, scale) { - scale = scale || 1.0; - - var r = Object(__WEBPACK_IMPORTED_MODULE_0__common__["c" /* GLMAT_RANDOM */])() * 2.0 * Math.PI; - var z = (Object(__WEBPACK_IMPORTED_MODULE_0__common__["c" /* GLMAT_RANDOM */])() * 2.0) - 1.0; - var zScale = Math.sqrt(1.0-z*z) * scale; - - out[0] = Math.cos(r) * zScale; - out[1] = Math.sin(r) * zScale; - out[2] = z * scale; - return out; -}; - -/** - * Transforms the vec3 with a mat4. - * 4th vector component is implicitly '1' - * - * @param {vec3} out the receiving vector - * @param {vec3} a the vector to transform - * @param {mat4} m matrix to transform with - * @returns {vec3} out - */ -vec3.transformMat4 = function(out, a, m) { - var x = a[0], y = a[1], z = a[2], - w = m[3] * x + m[7] * y + m[11] * z + m[15]; - w = w || 1.0; - out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; - out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; - out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; - return out; -}; - -/** - * Transforms the vec3 with a mat3. - * - * @param {vec3} out the receiving vector - * @param {vec3} a the vector to transform - * @param {mat4} m the 3x3 matrix to transform with - * @returns {vec3} out - */ -vec3.transformMat3 = function(out, a, m) { - var x = a[0], y = a[1], z = a[2]; - out[0] = x * m[0] + y * m[3] + z * m[6]; - out[1] = x * m[1] + y * m[4] + z * m[7]; - out[2] = x * m[2] + y * m[5] + z * m[8]; - return out; -}; - -/** - * Transforms the vec3 with a quat - * - * @param {vec3} out the receiving vector - * @param {vec3} a the vector to transform - * @param {quat} q quaternion to transform with - * @returns {vec3} out - */ -vec3.transformQuat = function(out, a, q) { - // benchmarks: http://jsperf.com/quaternion-transform-vec3-implementations - - var x = a[0], y = a[1], z = a[2], - qx = q[0], qy = q[1], qz = q[2], qw = q[3], - - // calculate quat * vec - ix = qw * x + qy * z - qz * y, - iy = qw * y + qz * x - qx * z, - iz = qw * z + qx * y - qy * x, - iw = -qx * x - qy * y - qz * z; - - // calculate result * inverse quat - out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy; - out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz; - out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx; - return out; -}; - -/** - * Rotate a 3D vector around the x-axis - * @param {vec3} out The receiving vec3 - * @param {vec3} a The vec3 point to rotate - * @param {vec3} b The origin of the rotation - * @param {Number} c The angle of rotation - * @returns {vec3} out - */ -vec3.rotateX = function(out, a, b, c){ - var p = [], r=[]; - //Translate point to the origin - p[0] = a[0] - b[0]; - p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; - - //perform rotation - r[0] = p[0]; - r[1] = p[1]*Math.cos(c) - p[2]*Math.sin(c); - r[2] = p[1]*Math.sin(c) + p[2]*Math.cos(c); - - //translate to correct position - out[0] = r[0] + b[0]; - out[1] = r[1] + b[1]; - out[2] = r[2] + b[2]; - - return out; -}; - -/** - * Rotate a 3D vector around the y-axis - * @param {vec3} out The receiving vec3 - * @param {vec3} a The vec3 point to rotate - * @param {vec3} b The origin of the rotation - * @param {Number} c The angle of rotation - * @returns {vec3} out - */ -vec3.rotateY = function(out, a, b, c){ - var p = [], r=[]; - //Translate point to the origin - p[0] = a[0] - b[0]; - p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; - - //perform rotation - r[0] = p[2]*Math.sin(c) + p[0]*Math.cos(c); - r[1] = p[1]; - r[2] = p[2]*Math.cos(c) - p[0]*Math.sin(c); - - //translate to correct position - out[0] = r[0] + b[0]; - out[1] = r[1] + b[1]; - out[2] = r[2] + b[2]; - - return out; -}; - -/** - * Rotate a 3D vector around the z-axis - * @param {vec3} out The receiving vec3 - * @param {vec3} a The vec3 point to rotate - * @param {vec3} b The origin of the rotation - * @param {Number} c The angle of rotation - * @returns {vec3} out - */ -vec3.rotateZ = function(out, a, b, c){ - var p = [], r=[]; - //Translate point to the origin - p[0] = a[0] - b[0]; - p[1] = a[1] - b[1]; - p[2] = a[2] - b[2]; - - //perform rotation - r[0] = p[0]*Math.cos(c) - p[1]*Math.sin(c); - r[1] = p[0]*Math.sin(c) + p[1]*Math.cos(c); - r[2] = p[2]; - - //translate to correct position - out[0] = r[0] + b[0]; - out[1] = r[1] + b[1]; - out[2] = r[2] + b[2]; - - return out; -}; - -/** - * Perform some operation over an array of vec3s. - * - * @param {Array} a the array of vectors to iterate over - * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed - * @param {Number} offset Number of elements to skip at the beginning of the array - * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array - * @param {Function} fn Function to call for each vector in the array - * @param {Object} [arg] additional argument to pass to fn - * @returns {Array} a - * @function - */ -vec3.forEach = (function() { - var vec = vec3.create(); - - return function(a, stride, offset, count, fn, arg) { - var i, l; - if(!stride) { - stride = 3; - } - - if(!offset) { - offset = 0; - } - - if(count) { - l = Math.min((count * stride) + offset, a.length); - } else { - l = a.length; - } - - for(i = offset; i < l; i += stride) { - vec[0] = a[i]; vec[1] = a[i+1]; vec[2] = a[i+2]; - fn(vec, vec, arg); - a[i] = vec[0]; a[i+1] = vec[1]; a[i+2] = vec[2]; - } - - return a; - }; -})(); - -/** - * Get the angle between two 3D vectors - * @param {vec3} a The first operand - * @param {vec3} b The second operand - * @returns {Number} The angle in radians - */ -vec3.angle = function(a, b) { - - var tempA = vec3.fromValues(a[0], a[1], a[2]); - var tempB = vec3.fromValues(b[0], b[1], b[2]); - - vec3.normalize(tempA, tempA); - vec3.normalize(tempB, tempB); - - var cosine = vec3.dot(tempA, tempB); - - if(cosine > 1.0){ - return 0; - } else { - return Math.acos(cosine); - } -}; - -/* harmony default export */ __webpack_exports__["a"] = (vec3); - -/***/ }), -/* 13 */ -/***/ (function(module, exports) { - -/** - * @module zrender/core/util - */ -// 用于处理merge时无法遍历Date等对象的问题 -var BUILTIN_OBJECT = { - '[object Function]': 1, - '[object RegExp]': 1, - '[object Date]': 1, - '[object Error]': 1, - '[object CanvasGradient]': 1, - '[object CanvasPattern]': 1, - // For node-canvas - '[object Image]': 1, - '[object Canvas]': 1 -}; -var TYPED_ARRAY = { - '[object Int8Array]': 1, - '[object Uint8Array]': 1, - '[object Uint8ClampedArray]': 1, - '[object Int16Array]': 1, - '[object Uint16Array]': 1, - '[object Int32Array]': 1, - '[object Uint32Array]': 1, - '[object Float32Array]': 1, - '[object Float64Array]': 1 -}; -var objToString = Object.prototype.toString; -var arrayProto = Array.prototype; -var nativeForEach = arrayProto.forEach; -var nativeFilter = arrayProto.filter; -var nativeSlice = arrayProto.slice; -var nativeMap = arrayProto.map; -var nativeReduce = arrayProto.reduce; // Avoid assign to an exported variable, for transforming to cjs. - -var methods = {}; - -function $override(name, fn) { - // Clear ctx instance for different environment - if (name === 'createCanvas') { - _ctx = null; - } - - methods[name] = fn; -} -/** - * Those data types can be cloned: - * Plain object, Array, TypedArray, number, string, null, undefined. - * Those data types will be assgined using the orginal data: - * BUILTIN_OBJECT - * Instance of user defined class will be cloned to a plain object, without - * properties in prototype. - * Other data types is not supported (not sure what will happen). - * - * Caution: do not support clone Date, for performance consideration. - * (There might be a large number of date in `series.data`). - * So date should not be modified in and out of echarts. - * - * @param {*} source - * @return {*} new - */ - - -function clone(source) { - if (source == null || typeof source != 'object') { - return source; - } - - var result = source; - var typeStr = objToString.call(source); - - if (typeStr === '[object Array]') { - if (!isPrimitive(source)) { - result = []; - - for (var i = 0, len = source.length; i < len; i++) { - result[i] = clone(source[i]); - } - } - } else if (TYPED_ARRAY[typeStr]) { - if (!isPrimitive(source)) { - var Ctor = source.constructor; - - if (source.constructor.from) { - result = Ctor.from(source); - } else { - result = new Ctor(source.length); - - for (var i = 0, len = source.length; i < len; i++) { - result[i] = clone(source[i]); - } - } - } - } else if (!BUILTIN_OBJECT[typeStr] && !isPrimitive(source) && !isDom(source)) { - result = {}; - - for (var key in source) { - if (source.hasOwnProperty(key)) { - result[key] = clone(source[key]); - } - } - } - - return result; -} -/** - * @memberOf module:zrender/core/util - * @param {*} target - * @param {*} source - * @param {boolean} [overwrite=false] - */ - - -function merge(target, source, overwrite) { - // We should escapse that source is string - // and enter for ... in ... - if (!isObject(source) || !isObject(target)) { - return overwrite ? clone(source) : target; - } - - for (var key in source) { - if (source.hasOwnProperty(key)) { - var targetProp = target[key]; - var sourceProp = source[key]; - - if (isObject(sourceProp) && isObject(targetProp) && !isArray(sourceProp) && !isArray(targetProp) && !isDom(sourceProp) && !isDom(targetProp) && !isBuiltInObject(sourceProp) && !isBuiltInObject(targetProp) && !isPrimitive(sourceProp) && !isPrimitive(targetProp)) { - // 如果需要递归覆盖,就递归调用merge - merge(targetProp, sourceProp, overwrite); - } else if (overwrite || !(key in target)) { - // 否则只处理overwrite为true,或者在目标对象中没有此属性的情况 - // NOTE,在 target[key] 不存在的时候也是直接覆盖 - target[key] = clone(source[key], true); - } - } - } - - return target; -} -/** - * @param {Array} targetAndSources The first item is target, and the rests are source. - * @param {boolean} [overwrite=false] - * @return {*} target - */ - - -function mergeAll(targetAndSources, overwrite) { - var result = targetAndSources[0]; - - for (var i = 1, len = targetAndSources.length; i < len; i++) { - result = merge(result, targetAndSources[i], overwrite); - } - - return result; -} -/** - * @param {*} target - * @param {*} source - * @memberOf module:zrender/core/util - */ - - -function extend(target, source) { - for (var key in source) { - if (source.hasOwnProperty(key)) { - target[key] = source[key]; - } - } - - return target; -} -/** - * @param {*} target - * @param {*} source - * @param {boolean} [overlay=false] - * @memberOf module:zrender/core/util - */ - - -function defaults(target, source, overlay) { - for (var key in source) { - if (source.hasOwnProperty(key) && (overlay ? source[key] != null : target[key] == null)) { - target[key] = source[key]; - } - } - - return target; -} - -var createCanvas = function () { - return methods.createCanvas(); -}; - -methods.createCanvas = function () { - return document.createElement('canvas'); -}; // FIXME - - -var _ctx; - -function getContext() { - if (!_ctx) { - // Use util.createCanvas instead of createCanvas - // because createCanvas may be overwritten in different environment - _ctx = createCanvas().getContext('2d'); - } - - return _ctx; -} -/** - * 查询数组中元素的index - * @memberOf module:zrender/core/util - */ - - -function indexOf(array, value) { - if (array) { - if (array.indexOf) { - return array.indexOf(value); - } - - for (var i = 0, len = array.length; i < len; i++) { - if (array[i] === value) { - return i; - } - } - } - - return -1; -} -/** - * 构造类继承关系 - * - * @memberOf module:zrender/core/util - * @param {Function} clazz 源类 - * @param {Function} baseClazz 基类 - */ - - -function inherits(clazz, baseClazz) { - var clazzPrototype = clazz.prototype; - - function F() {} - - F.prototype = baseClazz.prototype; - clazz.prototype = new F(); - - for (var prop in clazzPrototype) { - clazz.prototype[prop] = clazzPrototype[prop]; - } - - clazz.prototype.constructor = clazz; - clazz.superClass = baseClazz; -} -/** - * @memberOf module:zrender/core/util - * @param {Object|Function} target - * @param {Object|Function} sorce - * @param {boolean} overlay - */ - - -function mixin(target, source, overlay) { - target = 'prototype' in target ? target.prototype : target; - source = 'prototype' in source ? source.prototype : source; - defaults(target, source, overlay); -} -/** - * Consider typed array. - * @param {Array|TypedArray} data - */ - - -function isArrayLike(data) { - if (!data) { - return; - } - - if (typeof data == 'string') { - return false; - } - - return typeof data.length == 'number'; -} -/** - * 数组或对象遍历 - * @memberOf module:zrender/core/util - * @param {Object|Array} obj - * @param {Function} cb - * @param {*} [context] - */ - - -function each(obj, cb, context) { - if (!(obj && cb)) { - return; - } - - if (obj.forEach && obj.forEach === nativeForEach) { - obj.forEach(cb, context); - } else if (obj.length === +obj.length) { - for (var i = 0, len = obj.length; i < len; i++) { - cb.call(context, obj[i], i, obj); - } - } else { - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - cb.call(context, obj[key], key, obj); - } - } - } -} -/** - * 数组映射 - * @memberOf module:zrender/core/util - * @param {Array} obj - * @param {Function} cb - * @param {*} [context] - * @return {Array} - */ - - -function map(obj, cb, context) { - if (!(obj && cb)) { - return; - } - - if (obj.map && obj.map === nativeMap) { - return obj.map(cb, context); - } else { - var result = []; - - for (var i = 0, len = obj.length; i < len; i++) { - result.push(cb.call(context, obj[i], i, obj)); - } - - return result; - } -} -/** - * @memberOf module:zrender/core/util - * @param {Array} obj - * @param {Function} cb - * @param {Object} [memo] - * @param {*} [context] - * @return {Array} - */ - - -function reduce(obj, cb, memo, context) { - if (!(obj && cb)) { - return; - } - - if (obj.reduce && obj.reduce === nativeReduce) { - return obj.reduce(cb, memo, context); - } else { - for (var i = 0, len = obj.length; i < len; i++) { - memo = cb.call(context, memo, obj[i], i, obj); - } - - return memo; - } -} -/** - * 数组过滤 - * @memberOf module:zrender/core/util - * @param {Array} obj - * @param {Function} cb - * @param {*} [context] - * @return {Array} - */ - - -function filter(obj, cb, context) { - if (!(obj && cb)) { - return; - } - - if (obj.filter && obj.filter === nativeFilter) { - return obj.filter(cb, context); - } else { - var result = []; - - for (var i = 0, len = obj.length; i < len; i++) { - if (cb.call(context, obj[i], i, obj)) { - result.push(obj[i]); - } - } - - return result; - } -} -/** - * 数组项查找 - * @memberOf module:zrender/core/util - * @param {Array} obj - * @param {Function} cb - * @param {*} [context] - * @return {*} - */ - - -function find(obj, cb, context) { - if (!(obj && cb)) { - return; - } - - for (var i = 0, len = obj.length; i < len; i++) { - if (cb.call(context, obj[i], i, obj)) { - return obj[i]; - } - } -} -/** - * @memberOf module:zrender/core/util - * @param {Function} func - * @param {*} context - * @return {Function} - */ - - -function bind(func, context) { - var args = nativeSlice.call(arguments, 2); - return function () { - return func.apply(context, args.concat(nativeSlice.call(arguments))); - }; -} -/** - * @memberOf module:zrender/core/util - * @param {Function} func - * @return {Function} - */ - - -function curry(func) { - var args = nativeSlice.call(arguments, 1); - return function () { - return func.apply(this, args.concat(nativeSlice.call(arguments))); - }; -} -/** - * @memberOf module:zrender/core/util - * @param {*} value - * @return {boolean} - */ - - -function isArray(value) { - return objToString.call(value) === '[object Array]'; -} -/** - * @memberOf module:zrender/core/util - * @param {*} value - * @return {boolean} - */ - - -function isFunction(value) { - return typeof value === 'function'; -} -/** - * @memberOf module:zrender/core/util - * @param {*} value - * @return {boolean} - */ - - -function isString(value) { - return objToString.call(value) === '[object String]'; -} -/** - * @memberOf module:zrender/core/util - * @param {*} value - * @return {boolean} - */ - - -function isObject(value) { - // Avoid a V8 JIT bug in Chrome 19-20. - // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. - var type = typeof value; - return type === 'function' || !!value && type == 'object'; -} -/** - * @memberOf module:zrender/core/util - * @param {*} value - * @return {boolean} - */ - - -function isBuiltInObject(value) { - return !!BUILTIN_OBJECT[objToString.call(value)]; -} -/** - * @memberOf module:zrender/core/util - * @param {*} value - * @return {boolean} - */ - - -function isTypedArray(value) { - return !!TYPED_ARRAY[objToString.call(value)]; -} -/** - * @memberOf module:zrender/core/util - * @param {*} value - * @return {boolean} - */ - - -function isDom(value) { - return typeof value === 'object' && typeof value.nodeType === 'number' && typeof value.ownerDocument === 'object'; -} -/** - * Whether is exactly NaN. Notice isNaN('a') returns true. - * @param {*} value - * @return {boolean} - */ - - -function eqNaN(value) { - return value !== value; -} -/** - * If value1 is not null, then return value1, otherwise judget rest of values. - * Low performance. - * @memberOf module:zrender/core/util - * @return {*} Final value - */ - - -function retrieve(values) { - for (var i = 0, len = arguments.length; i < len; i++) { - if (arguments[i] != null) { - return arguments[i]; - } - } -} - -function retrieve2(value0, value1) { - return value0 != null ? value0 : value1; -} - -function retrieve3(value0, value1, value2) { - return value0 != null ? value0 : value1 != null ? value1 : value2; -} -/** - * @memberOf module:zrender/core/util - * @param {Array} arr - * @param {number} startIndex - * @param {number} endIndex - * @return {Array} - */ - - -function slice() { - return Function.call.apply(nativeSlice, arguments); -} -/** - * Normalize css liked array configuration - * e.g. - * 3 => [3, 3, 3, 3] - * [4, 2] => [4, 2, 4, 2] - * [4, 3, 2] => [4, 3, 2, 3] - * @param {number|Array.} val - * @return {Array.} - */ - - -function normalizeCssArray(val) { - if (typeof val === 'number') { - return [val, val, val, val]; - } - - var len = val.length; - - if (len === 2) { - // vertical | horizontal - return [val[0], val[1], val[0], val[1]]; - } else if (len === 3) { - // top | horizontal | bottom - return [val[0], val[1], val[2], val[1]]; - } - - return val; -} -/** - * @memberOf module:zrender/core/util - * @param {boolean} condition - * @param {string} message - */ - - -function assert(condition, message) { - if (!condition) { - throw new Error(message); - } -} -/** - * @memberOf module:zrender/core/util - * @param {string} str string to be trimed - * @return {string} trimed string - */ - - -function trim(str) { - if (str == null) { - return null; - } else if (typeof str.trim === 'function') { - return str.trim(); - } else { - return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); - } -} - -var primitiveKey = '__ec_primitive__'; -/** - * Set an object as primitive to be ignored traversing children in clone or merge - */ - -function setAsPrimitive(obj) { - obj[primitiveKey] = true; -} - -function isPrimitive(obj) { - return obj[primitiveKey]; -} -/** - * @constructor - * @param {Object} obj Only apply `ownProperty`. - */ - - -function HashMap(obj) { - var isArr = isArray(obj); - var thisMap = this; - obj instanceof HashMap ? obj.each(visit) : obj && each(obj, visit); - - function visit(value, key) { - isArr ? thisMap.set(value, key) : thisMap.set(key, value); - } -} // Add prefix to avoid conflict with Object.prototype. - - -HashMap.prototype = { - constructor: HashMap, - // Do not provide `has` method to avoid defining what is `has`. - // (We usually treat `null` and `undefined` as the same, different - // from ES6 Map). - get: function (key) { - return this.hasOwnProperty(key) ? this[key] : null; - }, - set: function (key, value) { - // Comparing with invocation chaining, `return value` is more commonly - // used in this case: `var someVal = map.set('a', genVal());` - return this[key] = value; - }, - // Although util.each can be performed on this hashMap directly, user - // should not use the exposed keys, who are prefixed. - each: function (cb, context) { - context !== void 0 && (cb = bind(cb, context)); - - for (var key in this) { - this.hasOwnProperty(key) && cb(this[key], key); - } - }, - // Do not use this method if performance sensitive. - removeKey: function (key) { - delete this[key]; - } -}; - -function createHashMap(obj) { - return new HashMap(obj); -} - -function concatArray(a, b) { - var newArray = new a.constructor(a.length + b.length); - - for (var i = 0; i < a.length; i++) { - newArray[i] = a[i]; - } - - var offset = a.length; - - for (i = 0; i < b.length; i++) { - newArray[i + offset] = b[i]; - } - - return newArray; -} - -function noop() {} - -exports.$override = $override; -exports.clone = clone; -exports.merge = merge; -exports.mergeAll = mergeAll; -exports.extend = extend; -exports.defaults = defaults; -exports.createCanvas = createCanvas; -exports.getContext = getContext; -exports.indexOf = indexOf; -exports.inherits = inherits; -exports.mixin = mixin; -exports.isArrayLike = isArrayLike; -exports.each = each; -exports.map = map; -exports.reduce = reduce; -exports.filter = filter; -exports.find = find; -exports.bind = bind; -exports.curry = curry; -exports.isArray = isArray; -exports.isFunction = isFunction; -exports.isString = isString; -exports.isObject = isObject; -exports.isBuiltInObject = isBuiltInObject; -exports.isTypedArray = isTypedArray; -exports.isDom = isDom; -exports.eqNaN = eqNaN; -exports.retrieve = retrieve; -exports.retrieve2 = retrieve2; -exports.retrieve3 = retrieve3; -exports.slice = slice; -exports.normalizeCssArray = normalizeCssArray; -exports.assert = assert; -exports.trim = trim; -exports.setAsPrimitive = setAsPrimitive; -exports.isPrimitive = isPrimitive; -exports.createHashMap = createHashMap; -exports.concatArray = concatArray; -exports.noop = noop; - -/***/ }), -/* 14 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__request__ = __webpack_require__(112); - - -var supportWebGL; - -var vendor = {}; - -/** - * If support WebGL - * @return {boolean} - */ -vendor.supportWebGL = function () { - if (supportWebGL == null) { - try { - var canvas = document.createElement('canvas'); - var gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl'); - if (!gl) { - throw new Error(); - } - } - catch (e) { - supportWebGL = false; - } - - } - return supportWebGL; -}; - -vendor.Int8Array = typeof Int8Array === 'undefined' ? Array : Int8Array; - -vendor.Uint8Array = typeof Uint8Array === 'undefined' ? Array : Uint8Array; - -vendor.Uint16Array = typeof Uint16Array === 'undefined' ? Array : Uint16Array; - -vendor.Uint32Array = typeof Uint32Array === 'undefined' ? Array : Uint32Array; - -vendor.Int16Array = typeof Int16Array === 'undefined' ? Array : Int16Array; - -vendor.Float32Array = typeof Float32Array === 'undefined' ? Array : Float32Array; - -vendor.Float64Array = typeof Float64Array === 'undefined' ? Array : Float64Array; - -var g = {}; -if (typeof window !== 'undefined') { - g = window; -} -else if (typeof global !== 'undefined') { - g = global; -} -vendor.requestAnimationFrame = g.requestAnimationFrame - || g.msRequestAnimationFrame - || g.mozRequestAnimationFrame - || g.webkitRequestAnimationFrame - || function (func){ setTimeout(func, 16); }; - -vendor.createCanvas = function () { - return document.createElement('canvas'); -}; - -vendor.createImage = function () { - return new g.Image(); -}; - -vendor.request = { - get: __WEBPACK_IMPORTED_MODULE_0__request__["a" /* default */].get -}; - -/* harmony default export */ __webpack_exports__["a"] = (vendor); - -/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(68))) - -/***/ }), -/* 15 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__core_vendor__ = __webpack_require__(14); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__ = __webpack_require__(12); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__glmatrix_mat4__ = __webpack_require__(21); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__math_BoundingBox__ = __webpack_require__(18); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__GeometryBase__ = __webpack_require__(118); - - - - - - -var vec3Create = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].create; -var vec3Add = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].add; -var vec3Set = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].set; - -var Attribute = __WEBPACK_IMPORTED_MODULE_4__GeometryBase__["a" /* default */].Attribute; - -/** - * Geometry in ClayGL contains vertex attributes of mesh. These vertex attributes will be finally provided to the {@link clay.Shader}. - * Different {@link clay.Shader} needs different attributes. Here is a list of attributes used in the builtin shaders. - * - * + position: `clay.basic`, `clay.lambert`, `clay.standard` - * + texcoord0: `clay.basic`, `clay.lambert`, `clay.standard` - * + color: `clay.basic`, `clay.lambert`, `clay.standard` - * + weight: `clay.basic`, `clay.lambert`, `clay.standard` - * + joint: `clay.basic`, `clay.lambert`, `clay.standard` - * + normal: `clay.lambert`, `clay.standard` - * + tangent: `clay.standard` - * - * #### Create a procedural geometry - * - * ClayGL provides a couple of builtin procedural geometries. Inlcuding: - * - * + {@link clay.geometry.Cube} - * + {@link clay.geometry.Sphere} - * + {@link clay.geometry.Plane} - * + {@link clay.geometry.Cylinder} - * + {@link clay.geometry.Cone} - * + {@link clay.geometry.ParametricSurface} - * - * It's simple to create a basic geometry with these classes. - * -```js -var sphere = new clay.geometry.Sphere({ - radius: 2 -}); -``` - * - * #### Create the geometry data by yourself - * - * Usually the vertex attributes data are created by the {@link clay.loader.GLTF} or procedural geometries like {@link clay.geometry.Sphere}. - * Besides these, you can create the data manually. Here is a simple example to create a triangle. -```js -var TRIANGLE_POSITIONS = [ - [-0.5, -0.5, 0], - [0.5, -0.5, 0], - [0, 0.5, 0] -]; -var geometry = new clay.StaticGeometryBase(); -// Add triangle vertices to position attribute. -geometry.attributes.position.fromArray(TRIANGLE_POSITIONS); -``` - * Then you can use the utility methods like `generateVertexNormals`, `generateTangents` to create the remaining necessary attributes. - * - * - * #### Use with custom shaders - * - * If you wan't to write custom shaders. Don't forget to add SEMANTICS to these attributes. For example - * - ```glsl -uniform mat4 worldViewProjection : WORLDVIEWPROJECTION; -uniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE; -uniform mat4 world : WORLD; - -attribute vec3 position : POSITION; -attribute vec2 texcoord : TEXCOORD_0; -attribute vec3 normal : NORMAL; -``` - * These `POSITION`, `TEXCOORD_0`, `NORMAL` are SEMANTICS which will map the attributes in shader to the attributes in the GeometryBase - * - * Available attributes SEMANTICS includes `POSITION`, `TEXCOORD_0`, `TEXCOORD_1` `NORMAL`, `TANGENT`, `COLOR`, `WEIGHT`, `JOINT`. - * - * - * @constructor clay.Geometry - * @extends clay.GeometryBase - */ -var Geometry = __WEBPACK_IMPORTED_MODULE_4__GeometryBase__["a" /* default */].extend(function () { - return /** @lends clay.Geometry# */ { - /** - * Attributes of geometry. Including: - * + `position` - * + `texcoord0` - * + `texcoord1` - * + `normal` - * + `tangent` - * + `color` - * + `weight` - * + `joint` - * + `barycentric` - * - * @type {Object.} - */ - attributes: { - position: new Attribute('position', 'float', 3, 'POSITION'), - texcoord0: new Attribute('texcoord0', 'float', 2, 'TEXCOORD_0'), - texcoord1: new Attribute('texcoord1', 'float', 2, 'TEXCOORD_1'), - normal: new Attribute('normal', 'float', 3, 'NORMAL'), - tangent: new Attribute('tangent', 'float', 4, 'TANGENT'), - color: new Attribute('color', 'float', 4, 'COLOR'), - // Skinning attributes - // Each vertex can be bind to 4 bones, because the - // sum of weights is 1, so the weights is stored in vec3 and the last - // can be calculated by 1-w.x-w.y-w.z - weight: new Attribute('weight', 'float', 3, 'WEIGHT'), - joint: new Attribute('joint', 'float', 4, 'JOINT'), - // For wireframe display - // http://codeflow.org/entries/2012/aug/02/easy-wireframe-display-with-barycentric-coordinates/ - barycentric: new Attribute('barycentric', 'float', 3, null), - }, - /** - * Calculated bounding box of geometry. - * @type {clay.BoundingBox} - */ - boundingBox: null - }; -}, -/** @lends clay.Geometry.prototype */ -{ - - mainAttribute: 'position', - - /** - * Update boundingBox of Geometry - */ - updateBoundingBox: function () { - var bbox = this.boundingBox; - if (!bbox) { - bbox = this.boundingBox = new __WEBPACK_IMPORTED_MODULE_3__math_BoundingBox__["a" /* default */](); - } - var posArr = this.attributes.position.value; - if (posArr && posArr.length) { - var min = bbox.min; - var max = bbox.max; - var minArr = min.array; - var maxArr = max.array; - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].set(minArr, posArr[0], posArr[1], posArr[2]); - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].set(maxArr, posArr[0], posArr[1], posArr[2]); - for (var i = 3; i < posArr.length;) { - var x = posArr[i++]; - var y = posArr[i++]; - var z = posArr[i++]; - if (x < minArr[0]) { minArr[0] = x; } - if (y < minArr[1]) { minArr[1] = y; } - if (z < minArr[2]) { minArr[2] = z; } - - if (x > maxArr[0]) { maxArr[0] = x; } - if (y > maxArr[1]) { maxArr[1] = y; } - if (z > maxArr[2]) { maxArr[2] = z; } - } - min._dirty = true; - max._dirty = true; - } - }, - - /** - * Generate normals per vertex. - */ - generateVertexNormals: function () { - if (!this.vertexCount) { - return; - } - - var indices = this.indices; - var attributes = this.attributes; - var positions = attributes.position.value; - var normals = attributes.normal.value; - - if (!normals || normals.length !== positions.length) { - normals = attributes.normal.value = new __WEBPACK_IMPORTED_MODULE_0__core_vendor__["a" /* default */].Float32Array(positions.length); - } - else { - // Reset - for (var i = 0; i < normals.length; i++) { - normals[i] = 0; - } - } - - var p1 = vec3Create(); - var p2 = vec3Create(); - var p3 = vec3Create(); - - var v21 = vec3Create(); - var v32 = vec3Create(); - - var n = vec3Create(); - - var len = indices ? indices.length : this.vertexCount; - var i1, i2, i3; - for (var f = 0; f < len;) { - if (indices) { - i1 = indices[f++]; - i2 = indices[f++]; - i3 = indices[f++]; - } - else { - i1 = f++; - i2 = f++; - i3 = f++; - } - - vec3Set(p1, positions[i1*3], positions[i1*3+1], positions[i1*3+2]); - vec3Set(p2, positions[i2*3], positions[i2*3+1], positions[i2*3+2]); - vec3Set(p3, positions[i3*3], positions[i3*3+1], positions[i3*3+2]); - - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].sub(v21, p1, p2); - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].sub(v32, p2, p3); - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].cross(n, v21, v32); - // Already be weighted by the triangle area - for (var i = 0; i < 3; i++) { - normals[i1*3+i] = normals[i1*3+i] + n[i]; - normals[i2*3+i] = normals[i2*3+i] + n[i]; - normals[i3*3+i] = normals[i3*3+i] + n[i]; - } - } - - for (var i = 0; i < normals.length;) { - vec3Set(n, normals[i], normals[i+1], normals[i+2]); - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].normalize(n, n); - normals[i++] = n[0]; - normals[i++] = n[1]; - normals[i++] = n[2]; - } - this.dirty(); - }, - - /** - * Generate normals per face. - */ - generateFaceNormals: function () { - if (!this.vertexCount) { - return; - } - - if (!this.isUniqueVertex()) { - this.generateUniqueVertex(); - } - - var indices = this.indices; - var attributes = this.attributes; - var positions = attributes.position.value; - var normals = attributes.normal.value; - - var p1 = vec3Create(); - var p2 = vec3Create(); - var p3 = vec3Create(); - - var v21 = vec3Create(); - var v32 = vec3Create(); - var n = vec3Create(); - - if (!normals) { - normals = attributes.normal.value = new Float32Array(positions.length); - } - var len = indices ? indices.length : this.vertexCount; - var i1, i2, i3; - for (var f = 0; f < len;) { - if (indices) { - i1 = indices[f++]; - i2 = indices[f++]; - i3 = indices[f++]; - } - else { - i1 = f++; - i2 = f++; - i3 = f++; - } - - vec3Set(p1, positions[i1*3], positions[i1*3+1], positions[i1*3+2]); - vec3Set(p2, positions[i2*3], positions[i2*3+1], positions[i2*3+2]); - vec3Set(p3, positions[i3*3], positions[i3*3+1], positions[i3*3+2]); - - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].sub(v21, p1, p2); - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].sub(v32, p2, p3); - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].cross(n, v21, v32); - - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].normalize(n, n); - - for (var i = 0; i < 3; i++) { - normals[i1*3 + i] = n[i]; - normals[i2*3 + i] = n[i]; - normals[i3*3 + i] = n[i]; - } - } - this.dirty(); - }, - - /** - * Generate tangents attributes. - */ - generateTangents: function () { - if (!this.vertexCount) { - return; - } - - var nVertex = this.vertexCount; - var attributes = this.attributes; - if (!attributes.tangent.value) { - attributes.tangent.value = new Float32Array(nVertex * 4); - } - var texcoords = attributes.texcoord0.value; - var positions = attributes.position.value; - var tangents = attributes.tangent.value; - var normals = attributes.normal.value; - - if (!texcoords) { - console.warn('Geometry without texcoords can\'t generate tangents.'); - return; - } - - var tan1 = []; - var tan2 = []; - for (var i = 0; i < nVertex; i++) { - tan1[i] = [0.0, 0.0, 0.0]; - tan2[i] = [0.0, 0.0, 0.0]; - } - - var sdir = [0.0, 0.0, 0.0]; - var tdir = [0.0, 0.0, 0.0]; - var indices = this.indices; - - var len = indices ? indices.length : this.vertexCount; - var i1, i2, i3; - for (var i = 0; i < len;) { - if (indices) { - i1 = indices[i++]; - i2 = indices[i++]; - i3 = indices[i++]; - } - else { - i1 = i++; - i2 = i++; - i3 = i++; - } - - var st1s = texcoords[i1 * 2], - st2s = texcoords[i2 * 2], - st3s = texcoords[i3 * 2], - st1t = texcoords[i1 * 2 + 1], - st2t = texcoords[i2 * 2 + 1], - st3t = texcoords[i3 * 2 + 1], - - p1x = positions[i1 * 3], - p2x = positions[i2 * 3], - p3x = positions[i3 * 3], - p1y = positions[i1 * 3 + 1], - p2y = positions[i2 * 3 + 1], - p3y = positions[i3 * 3 + 1], - p1z = positions[i1 * 3 + 2], - p2z = positions[i2 * 3 + 2], - p3z = positions[i3 * 3 + 2]; - - var x1 = p2x - p1x, - x2 = p3x - p1x, - y1 = p2y - p1y, - y2 = p3y - p1y, - z1 = p2z - p1z, - z2 = p3z - p1z; - - var s1 = st2s - st1s, - s2 = st3s - st1s, - t1 = st2t - st1t, - t2 = st3t - st1t; - - var r = 1.0 / (s1 * t2 - t1 * s2); - sdir[0] = (t2 * x1 - t1 * x2) * r; - sdir[1] = (t2 * y1 - t1 * y2) * r; - sdir[2] = (t2 * z1 - t1 * z2) * r; - - tdir[0] = (s1 * x2 - s2 * x1) * r; - tdir[1] = (s1 * y2 - s2 * y1) * r; - tdir[2] = (s1 * z2 - s2 * z1) * r; - - vec3Add(tan1[i1], tan1[i1], sdir); - vec3Add(tan1[i2], tan1[i2], sdir); - vec3Add(tan1[i3], tan1[i3], sdir); - vec3Add(tan2[i1], tan2[i1], tdir); - vec3Add(tan2[i2], tan2[i2], tdir); - vec3Add(tan2[i3], tan2[i3], tdir); - } - var tmp = vec3Create(); - var nCrossT = vec3Create(); - var n = vec3Create(); - for (var i = 0; i < nVertex; i++) { - n[0] = normals[i * 3]; - n[1] = normals[i * 3 + 1]; - n[2] = normals[i * 3 + 2]; - var t = tan1[i]; - - // Gram-Schmidt orthogonalize - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].scale(tmp, n, __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].dot(n, t)); - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].sub(tmp, t, tmp); - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].normalize(tmp, tmp); - // Calculate handedness. - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].cross(nCrossT, n, t); - tangents[i * 4] = tmp[0]; - tangents[i * 4 + 1] = tmp[1]; - tangents[i * 4 + 2] = tmp[2]; - // PENDING can config ? - tangents[i * 4 + 3] = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].dot(nCrossT, tan2[i]) < 0.0 ? -1.0 : 1.0; - } - this.dirty(); - }, - - /** - * If vertices are not shared by different indices. - */ - isUniqueVertex: function () { - if (this.isUseIndices()) { - return this.vertexCount === this.indices.length; - } - else { - return true; - } - }, - /** - * Create a unique vertex for each index. - */ - generateUniqueVertex: function () { - if (!this.vertexCount || !this.indices) { - return; - } - - if (this.indices.length > 0xffff) { - this.indices = new __WEBPACK_IMPORTED_MODULE_0__core_vendor__["a" /* default */].Uint32Array(this.indices); - } - - var attributes = this.attributes; - var indices = this.indices; - - var attributeNameList = this.getEnabledAttributes(); - - var oldAttrValues = {}; - for (var a = 0; a < attributeNameList.length; a++) { - var name = attributeNameList[a]; - oldAttrValues[name] = attributes[name].value; - attributes[name].init(this.indices.length); - } - - var cursor = 0; - for (var i = 0; i < indices.length; i++) { - var ii = indices[i]; - for (var a = 0; a < attributeNameList.length; a++) { - var name = attributeNameList[a]; - var array = attributes[name].value; - var size = attributes[name].size; - - for (var k = 0; k < size; k++) { - array[cursor * size + k] = oldAttrValues[name][ii * size + k]; - } - } - indices[i] = cursor; - cursor++; - } - - this.dirty(); - }, - - /** - * Generate barycentric coordinates for wireframe draw. - */ - generateBarycentric: function () { - if (!this.vertexCount) { - return; - } - - if (!this.isUniqueVertex()) { - this.generateUniqueVertex(); - } - - var attributes = this.attributes; - var array = attributes.barycentric.value; - var indices = this.indices; - // Already existed; - if (array && array.length === indices.length * 3) { - return; - } - array = attributes.barycentric.value = new Float32Array(indices.length * 3); - - for (var i = 0; i < (indices ? indices.length : this.vertexCount / 3);) { - for (var j = 0; j < 3; j++) { - var ii = indices ? indices[i++] : (i * 3 + j); - array[ii * 3 + j] = 1; - } - } - this.dirty(); - }, - - /** - * Apply transform to geometry attributes. - * @param {clay.Matrix4} matrix - */ - applyTransform: function (matrix) { - - var attributes = this.attributes; - var positions = attributes.position.value; - var normals = attributes.normal.value; - var tangents = attributes.tangent.value; - - matrix = matrix.array; - // Normal Matrix - var inverseTransposeMatrix = __WEBPACK_IMPORTED_MODULE_2__glmatrix_mat4__["a" /* default */].create(); - __WEBPACK_IMPORTED_MODULE_2__glmatrix_mat4__["a" /* default */].invert(inverseTransposeMatrix, matrix); - __WEBPACK_IMPORTED_MODULE_2__glmatrix_mat4__["a" /* default */].transpose(inverseTransposeMatrix, inverseTransposeMatrix); - - var vec3TransformMat4 = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].transformMat4; - var vec3ForEach = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].forEach; - vec3ForEach(positions, 3, 0, null, vec3TransformMat4, matrix); - if (normals) { - vec3ForEach(normals, 3, 0, null, vec3TransformMat4, inverseTransposeMatrix); - } - if (tangents) { - vec3ForEach(tangents, 4, 0, null, vec3TransformMat4, inverseTransposeMatrix); - } - - if (this.boundingBox) { - this.updateBoundingBox(); - } - }, - /** - * Dispose geometry data in GL context. - * @param {clay.Renderer} renderer - */ - dispose: function (renderer) { - - var cache = this._cache; - - cache.use(renderer.__uid__); - var chunks = cache.get('chunks'); - if (chunks) { - for (var c = 0; c < chunks.length; c++) { - var chunk = chunks[c]; - - for (var k = 0; k < chunk.attributeBuffers.length; k++) { - var attribs = chunk.attributeBuffers[k]; - renderer.gl.deleteBuffer(attribs.buffer); - } - - if (chunk.indicesBuffer) { - renderer.gl.deleteBuffer(chunk.indicesBuffer.buffer); - } - } - } - if (this.__vaoCache) { - var vaoExt = renderer.getGLExtension('OES_vertex_array_object'); - for (var id in this.__vaoCache) { - var vao = this.__vaoCache[id].vao; - if (vao) { - vaoExt.deleteVertexArrayOES(vao); - } - } - } - this.__vaoCache = {}; - cache.deleteContext(renderer.__uid__); - } - -}); - -Geometry.STATIC_DRAW = __WEBPACK_IMPORTED_MODULE_4__GeometryBase__["a" /* default */].STATIC_DRAW; -Geometry.DYNAMIC_DRAW = __WEBPACK_IMPORTED_MODULE_4__GeometryBase__["a" /* default */].DYNAMIC_DRAW; -Geometry.STREAM_DRAW = __WEBPACK_IMPORTED_MODULE_4__GeometryBase__["a" /* default */].STREAM_DRAW; - -Geometry.AttributeBuffer = __WEBPACK_IMPORTED_MODULE_4__GeometryBase__["a" /* default */].AttributeBuffer; -Geometry.IndicesBuffer = __WEBPACK_IMPORTED_MODULE_4__GeometryBase__["a" /* default */].IndicesBuffer; - -Geometry.Attribute = Attribute; - -/* harmony default export */ __webpack_exports__["a"] = (Geometry); - - -/***/ }), -/* 16 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__core_Base__ = __webpack_require__(7); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__camera_Orthographic__ = __webpack_require__(37); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__geometry_Plane__ = __webpack_require__(43); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Shader__ = __webpack_require__(8); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Material__ = __webpack_require__(19); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Mesh__ = __webpack_require__(40); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__core_glenum__ = __webpack_require__(11); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__shader_source_compositor_vertex_glsl_js__ = __webpack_require__(126); - - - - - - - - - -__WEBPACK_IMPORTED_MODULE_3__Shader__["a" /* default */]['import'](__WEBPACK_IMPORTED_MODULE_7__shader_source_compositor_vertex_glsl_js__["a" /* default */]); - -var planeGeo = new __WEBPACK_IMPORTED_MODULE_2__geometry_Plane__["a" /* default */](); -var mesh = new __WEBPACK_IMPORTED_MODULE_5__Mesh__["a" /* default */]({ - geometry: planeGeo, - frustumCulling: false -}); -var camera = new __WEBPACK_IMPORTED_MODULE_1__camera_Orthographic__["a" /* default */](); - -/** - * @constructor clay.compositor.Pass - * @extends clay.core.Base - */ -var Pass = __WEBPACK_IMPORTED_MODULE_0__core_Base__["a" /* default */].extend(function () { - return /** @lends clay.compositor.Pass# */ { - /** - * Fragment shader string - * @type {string} - */ - // PENDING shader or fragment ? - fragment: '', - - /** - * @type {Object} - */ - outputs: null, - - /** - * @type {clay.Material} - */ - material: null, - - /** - * @type {Boolean} - */ - blendWithPrevious: false, - - /** - * @type {Boolean} - */ - clearColor: false, - - /** - * @type {Boolean} - */ - clearDepth: true - }; -}, function() { - - var shader = new __WEBPACK_IMPORTED_MODULE_3__Shader__["a" /* default */](__WEBPACK_IMPORTED_MODULE_3__Shader__["a" /* default */].source('clay.compositor.vertex'), this.fragment); - var material = new __WEBPACK_IMPORTED_MODULE_4__Material__["a" /* default */]({ - shader: shader - }); - material.enableTexturesAll(); - - this.material = material; - -}, -/** @lends clay.compositor.Pass.prototype */ -{ - /** - * @param {string} name - * @param {} value - */ - setUniform: function(name, value) { - this.material.setUniform(name, value); - }, - /** - * @param {string} name - * @return {} - */ - getUniform: function(name) { - var uniform = this.material.uniforms[name]; - if (uniform) { - return uniform.value; - } - }, - /** - * @param {clay.Texture} texture - * @param {number} attachment - */ - attachOutput: function(texture, attachment) { - if (!this.outputs) { - this.outputs = {}; - } - attachment = attachment || __WEBPACK_IMPORTED_MODULE_6__core_glenum__["a" /* default */].COLOR_ATTACHMENT0; - this.outputs[attachment] = texture; - }, - /** - * @param {clay.Texture} texture - */ - detachOutput: function(texture) { - for (var attachment in this.outputs) { - if (this.outputs[attachment] === texture) { - this.outputs[attachment] = null; - } - } - }, - - bind: function(renderer, frameBuffer) { - - if (this.outputs) { - for (var attachment in this.outputs) { - var texture = this.outputs[attachment]; - if (texture) { - frameBuffer.attach(texture, attachment); - } - } - } - - if (frameBuffer) { - frameBuffer.bind(renderer); - } - }, - - unbind: function(renderer, frameBuffer) { - frameBuffer.unbind(renderer); - }, - /** - * @param {clay.Renderer} renderer - * @param {clay.FrameBuffer} [frameBuffer] - */ - render: function(renderer, frameBuffer) { - - var _gl = renderer.gl; - - if (frameBuffer) { - this.bind(renderer, frameBuffer); - // MRT Support in chrome - // https://www.khronos.org/registry/webgl/sdk/tests/conformance/extensions/ext-draw-buffers.html - var ext = renderer.getGLExtension('EXT_draw_buffers'); - if (ext && this.outputs) { - var bufs = []; - for (var attachment in this.outputs) { - attachment = +attachment; - if (attachment >= _gl.COLOR_ATTACHMENT0 && attachment <= _gl.COLOR_ATTACHMENT0 + 8) { - bufs.push(attachment); - } - } - ext.drawBuffersEXT(bufs); - } - } - - this.trigger('beforerender', this, renderer); - - // FIXME Don't clear in each pass in default, let the color overwrite the buffer - // FIXME pixels may be discard - var clearBit = this.clearDepth ? _gl.DEPTH_BUFFER_BIT : 0; - _gl.depthMask(true); - if (this.clearColor) { - clearBit = clearBit | _gl.COLOR_BUFFER_BIT; - _gl.colorMask(true, true, true, true); - var cc = this.clearColor; - if (Array.isArray(cc)) { - _gl.clearColor(cc[0], cc[1], cc[2], cc[3]); - } - } - _gl.clear(clearBit); - - if (this.blendWithPrevious) { - // Blend with previous rendered scene in the final output - // FIXME Configure blend. - // FIXME It will cause screen blink? - _gl.enable(_gl.BLEND); - this.material.transparent = true; - } - else { - _gl.disable(_gl.BLEND); - this.material.transparent = false; - } - - this.renderQuad(renderer); - - this.trigger('afterrender', this, renderer); - - if (frameBuffer) { - this.unbind(renderer, frameBuffer); - } - }, - - /** - * Simply do quad rendering - */ - renderQuad: function (renderer) { - mesh.material = this.material; - renderer.renderPass([mesh], camera); - }, - - /** - * @param {clay.Renderer} renderer - */ - dispose: function (renderer) {} -}); - -/* harmony default export */ __webpack_exports__["a"] = (Pass); - - -/***/ }), -/* 17 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = (function (seriesType, ecModel, api) { - return { - seriesType: seriesType, - reset: function (seriesModel, ecModel) { - var data = seriesModel.getData(); - var opacityAccessPath = seriesModel.visualColorAccessPath.split('.'); - opacityAccessPath[opacityAccessPath.length - 1] ='opacity'; - - var opacity = seriesModel.get(opacityAccessPath); - - data.setVisual('opacity', opacity == null ? 1 : opacity); - - function dataEach(data, idx) { - var itemModel = data.getItemModel(idx); - var opacity = itemModel.get(opacityAccessPath, true); - if (opacity != null) { - data.setItemVisual(idx, 'opacity', opacity); - } - } - - return { - dataEach: data.hasItemOption ? dataEach : null - }; - } - }; -}); - -/***/ }), -/* 18 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Vector3__ = __webpack_require__(3); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__ = __webpack_require__(12); - - - -var vec3Set = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].set; -var vec3Copy = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].copy; - -/** - * Axis aligned bounding box - * @constructor - * @alias clay.BoundingBox - * @param {clay.Vector3} [min] - * @param {clay.Vector3} [max] - */ -var BoundingBox = function (min, max) { - - /** - * Minimum coords of bounding box - * @type {clay.Vector3} - */ - this.min = min || new __WEBPACK_IMPORTED_MODULE_0__Vector3__["a" /* default */](Infinity, Infinity, Infinity); - - /** - * Maximum coords of bounding box - * @type {clay.Vector3} - */ - this.max = max || new __WEBPACK_IMPORTED_MODULE_0__Vector3__["a" /* default */](-Infinity, -Infinity, -Infinity); - - this.vertices = null; -}; - -BoundingBox.prototype = { - - constructor: BoundingBox, - /** - * Update min and max coords from a vertices array - * @param {array} vertices - */ - updateFromVertices: function (vertices) { - if (vertices.length > 0) { - var min = this.min; - var max = this.max; - var minArr = min.array; - var maxArr = max.array; - vec3Copy(minArr, vertices[0]); - vec3Copy(maxArr, vertices[0]); - for (var i = 1; i < vertices.length; i++) { - var vertex = vertices[i]; - - if (vertex[0] < minArr[0]) { minArr[0] = vertex[0]; } - if (vertex[1] < minArr[1]) { minArr[1] = vertex[1]; } - if (vertex[2] < minArr[2]) { minArr[2] = vertex[2]; } - - if (vertex[0] > maxArr[0]) { maxArr[0] = vertex[0]; } - if (vertex[1] > maxArr[1]) { maxArr[1] = vertex[1]; } - if (vertex[2] > maxArr[2]) { maxArr[2] = vertex[2]; } - } - min._dirty = true; - max._dirty = true; - } - }, - - /** - * Union operation with another bounding box - * @param {clay.BoundingBox} bbox - */ - union: function (bbox) { - var min = this.min; - var max = this.max; - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].min(min.array, min.array, bbox.min.array); - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].max(max.array, max.array, bbox.max.array); - min._dirty = true; - max._dirty = true; - return this; - }, - - /** - * Intersection operation with another bounding box - * @param {clay.BoundingBox} bbox - */ - intersection: function (bbox) { - var min = this.min; - var max = this.max; - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].max(min.array, min.array, bbox.min.array); - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].min(max.array, max.array, bbox.max.array); - min._dirty = true; - max._dirty = true; - return this; - }, - - /** - * If intersect with another bounding box - * @param {clay.BoundingBox} bbox - * @return {boolean} - */ - intersectBoundingBox: function (bbox) { - var _min = this.min.array; - var _max = this.max.array; - - var _min2 = bbox.min.array; - var _max2 = bbox.max.array; - - return ! (_min[0] > _max2[0] || _min[1] > _max2[1] || _min[2] > _max2[2] - || _max[0] < _min2[0] || _max[1] < _min2[1] || _max[2] < _min2[2]); - }, - - /** - * If contain another bounding box entirely - * @param {clay.BoundingBox} bbox - * @return {boolean} - */ - containBoundingBox: function (bbox) { - - var _min = this.min.array; - var _max = this.max.array; - - var _min2 = bbox.min.array; - var _max2 = bbox.max.array; - - return _min[0] <= _min2[0] && _min[1] <= _min2[1] && _min[2] <= _min2[2] - && _max[0] >= _max2[0] && _max[1] >= _max2[1] && _max[2] >= _max2[2]; - }, - - /** - * If contain point entirely - * @param {clay.Vector3} point - * @return {boolean} - */ - containPoint: function (p) { - var _min = this.min.array; - var _max = this.max.array; - - var _p = p.array; - - return _min[0] <= _p[0] && _min[1] <= _p[1] && _min[2] <= _p[2] - && _max[0] >= _p[0] && _max[1] >= _p[1] && _max[2] >= _p[2]; - }, - - /** - * If bounding box is finite - */ - isFinite: function () { - var _min = this.min.array; - var _max = this.max.array; - return isFinite(_min[0]) && isFinite(_min[1]) && isFinite(_min[2]) - && isFinite(_max[0]) && isFinite(_max[1]) && isFinite(_max[2]); - }, - - /** - * Apply an affine transform matrix to the bounding box - * @param {clay.Matrix4} matrix - */ - applyTransform: function (matrix) { - this.transformFrom(this, matrix); - }, - - /** - * Get from another bounding box and an affine transform matrix. - * @param {clay.BoundingBox} source - * @param {clay.Matrix4} matrix - */ - transformFrom: (function () { - // http://dev.theomader.com/transform-bounding-boxes/ - var xa = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].create(); - var xb = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].create(); - var ya = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].create(); - var yb = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].create(); - var za = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].create(); - var zb = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].create(); - - return function (source, matrix) { - var min = source.min.array; - var max = source.max.array; - - var m = matrix.array; - - xa[0] = m[0] * min[0]; xa[1] = m[1] * min[0]; xa[2] = m[2] * min[0]; - xb[0] = m[0] * max[0]; xb[1] = m[1] * max[0]; xb[2] = m[2] * max[0]; - - ya[0] = m[4] * min[1]; ya[1] = m[5] * min[1]; ya[2] = m[6] * min[1]; - yb[0] = m[4] * max[1]; yb[1] = m[5] * max[1]; yb[2] = m[6] * max[1]; - - za[0] = m[8] * min[2]; za[1] = m[9] * min[2]; za[2] = m[10] * min[2]; - zb[0] = m[8] * max[2]; zb[1] = m[9] * max[2]; zb[2] = m[10] * max[2]; - - min = this.min.array; - max = this.max.array; - min[0] = Math.min(xa[0], xb[0]) + Math.min(ya[0], yb[0]) + Math.min(za[0], zb[0]) + m[12]; - min[1] = Math.min(xa[1], xb[1]) + Math.min(ya[1], yb[1]) + Math.min(za[1], zb[1]) + m[13]; - min[2] = Math.min(xa[2], xb[2]) + Math.min(ya[2], yb[2]) + Math.min(za[2], zb[2]) + m[14]; - - max[0] = Math.max(xa[0], xb[0]) + Math.max(ya[0], yb[0]) + Math.max(za[0], zb[0]) + m[12]; - max[1] = Math.max(xa[1], xb[1]) + Math.max(ya[1], yb[1]) + Math.max(za[1], zb[1]) + m[13]; - max[2] = Math.max(xa[2], xb[2]) + Math.max(ya[2], yb[2]) + Math.max(za[2], zb[2]) + m[14]; - - this.min._dirty = true; - this.max._dirty = true; - - return this; - }; - })(), - - /** - * Apply a projection matrix to the bounding box - * @param {clay.Matrix4} matrix - */ - applyProjection: function (matrix) { - var min = this.min.array; - var max = this.max.array; - - var m = matrix.array; - // min in min z - var v10 = min[0]; - var v11 = min[1]; - var v12 = min[2]; - // max in min z - var v20 = max[0]; - var v21 = max[1]; - var v22 = min[2]; - // max in max z - var v30 = max[0]; - var v31 = max[1]; - var v32 = max[2]; - - if (m[15] === 1) { // Orthographic projection - min[0] = m[0] * v10 + m[12]; - min[1] = m[5] * v11 + m[13]; - max[2] = m[10] * v12 + m[14]; - - max[0] = m[0] * v30 + m[12]; - max[1] = m[5] * v31 + m[13]; - min[2] = m[10] * v32 + m[14]; - } - else { - var w = -1 / v12; - min[0] = m[0] * v10 * w; - min[1] = m[5] * v11 * w; - max[2] = (m[10] * v12 + m[14]) * w; - - w = -1 / v22; - max[0] = m[0] * v20 * w; - max[1] = m[5] * v21 * w; - - w = -1 / v32; - min[2] = (m[10] * v32 + m[14]) * w; - } - this.min._dirty = true; - this.max._dirty = true; - - return this; - }, - - updateVertices: function () { - var vertices = this.vertices; - if (!vertices) { - // Cube vertices - vertices = []; - for (var i = 0; i < 8; i++) { - vertices[i] = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].fromValues(0, 0, 0); - } - - /** - * Eight coords of bounding box - * @type {Float32Array[]} - */ - this.vertices = vertices; - } - var min = this.min.array; - var max = this.max.array; - //--- min z - // min x - vec3Set(vertices[0], min[0], min[1], min[2]); - vec3Set(vertices[1], min[0], max[1], min[2]); - // max x - vec3Set(vertices[2], max[0], min[1], min[2]); - vec3Set(vertices[3], max[0], max[1], min[2]); - - //-- max z - vec3Set(vertices[4], min[0], min[1], max[2]); - vec3Set(vertices[5], min[0], max[1], max[2]); - vec3Set(vertices[6], max[0], min[1], max[2]); - vec3Set(vertices[7], max[0], max[1], max[2]); - - return this; - }, - /** - * Copy values from another bounding box - * @param {clay.BoundingBox} bbox - */ - copy: function (bbox) { - var min = this.min; - var max = this.max; - vec3Copy(min.array, bbox.min.array); - vec3Copy(max.array, bbox.max.array); - min._dirty = true; - max._dirty = true; - return this; - }, - - /** - * Clone a new bounding box - * @return {clay.BoundingBox} - */ - clone: function () { - var boundingBox = new BoundingBox(); - boundingBox.copy(this); - return boundingBox; - } -}; - -/* harmony default export */ __webpack_exports__["a"] = (BoundingBox); - - -/***/ }), -/* 19 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__core_Base__ = __webpack_require__(7); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__core_util__ = __webpack_require__(23); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__core_color__ = __webpack_require__(113); - - - -var parseColor = __WEBPACK_IMPORTED_MODULE_2__core_color__["a" /* default */].parseToFloat; - -var programKeyCache = {}; - -function getDefineCode(defines) { - var defineKeys = Object.keys(defines); - defineKeys.sort(); - var defineStr = []; - // Custom Defines - for (var i = 0; i < defineKeys.length; i++) { - var key = defineKeys[i]; - var value = defines[key]; - if (value === null) { - defineStr.push(key); - } - else{ - defineStr.push(key + ' ' + value.toString()); - } - } - return defineStr.join('\n'); -} - -function getProgramKey(vertexDefines, fragmentDefines, enabledTextures) { - enabledTextures.sort(); - var defineStr = []; - for (var i = 0; i < enabledTextures.length; i++) { - var symbol = enabledTextures[i]; - defineStr.push(symbol); - } - var key = getDefineCode(vertexDefines) + '\n' - + getDefineCode(fragmentDefines) + '\n' - + defineStr.join('\n'); - - if (programKeyCache[key]) { - return programKeyCache[key]; - } - - var id = __WEBPACK_IMPORTED_MODULE_1__core_util__["a" /* default */].genGUID(); - programKeyCache[key] = id; - return id; -} - -/** - * Material defines the appearance of mesh surface, like `color`, `roughness`, `metalness`, etc. - * It contains a {@link clay.Shader} and corresponding uniforms. - * - * Here is a basic example to create a standard material -```js -var material = new clay.Material({ - shader: new clay.Shader( - clay.Shader.source('clay.vertex'), - clay.Shader.source('clay.fragment') - ) -}); -``` - * @constructor clay.Material - * @extends clay.core.Base - */ -var Material = __WEBPACK_IMPORTED_MODULE_0__core_Base__["a" /* default */].extend(function () { - return /** @lends clay.Material# */ { - /** - * @type {string} - */ - name: '', - - /** - * @type {Object} - */ - // uniforms: null, - - /** - * @type {clay.Shader} - */ - // shader: null, - - /** - * @type {boolean} - */ - depthTest: true, - - /** - * @type {boolean} - */ - depthMask: true, - - /** - * @type {boolean} - */ - transparent: false, - /** - * Blend func is a callback function when the material - * have custom blending - * The gl context will be the only argument passed in tho the - * blend function - * Detail of blend function in WebGL: - * http://www.khronos.org/registry/gles/specs/2.0/es_full_spec_2.0.25.pdf - * - * Example : - * function(_gl) { - * _gl.blendEquation(_gl.FUNC_ADD); - * _gl.blendFunc(_gl.SRC_ALPHA, _gl.ONE_MINUS_SRC_ALPHA); - * } - */ - blend: null, - - /** - * If update texture status automatically. - */ - autoUpdateTextureStatus: true, - - uniforms: {}, - vertexDefines: {}, - fragmentDefines: {}, - _textureStatus: {}, - - // shadowTransparentMap : null - - // PENDING enable the uniform that only used in shader. - _enabledUniforms: null, - }; -}, function () { - if (!this.name) { - this.name = 'MATERIAL_' + this.__uid__; - } - - if (this.shader) { - // Keep status, mainly preset uniforms, vertexDefines and fragmentDefines - this.attachShader(this.shader, true); - } -}, -/** @lends clay.Material.prototype */ -{ - precision: 'highp', - - /** - * Set material uniform - * @example - * mat.setUniform('color', [1, 1, 1, 1]); - * @param {string} symbol - * @param {number|array|clay.Texture|ArrayBufferView} value - */ - setUniform: function (symbol, value) { - if (value === undefined) { - console.warn('Uniform value "' + symbol + '" is undefined'); - } - var uniform = this.uniforms[symbol]; - if (uniform) { - - if (typeof value === 'string') { - // Try to parse as a color. Invalid color string will return null. - value = parseColor(value) || value; - } - - uniform.value = value; - - if (this.autoUpdateTextureStatus && uniform.type === 't') { - if (value) { - this.enableTexture(symbol); - } - else { - this.disableTexture(symbol); - } - } - } - }, - - /** - * @param {Object} obj - */ - setUniforms: function(obj) { - for (var key in obj) { - var val = obj[key]; - this.setUniform(key, val); - } - }, - - /** - * @param {string} symbol - * @return {boolean} - */ - isUniformEnabled: function (symbol) { - return this._enabledUniforms.indexOf(symbol) >= 0; - }, - - getEnabledUniforms: function () { - return this._enabledUniforms; - }, - getTextureUniforms: function () { - return this._textureUniforms; - }, - - /** - * Alias of setUniform and setUniforms - * @param {object|string} symbol - * @param {number|array|clay.Texture|ArrayBufferView} [value] - */ - set: function (symbol, value) { - if (typeof(symbol) === 'object') { - for (var key in symbol) { - var val = symbol[key]; - this.setUniform(key, val); - } - } - else { - this.setUniform(symbol, value); - } - }, - /** - * Get uniform value - * @param {string} symbol - * @return {number|array|clay.Texture|ArrayBufferView} - */ - get: function (symbol) { - var uniform = this.uniforms[symbol]; - if (uniform) { - return uniform.value; - } - }, - /** - * Attach a shader instance - * @param {clay.Shader} shader - * @param {boolean} keepStatus If try to keep uniform and texture - */ - attachShader: function(shader, keepStatus) { - var originalUniforms = this.uniforms; - - // Ignore if uniform can use in shader. - this.uniforms = shader.createUniforms(); - this.shader = shader; - - var uniforms = this.uniforms; - this._enabledUniforms = Object.keys(uniforms); - // Make sure uniforms are set in same order to avoid texture slot wrong - this._enabledUniforms.sort(); - this._textureUniforms = this._enabledUniforms.filter(function (uniformName) { - var type = this.uniforms[uniformName].type; - return type === 't' || type === 'tv'; - }, this); - - var originalVertexDefines = this.vertexDefines; - var originalFragmentDefines = this.fragmentDefines; - - this.vertexDefines = __WEBPACK_IMPORTED_MODULE_1__core_util__["a" /* default */].clone(shader.vertexDefines); - this.fragmentDefines = __WEBPACK_IMPORTED_MODULE_1__core_util__["a" /* default */].clone(shader.fragmentDefines); - - if (keepStatus) { - for (var symbol in originalUniforms) { - if (uniforms[symbol]) { - uniforms[symbol].value = originalUniforms[symbol].value; - } - } - - __WEBPACK_IMPORTED_MODULE_1__core_util__["a" /* default */].defaults(this.vertexDefines, originalVertexDefines); - __WEBPACK_IMPORTED_MODULE_1__core_util__["a" /* default */].defaults(this.fragmentDefines, originalFragmentDefines); - } - - var textureStatus = {}; - for (var key in shader.textures) { - textureStatus[key] = { - shaderType: shader.textures[key].shaderType, - type: shader.textures[key].type, - enabled: (keepStatus && this._textureStatus[key]) ? this._textureStatus[key].enabled : false - }; - } - - this._textureStatus = textureStatus; - - this._programKey = ''; - }, - - /** - * Clone a new material and keep uniforms, shader will not be cloned - * @return {clay.Material} - */ - clone: function () { - var material = new this.constructor({ - name: this.name, - shader: this.shader - }); - for (var symbol in this.uniforms) { - material.uniforms[symbol].value = this.uniforms[symbol].value; - } - material.depthTest = this.depthTest; - material.depthMask = this.depthMask; - material.transparent = this.transparent; - material.blend = this.blend; - - material.vertexDefines = __WEBPACK_IMPORTED_MODULE_1__core_util__["a" /* default */].clone(this.vertexDefines); - material.fragmentDefines = __WEBPACK_IMPORTED_MODULE_1__core_util__["a" /* default */].clone(this.fragmentDefines); - material.enableTexture(this.getEnabledTextures()); - material.precision = this.precision; - - return material; - }, - - /** - * Add a #define macro in shader code - * @param {string} shaderType Can be vertex, fragment or both - * @param {string} symbol - * @param {number} [val] - */ - define: function (shaderType, symbol, val) { - var vertexDefines = this.vertexDefines; - var fragmentDefines = this.fragmentDefines; - if (shaderType !== 'vertex' && shaderType !== 'fragment' && shaderType !== 'both' - && arguments.length < 3 - ) { - // shaderType default to be 'both' - val = symbol; - symbol = shaderType; - shaderType = 'both'; - } - val = val != null ? val : null; - if (shaderType === 'vertex' || shaderType === 'both') { - if (vertexDefines[symbol] !== val) { - vertexDefines[symbol] = val; - // Mark as dirty - this._programKey = ''; - } - } - if (shaderType === 'fragment' || shaderType === 'both') { - if (fragmentDefines[symbol] !== val) { - fragmentDefines[symbol] = val; - if (shaderType !== 'both') { - this._programKey = ''; - } - } - } - }, - - /** - * Remove a #define macro in shader code - * @param {string} shaderType Can be vertex, fragment or both - * @param {string} symbol - */ - undefine: function (shaderType, symbol) { - if (shaderType !== 'vertex' && shaderType !== 'fragment' && shaderType !== 'both' - && arguments.length < 2 - ) { - // shaderType default to be 'both' - symbol = shaderType; - shaderType = 'both'; - } - if (shaderType === 'vertex' || shaderType === 'both') { - if (this.isDefined('vertex', symbol)) { - delete this.vertexDefines[symbol]; - // Mark as dirty - this._programKey = ''; - } - } - if (shaderType === 'fragment' || shaderType === 'both') { - if (this.isDefined('fragment', symbol)) { - delete this.fragmentDefines[symbol]; - if (shaderType !== 'both') { - this._programKey = ''; - } - } - } - }, - - /** - * If macro is defined in shader. - * @param {string} shaderType Can be vertex, fragment or both - * @param {string} symbol - */ - isDefined: function (shaderType, symbol) { - // PENDING hasOwnProperty ? - switch (shaderType) { - case 'vertex': - return this.vertexDefines[symbol] !== undefined; - case 'fragment': - return this.fragmentDefines[symbol] !== undefined; - } - }, - /** - * Get macro value defined in shader. - * @param {string} shaderType Can be vertex, fragment or both - * @param {string} symbol - */ - getDefine: function (shaderType, symbol) { - switch(shaderType) { - case 'vertex': - return this.vertexDefines[symbol]; - case 'fragment': - return this.fragmentDefines[symbol]; - } - }, - /** - * Enable a texture, actually it will add a #define macro in the shader code - * For example, if texture symbol is diffuseMap, it will add a line `#define DIFFUSEMAP_ENABLED` in the shader code - * @param {string} symbol - */ - enableTexture: function (symbol) { - if (Array.isArray(symbol)) { - for (var i = 0; i < symbol.length; i++) { - this.enableTexture(symbol[i]); - } - return; - } - - var status = this._textureStatus[symbol]; - if (status) { - var isEnabled = status.enabled; - if (!isEnabled) { - status.enabled = true; - this._programKey = ''; - } - } - }, - /** - * Enable all textures used in the shader - */ - enableTexturesAll: function () { - var textureStatus = this._textureStatus; - for (var symbol in textureStatus) { - textureStatus[symbol].enabled = true; - } - - this._programKey = ''; - }, - /** - * Disable a texture, it remove a #define macro in the shader - * @param {string} symbol - */ - disableTexture: function (symbol) { - if (Array.isArray(symbol)) { - for (var i = 0; i < symbol.length; i++) { - this.disableTexture(symbol[i]); - } - return; - } - - var status = this._textureStatus[symbol]; - if (status) { - var isDisabled = ! status.enabled; - if (!isDisabled) { - status.enabled = false; - this._programKey = ''; - } - } - }, - /** - * Disable all textures used in the shader - */ - disableTexturesAll: function () { - var textureStatus = this._textureStatus; - for (var symbol in textureStatus) { - textureStatus[symbol].enabled = false; - } - - this._programKey = ''; - }, - /** - * If texture of given type is enabled. - * @param {string} symbol - * @return {boolean} - */ - isTextureEnabled: function (symbol) { - var textureStatus = this._textureStatus; - return !!textureStatus[symbol] - && textureStatus[symbol].enabled; - }, - - /** - * Get all enabled textures - * @return {string[]} - */ - getEnabledTextures: function () { - var enabledTextures = []; - var textureStatus = this._textureStatus; - for (var symbol in textureStatus) { - if (textureStatus[symbol].enabled) { - enabledTextures.push(symbol); - } - } - return enabledTextures; - }, - - /** - * Mark defines are updated. - */ - dirtyDefines: function () { - this._programKey = ''; - }, - - getProgramKey: function () { - if (!this._programKey) { - this._programKey = getProgramKey( - this.vertexDefines, this.fragmentDefines, this.getEnabledTextures() - ); - } - return this._programKey; - } -}); - -/* harmony default export */ __webpack_exports__["a"] = (Material); - - -/***/ }), -/* 20 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return GLMAT_EPSILON; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return GLMAT_ARRAY_TYPE; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return GLMAT_RANDOM; }); - -var GLMAT_EPSILON = 0.000001; - -// Use Array instead of Float32Array. It seems to be much faster and higher precision. -var GLMAT_ARRAY_TYPE = Array; -// if(!GLMAT_ARRAY_TYPE) { -// GLMAT_ARRAY_TYPE = (typeof Float32Array !== 'undefined') ? Float32Array : Array; -// } - -var GLMAT_RANDOM = Math.random; - - -/***/ }), -/* 21 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__common__ = __webpack_require__(20); - -/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - - -/** - * @class 4x4 Matrix - * @name mat4 - */ - -var mat4 = {}; - -/** - * Creates a new identity mat4 - * - * @returns {mat4} a new 4x4 matrix - */ -mat4.create = function() { - var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" /* GLMAT_ARRAY_TYPE */](16); - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = 1; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 1; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -}; - -/** - * Creates a new mat4 initialized with values from an existing matrix - * - * @param {mat4} a matrix to clone - * @returns {mat4} a new 4x4 matrix - */ -mat4.clone = function(a) { - var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" /* GLMAT_ARRAY_TYPE */](16); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - out[9] = a[9]; - out[10] = a[10]; - out[11] = a[11]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - return out; -}; - -/** - * Copy the values from one mat4 to another - * - * @param {mat4} out the receiving matrix - * @param {mat4} a the source matrix - * @returns {mat4} out - */ -mat4.copy = function(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - out[9] = a[9]; - out[10] = a[10]; - out[11] = a[11]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - return out; -}; - -/** - * Set a mat4 to the identity matrix - * - * @param {mat4} out the receiving matrix - * @returns {mat4} out - */ -mat4.identity = function(out) { - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = 1; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 1; - out[11] = 0; - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - return out; -}; - -/** - * Transpose the values of a mat4 - * - * @param {mat4} out the receiving matrix - * @param {mat4} a the source matrix - * @returns {mat4} out - */ -mat4.transpose = function(out, a) { - // If we are transposing ourselves we can skip a few steps but have to cache some values - if (out === a) { - var a01 = a[1], a02 = a[2], a03 = a[3], - a12 = a[6], a13 = a[7], - a23 = a[11]; - - out[1] = a[4]; - out[2] = a[8]; - out[3] = a[12]; - out[4] = a01; - out[6] = a[9]; - out[7] = a[13]; - out[8] = a02; - out[9] = a12; - out[11] = a[14]; - out[12] = a03; - out[13] = a13; - out[14] = a23; - } else { - out[0] = a[0]; - out[1] = a[4]; - out[2] = a[8]; - out[3] = a[12]; - out[4] = a[1]; - out[5] = a[5]; - out[6] = a[9]; - out[7] = a[13]; - out[8] = a[2]; - out[9] = a[6]; - out[10] = a[10]; - out[11] = a[14]; - out[12] = a[3]; - out[13] = a[7]; - out[14] = a[11]; - out[15] = a[15]; - } - - return out; -}; - -/** - * Inverts a mat4 - * - * @param {mat4} out the receiving matrix - * @param {mat4} a the source matrix - * @returns {mat4} out - */ -mat4.invert = function(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], - a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], - a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], - a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], - - b00 = a00 * a11 - a01 * a10, - b01 = a00 * a12 - a02 * a10, - b02 = a00 * a13 - a03 * a10, - b03 = a01 * a12 - a02 * a11, - b04 = a01 * a13 - a03 * a11, - b05 = a02 * a13 - a03 * a12, - b06 = a20 * a31 - a21 * a30, - b07 = a20 * a32 - a22 * a30, - b08 = a20 * a33 - a23 * a30, - b09 = a21 * a32 - a22 * a31, - b10 = a21 * a33 - a23 * a31, - b11 = a22 * a33 - a23 * a32, - - // Calculate the determinant - det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; - - if (!det) { - return null; - } - det = 1.0 / det; - - out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; - out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; - out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; - out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; - out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; - out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; - out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; - out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; - out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; - out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; - out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; - out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; - out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; - out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; - out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; - out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; - - return out; -}; - -/** - * Calculates the adjugate of a mat4 - * - * @param {mat4} out the receiving matrix - * @param {mat4} a the source matrix - * @returns {mat4} out - */ -mat4.adjoint = function(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], - a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], - a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], - a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; - - out[0] = (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22)); - out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22)); - out[2] = (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12)); - out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12)); - out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22)); - out[5] = (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22)); - out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12)); - out[7] = (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12)); - out[8] = (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21)); - out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21)); - out[10] = (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11)); - out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11)); - out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21)); - out[13] = (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21)); - out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11)); - out[15] = (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11)); - return out; -}; - -/** - * Calculates the determinant of a mat4 - * - * @param {mat4} a the source matrix - * @returns {Number} determinant of a - */ -mat4.determinant = function (a) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], - a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], - a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], - a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], - - b00 = a00 * a11 - a01 * a10, - b01 = a00 * a12 - a02 * a10, - b02 = a00 * a13 - a03 * a10, - b03 = a01 * a12 - a02 * a11, - b04 = a01 * a13 - a03 * a11, - b05 = a02 * a13 - a03 * a12, - b06 = a20 * a31 - a21 * a30, - b07 = a20 * a32 - a22 * a30, - b08 = a20 * a33 - a23 * a30, - b09 = a21 * a32 - a22 * a31, - b10 = a21 * a33 - a23 * a31, - b11 = a22 * a33 - a23 * a32; - - // Calculate the determinant - return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; -}; - -/** - * Multiplies two mat4's - * - * @param {mat4} out the receiving matrix - * @param {mat4} a the first operand - * @param {mat4} b the second operand - * @returns {mat4} out - */ -mat4.multiply = function (out, a, b) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], - a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], - a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], - a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; - - // Cache only the current line of the second matrix - var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; - out[0] = b0*a00 + b1*a10 + b2*a20 + b3*a30; - out[1] = b0*a01 + b1*a11 + b2*a21 + b3*a31; - out[2] = b0*a02 + b1*a12 + b2*a22 + b3*a32; - out[3] = b0*a03 + b1*a13 + b2*a23 + b3*a33; - - b0 = b[4]; b1 = b[5]; b2 = b[6]; b3 = b[7]; - out[4] = b0*a00 + b1*a10 + b2*a20 + b3*a30; - out[5] = b0*a01 + b1*a11 + b2*a21 + b3*a31; - out[6] = b0*a02 + b1*a12 + b2*a22 + b3*a32; - out[7] = b0*a03 + b1*a13 + b2*a23 + b3*a33; - - b0 = b[8]; b1 = b[9]; b2 = b[10]; b3 = b[11]; - out[8] = b0*a00 + b1*a10 + b2*a20 + b3*a30; - out[9] = b0*a01 + b1*a11 + b2*a21 + b3*a31; - out[10] = b0*a02 + b1*a12 + b2*a22 + b3*a32; - out[11] = b0*a03 + b1*a13 + b2*a23 + b3*a33; - - b0 = b[12]; b1 = b[13]; b2 = b[14]; b3 = b[15]; - out[12] = b0*a00 + b1*a10 + b2*a20 + b3*a30; - out[13] = b0*a01 + b1*a11 + b2*a21 + b3*a31; - out[14] = b0*a02 + b1*a12 + b2*a22 + b3*a32; - out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33; - return out; -}; - -/** - * Multiplies two affine mat4's - * Add by https://github.com/pissang - * @param {mat4} out the receiving matrix - * @param {mat4} a the first operand - * @param {mat4} b the second operand - * @returns {mat4} out - */ -mat4.multiplyAffine = function (out, a, b) { - var a00 = a[0], a01 = a[1], a02 = a[2], - a10 = a[4], a11 = a[5], a12 = a[6], - a20 = a[8], a21 = a[9], a22 = a[10], - a30 = a[12], a31 = a[13], a32 = a[14]; - - // Cache only the current line of the second matrix - var b0 = b[0], b1 = b[1], b2 = b[2]; - out[0] = b0*a00 + b1*a10 + b2*a20; - out[1] = b0*a01 + b1*a11 + b2*a21; - out[2] = b0*a02 + b1*a12 + b2*a22; - // out[3] = 0; - - b0 = b[4]; b1 = b[5]; b2 = b[6]; - out[4] = b0*a00 + b1*a10 + b2*a20; - out[5] = b0*a01 + b1*a11 + b2*a21; - out[6] = b0*a02 + b1*a12 + b2*a22; - // out[7] = 0; - - b0 = b[8]; b1 = b[9]; b2 = b[10]; - out[8] = b0*a00 + b1*a10 + b2*a20; - out[9] = b0*a01 + b1*a11 + b2*a21; - out[10] = b0*a02 + b1*a12 + b2*a22; - // out[11] = 0; - - b0 = b[12]; b1 = b[13]; b2 = b[14]; - out[12] = b0*a00 + b1*a10 + b2*a20 + a30; - out[13] = b0*a01 + b1*a11 + b2*a21 + a31; - out[14] = b0*a02 + b1*a12 + b2*a22 + a32; - // out[15] = 1; - return out; -}; - -/** - * Alias for {@link mat4.multiply} - * @function - */ -mat4.mul = mat4.multiply; - -/** - * Alias for {@link mat4.multiplyAffine} - * @function - */ -mat4.mulAffine = mat4.multiplyAffine; -/** - * Translate a mat4 by the given vector - * - * @param {mat4} out the receiving matrix - * @param {mat4} a the matrix to translate - * @param {vec3} v vector to translate by - * @returns {mat4} out - */ -mat4.translate = function (out, a, v) { - var x = v[0], y = v[1], z = v[2], - a00, a01, a02, a03, - a10, a11, a12, a13, - a20, a21, a22, a23; - - if (a === out) { - out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; - out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; - out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; - out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; - } else { - a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3]; - a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7]; - a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11]; - - out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03; - out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13; - out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23; - - out[12] = a00 * x + a10 * y + a20 * z + a[12]; - out[13] = a01 * x + a11 * y + a21 * z + a[13]; - out[14] = a02 * x + a12 * y + a22 * z + a[14]; - out[15] = a03 * x + a13 * y + a23 * z + a[15]; - } - - return out; -}; - -/** - * Scales the mat4 by the dimensions in the given vec3 - * - * @param {mat4} out the receiving matrix - * @param {mat4} a the matrix to scale - * @param {vec3} v the vec3 to scale the matrix by - * @returns {mat4} out - **/ -mat4.scale = function(out, a, v) { - var x = v[0], y = v[1], z = v[2]; - - out[0] = a[0] * x; - out[1] = a[1] * x; - out[2] = a[2] * x; - out[3] = a[3] * x; - out[4] = a[4] * y; - out[5] = a[5] * y; - out[6] = a[6] * y; - out[7] = a[7] * y; - out[8] = a[8] * z; - out[9] = a[9] * z; - out[10] = a[10] * z; - out[11] = a[11] * z; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - return out; -}; - -/** - * Rotates a mat4 by the given angle - * - * @param {mat4} out the receiving matrix - * @param {mat4} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @param {vec3} axis the axis to rotate around - * @returns {mat4} out - */ -mat4.rotate = function (out, a, rad, axis) { - var x = axis[0], y = axis[1], z = axis[2], - len = Math.sqrt(x * x + y * y + z * z), - s, c, t, - a00, a01, a02, a03, - a10, a11, a12, a13, - a20, a21, a22, a23, - b00, b01, b02, - b10, b11, b12, - b20, b21, b22; - - if (Math.abs(len) < __WEBPACK_IMPORTED_MODULE_0__common__["b" /* GLMAT_EPSILON */]) { return null; } - - len = 1 / len; - x *= len; - y *= len; - z *= len; - - s = Math.sin(rad); - c = Math.cos(rad); - t = 1 - c; - - a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3]; - a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7]; - a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11]; - - // Construct the elements of the rotation matrix - b00 = x * x * t + c; b01 = y * x * t + z * s; b02 = z * x * t - y * s; - b10 = x * y * t - z * s; b11 = y * y * t + c; b12 = z * y * t + x * s; - b20 = x * z * t + y * s; b21 = y * z * t - x * s; b22 = z * z * t + c; - - // Perform rotation-specific matrix multiplication - out[0] = a00 * b00 + a10 * b01 + a20 * b02; - out[1] = a01 * b00 + a11 * b01 + a21 * b02; - out[2] = a02 * b00 + a12 * b01 + a22 * b02; - out[3] = a03 * b00 + a13 * b01 + a23 * b02; - out[4] = a00 * b10 + a10 * b11 + a20 * b12; - out[5] = a01 * b10 + a11 * b11 + a21 * b12; - out[6] = a02 * b10 + a12 * b11 + a22 * b12; - out[7] = a03 * b10 + a13 * b11 + a23 * b12; - out[8] = a00 * b20 + a10 * b21 + a20 * b22; - out[9] = a01 * b20 + a11 * b21 + a21 * b22; - out[10] = a02 * b20 + a12 * b21 + a22 * b22; - out[11] = a03 * b20 + a13 * b21 + a23 * b22; - - if (a !== out) { // If the source and destination differ, copy the unchanged last row - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - } - return out; -}; - -/** - * Rotates a matrix by the given angle around the X axis - * - * @param {mat4} out the receiving matrix - * @param {mat4} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ -mat4.rotateX = function (out, a, rad) { - var s = Math.sin(rad), - c = Math.cos(rad), - a10 = a[4], - a11 = a[5], - a12 = a[6], - a13 = a[7], - a20 = a[8], - a21 = a[9], - a22 = a[10], - a23 = a[11]; - - if (a !== out) { // If the source and destination differ, copy the unchanged rows - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - } - - // Perform axis-specific matrix multiplication - out[4] = a10 * c + a20 * s; - out[5] = a11 * c + a21 * s; - out[6] = a12 * c + a22 * s; - out[7] = a13 * c + a23 * s; - out[8] = a20 * c - a10 * s; - out[9] = a21 * c - a11 * s; - out[10] = a22 * c - a12 * s; - out[11] = a23 * c - a13 * s; - return out; -}; - -/** - * Rotates a matrix by the given angle around the Y axis - * - * @param {mat4} out the receiving matrix - * @param {mat4} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ -mat4.rotateY = function (out, a, rad) { - var s = Math.sin(rad), - c = Math.cos(rad), - a00 = a[0], - a01 = a[1], - a02 = a[2], - a03 = a[3], - a20 = a[8], - a21 = a[9], - a22 = a[10], - a23 = a[11]; - - if (a !== out) { // If the source and destination differ, copy the unchanged rows - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - } - - // Perform axis-specific matrix multiplication - out[0] = a00 * c - a20 * s; - out[1] = a01 * c - a21 * s; - out[2] = a02 * c - a22 * s; - out[3] = a03 * c - a23 * s; - out[8] = a00 * s + a20 * c; - out[9] = a01 * s + a21 * c; - out[10] = a02 * s + a22 * c; - out[11] = a03 * s + a23 * c; - return out; -}; - -/** - * Rotates a matrix by the given angle around the Z axis - * - * @param {mat4} out the receiving matrix - * @param {mat4} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat4} out - */ -mat4.rotateZ = function (out, a, rad) { - var s = Math.sin(rad), - c = Math.cos(rad), - a00 = a[0], - a01 = a[1], - a02 = a[2], - a03 = a[3], - a10 = a[4], - a11 = a[5], - a12 = a[6], - a13 = a[7]; - - if (a !== out) { // If the source and destination differ, copy the unchanged last row - out[8] = a[8]; - out[9] = a[9]; - out[10] = a[10]; - out[11] = a[11]; - out[12] = a[12]; - out[13] = a[13]; - out[14] = a[14]; - out[15] = a[15]; - } - - // Perform axis-specific matrix multiplication - out[0] = a00 * c + a10 * s; - out[1] = a01 * c + a11 * s; - out[2] = a02 * c + a12 * s; - out[3] = a03 * c + a13 * s; - out[4] = a10 * c - a00 * s; - out[5] = a11 * c - a01 * s; - out[6] = a12 * c - a02 * s; - out[7] = a13 * c - a03 * s; - return out; -}; - -/** - * Creates a matrix from a quaternion rotation and vector translation - * This is equivalent to (but much faster than): - * - * mat4.identity(dest); - * mat4.translate(dest, vec); - * var quatMat = mat4.create(); - * quat4.toMat4(quat, quatMat); - * mat4.multiply(dest, quatMat); - * - * @param {mat4} out mat4 receiving operation result - * @param {quat4} q Rotation quaternion - * @param {vec3} v Translation vector - * @returns {mat4} out - */ -mat4.fromRotationTranslation = function (out, q, v) { - // Quaternion math - var x = q[0], y = q[1], z = q[2], w = q[3], - x2 = x + x, - y2 = y + y, - z2 = z + z, - - xx = x * x2, - xy = x * y2, - xz = x * z2, - yy = y * y2, - yz = y * z2, - zz = z * z2, - wx = w * x2, - wy = w * y2, - wz = w * z2; - - out[0] = 1 - (yy + zz); - out[1] = xy + wz; - out[2] = xz - wy; - out[3] = 0; - out[4] = xy - wz; - out[5] = 1 - (xx + zz); - out[6] = yz + wx; - out[7] = 0; - out[8] = xz + wy; - out[9] = yz - wx; - out[10] = 1 - (xx + yy); - out[11] = 0; - out[12] = v[0]; - out[13] = v[1]; - out[14] = v[2]; - out[15] = 1; - - return out; -}; - -mat4.fromQuat = function (out, q) { - var x = q[0], y = q[1], z = q[2], w = q[3], - x2 = x + x, - y2 = y + y, - z2 = z + z, - - xx = x * x2, - yx = y * x2, - yy = y * y2, - zx = z * x2, - zy = z * y2, - zz = z * z2, - wx = w * x2, - wy = w * y2, - wz = w * z2; - - out[0] = 1 - yy - zz; - out[1] = yx + wz; - out[2] = zx - wy; - out[3] = 0; - - out[4] = yx - wz; - out[5] = 1 - xx - zz; - out[6] = zy + wx; - out[7] = 0; - - out[8] = zx + wy; - out[9] = zy - wx; - out[10] = 1 - xx - yy; - out[11] = 0; - - out[12] = 0; - out[13] = 0; - out[14] = 0; - out[15] = 1; - - return out; -}; - -/** - * Generates a frustum matrix with the given bounds - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {Number} left Left bound of the frustum - * @param {Number} right Right bound of the frustum - * @param {Number} bottom Bottom bound of the frustum - * @param {Number} top Top bound of the frustum - * @param {Number} near Near bound of the frustum - * @param {Number} far Far bound of the frustum - * @returns {mat4} out - */ -mat4.frustum = function (out, left, right, bottom, top, near, far) { - var rl = 1 / (right - left), - tb = 1 / (top - bottom), - nf = 1 / (near - far); - out[0] = (near * 2) * rl; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = (near * 2) * tb; - out[6] = 0; - out[7] = 0; - out[8] = (right + left) * rl; - out[9] = (top + bottom) * tb; - out[10] = (far + near) * nf; - out[11] = -1; - out[12] = 0; - out[13] = 0; - out[14] = (far * near * 2) * nf; - out[15] = 0; - return out; -}; - -/** - * Generates a perspective projection matrix with the given bounds - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {number} fovy Vertical field of view in radians - * @param {number} aspect Aspect ratio. typically viewport width/height - * @param {number} near Near bound of the frustum - * @param {number} far Far bound of the frustum - * @returns {mat4} out - */ -mat4.perspective = function (out, fovy, aspect, near, far) { - var f = 1.0 / Math.tan(fovy / 2), - nf = 1 / (near - far); - out[0] = f / aspect; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = f; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = (far + near) * nf; - out[11] = -1; - out[12] = 0; - out[13] = 0; - out[14] = (2 * far * near) * nf; - out[15] = 0; - return out; -}; - -/** - * Generates a orthogonal projection matrix with the given bounds - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {number} left Left bound of the frustum - * @param {number} right Right bound of the frustum - * @param {number} bottom Bottom bound of the frustum - * @param {number} top Top bound of the frustum - * @param {number} near Near bound of the frustum - * @param {number} far Far bound of the frustum - * @returns {mat4} out - */ -mat4.ortho = function (out, left, right, bottom, top, near, far) { - var lr = 1 / (left - right), - bt = 1 / (bottom - top), - nf = 1 / (near - far); - out[0] = -2 * lr; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 0; - out[5] = -2 * bt; - out[6] = 0; - out[7] = 0; - out[8] = 0; - out[9] = 0; - out[10] = 2 * nf; - out[11] = 0; - out[12] = (left + right) * lr; - out[13] = (top + bottom) * bt; - out[14] = (far + near) * nf; - out[15] = 1; - return out; -}; - -/** - * Generates a look-at matrix with the given eye position, focal point, and up axis - * - * @param {mat4} out mat4 frustum matrix will be written into - * @param {vec3} eye Position of the viewer - * @param {vec3} center Point the viewer is looking at - * @param {vec3} up vec3 pointing up - * @returns {mat4} out - */ -mat4.lookAt = function (out, eye, center, up) { - var x0, x1, x2, y0, y1, y2, z0, z1, z2, len, - eyex = eye[0], - eyey = eye[1], - eyez = eye[2], - upx = up[0], - upy = up[1], - upz = up[2], - centerx = center[0], - centery = center[1], - centerz = center[2]; - - if (Math.abs(eyex - centerx) < __WEBPACK_IMPORTED_MODULE_0__common__["b" /* GLMAT_EPSILON */] && - Math.abs(eyey - centery) < __WEBPACK_IMPORTED_MODULE_0__common__["b" /* GLMAT_EPSILON */] && - Math.abs(eyez - centerz) < __WEBPACK_IMPORTED_MODULE_0__common__["b" /* GLMAT_EPSILON */]) { - return mat4.identity(out); - } - - z0 = eyex - centerx; - z1 = eyey - centery; - z2 = eyez - centerz; - - len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); - z0 *= len; - z1 *= len; - z2 *= len; - - x0 = upy * z2 - upz * z1; - x1 = upz * z0 - upx * z2; - x2 = upx * z1 - upy * z0; - len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); - if (!len) { - x0 = 0; - x1 = 0; - x2 = 0; - } else { - len = 1 / len; - x0 *= len; - x1 *= len; - x2 *= len; - } - - y0 = z1 * x2 - z2 * x1; - y1 = z2 * x0 - z0 * x2; - y2 = z0 * x1 - z1 * x0; - - len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); - if (!len) { - y0 = 0; - y1 = 0; - y2 = 0; - } else { - len = 1 / len; - y0 *= len; - y1 *= len; - y2 *= len; - } - - out[0] = x0; - out[1] = y0; - out[2] = z0; - out[3] = 0; - out[4] = x1; - out[5] = y1; - out[6] = z1; - out[7] = 0; - out[8] = x2; - out[9] = y2; - out[10] = z2; - out[11] = 0; - out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); - out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); - out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); - out[15] = 1; - - return out; -}; - -/** - * Returns Frobenius norm of a mat4 - * - * @param {mat4} a the matrix to calculate Frobenius norm of - * @returns {Number} Frobenius norm - */ -mat4.frob = function (a) { - return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2) + Math.pow(a[9], 2) + Math.pow(a[10], 2) + Math.pow(a[11], 2) + Math.pow(a[12], 2) + Math.pow(a[13], 2) + Math.pow(a[14], 2) + Math.pow(a[15], 2) )) -}; - -/* harmony default export */ __webpack_exports__["a"] = (mat4); - -/***/ }), -/* 22 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_claygl_src_Scene__ = __webpack_require__(36); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_claygl_src_prePass_ShadowMap__ = __webpack_require__(174); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_claygl_src_camera_Perspective__ = __webpack_require__(41); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_claygl_src_camera_Orthographic__ = __webpack_require__(37); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_claygl_src_math_Matrix4__ = __webpack_require__(9); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_claygl_src_math_Vector3__ = __webpack_require__(3); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_claygl_src_math_Vector2__ = __webpack_require__(26); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_claygl_src_core_mixin_notifier__ = __webpack_require__(53); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__effect_EffectCompositor__ = __webpack_require__(176); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__effect_TemporalSuperSampling__ = __webpack_require__(200); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__effect_halton__ = __webpack_require__(49); -/* - * @module echarts-gl/core/ViewGL - * @author Yi Shen(http://github.com/pissang) - */ - - - - - - - - - - - - - - - - - -/** - * @constructor - * @alias module:echarts-gl/core/ViewGL - * @param {string} [projection='perspective'] - */ -function ViewGL(projection) { - - projection = projection || 'perspective'; - - /** - * @type {module:echarts-gl/core/LayerGL} - */ - this.layer = null; - /** - * @type {clay.Scene} - */ - this.scene = new __WEBPACK_IMPORTED_MODULE_1_claygl_src_Scene__["a" /* default */](); - - /** - * @type {clay.Node} - */ - this.rootNode = this.scene; - - this.viewport = { - x: 0, y: 0, width: 0, height: 0 - }; - - this.setProjection(projection); - - this._compositor = new __WEBPACK_IMPORTED_MODULE_9__effect_EffectCompositor__["a" /* default */](); - - this._temporalSS = new __WEBPACK_IMPORTED_MODULE_10__effect_TemporalSuperSampling__["a" /* default */](); - - this._shadowMapPass = new __WEBPACK_IMPORTED_MODULE_2_claygl_src_prePass_ShadowMap__["a" /* default */](); - - var pcfKernels = []; - var off = 0; - for (var i = 0; i < 30; i++) { - var pcfKernel = []; - for (var k = 0; k < 6; k++) { - pcfKernel.push(Object(__WEBPACK_IMPORTED_MODULE_11__effect_halton__["a" /* default */])(off, 2) * 4.0 - 2.0); - pcfKernel.push(Object(__WEBPACK_IMPORTED_MODULE_11__effect_halton__["a" /* default */])(off, 3) * 4.0 - 2.0); - off++; - } - pcfKernels.push(pcfKernel); - } - this._pcfKernels = pcfKernels; - - this.scene.on('beforerender', function (renderer, scene, camera) { - if (this.needsTemporalSS()) { - this._temporalSS.jitterProjection(renderer, camera); - } - }, this); -} - -/** - * Set camera type of group - * @param {string} cameraType 'perspective' | 'orthographic' - */ -ViewGL.prototype.setProjection = function (projection) { - var oldCamera = this.camera; - oldCamera && oldCamera.update(); - if (projection === 'perspective') { - if (!(this.camera instanceof __WEBPACK_IMPORTED_MODULE_3_claygl_src_camera_Perspective__["a" /* default */])) { - this.camera = new __WEBPACK_IMPORTED_MODULE_3_claygl_src_camera_Perspective__["a" /* default */](); - if (oldCamera) { - this.camera.setLocalTransform(oldCamera.localTransform); - } - } - } - else { - if (!(this.camera instanceof __WEBPACK_IMPORTED_MODULE_4_claygl_src_camera_Orthographic__["a" /* default */])) { - this.camera = new __WEBPACK_IMPORTED_MODULE_4_claygl_src_camera_Orthographic__["a" /* default */](); - if (oldCamera) { - this.camera.setLocalTransform(oldCamera.localTransform); - } - } - } - // PENDING - this.camera.near = 0.1; - this.camera.far = 2000; -}; - -/** - * Set viewport of group - * @param {number} x Viewport left bottom x - * @param {number} y Viewport left bottom y - * @param {number} width Viewport height - * @param {number} height Viewport height - * @param {number} [dpr=1] - */ -ViewGL.prototype.setViewport = function (x, y, width, height, dpr) { - if (this.camera instanceof __WEBPACK_IMPORTED_MODULE_3_claygl_src_camera_Perspective__["a" /* default */]) { - this.camera.aspect = width / height; - } - dpr = dpr || 1; - - this.viewport.x = x; - this.viewport.y = y; - this.viewport.width = width; - this.viewport.height = height; - this.viewport.devicePixelRatio = dpr; - - // Source and output of compositor use high dpr texture. - // But the intermediate texture of bloom, dof effects use fixed 1.0 dpr - this._compositor.resize(width * dpr, height * dpr); - this._temporalSS.resize(width * dpr, height * dpr); -}; - -/** - * If contain screen point x, y - * @param {number} x offsetX - * @param {number} y offsetY - * @return {boolean} - */ -ViewGL.prototype.containPoint = function (x, y) { - var viewport = this.viewport; - var height = this.layer.renderer.getHeight(); - // Flip y; - y = height - y; - return x >= viewport.x && y >= viewport.y - && x <= viewport.x + viewport.width && y <= viewport.y + viewport.height; -}; - -/** - * Cast a ray - * @param {number} x offsetX - * @param {number} y offsetY - * @param {clay.math.Ray} out - * @return {clay.math.Ray} - */ -var ndc = new __WEBPACK_IMPORTED_MODULE_7_claygl_src_math_Vector2__["a" /* default */](); -ViewGL.prototype.castRay = function (x, y, out) { - var renderer = this.layer.renderer; - - var oldViewport = renderer.viewport; - renderer.viewport = this.viewport; - renderer.screenToNDC(x, y, ndc); - this.camera.castRay(ndc, out); - renderer.viewport = oldViewport; - - return out; -}; - -/** - * Prepare and update scene before render - */ -ViewGL.prototype.prepareRender = function () { - this.scene.update(); - this.camera.update(); - this.scene.updateLights(); - var renderList = this.scene.updateRenderList(this.camera); - - this._needsSortProgressively = false; - // If has any transparent mesh needs sort triangles progressively. - for (var i = 0; i < renderList.transparent.length; i++) { - var renderable = renderList.transparent[i]; - var geometry = renderable.geometry; - if (geometry.needsSortVerticesProgressively && geometry.needsSortVerticesProgressively()) { - this._needsSortProgressively = true; - } - if (geometry.needsSortTrianglesProgressively && geometry.needsSortTrianglesProgressively()) { - this._needsSortProgressively = true; - } - } - - this._frame = 0; - this._temporalSS.resetFrame(); - - // var lights = this.scene.getLights(); - // for (var i = 0; i < lights.length; i++) { - // if (lights[i].cubemap) { - // if (this._compositor && this._compositor.isSSREnabled()) { - // lights[i].invisible = true; - // } - // else { - // lights[i].invisible = false; - // } - // } - // } -}; - -ViewGL.prototype.render = function (renderer, accumulating) { - this._doRender(renderer, accumulating, this._frame); - this._frame++; -}; - -ViewGL.prototype.needsAccumulate = function () { - return this.needsTemporalSS() || this._needsSortProgressively; -}; - -ViewGL.prototype.needsTemporalSS = function () { - var enableTemporalSS = this._enableTemporalSS; - if (enableTemporalSS === 'auto') { - enableTemporalSS = this._enablePostEffect; - } - return enableTemporalSS; -}; - -ViewGL.prototype.hasDOF = function () { - return this._enableDOF; -}; - -ViewGL.prototype.isAccumulateFinished = function () { - return this.needsTemporalSS() ? this._temporalSS.isFinished() - : (this._frame > 30); -}; - -ViewGL.prototype._doRender = function (renderer, accumulating, accumFrame) { - - var scene = this.scene; - var camera = this.camera; - - accumFrame = accumFrame || 0; - - this._updateTransparent(renderer, scene, camera, accumFrame); - - if (!accumulating) { - this._shadowMapPass.kernelPCF = this._pcfKernels[0]; - // Not render shadowmap pass in accumulating frame. - this._shadowMapPass.render(renderer, scene, camera, true); - } - - this._updateShadowPCFKernel(accumFrame); - - // Shadowmap will set clear color. - var bgColor = renderer.clearColor; - renderer.gl.clearColor(bgColor[0], bgColor[1], bgColor[2], bgColor[3]); - - if (this._enablePostEffect) { - // normal render also needs to be jittered when have edge pass. - if (this.needsTemporalSS()) { - this._temporalSS.jitterProjection(renderer, camera); - } - this._compositor.updateNormal(renderer, scene, camera, this._temporalSS.getFrame()); - } - - // Always update SSAO to make sure have correct ssaoMap status - this._updateSSAO(renderer, scene, camera, this._temporalSS.getFrame()); - - if (this._enablePostEffect) { - - var frameBuffer = this._compositor.getSourceFrameBuffer(); - frameBuffer.bind(renderer); - renderer.gl.clear(renderer.gl.DEPTH_BUFFER_BIT | renderer.gl.COLOR_BUFFER_BIT); - renderer.render(scene, camera, true, true); - frameBuffer.unbind(renderer); - - if (this.needsTemporalSS() && accumulating) { - this._compositor.composite(renderer, scene, camera, this._temporalSS.getSourceFrameBuffer(), this._temporalSS.getFrame()); - renderer.setViewport(this.viewport); - this._temporalSS.render(renderer); - } - else { - renderer.setViewport(this.viewport); - this._compositor.composite(renderer, scene, camera, null, 0); - } - } - else { - if (this.needsTemporalSS() && accumulating) { - var frameBuffer = this._temporalSS.getSourceFrameBuffer(); - frameBuffer.bind(renderer); - renderer.saveClear(); - renderer.clearBit = renderer.gl.DEPTH_BUFFER_BIT | renderer.gl.COLOR_BUFFER_BIT; - renderer.render(scene, camera, true, true); - renderer.restoreClear(); - frameBuffer.unbind(renderer); - - renderer.setViewport(this.viewport); - this._temporalSS.render(renderer); - } - else { - renderer.setViewport(this.viewport); - renderer.render(scene, camera, true, true); - } - } - - // this._shadowMapPass.renderDebug(renderer); - // this._compositor._normalPass.renderDebug(renderer); -}; - -ViewGL.prototype._updateTransparent = function (renderer, scene, camera, frame) { - - var v3 = new __WEBPACK_IMPORTED_MODULE_6_claygl_src_math_Vector3__["a" /* default */](); - var invWorldTransform = new __WEBPACK_IMPORTED_MODULE_5_claygl_src_math_Matrix4__["a" /* default */](); - var cameraWorldPosition = camera.getWorldPosition(); - var transparentList = scene.getRenderList(camera).transparent; - - // Sort transparent object. - for (var i = 0; i < transparentList.length; i++) { - var renderable = transparentList[i]; - var geometry = renderable.geometry; - __WEBPACK_IMPORTED_MODULE_5_claygl_src_math_Matrix4__["a" /* default */].invert(invWorldTransform, renderable.worldTransform); - __WEBPACK_IMPORTED_MODULE_6_claygl_src_math_Vector3__["a" /* default */].transformMat4(v3, cameraWorldPosition, invWorldTransform); - if (geometry.needsSortTriangles && geometry.needsSortTriangles()) { - geometry.doSortTriangles(v3, frame); - } - if (geometry.needsSortVertices && geometry.needsSortVertices()) { - geometry.doSortVertices(v3, frame); - } - } -}; - -ViewGL.prototype._updateSSAO = function (renderer, scene, camera) { - var ifEnableSSAO = this._enableSSAO && this._enablePostEffect; - if (ifEnableSSAO) { - this._compositor.updateSSAO(renderer, scene, camera, this._temporalSS.getFrame()); - } - var renderList = scene.getRenderList(camera); - - for (var i = 0; i < renderList.opaque.length; i++) { - var renderable = renderList.opaque[i]; - // PENDING - if (renderable.renderNormal) { - renderable.material[ifEnableSSAO ? 'enableTexture' : 'disableTexture']('ssaoMap'); - } - if (ifEnableSSAO) { - renderable.material.set('ssaoMap', this._compositor.getSSAOTexture()); - } - } -}; - -ViewGL.prototype._updateShadowPCFKernel = function (frame) { - var pcfKernel = this._pcfKernels[frame % this._pcfKernels.length]; - var renderList = this.scene.getRenderList(this.camera); - var opaqueList = renderList.opaque; - for (var i = 0; i < opaqueList.length; i++) { - if (opaqueList[i].receiveShadow) { - opaqueList[i].material.set('pcfKernel', pcfKernel); - opaqueList[i].material.define('fragment', 'PCF_KERNEL_SIZE', pcfKernel.length / 2); - } - } -}; - -ViewGL.prototype.dispose = function (renderer) { - this._compositor.dispose(renderer.gl); - this._temporalSS.dispose(renderer.gl); - this._shadowMapPass.dispose(renderer); -}; -/** - * @param {module:echarts/Model} Post effect model - */ -ViewGL.prototype.setPostEffect = function (postEffectModel, api) { - var compositor = this._compositor; - this._enablePostEffect = postEffectModel.get('enable'); - var bloomModel = postEffectModel.getModel('bloom'); - var edgeModel = postEffectModel.getModel('edge'); - var dofModel = postEffectModel.getModel('DOF', postEffectModel.getModel('depthOfField')); - var ssaoModel = postEffectModel.getModel('SSAO', postEffectModel.getModel('screenSpaceAmbientOcclusion')); - var ssrModel = postEffectModel.getModel('SSR', postEffectModel.getModel('screenSpaceReflection')); - var fxaaModel = postEffectModel.getModel('FXAA'); - var colorCorrModel = postEffectModel.getModel('colorCorrection'); - bloomModel.get('enable') ? compositor.enableBloom() : compositor.disableBloom(); - dofModel.get('enable') ? compositor.enableDOF() : compositor.disableDOF(); - ssrModel.get('enable') ? compositor.enableSSR() : compositor.disableSSR(); - colorCorrModel.get('enable') ? compositor.enableColorCorrection() : compositor.disableColorCorrection(); - edgeModel.get('enable') ? compositor.enableEdge() : compositor.disableEdge(); - fxaaModel.get('enable') ? compositor.enableFXAA() : compositor.disableFXAA(); - - this._enableDOF = dofModel.get('enable'); - this._enableSSAO = ssaoModel.get('enable'); - - this._enableSSAO ? compositor.enableSSAO() : compositor.disableSSAO(); - - compositor.setBloomIntensity(bloomModel.get('intensity')); - compositor.setEdgeColor(edgeModel.get('color')); - compositor.setColorLookupTexture(colorCorrModel.get('lookupTexture'), api); - compositor.setExposure(colorCorrModel.get('exposure')); - - ['radius', 'quality', 'intensity'].forEach(function (name) { - compositor.setSSAOParameter(name, ssaoModel.get(name)); - }); - ['quality', 'maxRoughness', 'physical'].forEach(function (name) { - compositor.setSSRParameter(name, ssrModel.get(name)); - }); - ['quality', 'focalDistance', 'focalRange', 'blurRadius', 'fstop'].forEach(function (name) { - compositor.setDOFParameter(name, dofModel.get(name)); - }); - ['brightness', 'contrast', 'saturation'].forEach(function (name) { - compositor.setColorCorrection(name, colorCorrModel.get(name)); - }); - -}; - -ViewGL.prototype.setDOFFocusOnPoint = function (depth) { - if (this._enablePostEffect) { - - if (depth > this.camera.far || depth < this.camera.near) { - return; - } - - this._compositor.setDOFParameter('focalDistance', depth); - return true; - } -}; - -ViewGL.prototype.setTemporalSuperSampling = function (temporalSuperSamplingModel) { - this._enableTemporalSS = temporalSuperSamplingModel.get('enable'); -}; - -ViewGL.prototype.isLinearSpace = function () { - return this._enablePostEffect; -}; - -ViewGL.prototype.setRootNode = function (rootNode) { - if (this.rootNode === rootNode) { - return; - } - var children = this.rootNode.children(); - for (var i = 0; i < children.length; i++) { - rootNode.add(children[i]); - } - if (rootNode !== this.scene) { - this.scene.add(rootNode); - } - - this.rootNode = rootNode; -}; -// Proxies -ViewGL.prototype.add = function (node3D) { - this.rootNode.add(node3D); -}; -ViewGL.prototype.remove = function (node3D) { - this.rootNode.remove(node3D); -}; -ViewGL.prototype.removeAll = function (node3D) { - this.rootNode.removeAll(node3D); -}; - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.extend(ViewGL.prototype, __WEBPACK_IMPORTED_MODULE_8_claygl_src_core_mixin_notifier__["a" /* default */]); - -/* harmony default export */ __webpack_exports__["a"] = (ViewGL); - -/***/ }), -/* 23 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -var guid = 0; - -var ArrayProto = Array.prototype; -var nativeForEach = ArrayProto.forEach; - -/** - * Util functions - * @namespace clay.core.util - */ -var util = { - - /** - * Generate GUID - * @return {number} - * @memberOf clay.core.util - */ - genGUID: function () { - return ++guid; - }, - /** - * Relative path to absolute path - * @param {string} path - * @param {string} basePath - * @return {string} - * @memberOf clay.core.util - */ - relative2absolute: function (path, basePath) { - if (!basePath || path.match(/^\//)) { - return path; - } - var pathParts = path.split('/'); - var basePathParts = basePath.split('/'); - - var item = pathParts[0]; - while(item === '.' || item === '..') { - if (item === '..') { - basePathParts.pop(); - } - pathParts.shift(); - item = pathParts[0]; - } - return basePathParts.join('/') + '/' + pathParts.join('/'); - }, - - /** - * Extend target with source - * @param {Object} target - * @param {Object} source - * @return {Object} - * @memberOf clay.core.util - */ - extend: function (target, source) { - if (source) { - for (var name in source) { - if (source.hasOwnProperty(name)) { - target[name] = source[name]; - } - } - } - return target; - }, - - /** - * Extend properties to target if not exist. - * @param {Object} target - * @param {Object} source - * @return {Object} - * @memberOf clay.core.util - */ - defaults: function (target, source) { - if (source) { - for (var propName in source) { - if (target[propName] === undefined) { - target[propName] = source[propName]; - } - } - } - return target; - }, - /** - * Extend properties with a given property list to avoid for..in.. iteration. - * @param {Object} target - * @param {Object} source - * @param {Array.} propList - * @return {Object} - * @memberOf clay.core.util - */ - extendWithPropList: function (target, source, propList) { - if (source) { - for (var i = 0; i < propList.length; i++) { - var propName = propList[i]; - target[propName] = source[propName]; - } - } - return target; - }, - /** - * Extend properties to target if not exist. With a given property list avoid for..in.. iteration. - * @param {Object} target - * @param {Object} source - * @param {Array.} propList - * @return {Object} - * @memberOf clay.core.util - */ - defaultsWithPropList: function (target, source, propList) { - if (source) { - for (var i = 0; i < propList.length; i++) { - var propName = propList[i]; - if (target[propName] == null) { - target[propName] = source[propName]; - } - } - } - return target; - }, - /** - * @param {Object|Array} obj - * @param {Function} iterator - * @param {Object} [context] - * @memberOf clay.core.util - */ - each: function (obj, iterator, context) { - if (!(obj && iterator)) { - return; - } - if (obj.forEach && obj.forEach === nativeForEach) { - obj.forEach(iterator, context); - } - else if (obj.length === + obj.length) { - for (var i = 0, len = obj.length; i < len; i++) { - iterator.call(context, obj[i], i, obj); - } - } - else { - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - iterator.call(context, obj[key], key, obj); - } - } - } - }, - - /** - * Is object - * @param {} obj - * @return {boolean} - * @memberOf clay.core.util - */ - isObject: function (obj) { - return obj === Object(obj); - }, - - /** - * Is array ? - * @param {} obj - * @return {boolean} - * @memberOf clay.core.util - */ - isArray: function (obj) { - return Array.isArray(obj); - }, - - /** - * Is array like, which have a length property - * @param {} obj - * @return {boolean} - * @memberOf clay.core.util - */ - isArrayLike: function (obj) { - if (!obj) { - return false; - } - else { - return obj.length === + obj.length; - } - }, - - /** - * @param {} obj - * @return {} - * @memberOf clay.core.util - */ - clone: function (obj) { - if (!util.isObject(obj)) { - return obj; - } - else if (util.isArray(obj)) { - return obj.slice(); - } - else if (util.isArrayLike(obj)) { // is typed array - var ret = new obj.constructor(obj.length); - for (var i = 0; i < obj.length; i++) { - ret[i] = obj[i]; - } - return ret; - } - else { - return util.extend({}, obj); - } - } -}; - -/* harmony default export */ __webpack_exports__["a"] = (util); - - -/***/ }), -/* 24 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Node__ = __webpack_require__(35); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Shader__ = __webpack_require__(8); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__shader_source_header_light__ = __webpack_require__(119); - - - - -__WEBPACK_IMPORTED_MODULE_1__Shader__["a" /* default */]['import'](__WEBPACK_IMPORTED_MODULE_2__shader_source_header_light__["a" /* default */]); - -/** - * @constructor clay.Light - * @extends clay.Node - */ -var Light = __WEBPACK_IMPORTED_MODULE_0__Node__["a" /* default */].extend(function(){ - return /** @lends clay.Light# */ { - /** - * Light RGB color - * @type {number[]} - */ - color: [1, 1, 1], - - /** - * Light intensity - * @type {number} - */ - intensity: 1.0, - - // Config for shadow map - /** - * If light cast shadow - * @type {boolean} - */ - castShadow: true, - - /** - * Shadow map size - * @type {number} - */ - shadowResolution: 512, - - /** - * Light group, shader with same `lightGroup` will be affected - * - * Only useful in forward rendering - * @type {number} - */ - group: 0 - }; -}, -/** @lends clay.Light.prototype. */ -{ - /** - * Light type - * @type {string} - * @memberOf clay.Light# - */ - type: '', - - /** - * @return {clay.Light} - * @memberOf clay.Light.prototype - */ - clone: function() { - var light = __WEBPACK_IMPORTED_MODULE_0__Node__["a" /* default */].prototype.clone.call(this); - light.color = Array.prototype.slice.call(this.color); - light.intensity = this.intensity; - light.castShadow = this.castShadow; - light.shadowResolution = this.shadowResolution; - - return light; - } -}); - -/* harmony default export */ __webpack_exports__["a"] = (Light); - - -/***/ }), -/* 25 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_claygl_src_Geometry__ = __webpack_require__(15); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__dynamicConvertMixin__ = __webpack_require__(38); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_claygl_src_dep_glmatrix__ = __webpack_require__(6); -/** - * Lines geometry - * Use screen space projected lines lineWidth > MAX_LINE_WIDTH - * https://mattdesl.svbtle.com/drawing-lines-is-hard - * @module echarts-gl/util/geometry/LinesGeometry - * @author Yi Shen(http://github.com/pissang) - */ - - - - - -var vec3 = __WEBPACK_IMPORTED_MODULE_3_claygl_src_dep_glmatrix__["a" /* default */].vec3; - -// var CURVE_RECURSION_LIMIT = 8; -// var CURVE_COLLINEAR_EPSILON = 40; - -var sampleLinePoints = [[0, 0], [1, 1]]; -/** - * @constructor - * @alias module:echarts-gl/util/geometry/LinesGeometry - * @extends clay.Geometry - */ - -var LinesGeometry = __WEBPACK_IMPORTED_MODULE_0_claygl_src_Geometry__["a" /* default */].extend(function () { - return { - - segmentScale: 1, - - dynamic: true, - /** - * Need to use mesh to expand lines if lineWidth > MAX_LINE_WIDTH - */ - useNativeLine: true, - - attributes: { - position: new __WEBPACK_IMPORTED_MODULE_0_claygl_src_Geometry__["a" /* default */].Attribute('position', 'float', 3, 'POSITION'), - positionPrev: new __WEBPACK_IMPORTED_MODULE_0_claygl_src_Geometry__["a" /* default */].Attribute('positionPrev', 'float', 3), - positionNext: new __WEBPACK_IMPORTED_MODULE_0_claygl_src_Geometry__["a" /* default */].Attribute('positionNext', 'float', 3), - prevPositionPrev: new __WEBPACK_IMPORTED_MODULE_0_claygl_src_Geometry__["a" /* default */].Attribute('prevPositionPrev', 'float', 3), - prevPosition: new __WEBPACK_IMPORTED_MODULE_0_claygl_src_Geometry__["a" /* default */].Attribute('prevPosition', 'float', 3), - prevPositionNext: new __WEBPACK_IMPORTED_MODULE_0_claygl_src_Geometry__["a" /* default */].Attribute('prevPositionNext', 'float', 3), - offset: new __WEBPACK_IMPORTED_MODULE_0_claygl_src_Geometry__["a" /* default */].Attribute('offset', 'float', 1), - color: new __WEBPACK_IMPORTED_MODULE_0_claygl_src_Geometry__["a" /* default */].Attribute('color', 'float', 4, 'COLOR') - } - }; -}, -/** @lends module: echarts-gl/util/geometry/LinesGeometry.prototype */ -{ - - /** - * Reset offset - */ - resetOffset: function () { - this._vertexOffset = 0; - this._triangleOffset = 0; - - this._itemVertexOffsets = []; - }, - - /** - * @param {number} nVertex - */ - setVertexCount: function (nVertex) { - var attributes = this.attributes; - if (this.vertexCount !== nVertex) { - attributes.position.init(nVertex); - attributes.color.init(nVertex); - - if (!this.useNativeLine) { - attributes.positionPrev.init(nVertex); - attributes.positionNext.init(nVertex); - attributes.offset.init(nVertex); - } - - if (nVertex > 0xffff) { - if (this.indices instanceof Uint16Array) { - this.indices = new Uint32Array(this.indices); - } - } - else { - if (this.indices instanceof Uint32Array) { - this.indices = new Uint16Array(this.indices); - } - } - } - }, - - /** - * @param {number} nTriangle - */ - setTriangleCount: function (nTriangle) { - if (this.triangleCount !== nTriangle) { - if (nTriangle === 0) { - this.indices = null; - } - else { - this.indices = this.vertexCount > 0xffff ? new Uint32Array(nTriangle * 3) : new Uint16Array(nTriangle * 3); - } - } - }, - - _getCubicCurveApproxStep: function (p0, p1, p2, p3) { - var len = vec3.dist(p0, p1) + vec3.dist(p2, p1) + vec3.dist(p3, p2); - var step = 1 / (len + 1) * this.segmentScale; - return step; - }, - - /** - * Get vertex count of cubic curve - * @param {Array.} p0 - * @param {Array.} p1 - * @param {Array.} p2 - * @param {Array.} p3 - * @return number - */ - getCubicCurveVertexCount: function (p0, p1, p2, p3) { - var step = this._getCubicCurveApproxStep(p0, p1, p2, p3); - var segCount = Math.ceil(1 / step); - if (!this.useNativeLine) { - return segCount * 2 + 2; - } - else { - return segCount * 2; - } - }, - - /** - * Get face count of cubic curve - * @param {Array.} p0 - * @param {Array.} p1 - * @param {Array.} p2 - * @param {Array.} p3 - * @return number - */ - getCubicCurveTriangleCount: function (p0, p1, p2, p3) { - var step = this._getCubicCurveApproxStep(p0, p1, p2, p3); - var segCount = Math.ceil(1 / step); - if (!this.useNativeLine) { - return segCount * 2; - } - else { - return 0; - } - }, - - /** - * Get vertex count of line - * @return {number} - */ - getLineVertexCount: function () { - return this.getPolylineVertexCount(sampleLinePoints); - }, - - /** - * Get face count of line - * @return {number} - */ - getLineTriangleCount: function () { - return this.getPolylineTriangleCount(sampleLinePoints); - }, - - /** - * Get how many vertices will polyline take. - * @type {number|Array} points Can be a 1d/2d list of points, or a number of points amount. - * @return {number} - */ - getPolylineVertexCount: function (points) { - var pointsLen; - if (typeof points === 'number') { - pointsLen = points; - } - else { - var is2DArray = typeof points[0] !== 'number'; - pointsLen = is2DArray ? points.length : (points.length / 3); - } - return !this.useNativeLine ? ((pointsLen - 1) * 2 + 2) : (pointsLen - 1) * 2; - }, - - /** - * Get how many triangles will polyline take. - * @type {number|Array} points Can be a 1d/2d list of points, or a number of points amount. - * @return {number} - */ - getPolylineTriangleCount: function (points) { - var pointsLen; - if (typeof points === 'number') { - pointsLen = points; - } - else { - var is2DArray = typeof points[0] !== 'number'; - pointsLen = is2DArray ? points.length : (points.length / 3); - } - return !this.useNativeLine ? Math.max(pointsLen - 1, 0) * 2 : 0; - }, - - /** - * Add a cubic curve - * @param {Array.} p0 - * @param {Array.} p1 - * @param {Array.} p2 - * @param {Array.} p3 - * @param {Array.} color - * @param {number} [lineWidth=1] - */ - addCubicCurve: function (p0, p1, p2, p3, color, lineWidth) { - if (lineWidth == null) { - lineWidth = 1; - } - // incremental interpolation - // http://antigrain.com/research/bezier_interpolation/index.html#PAGE_BEZIER_INTERPOLATION - var x0 = p0[0], y0 = p0[1], z0 = p0[2]; - var x1 = p1[0], y1 = p1[1], z1 = p1[2]; - var x2 = p2[0], y2 = p2[1], z2 = p2[2]; - var x3 = p3[0], y3 = p3[1], z3 = p3[2]; - - var step = this._getCubicCurveApproxStep(p0, p1, p2, p3); - - var step2 = step * step; - var step3 = step2 * step; - - var pre1 = 3.0 * step; - var pre2 = 3.0 * step2; - var pre4 = 6.0 * step2; - var pre5 = 6.0 * step3; - - var tmp1x = x0 - x1 * 2.0 + x2; - var tmp1y = y0 - y1 * 2.0 + y2; - var tmp1z = z0 - z1 * 2.0 + z2; - - var tmp2x = (x1 - x2) * 3.0 - x0 + x3; - var tmp2y = (y1 - y2) * 3.0 - y0 + y3; - var tmp2z = (z1 - z2) * 3.0 - z0 + z3; - - var fx = x0; - var fy = y0; - var fz = z0; - - var dfx = (x1 - x0) * pre1 + tmp1x * pre2 + tmp2x * step3; - var dfy = (y1 - y0) * pre1 + tmp1y * pre2 + tmp2y * step3; - var dfz = (z1 - z0) * pre1 + tmp1z * pre2 + tmp2z * step3; - - var ddfx = tmp1x * pre4 + tmp2x * pre5; - var ddfy = tmp1y * pre4 + tmp2y * pre5; - var ddfz = tmp1z * pre4 + tmp2z * pre5; - - var dddfx = tmp2x * pre5; - var dddfy = tmp2y * pre5; - var dddfz = tmp2z * pre5; - - var t = 0; - - var k = 0; - var segCount = Math.ceil(1 / step); - - var points = new Float32Array((segCount + 1) * 3); - var points = []; - var offset = 0; - for (var k = 0; k < segCount + 1; k++) { - points[offset++] = fx; - points[offset++] = fy; - points[offset++] = fz; - - fx += dfx; fy += dfy; fz += dfz; - dfx += ddfx; dfy += ddfy; dfz += ddfz; - ddfx += dddfx; ddfy += dddfy; ddfz += dddfz; - t += step; - - if (t > 1) { - fx = dfx > 0 ? Math.min(fx, x3) : Math.max(fx, x3); - fy = dfy > 0 ? Math.min(fy, y3) : Math.max(fy, y3); - fz = dfz > 0 ? Math.min(fz, z3) : Math.max(fz, z3); - } - } - - return this.addPolyline(points, color, lineWidth); - }, - - /** - * Add a straight line - * @param {Array.} p0 - * @param {Array.} p1 - * @param {Array.} color - * @param {number} [lineWidth=1] - */ - addLine: function (p0, p1, color, lineWidth) { - return this.addPolyline([p0, p1], color, lineWidth); - }, - - /** - * Add a straight line - * @param {Array. | Array.} points - * @param {Array. | Array.} color - * @param {number} [lineWidth=1] - * @param {number} [startOffset=0] - * @param {number} [pointsCount] Default to be amount of points in the first argument - */ - addPolyline: function (points, color, lineWidth, startOffset, pointsCount) { - if (!points.length) { - return; - } - var is2DArray = typeof points[0] !== 'number'; - if (pointsCount == null) { - pointsCount = is2DArray ? points.length : points.length / 3; - } - if (pointsCount < 2) { - return; - } - if (startOffset == null) { - startOffset = 0; - } - if (lineWidth == null) { - lineWidth = 1; - } - - this._itemVertexOffsets.push(this._vertexOffset); - - var is2DArray = typeof points[0] !== 'number'; - var notSharingColor = is2DArray - ? typeof color[0] !== 'number' - : color.length / 4 === pointsCount; - - var positionAttr = this.attributes.position; - var positionPrevAttr = this.attributes.positionPrev; - var positionNextAttr = this.attributes.positionNext; - var colorAttr = this.attributes.color; - var offsetAttr = this.attributes.offset; - var indices = this.indices; - - var vertexOffset = this._vertexOffset; - var point; - var pointColor; - - lineWidth = Math.max(lineWidth, 0.01); - - for (var k = startOffset; k < pointsCount; k++) { - if (is2DArray) { - point = points[k]; - if (notSharingColor) { - pointColor = color[k]; - } - else { - pointColor = color; - } - } - else { - var k3 = k * 3; - point = point || []; - point[0] = points[k3]; - point[1] = points[k3 + 1]; - point[2] = points[k3 + 2]; - - if (notSharingColor) { - var k4 = k * 4; - pointColor = pointColor || []; - pointColor[0] = color[k4]; - pointColor[1] = color[k4 + 1]; - pointColor[2] = color[k4 + 2]; - pointColor[3] = color[k4 + 3]; - } - else { - pointColor = color; - } - } - if (!this.useNativeLine) { - if (k < pointsCount - 1) { - // Set to next two points - positionPrevAttr.set(vertexOffset + 2, point); - positionPrevAttr.set(vertexOffset + 3, point); - } - if (k > 0) { - // Set to previous two points - positionNextAttr.set(vertexOffset - 2, point); - positionNextAttr.set(vertexOffset - 1, point); - } - - positionAttr.set(vertexOffset, point); - positionAttr.set(vertexOffset + 1, point); - - colorAttr.set(vertexOffset, pointColor); - colorAttr.set(vertexOffset + 1, pointColor); - - offsetAttr.set(vertexOffset, lineWidth / 2); - offsetAttr.set(vertexOffset + 1, -lineWidth / 2); - - vertexOffset += 2; - } - else { - if (k > 1) { - positionAttr.copy(vertexOffset, vertexOffset - 1); - colorAttr.copy(vertexOffset, vertexOffset - 1); - vertexOffset++; - } - } - - if (!this.useNativeLine) { - if (k > 0) { - var idx3 = this._triangleOffset * 3; - var indices = this.indices; - // 0-----2 - // 1-----3 - // 0->1->2, 1->3->2 - indices[idx3] = vertexOffset - 4; - indices[idx3 + 1] = vertexOffset - 3; - indices[idx3 + 2] = vertexOffset - 2; - - indices[idx3 + 3] = vertexOffset - 3; - indices[idx3 + 4] = vertexOffset - 1; - indices[idx3 + 5] = vertexOffset - 2; - - this._triangleOffset += 2; - } - } - else { - colorAttr.set(vertexOffset, pointColor); - positionAttr.set(vertexOffset, point); - vertexOffset++; - } - } - if (!this.useNativeLine) { - var start = this._vertexOffset; - var end = this._vertexOffset + pointsCount * 2; - positionPrevAttr.copy(start, start + 2); - positionPrevAttr.copy(start + 1, start + 3); - positionNextAttr.copy(end - 1, end - 3); - positionNextAttr.copy(end - 2, end - 4); - } - - this._vertexOffset = vertexOffset; - - return this._vertexOffset; - }, - - /** - * Set color of single line. - */ - setItemColor: function (idx, color) { - var startOffset = this._itemVertexOffsets[idx]; - var endOffset = idx < this._itemVertexOffsets.length - 1 ? this._itemVertexOffsets[idx + 1] : this._vertexOffset; - - for (var i = startOffset; i < endOffset; i++) { - this.attributes.color.set(i, color); - } - this.dirty('color'); - }, - - /** - * @return {number} - */ - currentTriangleOffset: function () { - return this._triangleOffset; - }, - - /** - * @return {number} - */ - currentVertexOffset: function () { - return this._vertexOffset; - } -}); - -__WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts___default.a.util.defaults(LinesGeometry.prototype, __WEBPACK_IMPORTED_MODULE_2__dynamicConvertMixin__["a" /* default */]); - -/* harmony default export */ __webpack_exports__["a"] = (LinesGeometry); - -/***/ }), -/* 26 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__ = __webpack_require__(70); - - -/** - * @constructor - * @alias clay.Vector2 - * @param {number} x - * @param {number} y - */ -var Vector2 = function(x, y) { - - x = x || 0; - y = y || 0; - - /** - * Storage of Vector2, read and write of x, y will change the values in array - * All methods also operate on the array instead of x, y components - * @name array - * @type {Float32Array} - * @memberOf clay.Vector2# - */ - this.array = __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].fromValues(x, y); - - /** - * Dirty flag is used by the Node to determine - * if the matrix is updated to latest - * @name _dirty - * @type {boolean} - * @memberOf clay.Vector2# - */ - this._dirty = true; -}; - -Vector2.prototype = { - - constructor: Vector2, - - /** - * Add b to self - * @param {clay.Vector2} b - * @return {clay.Vector2} - */ - add: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].add(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Set x and y components - * @param {number} x - * @param {number} y - * @return {clay.Vector2} - */ - set: function(x, y) { - this.array[0] = x; - this.array[1] = y; - this._dirty = true; - return this; - }, - - /** - * Set x and y components from array - * @param {Float32Array|number[]} arr - * @return {clay.Vector2} - */ - setArray: function(arr) { - this.array[0] = arr[0]; - this.array[1] = arr[1]; - - this._dirty = true; - return this; - }, - - /** - * Clone a new Vector2 - * @return {clay.Vector2} - */ - clone: function() { - return new Vector2(this.x, this.y); - }, - - /** - * Copy x, y from b - * @param {clay.Vector2} b - * @return {clay.Vector2} - */ - copy: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].copy(this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Cross product of self and b, written to a Vector3 out - * @param {clay.Vector3} out - * @param {clay.Vector2} b - * @return {clay.Vector2} - */ - cross: function(out, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].cross(out.array, this.array, b.array); - out._dirty = true; - return this; - }, - - /** - * Alias for distance - * @param {clay.Vector2} b - * @return {number} - */ - dist: function(b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].dist(this.array, b.array); - }, - - /** - * Distance between self and b - * @param {clay.Vector2} b - * @return {number} - */ - distance: function(b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].distance(this.array, b.array); - }, - - /** - * Alias for divide - * @param {clay.Vector2} b - * @return {clay.Vector2} - */ - div: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].div(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Divide self by b - * @param {clay.Vector2} b - * @return {clay.Vector2} - */ - divide: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].divide(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Dot product of self and b - * @param {clay.Vector2} b - * @return {number} - */ - dot: function(b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].dot(this.array, b.array); - }, - - /** - * Alias of length - * @return {number} - */ - len: function() { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].len(this.array); - }, - - /** - * Calculate the length - * @return {number} - */ - length: function() { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].length(this.array); - }, - - /** - * Linear interpolation between a and b - * @param {clay.Vector2} a - * @param {clay.Vector2} b - * @param {number} t - * @return {clay.Vector2} - */ - lerp: function(a, b, t) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].lerp(this.array, a.array, b.array, t); - this._dirty = true; - return this; - }, - - /** - * Minimum of self and b - * @param {clay.Vector2} b - * @return {clay.Vector2} - */ - min: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].min(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Maximum of self and b - * @param {clay.Vector2} b - * @return {clay.Vector2} - */ - max: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].max(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Alias for multiply - * @param {clay.Vector2} b - * @return {clay.Vector2} - */ - mul: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].mul(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Mutiply self and b - * @param {clay.Vector2} b - * @return {clay.Vector2} - */ - multiply: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].multiply(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Negate self - * @return {clay.Vector2} - */ - negate: function() { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].negate(this.array, this.array); - this._dirty = true; - return this; - }, - - /** - * Normalize self - * @return {clay.Vector2} - */ - normalize: function() { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].normalize(this.array, this.array); - this._dirty = true; - return this; - }, - - /** - * Generate random x, y components with a given scale - * @param {number} scale - * @return {clay.Vector2} - */ - random: function(scale) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].random(this.array, scale); - this._dirty = true; - return this; - }, - - /** - * Scale self - * @param {number} scale - * @return {clay.Vector2} - */ - scale: function(s) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].scale(this.array, this.array, s); - this._dirty = true; - return this; - }, - - /** - * Scale b and add to self - * @param {clay.Vector2} b - * @param {number} scale - * @return {clay.Vector2} - */ - scaleAndAdd: function(b, s) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].scaleAndAdd(this.array, this.array, b.array, s); - this._dirty = true; - return this; - }, - - /** - * Alias for squaredDistance - * @param {clay.Vector2} b - * @return {number} - */ - sqrDist: function(b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].sqrDist(this.array, b.array); - }, - - /** - * Squared distance between self and b - * @param {clay.Vector2} b - * @return {number} - */ - squaredDistance: function(b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].squaredDistance(this.array, b.array); - }, - - /** - * Alias for squaredLength - * @return {number} - */ - sqrLen: function() { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].sqrLen(this.array); - }, - - /** - * Squared length of self - * @return {number} - */ - squaredLength: function() { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].squaredLength(this.array); - }, - - /** - * Alias for subtract - * @param {clay.Vector2} b - * @return {clay.Vector2} - */ - sub: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].sub(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Subtract b from self - * @param {clay.Vector2} b - * @return {clay.Vector2} - */ - subtract: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].subtract(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Transform self with a Matrix2 m - * @param {clay.Matrix2} m - * @return {clay.Vector2} - */ - transformMat2: function(m) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].transformMat2(this.array, this.array, m.array); - this._dirty = true; - return this; - }, - - /** - * Transform self with a Matrix2d m - * @param {clay.Matrix2d} m - * @return {clay.Vector2} - */ - transformMat2d: function(m) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].transformMat2d(this.array, this.array, m.array); - this._dirty = true; - return this; - }, - - /** - * Transform self with a Matrix3 m - * @param {clay.Matrix3} m - * @return {clay.Vector2} - */ - transformMat3: function(m) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].transformMat3(this.array, this.array, m.array); - this._dirty = true; - return this; - }, - - /** - * Transform self with a Matrix4 m - * @param {clay.Matrix4} m - * @return {clay.Vector2} - */ - transformMat4: function(m) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].transformMat4(this.array, this.array, m.array); - this._dirty = true; - return this; - }, - - toString: function() { - return '[' + Array.prototype.join.call(this.array, ',') + ']'; - }, - - toArray: function () { - return Array.prototype.slice.call(this.array); - } -}; - -// Getter and Setter -if (Object.defineProperty) { - - var proto = Vector2.prototype; - /** - * @name x - * @type {number} - * @memberOf clay.Vector2 - * @instance - */ - Object.defineProperty(proto, 'x', { - get: function () { - return this.array[0]; - }, - set: function (value) { - this.array[0] = value; - this._dirty = true; - } - }); - - /** - * @name y - * @type {number} - * @memberOf clay.Vector2 - * @instance - */ - Object.defineProperty(proto, 'y', { - get: function () { - return this.array[1]; - }, - set: function (value) { - this.array[1] = value; - this._dirty = true; - } - }); -} - -// Supply methods that are not in place - -/** - * @param {clay.Vector2} out - * @param {clay.Vector2} a - * @param {clay.Vector2} b - * @return {clay.Vector2} - */ -Vector2.add = function(out, a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].add(out.array, a.array, b.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Vector2} out - * @param {number} x - * @param {number} y - * @return {clay.Vector2} - */ -Vector2.set = function(out, x, y) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].set(out.array, x, y); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Vector2} out - * @param {clay.Vector2} b - * @return {clay.Vector2} - */ -Vector2.copy = function(out, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].copy(out.array, b.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Vector3} out - * @param {clay.Vector2} a - * @param {clay.Vector2} b - * @return {clay.Vector2} - */ -Vector2.cross = function(out, a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].cross(out.array, a.array, b.array); - out._dirty = true; - return out; -}; -/** - * @param {clay.Vector2} a - * @param {clay.Vector2} b - * @return {number} - */ -Vector2.dist = function(a, b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].distance(a.array, b.array); -}; -/** - * @function - * @param {clay.Vector2} a - * @param {clay.Vector2} b - * @return {number} - */ -Vector2.distance = Vector2.dist; -/** - * @param {clay.Vector2} out - * @param {clay.Vector2} a - * @param {clay.Vector2} b - * @return {clay.Vector2} - */ -Vector2.div = function(out, a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].divide(out.array, a.array, b.array); - out._dirty = true; - return out; -}; -/** - * @function - * @param {clay.Vector2} out - * @param {clay.Vector2} a - * @param {clay.Vector2} b - * @return {clay.Vector2} - */ -Vector2.divide = Vector2.div; -/** - * @param {clay.Vector2} a - * @param {clay.Vector2} b - * @return {number} - */ -Vector2.dot = function(a, b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].dot(a.array, b.array); -}; - -/** - * @param {clay.Vector2} a - * @return {number} - */ -Vector2.len = function(b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].length(b.array); -}; - -// Vector2.length = Vector2.len; - -/** - * @param {clay.Vector2} out - * @param {clay.Vector2} a - * @param {clay.Vector2} b - * @param {number} t - * @return {clay.Vector2} - */ -Vector2.lerp = function(out, a, b, t) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].lerp(out.array, a.array, b.array, t); - out._dirty = true; - return out; -}; -/** - * @param {clay.Vector2} out - * @param {clay.Vector2} a - * @param {clay.Vector2} b - * @return {clay.Vector2} - */ -Vector2.min = function(out, a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].min(out.array, a.array, b.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Vector2} out - * @param {clay.Vector2} a - * @param {clay.Vector2} b - * @return {clay.Vector2} - */ -Vector2.max = function(out, a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].max(out.array, a.array, b.array); - out._dirty = true; - return out; -}; -/** - * @param {clay.Vector2} out - * @param {clay.Vector2} a - * @param {clay.Vector2} b - * @return {clay.Vector2} - */ -Vector2.mul = function(out, a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].multiply(out.array, a.array, b.array); - out._dirty = true; - return out; -}; -/** - * @function - * @param {clay.Vector2} out - * @param {clay.Vector2} a - * @param {clay.Vector2} b - * @return {clay.Vector2} - */ -Vector2.multiply = Vector2.mul; -/** - * @param {clay.Vector2} out - * @param {clay.Vector2} a - * @return {clay.Vector2} - */ -Vector2.negate = function(out, a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].negate(out.array, a.array); - out._dirty = true; - return out; -}; -/** - * @param {clay.Vector2} out - * @param {clay.Vector2} a - * @return {clay.Vector2} - */ -Vector2.normalize = function(out, a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].normalize(out.array, a.array); - out._dirty = true; - return out; -}; -/** - * @param {clay.Vector2} out - * @param {number} scale - * @return {clay.Vector2} - */ -Vector2.random = function(out, scale) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].random(out.array, scale); - out._dirty = true; - return out; -}; -/** - * @param {clay.Vector2} out - * @param {clay.Vector2} a - * @param {number} scale - * @return {clay.Vector2} - */ -Vector2.scale = function(out, a, scale) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].scale(out.array, a.array, scale); - out._dirty = true; - return out; -}; -/** - * @param {clay.Vector2} out - * @param {clay.Vector2} a - * @param {clay.Vector2} b - * @param {number} scale - * @return {clay.Vector2} - */ -Vector2.scaleAndAdd = function(out, a, b, scale) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].scaleAndAdd(out.array, a.array, b.array, scale); - out._dirty = true; - return out; -}; -/** - * @param {clay.Vector2} a - * @param {clay.Vector2} b - * @return {number} - */ -Vector2.sqrDist = function(a, b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].sqrDist(a.array, b.array); -}; -/** - * @function - * @param {clay.Vector2} a - * @param {clay.Vector2} b - * @return {number} - */ -Vector2.squaredDistance = Vector2.sqrDist; - -/** - * @param {clay.Vector2} a - * @return {number} - */ -Vector2.sqrLen = function(a) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].sqrLen(a.array); -}; -/** - * @function - * @param {clay.Vector2} a - * @return {number} - */ -Vector2.squaredLength = Vector2.sqrLen; - -/** - * @param {clay.Vector2} out - * @param {clay.Vector2} a - * @param {clay.Vector2} b - * @return {clay.Vector2} - */ -Vector2.sub = function(out, a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].subtract(out.array, a.array, b.array); - out._dirty = true; - return out; -}; -/** - * @function - * @param {clay.Vector2} out - * @param {clay.Vector2} a - * @param {clay.Vector2} b - * @return {clay.Vector2} - */ -Vector2.subtract = Vector2.sub; -/** - * @param {clay.Vector2} out - * @param {clay.Vector2} a - * @param {clay.Matrix2} m - * @return {clay.Vector2} - */ -Vector2.transformMat2 = function(out, a, m) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].transformMat2(out.array, a.array, m.array); - out._dirty = true; - return out; -}; -/** - * @param {clay.Vector2} out - * @param {clay.Vector2} a - * @param {clay.Matrix2d} m - * @return {clay.Vector2} - */ -Vector2.transformMat2d = function(out, a, m) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].transformMat2d(out.array, a.array, m.array); - out._dirty = true; - return out; -}; -/** - * @param {clay.Vector2} out - * @param {clay.Vector2} a - * @param {Matrix3} m - * @return {clay.Vector2} - */ -Vector2.transformMat3 = function(out, a, m) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].transformMat3(out.array, a.array, m.array); - out._dirty = true; - return out; -}; -/** - * @param {clay.Vector2} out - * @param {clay.Vector2} a - * @param {clay.Matrix4} m - * @return {clay.Vector2} - */ -Vector2.transformMat4 = function(out, a, m) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec2__["a" /* default */].transformMat4(out.array, a.array, m.array); - out._dirty = true; - return out; -}; - -/* harmony default export */ __webpack_exports__["a"] = (Vector2); - - -/***/ }), -/* 27 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Texture__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__core_glenum__ = __webpack_require__(11); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__core_util__ = __webpack_require__(23); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__math_util__ = __webpack_require__(73); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__core_vendor__ = __webpack_require__(14); - - - - - -var isPowerOfTwo = __WEBPACK_IMPORTED_MODULE_3__math_util__["a" /* default */].isPowerOfTwo; - -var targetList = ['px', 'nx', 'py', 'ny', 'pz', 'nz']; - -/** - * @constructor clay.TextureCube - * @extends clay.Texture - * - * @example - * ... - * var mat = new clay.Material({ - * shader: clay.shader.library.get('clay.phong', 'environmentMap') - * }); - * var envMap = new clay.TextureCube(); - * envMap.load({ - * 'px': 'assets/textures/sky/px.jpg', - * 'nx': 'assets/textures/sky/nx.jpg' - * 'py': 'assets/textures/sky/py.jpg' - * 'ny': 'assets/textures/sky/ny.jpg' - * 'pz': 'assets/textures/sky/pz.jpg' - * 'nz': 'assets/textures/sky/nz.jpg' - * }); - * mat.set('environmentMap', envMap); - * ... - * envMap.success(function () { - * // Wait for the sky texture loaded - * animation.on('frame', function (frameTime) { - * renderer.render(scene, camera); - * }); - * }); - */ -var TextureCube = __WEBPACK_IMPORTED_MODULE_0__Texture__["a" /* default */].extend(function () { - return /** @lends clay.TextureCube# */{ - - /** - * @type {boolean} - * @default false - */ - // PENDING cubemap should not flipY in default. - // flipY: false, - - /** - * @type {Object} - * @property {?HTMLImageElement|HTMLCanvasElemnet} px - * @property {?HTMLImageElement|HTMLCanvasElemnet} nx - * @property {?HTMLImageElement|HTMLCanvasElemnet} py - * @property {?HTMLImageElement|HTMLCanvasElemnet} ny - * @property {?HTMLImageElement|HTMLCanvasElemnet} pz - * @property {?HTMLImageElement|HTMLCanvasElemnet} nz - */ - image: { - px: null, - nx: null, - py: null, - ny: null, - pz: null, - nz: null - }, - /** - * Pixels data of each side. Will be ignored if images are set. - * @type {Object} - * @property {?Uint8Array} px - * @property {?Uint8Array} nx - * @property {?Uint8Array} py - * @property {?Uint8Array} ny - * @property {?Uint8Array} pz - * @property {?Uint8Array} nz - */ - pixels: { - px: null, - nx: null, - py: null, - ny: null, - pz: null, - nz: null - }, - - /** - * @type {Array.} - */ - mipmaps: [] - }; -}, { - - textureType: 'textureCube', - - update: function (renderer) { - var _gl = renderer.gl; - _gl.bindTexture(_gl.TEXTURE_CUBE_MAP, this._cache.get('webgl_texture')); - - this.updateCommon(renderer); - - var glFormat = this.format; - var glType = this.type; - - _gl.texParameteri(_gl.TEXTURE_CUBE_MAP, _gl.TEXTURE_WRAP_S, this.getAvailableWrapS()); - _gl.texParameteri(_gl.TEXTURE_CUBE_MAP, _gl.TEXTURE_WRAP_T, this.getAvailableWrapT()); - - _gl.texParameteri(_gl.TEXTURE_CUBE_MAP, _gl.TEXTURE_MAG_FILTER, this.getAvailableMagFilter()); - _gl.texParameteri(_gl.TEXTURE_CUBE_MAP, _gl.TEXTURE_MIN_FILTER, this.getAvailableMinFilter()); - - var anisotropicExt = renderer.getGLExtension('EXT_texture_filter_anisotropic'); - if (anisotropicExt && this.anisotropic > 1) { - _gl.texParameterf(_gl.TEXTURE_CUBE_MAP, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, this.anisotropic); - } - - // Fallback to float type if browser don't have half float extension - if (glType === 36193) { - var halfFloatExt = renderer.getGLExtension('OES_texture_half_float'); - if (!halfFloatExt) { - glType = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].FLOAT; - } - } - - if (this.mipmaps.length) { - var width = this.width; - var height = this.height; - for (var i = 0; i < this.mipmaps.length; i++) { - var mipmap = this.mipmaps[i]; - this._updateTextureData(_gl, mipmap, i, width, height, glFormat, glType); - width /= 2; - height /= 2; - } - } - else { - this._updateTextureData(_gl, this, 0, this.width, this.height, glFormat, glType); - - if (!this.NPOT && this.useMipmap) { - _gl.generateMipmap(_gl.TEXTURE_CUBE_MAP); - } - } - - _gl.bindTexture(_gl.TEXTURE_CUBE_MAP, null); - }, - - _updateTextureData: function (_gl, data, level, width, height, glFormat, glType) { - for (var i = 0; i < 6; i++) { - var target = targetList[i]; - var img = data.image && data.image[target]; - if (img) { - _gl.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, level, glFormat, glFormat, glType, img); - } - else { - _gl.texImage2D(_gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, level, glFormat, width, height, 0, glFormat, glType, data.pixels && data.pixels[target]); - } - } - }, - - /** - * @param {clay.Renderer} renderer - * @memberOf clay.TextureCube.prototype - */ - generateMipmap: function (renderer) { - var _gl = renderer.gl; - if (this.useMipmap && !this.NPOT) { - _gl.bindTexture(_gl.TEXTURE_CUBE_MAP, this._cache.get('webgl_texture')); - _gl.generateMipmap(_gl.TEXTURE_CUBE_MAP); - } - }, - - bind: function (renderer) { - renderer.gl.bindTexture(renderer.gl.TEXTURE_CUBE_MAP, this.getWebGLTexture(renderer)); - }, - - unbind: function (renderer) { - renderer.gl.bindTexture(renderer.gl.TEXTURE_CUBE_MAP, null); - }, - - // Overwrite the isPowerOfTwo method - isPowerOfTwo: function () { - if (this.image.px) { - return isPowerOfTwo(this.image.px.width) - && isPowerOfTwo(this.image.px.height); - } - else { - return isPowerOfTwo(this.width) - && isPowerOfTwo(this.height); - } - }, - - isRenderable: function () { - if (this.image.px) { - return isImageRenderable(this.image.px) - && isImageRenderable(this.image.nx) - && isImageRenderable(this.image.py) - && isImageRenderable(this.image.ny) - && isImageRenderable(this.image.pz) - && isImageRenderable(this.image.nz); - } - else { - return !!(this.width && this.height); - } - }, - - load: function (imageList, crossOrigin) { - var loading = 0; - var self = this; - __WEBPACK_IMPORTED_MODULE_2__core_util__["a" /* default */].each(imageList, function (src, target){ - var image = __WEBPACK_IMPORTED_MODULE_4__core_vendor__["a" /* default */].createImage(); - if (crossOrigin) { - image.crossOrigin = crossOrigin; - } - image.onload = function () { - loading --; - if (loading === 0){ - self.dirty(); - self.trigger('success', self); - } - image.onload = null; - }; - image.onerror = function () { - loading --; - image.onerror = null; - }; - - loading++; - image.src = src; - self.image[target] = image; - }); - - return this; - } -}); - -Object.defineProperty(TextureCube.prototype, 'width', { - get: function () { - if (this.image && this.image.px) { - return this.image.px.width; - } - return this._width; - }, - set: function (value) { - if (this.image && this.image.px) { - console.warn('Texture from image can\'t set width'); - } - else { - if (this._width !== value) { - this.dirty(); - } - this._width = value; - } - } -}); -Object.defineProperty(TextureCube.prototype, 'height', { - get: function () { - if (this.image && this.image.px) { - return this.image.px.height; - } - return this._height; - }, - set: function (value) { - if (this.image && this.image.px) { - console.warn('Texture from image can\'t set height'); - } - else { - if (this._height !== value) { - this.dirty(); - } - this._height = value; - } - } -}); -function isImageRenderable(image) { - return image.nodeName === 'CANVAS' || - image.nodeName === 'VIDEO' || - image.complete; -} - -/* harmony default export */ __webpack_exports__["a"] = (TextureCube); - - -/***/ }), -/* 28 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ({ - defaultOption: { - // Post effect - postEffect: { - enable: false, - - bloom: { - enable: true, - intensity: 0.1 - }, - depthOfField: { - enable: false, - focalRange: 20, - focalDistance: 50, - blurRadius: 10, - fstop: 2.8, - quality: 'medium' - }, - - screenSpaceAmbientOcclusion: { - enable: false, - radius: 2, - // low, medium, high, ultra - quality: 'medium', - intensity: 1 - }, - - screenSpaceReflection: { - enable: false, - quality: 'medium', - maxRoughness: 0.8 - }, - - colorCorrection: { - enable: true, - - exposure: 0, - - brightness: 0, - - contrast: 1, - - saturation: 1, - - lookupTexture: '' - }, - - edge: { - enable: false - }, - - FXAA: { - enable: false - } - }, - - // Temporal super sampling when the picture is still. - temporalSuperSampling: { - // Only enabled when postEffect is enabled - enable: 'auto' - } - } -}); - -/***/ }), -/* 29 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ({ - defaultOption: { - // Light is available when material.shading is not color - light: { - // Main light - main: { - shadow: false, - // low, medium, high, ultra - shadowQuality: 'high', - - color: '#fff', - intensity: 1, - - alpha: 0, - beta: 0 - }, - ambient: { - color: '#fff', - intensity: 0.2 - }, - ambientCubemap: { - // Panorama environment texture, - // Support .hdr and commmon web formats. - texture: null, - // Available when texture is hdr. - exposure: 1, - // Intensity for diffuse term - diffuseIntensity: 0.5, - // Intensity for specular term, only available when shading is realastic - specularIntensity: 0.5 - } - } - } -}); - -/***/ }), -/* 30 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_graphicGL__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_claygl_src_plugin_Skybox__ = __webpack_require__(42); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_echarts_lib_echarts__); - - - - -function SceneHelper() { -} - -SceneHelper.prototype = { - constructor: SceneHelper, - - setScene: function (scene) { - this._scene = scene; - - if (this._skybox) { - this._skybox.attachScene(this._scene); - } - }, - - initLight: function (rootNode) { - this._lightRoot = rootNode; - /** - * @type {clay.light.Directional} - */ - this.mainLight = new __WEBPACK_IMPORTED_MODULE_0__util_graphicGL__["a" /* default */].DirectionalLight({ - shadowBias: 0.005 - }); - - /** - * @type {clay.light.Ambient} - */ - this.ambientLight = new __WEBPACK_IMPORTED_MODULE_0__util_graphicGL__["a" /* default */].AmbientLight(); - - rootNode.add(this.mainLight); - rootNode.add(this.ambientLight); - }, - - dispose: function () { - if (this._lightRoot) { - this._lightRoot.remove(this.mainLight); - this._lightRoot.remove(this.ambientLight); - } - }, - - updateLight: function (componentModel) { - - var mainLight = this.mainLight; - var ambientLight = this.ambientLight; - - var lightModel = componentModel.getModel('light'); - var mainLightModel = lightModel.getModel('main'); - var ambientLightModel = lightModel.getModel('ambient'); - - mainLight.intensity = mainLightModel.get('intensity'); - ambientLight.intensity = ambientLightModel.get('intensity'); - mainLight.color = __WEBPACK_IMPORTED_MODULE_0__util_graphicGL__["a" /* default */].parseColor(mainLightModel.get('color')).slice(0, 3); - ambientLight.color = __WEBPACK_IMPORTED_MODULE_0__util_graphicGL__["a" /* default */].parseColor(ambientLightModel.get('color')).slice(0, 3); - - var alpha = mainLightModel.get('alpha') || 0; - var beta = mainLightModel.get('beta') || 0; - mainLight.position.setArray(__WEBPACK_IMPORTED_MODULE_0__util_graphicGL__["a" /* default */].directionFromAlphaBeta(alpha, beta)); - mainLight.lookAt(__WEBPACK_IMPORTED_MODULE_0__util_graphicGL__["a" /* default */].Vector3.ZERO); - - mainLight.castShadow = mainLightModel.get('shadow'); - mainLight.shadowResolution = __WEBPACK_IMPORTED_MODULE_0__util_graphicGL__["a" /* default */].getShadowResolution(mainLightModel.get('shadowQuality')); - }, - - updateAmbientCubemap: function (renderer, componentModel, api) { - var ambientCubemapModel = componentModel.getModel('light.ambientCubemap'); - - var textureUrl = ambientCubemapModel.get('texture'); - if (textureUrl) { - this._cubemapLightsCache = this._cubemapLightsCache || {}; - var lights = this._cubemapLightsCache[textureUrl]; - if (!lights) { - var self = this; - lights = this._cubemapLightsCache[textureUrl] - = __WEBPACK_IMPORTED_MODULE_0__util_graphicGL__["a" /* default */].createAmbientCubemap(ambientCubemapModel.option, renderer, api, function () { - // Use prefitered cubemap - if (self._isSkyboxFromAmbientCubemap) { - self._skybox.setEnvironmentMap(lights.specular.cubemap); - } - - api.getZr().refresh(); - }); - } - this._lightRoot.add(lights.diffuse); - this._lightRoot.add(lights.specular); - - this._currentCubemapLights = lights; - } - else if (this._currentCubemapLights) { - this._lightRoot.remove(this._currentCubemapLights.diffuse); - this._lightRoot.remove(this._currentCubemapLights.specular); - this._currentCubemapLights = null; - } - }, - - updateSkybox: function (renderer, componentModel, api) { - var environmentUrl = componentModel.get('environment'); - - var self = this; - function getSkybox() { - self._skybox = self._skybox || new __WEBPACK_IMPORTED_MODULE_1_claygl_src_plugin_Skybox__["a" /* default */](); - return self._skybox; - } - - var skybox = getSkybox(); - if (environmentUrl && environmentUrl !== 'none') { - if (environmentUrl === 'auto') { - this._isSkyboxFromAmbientCubemap = true; - // Use environment in ambient cubemap - if (this._currentCubemapLights) { - var cubemap = this._currentCubemapLights.specular.cubemap; - skybox.setEnvironmentMap(cubemap); - if (this._scene) { - skybox.attachScene(this._scene); - } - skybox.material.set('lod', 3); - } - else if (this._skybox) { - this._skybox.detachScene(); - } - } - // Is gradient or color string - else if ((typeof environmentUrl === 'object' && environmentUrl.colorStops) - || (typeof environmentUrl === 'string' && __WEBPACK_IMPORTED_MODULE_2_echarts_lib_echarts___default.a.color.parse(environmentUrl)) - ) { - this._isSkyboxFromAmbientCubemap = false; - var texture = new __WEBPACK_IMPORTED_MODULE_0__util_graphicGL__["a" /* default */].Texture2D({ - anisotropic: 8, - flipY: false - }); - skybox.setEnvironmentMap(texture); - var canvas = texture.image = document.createElement('canvas'); - canvas.width = canvas.height = 16; - var ctx = canvas.getContext('2d'); - var rect = new __WEBPACK_IMPORTED_MODULE_2_echarts_lib_echarts___default.a.graphic.Rect({ - shape: { x: 0, y: 0, width: 16, height: 16 }, - style: { fill: environmentUrl } - }); - rect.brush(ctx); - - skybox.attachScene(this._scene); - } - else { - this._isSkyboxFromAmbientCubemap = false; - // Panorama - var texture = __WEBPACK_IMPORTED_MODULE_0__util_graphicGL__["a" /* default */].loadTexture(environmentUrl, api, { - anisotropic: 8, - flipY: false - }); - skybox.setEnvironmentMap(texture); - - skybox.attachScene(this._scene); - } - } - else { - if (this._skybox) { - this._skybox.detachScene(this._scene); - } - this._skybox = null; - } - - var coordSys = componentModel.coordinateSystem; - if (this._skybox) { - if (coordSys && coordSys.viewGL - && environmentUrl !== 'auto' - && !(environmentUrl.match && environmentUrl.match(/.hdr$/)) - ) { - var srgbDefineMethod = coordSys.viewGL.isLinearSpace() ? 'define' : 'undefine'; - this._skybox.material[srgbDefineMethod]('fragment', 'SRGB_DECODE'); - } - else { - this._skybox.material.undefine('fragment', 'SRGB_DECODE'); - } - // var ambientCubemapUrl = environmentUrl === 'auto' - // ? componentModel.get('light.ambientCubemap.texture') - // : environmentUrl; - } - } -}; - -/* harmony default export */ __webpack_exports__["a"] = (SceneHelper); - -/***/ }), -/* 31 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ({ - defaultOption: { - shading: null, - - realisticMaterial: { - textureTiling: 1, - textureOffset: 0, - - detailTexture: null - }, - - lambertMaterial: { - textureTiling: 1, - textureOffset: 0, - - detailTexture: null - }, - - colorMaterial: { - textureTiling: 1, - textureOffset: 0, - - detailTexture: null - }, - - hatchingMaterial: { - textureTiling: 1, - textureOffset: 0, - - paperColor: '#fff' - } - } -}); - -/***/ }), -/* 32 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); - - -var formatUtil = {}; -formatUtil.getFormattedLabel = function (seriesModel, dataIndex, status, dataType, dimIndex) { - status = status || 'normal'; - var data = seriesModel.getData(dataType); - var itemModel = data.getItemModel(dataIndex); - - var params = seriesModel.getDataParams(dataIndex, dataType); - if (dimIndex != null && (params.value instanceof Array)) { - params.value = params.value[dimIndex]; - } - - var formatter = itemModel.get(status === 'normal' ? ['label', 'formatter'] : ['emphasis', 'label', 'formatter']); - if (formatter == null) { - formatter = itemModel.get(['label', 'formatter']); - } - var text; - if (typeof formatter === 'function') { - params.status = status; - text = formatter(params); - } - else if (typeof formatter === 'string') { - text = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.format.formatTpl(formatter, params); - } - return text; -}; - -/** - * If value is not array, then convert it to array. - * @param {*} value - * @return {Array} [value] or value - */ -formatUtil.normalizeToArray = function (value) { - return value instanceof Array - ? value - : value == null - ? [] - : [value]; -}; - -/* harmony default export */ __webpack_exports__["a"] = (formatUtil); - -/***/ }), -/* 33 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* unused harmony export vec4 */ -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__common__ = __webpack_require__(20); - -/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - - -/** - * @class 4 Dimensional Vector - * @name vec4 - */ - -var vec4 = {}; - -/** - * Creates a new, empty vec4 - * - * @returns {vec4} a new 4D vector - */ -vec4.create = function() { - var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" /* GLMAT_ARRAY_TYPE */](4); - out[0] = 0; - out[1] = 0; - out[2] = 0; - out[3] = 0; - return out; -}; - -/** - * Creates a new vec4 initialized with values from an existing vector - * - * @param {vec4} a vector to clone - * @returns {vec4} a new 4D vector - */ -vec4.clone = function(a) { - var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" /* GLMAT_ARRAY_TYPE */](4); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - return out; -}; - -/** - * Creates a new vec4 initialized with the given values - * - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @param {Number} w W component - * @returns {vec4} a new 4D vector - */ -vec4.fromValues = function(x, y, z, w) { - var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" /* GLMAT_ARRAY_TYPE */](4); - out[0] = x; - out[1] = y; - out[2] = z; - out[3] = w; - return out; -}; - -/** - * Copy the values from one vec4 to another - * - * @param {vec4} out the receiving vector - * @param {vec4} a the source vector - * @returns {vec4} out - */ -vec4.copy = function(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - return out; -}; - -/** - * Set the components of a vec4 to the given values - * - * @param {vec4} out the receiving vector - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @param {Number} w W component - * @returns {vec4} out - */ -vec4.set = function(out, x, y, z, w) { - out[0] = x; - out[1] = y; - out[2] = z; - out[3] = w; - return out; -}; - -/** - * Adds two vec4's - * - * @param {vec4} out the receiving vector - * @param {vec4} a the first operand - * @param {vec4} b the second operand - * @returns {vec4} out - */ -vec4.add = function(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - out[2] = a[2] + b[2]; - out[3] = a[3] + b[3]; - return out; -}; - -/** - * Subtracts vector b from vector a - * - * @param {vec4} out the receiving vector - * @param {vec4} a the first operand - * @param {vec4} b the second operand - * @returns {vec4} out - */ -vec4.subtract = function(out, a, b) { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - out[2] = a[2] - b[2]; - out[3] = a[3] - b[3]; - return out; -}; - -/** - * Alias for {@link vec4.subtract} - * @function - */ -vec4.sub = vec4.subtract; - -/** - * Multiplies two vec4's - * - * @param {vec4} out the receiving vector - * @param {vec4} a the first operand - * @param {vec4} b the second operand - * @returns {vec4} out - */ -vec4.multiply = function(out, a, b) { - out[0] = a[0] * b[0]; - out[1] = a[1] * b[1]; - out[2] = a[2] * b[2]; - out[3] = a[3] * b[3]; - return out; -}; - -/** - * Alias for {@link vec4.multiply} - * @function - */ -vec4.mul = vec4.multiply; - -/** - * Divides two vec4's - * - * @param {vec4} out the receiving vector - * @param {vec4} a the first operand - * @param {vec4} b the second operand - * @returns {vec4} out - */ -vec4.divide = function(out, a, b) { - out[0] = a[0] / b[0]; - out[1] = a[1] / b[1]; - out[2] = a[2] / b[2]; - out[3] = a[3] / b[3]; - return out; -}; - -/** - * Alias for {@link vec4.divide} - * @function - */ -vec4.div = vec4.divide; - -/** - * Returns the minimum of two vec4's - * - * @param {vec4} out the receiving vector - * @param {vec4} a the first operand - * @param {vec4} b the second operand - * @returns {vec4} out - */ -vec4.min = function(out, a, b) { - out[0] = Math.min(a[0], b[0]); - out[1] = Math.min(a[1], b[1]); - out[2] = Math.min(a[2], b[2]); - out[3] = Math.min(a[3], b[3]); - return out; -}; - -/** - * Returns the maximum of two vec4's - * - * @param {vec4} out the receiving vector - * @param {vec4} a the first operand - * @param {vec4} b the second operand - * @returns {vec4} out - */ -vec4.max = function(out, a, b) { - out[0] = Math.max(a[0], b[0]); - out[1] = Math.max(a[1], b[1]); - out[2] = Math.max(a[2], b[2]); - out[3] = Math.max(a[3], b[3]); - return out; -}; - -/** - * Scales a vec4 by a scalar number - * - * @param {vec4} out the receiving vector - * @param {vec4} a the vector to scale - * @param {Number} b amount to scale the vector by - * @returns {vec4} out - */ -vec4.scale = function(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - out[2] = a[2] * b; - out[3] = a[3] * b; - return out; -}; - -/** - * Adds two vec4's after scaling the second operand by a scalar value - * - * @param {vec4} out the receiving vector - * @param {vec4} a the first operand - * @param {vec4} b the second operand - * @param {Number} scale the amount to scale b by before adding - * @returns {vec4} out - */ -vec4.scaleAndAdd = function(out, a, b, scale) { - out[0] = a[0] + (b[0] * scale); - out[1] = a[1] + (b[1] * scale); - out[2] = a[2] + (b[2] * scale); - out[3] = a[3] + (b[3] * scale); - return out; -}; - -/** - * Calculates the euclidian distance between two vec4's - * - * @param {vec4} a the first operand - * @param {vec4} b the second operand - * @returns {Number} distance between a and b - */ -vec4.distance = function(a, b) { - var x = b[0] - a[0], - y = b[1] - a[1], - z = b[2] - a[2], - w = b[3] - a[3]; - return Math.sqrt(x*x + y*y + z*z + w*w); -}; - -/** - * Alias for {@link vec4.distance} - * @function - */ -vec4.dist = vec4.distance; - -/** - * Calculates the squared euclidian distance between two vec4's - * - * @param {vec4} a the first operand - * @param {vec4} b the second operand - * @returns {Number} squared distance between a and b - */ -vec4.squaredDistance = function(a, b) { - var x = b[0] - a[0], - y = b[1] - a[1], - z = b[2] - a[2], - w = b[3] - a[3]; - return x*x + y*y + z*z + w*w; -}; - -/** - * Alias for {@link vec4.squaredDistance} - * @function - */ -vec4.sqrDist = vec4.squaredDistance; - -/** - * Calculates the length of a vec4 - * - * @param {vec4} a vector to calculate length of - * @returns {Number} length of a - */ -vec4.length = function (a) { - var x = a[0], - y = a[1], - z = a[2], - w = a[3]; - return Math.sqrt(x*x + y*y + z*z + w*w); -}; - -/** - * Alias for {@link vec4.length} - * @function - */ -vec4.len = vec4.length; - -/** - * Calculates the squared length of a vec4 - * - * @param {vec4} a vector to calculate squared length of - * @returns {Number} squared length of a - */ -vec4.squaredLength = function (a) { - var x = a[0], - y = a[1], - z = a[2], - w = a[3]; - return x*x + y*y + z*z + w*w; -}; - -/** - * Alias for {@link vec4.squaredLength} - * @function - */ -vec4.sqrLen = vec4.squaredLength; - -/** - * Negates the components of a vec4 - * - * @param {vec4} out the receiving vector - * @param {vec4} a vector to negate - * @returns {vec4} out - */ -vec4.negate = function(out, a) { - out[0] = -a[0]; - out[1] = -a[1]; - out[2] = -a[2]; - out[3] = -a[3]; - return out; -}; - -/** - * Returns the inverse of the components of a vec4 - * - * @param {vec4} out the receiving vector - * @param {vec4} a vector to invert - * @returns {vec4} out - */ -vec4.inverse = function(out, a) { - out[0] = 1.0 / a[0]; - out[1] = 1.0 / a[1]; - out[2] = 1.0 / a[2]; - out[3] = 1.0 / a[3]; - return out; -}; - -/** - * Normalize a vec4 - * - * @param {vec4} out the receiving vector - * @param {vec4} a vector to normalize - * @returns {vec4} out - */ -vec4.normalize = function(out, a) { - var x = a[0], - y = a[1], - z = a[2], - w = a[3]; - var len = x*x + y*y + z*z + w*w; - if (len > 0) { - len = 1 / Math.sqrt(len); - out[0] = a[0] * len; - out[1] = a[1] * len; - out[2] = a[2] * len; - out[3] = a[3] * len; - } - return out; -}; - -/** - * Calculates the dot product of two vec4's - * - * @param {vec4} a the first operand - * @param {vec4} b the second operand - * @returns {Number} dot product of a and b - */ -vec4.dot = function (a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; -}; - -/** - * Performs a linear interpolation between two vec4's - * - * @param {vec4} out the receiving vector - * @param {vec4} a the first operand - * @param {vec4} b the second operand - * @param {Number} t interpolation amount between the two inputs - * @returns {vec4} out - */ -vec4.lerp = function (out, a, b, t) { - var ax = a[0], - ay = a[1], - az = a[2], - aw = a[3]; - out[0] = ax + t * (b[0] - ax); - out[1] = ay + t * (b[1] - ay); - out[2] = az + t * (b[2] - az); - out[3] = aw + t * (b[3] - aw); - return out; -}; - -/** - * Generates a random vector with the given scale - * - * @param {vec4} out the receiving vector - * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned - * @returns {vec4} out - */ -vec4.random = function (out, scale) { - scale = scale || 1.0; - - //TODO: This is a pretty awful way of doing this. Find something better. - out[0] = Object(__WEBPACK_IMPORTED_MODULE_0__common__["c" /* GLMAT_RANDOM */])(); - out[1] = Object(__WEBPACK_IMPORTED_MODULE_0__common__["c" /* GLMAT_RANDOM */])(); - out[2] = Object(__WEBPACK_IMPORTED_MODULE_0__common__["c" /* GLMAT_RANDOM */])(); - out[3] = Object(__WEBPACK_IMPORTED_MODULE_0__common__["c" /* GLMAT_RANDOM */])(); - vec4.normalize(out, out); - vec4.scale(out, out, scale); - return out; -}; - -/** - * Transforms the vec4 with a mat4. - * - * @param {vec4} out the receiving vector - * @param {vec4} a the vector to transform - * @param {mat4} m matrix to transform with - * @returns {vec4} out - */ -vec4.transformMat4 = function(out, a, m) { - var x = a[0], y = a[1], z = a[2], w = a[3]; - out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w; - out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w; - out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w; - out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w; - return out; -}; - -/** - * Transforms the vec4 with a quat - * - * @param {vec4} out the receiving vector - * @param {vec4} a the vector to transform - * @param {quat} q quaternion to transform with - * @returns {vec4} out - */ -vec4.transformQuat = function(out, a, q) { - var x = a[0], y = a[1], z = a[2], - qx = q[0], qy = q[1], qz = q[2], qw = q[3], - - // calculate quat * vec - ix = qw * x + qy * z - qz * y, - iy = qw * y + qz * x - qx * z, - iz = qw * z + qx * y - qy * x, - iw = -qx * x - qy * y - qz * z; - - // calculate result * inverse quat - out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy; - out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz; - out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx; - return out; -}; - -/** - * Perform some operation over an array of vec4s. - * - * @param {Array} a the array of vectors to iterate over - * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed - * @param {Number} offset Number of elements to skip at the beginning of the array - * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array - * @param {Function} fn Function to call for each vector in the array - * @param {Object} [arg] additional argument to pass to fn - * @returns {Array} a - * @function - */ -vec4.forEach = (function() { - var vec = vec4.create(); - - return function(a, stride, offset, count, fn, arg) { - var i, l; - if(!stride) { - stride = 4; - } - - if(!offset) { - offset = 0; - } - - if(count) { - l = Math.min((count * stride) + offset, a.length); - } else { - l = a.length; - } - - for(i = offset; i < l; i += stride) { - vec[0] = a[i]; vec[1] = a[i+1]; vec[2] = a[i+2]; vec[3] = a[i+3]; - fn(vec, vec, arg); - a[i] = vec[0]; a[i+1] = vec[1]; a[i+2] = vec[2]; a[i+3] = vec[3]; - } - - return a; - }; -})(); - -/* harmony default export */ __webpack_exports__["a"] = (vec4); - -/***/ }), -/* 34 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__common__ = __webpack_require__(20); - -/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - - -/** - * @class 3x3 Matrix - * @name mat3 - */ - -var mat3 = {}; - -/** - * Creates a new identity mat3 - * - * @returns {mat3} a new 3x3 matrix - */ -mat3.create = function() { - var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" /* GLMAT_ARRAY_TYPE */](9); - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 1; - out[5] = 0; - out[6] = 0; - out[7] = 0; - out[8] = 1; - return out; -}; - -/** - * Copies the upper-left 3x3 values into the given mat3. - * - * @param {mat3} out the receiving 3x3 matrix - * @param {mat4} a the source 4x4 matrix - * @returns {mat3} out - */ -mat3.fromMat4 = function(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[4]; - out[4] = a[5]; - out[5] = a[6]; - out[6] = a[8]; - out[7] = a[9]; - out[8] = a[10]; - return out; -}; - -/** - * Creates a new mat3 initialized with values from an existing matrix - * - * @param {mat3} a matrix to clone - * @returns {mat3} a new 3x3 matrix - */ -mat3.clone = function(a) { - var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" /* GLMAT_ARRAY_TYPE */](9); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - return out; -}; - -/** - * Copy the values from one mat3 to another - * - * @param {mat3} out the receiving matrix - * @param {mat3} a the source matrix - * @returns {mat3} out - */ -mat3.copy = function(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - return out; -}; - -/** - * Set a mat3 to the identity matrix - * - * @param {mat3} out the receiving matrix - * @returns {mat3} out - */ -mat3.identity = function(out) { - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 0; - out[4] = 1; - out[5] = 0; - out[6] = 0; - out[7] = 0; - out[8] = 1; - return out; -}; - -/** - * Transpose the values of a mat3 - * - * @param {mat3} out the receiving matrix - * @param {mat3} a the source matrix - * @returns {mat3} out - */ -mat3.transpose = function(out, a) { - // If we are transposing ourselves we can skip a few steps but have to cache some values - if (out === a) { - var a01 = a[1], a02 = a[2], a12 = a[5]; - out[1] = a[3]; - out[2] = a[6]; - out[3] = a01; - out[5] = a[7]; - out[6] = a02; - out[7] = a12; - } else { - out[0] = a[0]; - out[1] = a[3]; - out[2] = a[6]; - out[3] = a[1]; - out[4] = a[4]; - out[5] = a[7]; - out[6] = a[2]; - out[7] = a[5]; - out[8] = a[8]; - } - - return out; -}; - -/** - * Inverts a mat3 - * - * @param {mat3} out the receiving matrix - * @param {mat3} a the source matrix - * @returns {mat3} out - */ -mat3.invert = function(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2], - a10 = a[3], a11 = a[4], a12 = a[5], - a20 = a[6], a21 = a[7], a22 = a[8], - - b01 = a22 * a11 - a12 * a21, - b11 = -a22 * a10 + a12 * a20, - b21 = a21 * a10 - a11 * a20, - - // Calculate the determinant - det = a00 * b01 + a01 * b11 + a02 * b21; - - if (!det) { - return null; - } - det = 1.0 / det; - - out[0] = b01 * det; - out[1] = (-a22 * a01 + a02 * a21) * det; - out[2] = (a12 * a01 - a02 * a11) * det; - out[3] = b11 * det; - out[4] = (a22 * a00 - a02 * a20) * det; - out[5] = (-a12 * a00 + a02 * a10) * det; - out[6] = b21 * det; - out[7] = (-a21 * a00 + a01 * a20) * det; - out[8] = (a11 * a00 - a01 * a10) * det; - return out; -}; - -/** - * Calculates the adjugate of a mat3 - * - * @param {mat3} out the receiving matrix - * @param {mat3} a the source matrix - * @returns {mat3} out - */ -mat3.adjoint = function(out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2], - a10 = a[3], a11 = a[4], a12 = a[5], - a20 = a[6], a21 = a[7], a22 = a[8]; - - out[0] = (a11 * a22 - a12 * a21); - out[1] = (a02 * a21 - a01 * a22); - out[2] = (a01 * a12 - a02 * a11); - out[3] = (a12 * a20 - a10 * a22); - out[4] = (a00 * a22 - a02 * a20); - out[5] = (a02 * a10 - a00 * a12); - out[6] = (a10 * a21 - a11 * a20); - out[7] = (a01 * a20 - a00 * a21); - out[8] = (a00 * a11 - a01 * a10); - return out; -}; - -/** - * Calculates the determinant of a mat3 - * - * @param {mat3} a the source matrix - * @returns {Number} determinant of a - */ -mat3.determinant = function (a) { - var a00 = a[0], a01 = a[1], a02 = a[2], - a10 = a[3], a11 = a[4], a12 = a[5], - a20 = a[6], a21 = a[7], a22 = a[8]; - - return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20); -}; - -/** - * Multiplies two mat3's - * - * @param {mat3} out the receiving matrix - * @param {mat3} a the first operand - * @param {mat3} b the second operand - * @returns {mat3} out - */ -mat3.multiply = function (out, a, b) { - var a00 = a[0], a01 = a[1], a02 = a[2], - a10 = a[3], a11 = a[4], a12 = a[5], - a20 = a[6], a21 = a[7], a22 = a[8], - - b00 = b[0], b01 = b[1], b02 = b[2], - b10 = b[3], b11 = b[4], b12 = b[5], - b20 = b[6], b21 = b[7], b22 = b[8]; - - out[0] = b00 * a00 + b01 * a10 + b02 * a20; - out[1] = b00 * a01 + b01 * a11 + b02 * a21; - out[2] = b00 * a02 + b01 * a12 + b02 * a22; - - out[3] = b10 * a00 + b11 * a10 + b12 * a20; - out[4] = b10 * a01 + b11 * a11 + b12 * a21; - out[5] = b10 * a02 + b11 * a12 + b12 * a22; - - out[6] = b20 * a00 + b21 * a10 + b22 * a20; - out[7] = b20 * a01 + b21 * a11 + b22 * a21; - out[8] = b20 * a02 + b21 * a12 + b22 * a22; - return out; -}; - -/** - * Alias for {@link mat3.multiply} - * @function - */ -mat3.mul = mat3.multiply; - -/** - * Translate a mat3 by the given vector - * - * @param {mat3} out the receiving matrix - * @param {mat3} a the matrix to translate - * @param {vec2} v vector to translate by - * @returns {mat3} out - */ -mat3.translate = function(out, a, v) { - var a00 = a[0], a01 = a[1], a02 = a[2], - a10 = a[3], a11 = a[4], a12 = a[5], - a20 = a[6], a21 = a[7], a22 = a[8], - x = v[0], y = v[1]; - - out[0] = a00; - out[1] = a01; - out[2] = a02; - - out[3] = a10; - out[4] = a11; - out[5] = a12; - - out[6] = x * a00 + y * a10 + a20; - out[7] = x * a01 + y * a11 + a21; - out[8] = x * a02 + y * a12 + a22; - return out; -}; - -/** - * Rotates a mat3 by the given angle - * - * @param {mat3} out the receiving matrix - * @param {mat3} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat3} out - */ -mat3.rotate = function (out, a, rad) { - var a00 = a[0], a01 = a[1], a02 = a[2], - a10 = a[3], a11 = a[4], a12 = a[5], - a20 = a[6], a21 = a[7], a22 = a[8], - - s = Math.sin(rad), - c = Math.cos(rad); - - out[0] = c * a00 + s * a10; - out[1] = c * a01 + s * a11; - out[2] = c * a02 + s * a12; - - out[3] = c * a10 - s * a00; - out[4] = c * a11 - s * a01; - out[5] = c * a12 - s * a02; - - out[6] = a20; - out[7] = a21; - out[8] = a22; - return out; -}; - -/** - * Scales the mat3 by the dimensions in the given vec2 - * - * @param {mat3} out the receiving matrix - * @param {mat3} a the matrix to rotate - * @param {vec2} v the vec2 to scale the matrix by - * @returns {mat3} out - **/ -mat3.scale = function(out, a, v) { - var x = v[0], y = v[1]; - - out[0] = x * a[0]; - out[1] = x * a[1]; - out[2] = x * a[2]; - - out[3] = y * a[3]; - out[4] = y * a[4]; - out[5] = y * a[5]; - - out[6] = a[6]; - out[7] = a[7]; - out[8] = a[8]; - return out; -}; - -/** - * Copies the values from a mat2d into a mat3 - * - * @param {mat3} out the receiving matrix - * @param {mat2d} a the matrix to copy - * @returns {mat3} out - **/ -mat3.fromMat2d = function(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = 0; - - out[3] = a[2]; - out[4] = a[3]; - out[5] = 0; - - out[6] = a[4]; - out[7] = a[5]; - out[8] = 1; - return out; -}; - -/** -* Calculates a 3x3 matrix from the given quaternion -* -* @param {mat3} out mat3 receiving operation result -* @param {quat} q Quaternion to create matrix from -* -* @returns {mat3} out -*/ -mat3.fromQuat = function (out, q) { - var x = q[0], y = q[1], z = q[2], w = q[3], - x2 = x + x, - y2 = y + y, - z2 = z + z, - - xx = x * x2, - yx = y * x2, - yy = y * y2, - zx = z * x2, - zy = z * y2, - zz = z * z2, - wx = w * x2, - wy = w * y2, - wz = w * z2; - - out[0] = 1 - yy - zz; - out[3] = yx - wz; - out[6] = zx + wy; - - out[1] = yx + wz; - out[4] = 1 - xx - zz; - out[7] = zy - wx; - - out[2] = zx - wy; - out[5] = zy + wx; - out[8] = 1 - xx - yy; - - return out; -}; - -/** -* Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix -* -* @param {mat3} out mat3 receiving operation result -* @param {mat4} a Mat4 to derive the normal matrix from -* -* @returns {mat3} out -*/ -mat3.normalFromMat4 = function (out, a) { - var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], - a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], - a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], - a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], - - b00 = a00 * a11 - a01 * a10, - b01 = a00 * a12 - a02 * a10, - b02 = a00 * a13 - a03 * a10, - b03 = a01 * a12 - a02 * a11, - b04 = a01 * a13 - a03 * a11, - b05 = a02 * a13 - a03 * a12, - b06 = a20 * a31 - a21 * a30, - b07 = a20 * a32 - a22 * a30, - b08 = a20 * a33 - a23 * a30, - b09 = a21 * a32 - a22 * a31, - b10 = a21 * a33 - a23 * a31, - b11 = a22 * a33 - a23 * a32, - - // Calculate the determinant - det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; - - if (!det) { - return null; - } - det = 1.0 / det; - - out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; - out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det; - out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det; - - out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det; - out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det; - out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det; - - out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det; - out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det; - out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det; - - return out; -}; - -/** - * Returns Frobenius norm of a mat3 - * - * @param {mat3} a the matrix to calculate Frobenius norm of - * @returns {Number} Frobenius norm - */ -mat3.frob = function (a) { - return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2))) -}; - - -/* harmony default export */ __webpack_exports__["a"] = (mat3); - -/***/ }), -/* 35 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__core_Base__ = __webpack_require__(7); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__math_Vector3__ = __webpack_require__(3); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__math_Quaternion__ = __webpack_require__(56); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__math_Matrix4__ = __webpack_require__(9); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__glmatrix_mat4__ = __webpack_require__(21); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__math_BoundingBox__ = __webpack_require__(18); - - - - - - - -var nameId = 0; - -/** - * @constructor clay.Node - * @extends clay.core.Base - */ -var Node = __WEBPACK_IMPORTED_MODULE_0__core_Base__["a" /* default */].extend(/** @lends clay.Node# */{ - /** - * Scene node name - * @type {string} - */ - name: '', - - /** - * Position relative to its parent node. aka translation. - * @type {clay.Vector3} - */ - position: null, - - /** - * Rotation relative to its parent node. Represented by a quaternion - * @type {clay.Quaternion} - */ - rotation: null, - - /** - * Scale relative to its parent node - * @type {clay.Vector3} - */ - scale: null, - - /** - * Affine transform matrix relative to its root scene. - * @type {clay.Matrix4} - */ - worldTransform: null, - - /** - * Affine transform matrix relative to its parent node. - * Composited with position, rotation and scale. - * @type {clay.Matrix4} - */ - localTransform: null, - - /** - * If the local transform is update from SRT(scale, rotation, translation, which is position here) each frame - * @type {boolean} - */ - autoUpdateLocalTransform: true, - - /** - * Parent of current scene node - * @type {?clay.Node} - * @private - */ - _parent: null, - /** - * The root scene mounted. Null if it is a isolated node - * @type {?clay.Scene} - * @private - */ - _scene: null, - /** - * @type {boolean} - * @private - */ - _needsUpdateWorldTransform: true, - /** - * @type {boolean} - * @private - */ - _inIterating: false, - - // Depth for transparent list sorting - __depth: 0 - -}, function () { - - if (!this.name) { - this.name = (this.type || 'NODE') + '_' + (nameId++); - } - - if (!this.position) { - this.position = new __WEBPACK_IMPORTED_MODULE_1__math_Vector3__["a" /* default */](); - } - if (!this.rotation) { - this.rotation = new __WEBPACK_IMPORTED_MODULE_2__math_Quaternion__["a" /* default */](); - } - if (!this.scale) { - this.scale = new __WEBPACK_IMPORTED_MODULE_1__math_Vector3__["a" /* default */](1, 1, 1); - } - - this.worldTransform = new __WEBPACK_IMPORTED_MODULE_3__math_Matrix4__["a" /* default */](); - this.localTransform = new __WEBPACK_IMPORTED_MODULE_3__math_Matrix4__["a" /* default */](); - - this._children = []; - -}, -/**@lends clay.Node.prototype. */ -{ - - /** - * @type {?clay.Vector3} - * @instance - */ - target: null, - /** - * If node and its chilren invisible - * @type {boolean} - * @instance - */ - invisible: false, - - /** - * If Node is a skinned mesh - * @return {boolean} - */ - isSkinnedMesh: function () { - return false; - }, - /** - * Return true if it is a renderable scene node, like Mesh and ParticleSystem - * @return {boolean} - */ - isRenderable: function () { - return false; - }, - - /** - * Set the name of the scene node - * @param {string} name - */ - setName: function (name) { - var scene = this._scene; - if (scene) { - var nodeRepository = scene._nodeRepository; - delete nodeRepository[this.name]; - nodeRepository[name] = this; - } - this.name = name; - }, - - /** - * Add a child node - * @param {clay.Node} node - */ - add: function (node) { - var originalParent = node._parent; - if (originalParent === this) { - return; - } - if (originalParent) { - originalParent.remove(node); - } - node._parent = this; - this._children.push(node); - - var scene = this._scene; - if (scene && scene !== node.scene) { - node.traverse(this._addSelfToScene, this); - } - // Mark children needs update transform - // In case child are remove and added again after parent moved - node._needsUpdateWorldTransform = true; - }, - - /** - * Remove the given child scene node - * @param {clay.Node} node - */ - remove: function (node) { - var children = this._children; - var idx = children.indexOf(node); - if (idx < 0) { - return; - } - - children.splice(idx, 1); - node._parent = null; - - if (this._scene) { - node.traverse(this._removeSelfFromScene, this); - } - }, - - /** - * Remove all children - */ - removeAll: function () { - var children = this._children; - - for (var idx = 0; idx < children.length; idx++) { - children[idx]._parent = null; - - if (this._scene) { - children[idx].traverse(this._removeSelfFromScene, this); - } - } - - this._children = []; - }, - - /** - * Get the scene mounted - * @return {clay.Scene} - */ - getScene: function () { - return this._scene; - }, - - /** - * Get parent node - * @return {clay.Scene} - */ - getParent: function () { - return this._parent; - }, - - _removeSelfFromScene: function (descendant) { - descendant._scene.removeFromScene(descendant); - descendant._scene = null; - }, - - _addSelfToScene: function (descendant) { - this._scene.addToScene(descendant); - descendant._scene = this._scene; - }, - - /** - * Return true if it is ancestor of the given scene node - * @param {clay.Node} node - */ - isAncestor: function (node) { - var parent = node._parent; - while(parent) { - if (parent === this) { - return true; - } - parent = parent._parent; - } - return false; - }, - - /** - * Get a new created array of all children nodes - * @return {clay.Node[]} - */ - children: function () { - return this._children.slice(); - }, - - /** - * Get child scene node at given index. - * @param {number} idx - * @return {clay.Node} - */ - childAt: function (idx) { - return this._children[idx]; - }, - - /** - * Get first child with the given name - * @param {string} name - * @return {clay.Node} - */ - getChildByName: function (name) { - var children = this._children; - for (var i = 0; i < children.length; i++) { - if (children[i].name === name) { - return children[i]; - } - } - }, - - /** - * Get first descendant have the given name - * @param {string} name - * @return {clay.Node} - */ - getDescendantByName: function (name) { - var children = this._children; - for (var i = 0; i < children.length; i++) { - var child = children[i]; - if (child.name === name) { - return child; - } else { - var res = child.getDescendantByName(name); - if (res) { - return res; - } - } - } - }, - - /** - * Query descendant node by path - * @param {string} path - * @return {clay.Node} - * @example - * node.queryNode('root/parent/child'); - */ - queryNode: function (path) { - if (!path) { - return; - } - // TODO Name have slash ? - var pathArr = path.split('/'); - var current = this; - for (var i = 0; i < pathArr.length; i++) { - var name = pathArr[i]; - // Skip empty - if (!name) { - continue; - } - var found = false; - var children = current._children; - for (var j = 0; j < children.length; j++) { - var child = children[j]; - if (child.name === name) { - current = child; - found = true; - break; - } - } - // Early return if not found - if (!found) { - return; - } - } - - return current; - }, - - /** - * Get query path, relative to rootNode(default is scene) - * @param {clay.Node} [rootNode] - * @return {string} - */ - getPath: function (rootNode) { - if (!this._parent) { - return '/'; - } - - var current = this._parent; - var path = this.name; - while (current._parent) { - path = current.name + '/' + path; - if (current._parent == rootNode) { - break; - } - current = current._parent; - } - if (!current._parent && rootNode) { - return null; - } - return path; - }, - - /** - * Depth first traverse all its descendant scene nodes. - * - * **WARN** Don't do `add`, `remove` operation in the callback during traverse. - * @param {Function} callback - * @param {Node} [context] - */ - traverse: function (callback, context) { - callback.call(context, this); - var _children = this._children; - for(var i = 0, len = _children.length; i < len; i++) { - _children[i].traverse(callback, context); - } - }, - - /** - * Traverse all children nodes. - * - * **WARN** DON'T do `add`, `remove` operation in the callback during iteration. - * - * @param {Function} callback - * @param {Node} [context] - */ - eachChild: function (callback, context) { - var _children = this._children; - for(var i = 0, len = _children.length; i < len; i++) { - var child = _children[i]; - callback.call(context, child, i); - } - }, - - /** - * Set the local transform and decompose to SRT - * @param {clay.Matrix4} matrix - */ - setLocalTransform: function (matrix) { - __WEBPACK_IMPORTED_MODULE_4__glmatrix_mat4__["a" /* default */].copy(this.localTransform.array, matrix.array); - this.decomposeLocalTransform(); - }, - - /** - * Decompose the local transform to SRT - */ - decomposeLocalTransform: function (keepScale) { - var scale = !keepScale ? this.scale: null; - this.localTransform.decomposeMatrix(scale, this.rotation, this.position); - }, - - /** - * Set the world transform and decompose to SRT - * @param {clay.Matrix4} matrix - */ - setWorldTransform: function (matrix) { - __WEBPACK_IMPORTED_MODULE_4__glmatrix_mat4__["a" /* default */].copy(this.worldTransform.array, matrix.array); - this.decomposeWorldTransform(); - }, - - /** - * Decompose the world transform to SRT - * @function - */ - decomposeWorldTransform: (function () { - - var tmp = __WEBPACK_IMPORTED_MODULE_4__glmatrix_mat4__["a" /* default */].create(); - - return function (keepScale) { - var localTransform = this.localTransform; - var worldTransform = this.worldTransform; - // Assume world transform is updated - if (this._parent) { - __WEBPACK_IMPORTED_MODULE_4__glmatrix_mat4__["a" /* default */].invert(tmp, this._parent.worldTransform.array); - __WEBPACK_IMPORTED_MODULE_4__glmatrix_mat4__["a" /* default */].multiply(localTransform.array, tmp, worldTransform.array); - } else { - __WEBPACK_IMPORTED_MODULE_4__glmatrix_mat4__["a" /* default */].copy(localTransform.array, worldTransform.array); - } - var scale = !keepScale ? this.scale: null; - localTransform.decomposeMatrix(scale, this.rotation, this.position); - }; - })(), - - transformNeedsUpdate: function () { - return this.position._dirty - || this.rotation._dirty - || this.scale._dirty; - }, - - /** - * Update local transform from SRT - * Notice that local transform will not be updated if _dirty mark of position, rotation, scale is all false - */ - updateLocalTransform: function () { - var position = this.position; - var rotation = this.rotation; - var scale = this.scale; - - if (this.transformNeedsUpdate()) { - var m = this.localTransform.array; - - // Transform order, scale->rotation->position - __WEBPACK_IMPORTED_MODULE_4__glmatrix_mat4__["a" /* default */].fromRotationTranslation(m, rotation.array, position.array); - - __WEBPACK_IMPORTED_MODULE_4__glmatrix_mat4__["a" /* default */].scale(m, m, scale.array); - - rotation._dirty = false; - scale._dirty = false; - position._dirty = false; - - this._needsUpdateWorldTransform = true; - } - }, - - /** - * Update world transform, assume its parent world transform have been updated - * @private - */ - _updateWorldTransformTopDown: function () { - var localTransform = this.localTransform.array; - var worldTransform = this.worldTransform.array; - if (this._parent) { - __WEBPACK_IMPORTED_MODULE_4__glmatrix_mat4__["a" /* default */].multiplyAffine( - worldTransform, - this._parent.worldTransform.array, - localTransform - ); - } - else { - __WEBPACK_IMPORTED_MODULE_4__glmatrix_mat4__["a" /* default */].copy(worldTransform, localTransform); - } - }, - - /** - * Update world transform before whole scene is updated. - */ - updateWorldTransform: function () { - // Find the root node which transform needs update; - var rootNodeIsDirty = this; - while (rootNodeIsDirty && rootNodeIsDirty.getParent() - && rootNodeIsDirty.getParent().transformNeedsUpdate() - ) { - rootNodeIsDirty = rootNodeIsDirty.getParent(); - } - rootNodeIsDirty.update(); - }, - - /** - * Update local transform and world transform recursively - * @param {boolean} forceUpdateWorld - */ - update: function (forceUpdateWorld) { - if (this.autoUpdateLocalTransform) { - this.updateLocalTransform(); - } - else { - // Transform is manually setted - forceUpdateWorld = true; - } - - if (forceUpdateWorld || this._needsUpdateWorldTransform) { - this._updateWorldTransformTopDown(); - forceUpdateWorld = true; - this._needsUpdateWorldTransform = false; - } - - var children = this._children; - for(var i = 0, len = children.length; i < len; i++) { - children[i].update(forceUpdateWorld); - } - }, - - /** - * Get bounding box of node - * @param {Function} [filter] - * @param {clay.BoundingBox} [out] - * @return {clay.BoundingBox} - */ - // TODO Skinning - getBoundingBox: (function () { - function defaultFilter (el) { - return !el.invisible && el.geometry; - } - var tmpBBox = new __WEBPACK_IMPORTED_MODULE_5__math_BoundingBox__["a" /* default */](); - var tmpMat4 = new __WEBPACK_IMPORTED_MODULE_3__math_Matrix4__["a" /* default */](); - var invWorldTransform = new __WEBPACK_IMPORTED_MODULE_3__math_Matrix4__["a" /* default */](); - return function (filter, out) { - out = out || new __WEBPACK_IMPORTED_MODULE_5__math_BoundingBox__["a" /* default */](); - filter = filter || defaultFilter; - - if (this._parent) { - __WEBPACK_IMPORTED_MODULE_3__math_Matrix4__["a" /* default */].invert(invWorldTransform, this._parent.worldTransform); - } - else { - __WEBPACK_IMPORTED_MODULE_3__math_Matrix4__["a" /* default */].identity(invWorldTransform); - } - - this.traverse(function (mesh) { - if (mesh.geometry && mesh.geometry.boundingBox) { - tmpBBox.copy(mesh.geometry.boundingBox); - __WEBPACK_IMPORTED_MODULE_3__math_Matrix4__["a" /* default */].multiply(tmpMat4, invWorldTransform, mesh.worldTransform); - tmpBBox.applyTransform(tmpMat4); - out.union(tmpBBox); - } - }, this, defaultFilter); - - return out; - }; - })(), - - /** - * Get world position, extracted from world transform - * @param {clay.Vector3} [out] - * @return {clay.Vector3} - */ - getWorldPosition: function (out) { - // PENDING - if (this.transformNeedsUpdate()) { - this.updateWorldTransform(); - } - var m = this.worldTransform.array; - if (out) { - var arr = out.array; - arr[0] = m[12]; - arr[1] = m[13]; - arr[2] = m[14]; - return out; - } - else { - return new __WEBPACK_IMPORTED_MODULE_1__math_Vector3__["a" /* default */](m[12], m[13], m[14]); - } - }, - - /** - * Clone a new node - * @return {Node} - */ - clone: function () { - var node = new this.constructor(); - - var children = this._children; - - node.setName(this.name); - node.position.copy(this.position); - node.rotation.copy(this.rotation); - node.scale.copy(this.scale); - - for (var i = 0; i < children.length; i++) { - node.add(children[i].clone()); - } - - return node; - }, - - /** - * Rotate the node around a axis by angle degrees, axis passes through point - * @param {clay.Vector3} point Center point - * @param {clay.Vector3} axis Center axis - * @param {number} angle Rotation angle - * @see http://docs.unity3d.com/Documentation/ScriptReference/Transform.RotateAround.html - * @function - */ - rotateAround: (function () { - var v = new __WEBPACK_IMPORTED_MODULE_1__math_Vector3__["a" /* default */](); - var RTMatrix = new __WEBPACK_IMPORTED_MODULE_3__math_Matrix4__["a" /* default */](); - - // TODO improve performance - return function (point, axis, angle) { - - v.copy(this.position).subtract(point); - - var localTransform = this.localTransform; - localTransform.identity(); - // parent node - localTransform.translate(point); - localTransform.rotate(angle, axis); - - RTMatrix.fromRotationTranslation(this.rotation, v); - localTransform.multiply(RTMatrix); - localTransform.scale(this.scale); - - this.decomposeLocalTransform(); - this._needsUpdateWorldTransform = true; - }; - })(), - - /** - * @param {clay.Vector3} target - * @param {clay.Vector3} [up] - * @see http://www.opengl.org/sdk/docs/man2/xhtml/gluLookAt.xml - * @function - */ - lookAt: (function () { - var m = new __WEBPACK_IMPORTED_MODULE_3__math_Matrix4__["a" /* default */](); - return function (target, up) { - m.lookAt(this.position, target, up || this.localTransform.y).invert(); - this.setLocalTransform(m); - - this.target = target; - }; - })() -}); - -/* harmony default export */ __webpack_exports__["a"] = (Node); - - -/***/ }), -/* 36 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Node__ = __webpack_require__(35); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Light__ = __webpack_require__(24); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Camera__ = __webpack_require__(58); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__math_BoundingBox__ = __webpack_require__(18); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__core_util__ = __webpack_require__(23); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__glmatrix_mat4__ = __webpack_require__(21); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__core_LRU__ = __webpack_require__(69); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__math_Matrix4__ = __webpack_require__(9); - - - - - - - - - -var IDENTITY = __WEBPACK_IMPORTED_MODULE_5__glmatrix_mat4__["a" /* default */].create(); -var WORLDVIEW = __WEBPACK_IMPORTED_MODULE_5__glmatrix_mat4__["a" /* default */].create(); - -var programKeyCache = {}; - -function getProgramKey(lightNumbers) { - var defineStr = []; - var lightTypes = Object.keys(lightNumbers); - lightTypes.sort(); - for (var i = 0; i < lightTypes.length; i++) { - var lightType = lightTypes[i]; - defineStr.push(lightType + ' ' + lightNumbers[lightType]); - } - var key = defineStr.join('\n'); - - if (programKeyCache[key]) { - return programKeyCache[key]; - } - - var id = __WEBPACK_IMPORTED_MODULE_4__core_util__["a" /* default */].genGUID(); - programKeyCache[key] = id; - return id; -} - -function RenderList() { - - this.opaque = []; - this.transparent = []; - - this._opaqueCount = 0; - this._transparentCount = 0; -} - -RenderList.prototype.startCount = function () { - this._opaqueCount = 0; - this._transparentCount = 0; -}; - -RenderList.prototype.add = function (object, isTransparent) { - if (isTransparent) { - this.transparent[this._transparentCount++] = object; - } - else { - this.opaque[this._opaqueCount++] = object; - } -}; - -RenderList.prototype.endCount = function () { - this.transparent.length = this._transparentCount; - this.opaque.length = this._opaqueCount; -}; - -/** - * @typedef {Object} clay.Scene.RenderList - * @property {Array.} opaque - * @property {Array.} transparent - */ - -/** - * @constructor clay.Scene - * @extends clay.Node - */ -var Scene = __WEBPACK_IMPORTED_MODULE_0__Node__["a" /* default */].extend(function () { - return /** @lends clay.Scene# */ { - /** - * Global material of scene - * @type {clay.Material} - */ - material: null, - - lights: [], - - /** - * Scene bounding box in view space. - * Used when camera needs to adujst the near and far plane automatically - * so that the view frustum contains the visible objects as tightly as possible. - * Notice: - * It is updated after rendering (in the step of frustum culling passingly). So may be not so accurate, but saves a lot of calculation - * - * @type {clay.BoundingBox} - */ - viewBoundingBoxLastFrame: new __WEBPACK_IMPORTED_MODULE_3__math_BoundingBox__["a" /* default */](), - - // Uniforms for shadow map. - shadowUniforms: {}, - - _cameraList: [], - - // Properties to save the light information in the scene - // Will be set in the render function - _lightUniforms: {}, - - _previousLightNumber: {}, - - _lightNumber: { - // groupId: { - // POINT_LIGHT: 0, - // DIRECTIONAL_LIGHT: 0, - // SPOT_LIGHT: 0, - // AMBIENT_LIGHT: 0, - // AMBIENT_SH_LIGHT: 0 - // } - }, - - _lightProgramKeys: {}, - - _nodeRepository: {}, - - _renderLists: new __WEBPACK_IMPORTED_MODULE_6__core_LRU__["a" /* default */](20) - - }; -}, function () { - this._scene = this; -}, -/** @lends clay.Scene.prototype. */ -{ - - // Add node to scene - addToScene: function (node) { - if (node instanceof __WEBPACK_IMPORTED_MODULE_2__Camera__["a" /* default */]) { - if (this._cameraList.length > 0) { - console.warn('Found multiple camera in one scene. Use the fist one.'); - } - this._cameraList.push(node); - } - else if (node instanceof __WEBPACK_IMPORTED_MODULE_1__Light__["a" /* default */]) { - this.lights.push(node); - } - if (node.name) { - this._nodeRepository[node.name] = node; - } - }, - - // Remove node from scene - removeFromScene: function (node) { - var idx; - if (node instanceof __WEBPACK_IMPORTED_MODULE_2__Camera__["a" /* default */]) { - idx = this._cameraList.indexOf(node); - if (idx >= 0) { - this._cameraList.splice(idx, 1); - } - } - else if (node instanceof __WEBPACK_IMPORTED_MODULE_1__Light__["a" /* default */]) { - idx = this.lights.indexOf(node); - if (idx >= 0) { - this.lights.splice(idx, 1); - } - } - if (node.name) { - delete this._nodeRepository[node.name]; - } - }, - - /** - * Get node by name - * @param {string} name - * @return {Node} - * @DEPRECATED - */ - getNode: function (name) { - return this._nodeRepository[name]; - }, - - /** - * Set main camera of the scene. - * @param {claygl.Camera} camera - */ - setMainCamera: function (camera) { - var idx = this._cameraList.indexOf(camera); - if (idx >= 0) { - this._cameraList.splice(idx, 1); - } - this._cameraList.unshift(camera); - }, - /** - * Get main camera of the scene. - */ - getMainCamera: function () { - return this._cameraList[0]; - }, - - getLights: function () { - return this.lights; - }, - - updateLights: function () { - var lights = this.lights; - this._previousLightNumber = this._lightNumber; - - var lightNumber = {}; - for (var i = 0; i < lights.length; i++) { - var light = lights[i]; - if (light.invisible) { - continue; - } - var group = light.group; - if (!lightNumber[group]) { - lightNumber[group] = {}; - } - // User can use any type of light - lightNumber[group][light.type] = lightNumber[group][light.type] || 0; - lightNumber[group][light.type]++; - } - this._lightNumber = lightNumber; - - for (var groupId in lightNumber) { - this._lightProgramKeys[groupId] = getProgramKey(lightNumber[groupId]); - } - - this._updateLightUniforms(); - }, - - /** - * Clone a node and it's children, including mesh, camera, light, etc. - * Unlike using `Node#clone`. It will clone skeleton and remap the joints. Material will also be cloned. - * - * @param {clay.Node} node - * @return {clay.Node} - */ - cloneNode: function (node) { - var newNode = node.clone(); - var clonedNodesMap = {}; - function buildNodesMap(sNode, tNode) { - clonedNodesMap[sNode.__uid__] = tNode; - - for (var i = 0; i < sNode._children.length; i++) { - var sChild = sNode._children[i]; - var tChild = tNode._children[i]; - buildNodesMap(sChild, tChild); - } - } - buildNodesMap(node, newNode); - - newNode.traverse(function (newChild) { - if (newChild.skeleton) { - newChild.skeleton = newChild.skeleton.clone(clonedNodesMap); - } - if (newChild.material) { - newChild.material = newChild.material.clone(); - } - }); - - return newNode; - }, - - /** - * Traverse the scene and add the renderable object to the render list. - * It needs camera for the frustum culling. - * - * @param {clay.Camera} camera - * @param {boolean} updateSceneBoundingBox - * @return {clay.Scene.RenderList} - */ - updateRenderList: function (camera, updateSceneBoundingBox) { - var id = camera.__uid__; - var renderList = this._renderLists.get(id); - if (!renderList) { - renderList = new RenderList(); - this._renderLists.put(id, renderList); - } - renderList.startCount(); - - if (updateSceneBoundingBox) { - this.viewBoundingBoxLastFrame.min.set(Infinity, Infinity, Infinity); - this.viewBoundingBoxLastFrame.max.set(-Infinity, -Infinity, -Infinity); - } - - var sceneMaterialTransparent = this.material && this.material.transparent || false; - this._doUpdateRenderList(this, camera, sceneMaterialTransparent, renderList, updateSceneBoundingBox); - - renderList.endCount(); - - return renderList; - }, - - /** - * Get render list. Used after {@link clay.Scene#updateRenderList} - * @param {clay.Camera} camera - * @return {clay.Scene.RenderList} - */ - getRenderList: function (camera) { - return this._renderLists.get(camera.__uid__); - }, - - _doUpdateRenderList: function (parent, camera, sceneMaterialTransparent, renderList, updateSceneBoundingBox) { - if (parent.invisible) { - return; - } - // TODO Optimize - for (var i = 0; i < parent._children.length; i++) { - var child = parent._children[i]; - - if (child.isRenderable()) { - // Frustum culling - var worldM = child.isSkinnedMesh() ? IDENTITY : child.worldTransform.array; - var geometry = child.geometry; - - __WEBPACK_IMPORTED_MODULE_5__glmatrix_mat4__["a" /* default */].multiplyAffine(WORLDVIEW, camera.viewMatrix.array, worldM); - if (updateSceneBoundingBox && !geometry.boundingBox || !this.isFrustumCulled(child, camera, WORLDVIEW)) { - renderList.add(child, child.material.transparent || sceneMaterialTransparent); - } - } - if (child._children.length > 0) { - this._doUpdateRenderList(child, camera, sceneMaterialTransparent, renderList, updateSceneBoundingBox); - } - } - }, - - /** - * If an scene object is culled by camera frustum - * - * Object can be a renderable or a light - * - * @param {clay.Node} object - * @param {clay.Camera} camera - * @param {Array.} worldViewMat represented with array - * @param {Array.} projectionMat represented with array - */ - isFrustumCulled: (function () { - // Frustum culling - // http://www.cse.chalmers.se/~uffe/vfc_bbox.pdf - var cullingBoundingBox = new __WEBPACK_IMPORTED_MODULE_3__math_BoundingBox__["a" /* default */](); - var cullingMatrix = new __WEBPACK_IMPORTED_MODULE_7__math_Matrix4__["a" /* default */](); - return function(object, camera, worldViewMat) { - // Bounding box can be a property of object(like light) or renderable.geometry - // PENDING - var geoBBox = object.boundingBox; - if (!geoBBox) { - if (object.skeleton && object.skeleton.boundingBox) { - geoBBox = object.skeleton.boundingBox; - } - else { - geoBBox = object.geometry.boundingBox; - } - } - - if (!geoBBox) { - return false; - } - - cullingMatrix.array = worldViewMat; - cullingBoundingBox.transformFrom(geoBBox, cullingMatrix); - - // Passingly update the scene bounding box - // FIXME exclude very large mesh like ground plane or terrain ? - // FIXME Only rendererable which cast shadow ? - - // FIXME boundingBox becomes much larger after transformd. - if (object.castShadow) { - this.viewBoundingBoxLastFrame.union(cullingBoundingBox); - } - // Ignore frustum culling if object is skinned mesh. - if (object.frustumCulling) { - if (!cullingBoundingBox.intersectBoundingBox(camera.frustum.boundingBox)) { - return true; - } - - cullingMatrix.array = camera.projectionMatrix.array; - if ( - cullingBoundingBox.max.array[2] > 0 && - cullingBoundingBox.min.array[2] < 0 - ) { - // Clip in the near plane - cullingBoundingBox.max.array[2] = -1e-20; - } - - cullingBoundingBox.applyProjection(cullingMatrix); - - var min = cullingBoundingBox.min.array; - var max = cullingBoundingBox.max.array; - - if ( - max[0] < -1 || min[0] > 1 - || max[1] < -1 || min[1] > 1 - || max[2] < -1 || min[2] > 1 - ) { - return true; - } - } - - return false; - }; - })(), - - _updateLightUniforms: function () { - var lights = this.lights; - // Put the light cast shadow before the light not cast shadow - lights.sort(lightSortFunc); - - var lightUniforms = this._lightUniforms; - for (var group in lightUniforms) { - for (var symbol in lightUniforms[group]) { - lightUniforms[group][symbol].value.length = 0; - } - } - for (var i = 0; i < lights.length; i++) { - - var light = lights[i]; - - if (light.invisible) { - continue; - } - - var group = light.group; - - for (var symbol in light.uniformTemplates) { - var uniformTpl = light.uniformTemplates[symbol]; - var value = uniformTpl.value(light); - if (value == null) { - continue; - } - if (!lightUniforms[group]) { - lightUniforms[group] = {}; - } - if (!lightUniforms[group][symbol]) { - lightUniforms[group][symbol] = { - type: '', - value: [] - }; - } - var lu = lightUniforms[group][symbol]; - lu.type = uniformTpl.type + 'v'; - switch (uniformTpl.type) { - case '1i': - case '1f': - case 't': - lu.value.push(value); - break; - case '2f': - case '3f': - case '4f': - for (var j = 0; j < value.length; j++) { - lu.value.push(value[j]); - } - break; - default: - console.error('Unkown light uniform type ' + uniformTpl.type); - } - } - } - }, - - getLightGroups: function () { - var lightGroups = []; - for (var groupId in this._lightNumber) { - lightGroups.push(groupId); - } - return lightGroups; - }, - - getNumberChangedLightGroups: function () { - var lightGroups = []; - for (var groupId in this._lightNumber) { - if (this.isLightNumberChanged(groupId)) { - lightGroups.push(groupId); - } - } - return lightGroups; - }, - - // Determine if light group is different with since last frame - // Used to determine whether to update shader and scene's uniforms in Renderer.render - isLightNumberChanged: function (lightGroup) { - var prevLightNumber = this._previousLightNumber; - var currentLightNumber = this._lightNumber; - // PENDING Performance - for (var type in currentLightNumber[lightGroup]) { - if (!prevLightNumber[lightGroup]) { - return true; - } - if (currentLightNumber[lightGroup][type] !== prevLightNumber[lightGroup][type]) { - return true; - } - } - for (var type in prevLightNumber[lightGroup]) { - if (!currentLightNumber[lightGroup]) { - return true; - } - if (currentLightNumber[lightGroup][type] !== prevLightNumber[lightGroup][type]) { - return true; - } - } - return false; - }, - - getLightsNumbers: function (lightGroup) { - return this._lightNumber[lightGroup]; - }, - - getProgramKey: function (lightGroup) { - return this._lightProgramKeys[lightGroup]; - }, - - setLightUniforms: (function () { - function setUniforms(uniforms, program, renderer) { - for (var symbol in uniforms) { - var lu = uniforms[symbol]; - if (lu.type === 'tv') { - if (!program.hasUniform(symbol)) { - continue; - } - var texSlots = []; - for (var i = 0; i < lu.value.length; i++) { - var texture = lu.value[i]; - var slot = program.takeCurrentTextureSlot(renderer, texture); - texSlots.push(slot); - } - program.setUniform(renderer.gl, '1iv', symbol, texSlots); - } - else { - program.setUniform(renderer.gl, lu.type, symbol, lu.value); - } - } - } - - return function (program, lightGroup, renderer) { - setUniforms(this._lightUniforms[lightGroup], program, renderer); - // Set shadows - setUniforms(this.shadowUniforms, program, renderer); - }; - })(), - - /** - * Dispose self, clear all the scene objects - * But resources of gl like texuture, shader will not be disposed. - * Mostly you should use disposeScene method in Renderer to do dispose. - */ - dispose: function () { - this.material = null; - this._opaqueList = []; - this._transparentList = []; - - this.lights = []; - - this._lightUniforms = {}; - - this._lightNumber = {}; - this._nodeRepository = {}; - } -}); - -function lightSortFunc(a, b) { - if (b.castShadow && !a.castShadow) { - return true; - } -} - -/* harmony default export */ __webpack_exports__["a"] = (Scene); - - -/***/ }), -/* 37 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Camera__ = __webpack_require__(58); - -/** - * @constructor clay.camera.Orthographic - * @extends clay.Camera - */ -var Orthographic = __WEBPACK_IMPORTED_MODULE_0__Camera__["a" /* default */].extend( -/** @lends clay.camera.Orthographic# */ -{ - /** - * @type {number} - */ - left: -1, - /** - * @type {number} - */ - right: 1, - /** - * @type {number} - */ - near: -1, - /** - * @type {number} - */ - far: 1, - /** - * @type {number} - */ - top: 1, - /** - * @type {number} - */ - bottom: -1 -}, -/** @lends clay.camera.Orthographic.prototype */ -{ - - updateProjectionMatrix: function() { - this.projectionMatrix.ortho(this.left, this.right, this.bottom, this.top, this.near, this.far); - }, - - decomposeProjectionMatrix: function () { - var m = this.projectionMatrix.array; - this.left = (-1 - m[12]) / m[0]; - this.right = (1 - m[12]) / m[0]; - this.top = (1 - m[13]) / m[5]; - this.bottom = (-1 - m[13]) / m[5]; - this.near = -(-1 - m[14]) / m[10]; - this.far = -(1 - m[14]) / m[10]; - }, - /** - * @return {clay.camera.Orthographic} - */ - clone: function() { - var camera = __WEBPACK_IMPORTED_MODULE_0__Camera__["a" /* default */].prototype.clone.call(this); - camera.left = this.left; - camera.right = this.right; - camera.near = this.near; - camera.far = this.far; - camera.top = this.top; - camera.bottom = this.bottom; - - return camera; - } -}); - -/* harmony default export */ __webpack_exports__["a"] = (Orthographic); - - -/***/ }), -/* 38 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ({ - convertToDynamicArray: function (clear) { - if (clear) { - this.resetOffset(); - } - var attributes = this.attributes; - for (var name in attributes) { - if (clear || !attributes[name].value) { - attributes[name].value = []; - } - else { - attributes[name].value = Array.prototype.slice.call(attributes[name].value); - } - } - if (clear || !this.indices) { - this.indices = []; - } - else { - this.indices = Array.prototype.slice.call(this.indices); - } - }, - - convertToTypedArray: function () { - var attributes = this.attributes; - for (var name in attributes) { - if (attributes[name].value && attributes[name].value.length > 0) { - attributes[name].value = new Float32Array(attributes[name].value); - } - else { - attributes[name].value = null; - } - } - if (this.indices && this.indices.length > 0) { - this.indices = this.vertexCount > 0xffff ? new Uint32Array(this.indices) : new Uint16Array(this.indices); - } - - this.dirty(); - } -}); - -/***/ }), -/* 39 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); - - -function otherDimToDataDim (data, otherDim) { - var dataDim = []; - __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.each(data.dimensions, function (dimName) { - var dimItem = data.getDimensionInfo(dimName); - var otherDims = dimItem.otherDims; - var dimIndex = otherDims[otherDim]; - if (dimIndex != null && dimIndex !== false) { - dataDim[dimIndex] = dimItem.name; - } - }); - return dataDim; -} - -/* harmony default export */ __webpack_exports__["a"] = (function (seriesModel, dataIndex, multipleSeries) { - function formatArrayValue(value) { - var vertially = true; - - var result = []; - var tooltipDims = otherDimToDataDim(data, 'tooltip'); - - tooltipDims.length - ? __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.each(tooltipDims, function (dimIdx) { - setEachItem(data.get(dimIdx, dataIndex), dimIdx); - }) - // By default, all dims is used on tooltip. - : __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.each(value, setEachItem); - - function setEachItem(val, dimIdx) { - var dimInfo = data.getDimensionInfo(dimIdx); - // If `dimInfo.tooltip` is not set, show tooltip. - if (!dimInfo || dimInfo.otherDims.tooltip === false) { - return; - } - var dimType = dimInfo.type; - var valStr = (vertially ? '- ' + (dimInfo.tooltipName || dimInfo.name) + ': ' : '') - + (dimType === 'ordinal' - ? val + '' - : dimType === 'time' - ? (multipleSeries ? '' : __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.format.formatTime('yyyy/MM/dd hh:mm:ss', val)) - : __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.format.addCommas(val) - ); - valStr && result.push(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.format.encodeHTML(valStr)); - } - - return (vertially ? '
' : '') + result.join(vertially ? '
' : ', '); - } - - var data = seriesModel.getData(); - - var value = seriesModel.getRawValue(dataIndex); - var formattedValue = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.isArray(value) - ? formatArrayValue(value) : __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.format.encodeHTML(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.format.addCommas(value)); - var name = data.getName(dataIndex); - - var color = data.getItemVisual(dataIndex, 'color'); - if (__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.isObject(color) && color.colorStops) { - color = (color.colorStops[0] || {}).color; - } - color = color || 'transparent'; - - var colorEl = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.format.getTooltipMarker(color); - - var seriesName = seriesModel.name; - // FIXME - if (seriesName === '\0-') { - // Not show '-' - seriesName = ''; - } - seriesName = seriesName - ? __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.format.encodeHTML(seriesName) + (!multipleSeries ? '
' : ': ') - : ''; - return !multipleSeries - ? seriesName + colorEl - + (name - ? __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.format.encodeHTML(name) + ': ' + formattedValue - : formattedValue - ) - : colorEl + seriesName + formattedValue; -});; - -/***/ }), -/* 40 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Renderable__ = __webpack_require__(72); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__core_glenum__ = __webpack_require__(11); - - - -/** - * @constructor clay.Mesh - * @extends clay.Renderable - */ -var Mesh = __WEBPACK_IMPORTED_MODULE_0__Renderable__["a" /* default */].extend(/** @lends clay.Mesh# */ { - /** - * Used when it is a skinned mesh - * @type {clay.Skeleton} - */ - skeleton: null, - /** - * Joints indices Meshes can share the one skeleton instance and each mesh can use one part of joints. Joints indices indicate the index of joint in the skeleton instance - * @type {number[]} - */ - joints: null, - - /** - * If store the skin matrices in vertex texture - * @type {bool} - */ - useSkinMatricesTexture: false - -}, function () { - if (!this.joints) { - this.joints = []; - } -}, { - - isSkinnedMesh: function () { - return !!(this.skeleton && this.joints && this.joints.length > 0); - }, - - clone: function () { - var mesh = __WEBPACK_IMPORTED_MODULE_0__Renderable__["a" /* default */].prototype.clone.call(this); - mesh.skeleton = this.skeleton; - if (this.joints) { - mesh.joints = this.joints.slice(); - } - return mesh; - } -}); - -// Enums -Mesh.POINTS = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].POINTS; -Mesh.LINES = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LINES; -Mesh.LINE_LOOP = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LINE_LOOP; -Mesh.LINE_STRIP = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LINE_STRIP; -Mesh.TRIANGLES = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].TRIANGLES; -Mesh.TRIANGLE_STRIP = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].TRIANGLE_STRIP; -Mesh.TRIANGLE_FAN = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].TRIANGLE_FAN; - -Mesh.BACK = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].BACK; -Mesh.FRONT = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].FRONT; -Mesh.FRONT_AND_BACK = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].FRONT_AND_BACK; -Mesh.CW = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].CW; -Mesh.CCW = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].CCW; - -/* harmony default export */ __webpack_exports__["a"] = (Mesh); - - -/***/ }), -/* 41 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Camera__ = __webpack_require__(58); - - -/** - * @constructor clay.camera.Perspective - * @extends clay.Camera - */ -var Perspective = __WEBPACK_IMPORTED_MODULE_0__Camera__["a" /* default */].extend(/** @lends clay.camera.Perspective# */{ - /** - * Vertical field of view in degrees - * @type {number} - */ - fov: 50, - /** - * Aspect ratio, typically viewport width / height - * @type {number} - */ - aspect: 1, - /** - * Near bound of the frustum - * @type {number} - */ - near: 0.1, - /** - * Far bound of the frustum - * @type {number} - */ - far: 2000 -}, -/** @lends clay.camera.Perspective.prototype */ -{ - - updateProjectionMatrix: function() { - var rad = this.fov / 180 * Math.PI; - this.projectionMatrix.perspective(rad, this.aspect, this.near, this.far); - }, - decomposeProjectionMatrix: function () { - var m = this.projectionMatrix.array; - var rad = Math.atan(1 / m[5]) * 2; - this.fov = rad / Math.PI * 180; - this.aspect = m[5] / m[0]; - this.near = m[14] / (m[10] - 1); - this.far = m[14] / (m[10] + 1); - }, - /** - * @return {clay.camera.Perspective} - */ - clone: function() { - var camera = __WEBPACK_IMPORTED_MODULE_0__Camera__["a" /* default */].prototype.clone.call(this); - camera.fov = this.fov; - camera.aspect = this.aspect; - camera.near = this.near; - camera.far = this.far; - - return camera; - } -}); - -/* harmony default export */ __webpack_exports__["a"] = (Perspective); - - -/***/ }), -/* 42 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Mesh__ = __webpack_require__(40); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__geometry_Cube__ = __webpack_require__(76); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Shader__ = __webpack_require__(8); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__Material__ = __webpack_require__(19); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Texture__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__shader_source_skybox_glsl_js__ = __webpack_require__(121); -// TODO Should not derived from mesh? - - - - - - - -__WEBPACK_IMPORTED_MODULE_2__Shader__["a" /* default */].import(__WEBPACK_IMPORTED_MODULE_5__shader_source_skybox_glsl_js__["a" /* default */]); -/** - * @constructor clay.plugin.Skybox - * - * @example - * var skyTex = new clay.TextureCube(); - * skyTex.load({ - * 'px': 'assets/textures/sky/px.jpg', - * 'nx': 'assets/textures/sky/nx.jpg' - * 'py': 'assets/textures/sky/py.jpg' - * 'ny': 'assets/textures/sky/ny.jpg' - * 'pz': 'assets/textures/sky/pz.jpg' - * 'nz': 'assets/textures/sky/nz.jpg' - * }); - * var skybox = new clay.plugin.Skybox({ - * scene: scene - * }); - * skybox.material.set('environmentMap', skyTex); - */ -var Skybox = __WEBPACK_IMPORTED_MODULE_0__Mesh__["a" /* default */].extend(function () { - - var skyboxShader = new __WEBPACK_IMPORTED_MODULE_2__Shader__["a" /* default */]({ - vertex: __WEBPACK_IMPORTED_MODULE_2__Shader__["a" /* default */].source('clay.skybox.vertex'), - fragment: __WEBPACK_IMPORTED_MODULE_2__Shader__["a" /* default */].source('clay.skybox.fragment') - }); - var material = new __WEBPACK_IMPORTED_MODULE_3__Material__["a" /* default */]({ - shader: skyboxShader, - depthMask: false - }); - - return { - /** - * @type {clay.Scene} - * @memberOf clay.plugin.Skybox.prototype - */ - scene: null, - - geometry: new __WEBPACK_IMPORTED_MODULE_1__geometry_Cube__["a" /* default */](), - - material: material, - - environmentMap: null, - - culling: false - }; -}, function () { - var scene = this.scene; - if (scene) { - this.attachScene(scene); - } - if (this.environmentMap) { - this.setEnvironmentMap(this.environmentMap); - } -}, /** @lends clay.plugin.Skybox# */ { - /** - * Attach the skybox to the scene - * @param {clay.Scene} scene - */ - attachScene: function (scene) { - if (this.scene) { - this.detachScene(); - } - scene.skybox = this; - - this.scene = scene; - scene.on('beforerender', this._beforeRenderScene, this); - }, - /** - * Detach from scene - */ - detachScene: function () { - if (this.scene) { - this.scene.off('beforerender', this._beforeRenderScene); - this.scene.skybox = null; - } - this.scene = null; - }, - - /** - * Dispose skybox - * @param {clay.Renderer} renderer - */ - dispose: function (renderer) { - this.detachScene(); - this.geometry.dispose(renderer); - }, - /** - * Set environment map - * @param {clay.TextureCube} envMap - */ - setEnvironmentMap: function (envMap) { - if (envMap.textureType === 'texture2D') { - this.material.define('EQUIRECTANGULAR'); - // LINEAR filter can remove the artifacts in pole - envMap.minFilter = __WEBPACK_IMPORTED_MODULE_4__Texture__["a" /* default */].LINEAR; - } - else { - this.material.undefine('EQUIRECTANGULAR'); - } - this.material.set('environmentMap', envMap); - }, - /** - * Get environment map - * @return {clay.TextureCube} - */ - getEnvironmentMap: function () { - return this.material.get('environmentMap'); - }, - - _beforeRenderScene: function(renderer, scene, camera) { - this.renderSkybox(renderer, camera); - }, - - renderSkybox: function (renderer, camera) { - this.position.copy(camera.getWorldPosition()); - this.update(); - // Don't remember to disable blend - renderer.gl.disable(renderer.gl.BLEND); - if (this.material.get('lod') > 0) { - this.material.define('fragment', 'LOD'); - } - else { - this.material.undefine('fragment', 'LOD'); - } - renderer.renderPass([this], camera); - } -}); - -/* harmony default export */ __webpack_exports__["a"] = (Skybox); - - -/***/ }), -/* 43 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Geometry__ = __webpack_require__(15); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__math_BoundingBox__ = __webpack_require__(18); - - - -/** - * @constructor clay.geometry.Plane - * @extends clay.Geometry - * @param {Object} [opt] - * @param {number} [opt.widthSegments] - * @param {number} [opt.heightSegments] - */ -var Plane = __WEBPACK_IMPORTED_MODULE_0__Geometry__["a" /* default */].extend( -/** @lends clay.geometry.Plane# */ -{ - dynamic: false, - /** - * @type {number} - */ - widthSegments: 1, - /** - * @type {number} - */ - heightSegments: 1 -}, function() { - this.build(); -}, -/** @lends clay.geometry.Plane.prototype */ -{ - /** - * Build plane geometry - */ - build: function() { - var heightSegments = this.heightSegments; - var widthSegments = this.widthSegments; - var attributes = this.attributes; - var positions = []; - var texcoords = []; - var normals = []; - var faces = []; - - for (var y = 0; y <= heightSegments; y++) { - var t = y / heightSegments; - for (var x = 0; x <= widthSegments; x++) { - var s = x / widthSegments; - - positions.push([2 * s - 1, 2 * t - 1, 0]); - if (texcoords) { - texcoords.push([s, t]); - } - if (normals) { - normals.push([0, 0, 1]); - } - if (x < widthSegments && y < heightSegments) { - var i = x + y * (widthSegments + 1); - faces.push([i, i + 1, i + widthSegments + 1]); - faces.push([i + widthSegments + 1, i + 1, i + widthSegments + 2]); - } - } - } - - attributes.position.fromArray(positions); - attributes.texcoord0.fromArray(texcoords); - attributes.normal.fromArray(normals); - - this.initIndicesFromArray(faces); - - this.boundingBox = new __WEBPACK_IMPORTED_MODULE_1__math_BoundingBox__["a" /* default */](); - this.boundingBox.min.set(-1, -1, 0); - this.boundingBox.max.set(1, 1, 0); - } -}); - -/* harmony default export */ __webpack_exports__["a"] = (Plane); - - -/***/ }), -/* 44 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ({ - defaultOption: { - - viewControl: { - // perspective, orthographic. - // TODO Isometric - projection: 'perspective', - // If rotate on on init - autoRotate: false, - // cw or ccw - autoRotateDirection: 'cw', - // Degree per second - autoRotateSpeed: 10, - - // Start rotating after still for a given time - // default is 3 seconds - autoRotateAfterStill: 3, - - // Rotate, zoom damping. - damping: 0.8, - // Sensitivities for operations. - // Can be array to set x,y respectively - rotateSensitivity: 1, - zoomSensitivity: 1, - // Can be array to set x,y respectively - panSensitivity: 1, - // Which mouse button do rotate or pan - panMouseButton: 'middle', - rotateMouseButton: 'left', - - // Distance to the target - // Only available when camera is perspective. - distance: 150, - // Min distance mouse can zoom in - minDistance: 40, - // Max distance mouse can zoom out - maxDistance: 400, - - // Size of viewing volume. - // Only available when camera is orthographic - orthographicSize: 150, - maxOrthographicSize: 400, - minOrthographicSize: 20, - - // Center view point - center: [0, 0, 0], - // Alpha angle for top-down rotation - // Positive to rotate to top. - alpha: 0, - // beta angle for left-right rotation - // Positive to rotate to right. - beta: 0, - - minAlpha: -90, - maxAlpha: 90 - - // minBeta: -Infinity - // maxBeta: -Infinity - } - }, - - setView: function (opts) { - opts = opts || {}; - this.option.viewControl = this.option.viewControl || {}; - if (opts.alpha != null) { - this.option.viewControl.alpha = opts.alpha; - } - if (opts.beta != null) { - this.option.viewControl.beta = opts.beta; - } - if (opts.distance != null) { - this.option.viewControl.distance = opts.distance; - } - if (opts.center != null) { - this.option.viewControl.center = opts.center; - } - } -}); - -/***/ }), -/* 45 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_claygl_src_core_Base__ = __webpack_require__(7); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_claygl_src_math_Vector2__ = __webpack_require__(26); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_claygl_src_math_Vector3__ = __webpack_require__(3); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_claygl_src_math_Quaternion__ = __webpack_require__(56); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__retrieve__ = __webpack_require__(2); -/** - * Provide orbit control for 3D objects - * - * @module echarts-gl/util/OrbitControl - * @author Yi Shen(http://github.com/pissang) - */ - -// TODO Remove magic numbers on sensitivity - - - - - -var firstNotNull = __WEBPACK_IMPORTED_MODULE_4__retrieve__["a" /* default */].firstNotNull; - - -var MOUSE_BUTTON_KEY_MAP = { - left: 0, - middle: 1, - right: 2 -}; - -function convertToArray(val) { - if (!(val instanceof Array)) { - val = [val, val]; - } - return val; -} - -/** - * @alias module:echarts-x/util/OrbitControl - */ -var OrbitControl = __WEBPACK_IMPORTED_MODULE_0_claygl_src_core_Base__["a" /* default */].extend(function () { - - return { - /** - * @type {module:zrender~ZRender} - */ - zr: null, - - /** - * @type {module:echarts-gl/core/ViewGL} - */ - viewGL: null, - - /** - * @type {clay.math.Vector3} - */ - _center: new __WEBPACK_IMPORTED_MODULE_2_claygl_src_math_Vector3__["a" /* default */](), - - /** - * Minimum distance to the center - * Only available when camera is perspective. - * @type {number} - * @default 0.5 - */ - minDistance: 0.5, - - /** - * Maximum distance to the center - * Only available when camera is perspective. - * @type {number} - * @default 2 - */ - maxDistance: 1.5, - - /** - * Only available when camera is orthographic - */ - maxOrthographicSize: 300, - - /** - * Only available when camera is orthographic - */ - minOrthographicSize: 30, - - /** - * Minimum alpha rotation - */ - minAlpha: -90, - - /** - * Maximum alpha rotation - */ - maxAlpha: 90, - - /** - * Minimum beta rotation - */ - minBeta: -Infinity, - /** - * Maximum beta rotation - */ - maxBeta: Infinity, - - /** - * Start auto rotating after still for the given time - */ - autoRotateAfterStill: 0, - - /** - * Direction of autoRotate. cw or ccw when looking top down. - */ - autoRotateDirection: 'cw', - - /** - * Degree per second - */ - autoRotateSpeed: 60, - - /** - * @param {number} - */ - damping: 0.8, - - /** - * @param {number} - */ - rotateSensitivity: 1, - - /** - * @param {number} - */ - zoomSensitivity: 1, - - /** - * @param {number} - */ - panSensitivity: 1, - - panMouseButton: 'middle', - rotateMouseButton: 'left', - - /** - * Pan or rotate - * @private - * @type {String} - */ - _mode: 'rotate', - - /** - * @private - * @type {clay.Camera} - */ - _camera: null, - - _needsUpdate: false, - - _rotating: false, - - // Rotation around yAxis in radian - _phi: 0, - // Rotation around xAxis in radian - _theta: 0, - - _mouseX: 0, - _mouseY: 0, - - _rotateVelocity: new __WEBPACK_IMPORTED_MODULE_1_claygl_src_math_Vector2__["a" /* default */](), - - _panVelocity: new __WEBPACK_IMPORTED_MODULE_1_claygl_src_math_Vector2__["a" /* default */](), - - _distance: 500, - - _zoomSpeed: 0, - - _stillTimeout: 0, - - _animators: [] - }; -}, function () { - // Each OrbitControl has it's own handler - ['_mouseDownHandler', '_mouseWheelHandler', '_mouseMoveHandler', '_mouseUpHandler', - '_pinchHandler', '_contextMenuHandler', '_update'].forEach(function (hdlName) { - this[hdlName] = this[hdlName].bind(this); - }, this); -}, { - /** - * Initialize. - * Mouse event binding - */ - init: function () { - var zr = this.zr; - - if (zr) { - zr.on('mousedown', this._mouseDownHandler); - zr.on('globalout', this._mouseUpHandler); - zr.on('mousewheel', this._mouseWheelHandler); - zr.on('pinch', this._pinchHandler); - - zr.animation.on('frame', this._update); - - zr.dom.addEventListener('contextmenu', this._contextMenuHandler); - } - }, - - /** - * Dispose. - * Mouse event unbinding - */ - dispose: function () { - var zr = this.zr; - - if (zr) { - zr.off('mousedown', this._mouseDownHandler); - zr.off('mousemove', this._mouseMoveHandler); - zr.off('mouseup', this._mouseUpHandler); - zr.off('mousewheel', this._mouseWheelHandler); - zr.off('pinch', this._pinchHandler); - zr.off('globalout', this._mouseUpHandler); - zr.dom.removeEventListener('contextmenu', this._contextMenuHandler); - - zr.animation.off('frame', this._update); - } - this.stopAllAnimation(); - }, - - /** - * Get distance - * @return {number} - */ - getDistance: function () { - return this._distance; - }, - - /** - * Set distance - * @param {number} distance - */ - setDistance: function (distance) { - this._distance = distance; - this._needsUpdate = true; - }, - - /** - * Get size of orthographic viewing volume - * @return {number} - */ - getOrthographicSize: function () { - return this._orthoSize; - }, - - /** - * Set size of orthographic viewing volume - * @param {number} size - */ - setOrthographicSize: function (size) { - this._orthoSize = size; - this._needsUpdate = true; - }, - - /** - * Get alpha rotation - * Alpha angle for top-down rotation. Positive to rotate to top. - * - * Which means camera rotation around x axis. - */ - getAlpha: function () { - return this._theta / Math.PI * 180; - }, - - /** - * Get beta rotation - * Beta angle for left-right rotation. Positive to rotate to right. - * - * Which means camera rotation around y axis. - */ - getBeta: function () { - return -this._phi / Math.PI * 180; - }, - - /** - * Get control center - * @return {Array.} - */ - getCenter: function () { - return this._center.toArray(); - }, - - /** - * Set alpha rotation angle - * @param {number} alpha - */ - setAlpha: function (alpha) { - alpha = Math.max(Math.min(this.maxAlpha, alpha), this.minAlpha); - - this._theta = alpha / 180 * Math.PI; - this._needsUpdate = true; - }, - - /** - * Set beta rotation angle - * @param {number} beta - */ - setBeta: function (beta) { - beta = Math.max(Math.min(this.maxBeta, beta), this.minBeta); - - this._phi = -beta / 180 * Math.PI; - this._needsUpdate = true; - }, - - /** - * Set control center - * @param {Array.} center - */ - setCenter: function (centerArr) { - this._center.setArray(centerArr); - }, - - /** - * @param {module:echarts-gl/core/ViewGL} viewGL - */ - setViewGL: function (viewGL) { - this.viewGL = viewGL; - }, - - /** - * @return {clay.Camera} - */ - getCamera: function () { - return this.viewGL.camera; - }, - - setFromViewControlModel: function (viewControlModel, extraOpts) { - extraOpts = extraOpts || {}; - var baseDistance = extraOpts.baseDistance || 0; - var baseOrthoSize = extraOpts.baseOrthoSize || 1; - - var projection = viewControlModel.get('projection'); - if (projection !== 'perspective' && projection !== 'orthographic' && projection !== 'isometric') { - if (true) { - console.error('Unkown projection type %s, use perspective projection instead.', projection); - } - projection = 'perspective'; - } - this._projection = projection; - this.viewGL.setProjection(projection); - - var targetDistance = viewControlModel.get('distance') + baseDistance; - var targetOrthographicSize = viewControlModel.get('orthographicSize') + baseOrthoSize; - - [ - ['damping', 0.8], - ['autoRotate', false], - ['autoRotateAfterStill', 3], - ['autoRotateDirection', 'cw'], - ['autoRotateSpeed', 10], - ['minDistance', 30], - ['maxDistance', 400], - ['minOrthographicSize', 30], - ['maxOrthographicSize', 300], - ['minAlpha', -90], - ['maxAlpha', 90], - ['minBeta', -Infinity], - ['maxBeta', Infinity], - ['rotateSensitivity', 1], - ['zoomSensitivity', 1], - ['panSensitivity', 1], - ['panMouseButton', 'left'], - ['rotateMouseButton', 'middle'], - ].forEach(function (prop) { - this[prop[0]] = firstNotNull(viewControlModel.get(prop[0]), prop[1]); - }, this); - - this.minDistance += baseDistance; - this.maxDistance += baseDistance; - this.minOrthographicSize += baseOrthoSize, - this.maxOrthographicSize += baseOrthoSize; - - var ecModel = viewControlModel.ecModel; - - var animationOpts = {}; - ['animation', 'animationDurationUpdate', 'animationEasingUpdate'].forEach(function (key) { - animationOpts[key] = firstNotNull( - viewControlModel.get(key), ecModel && ecModel.get(key) - ); - }); - - var alpha = firstNotNull(extraOpts.alpha, viewControlModel.get('alpha')) || 0; - var beta = firstNotNull(extraOpts.beta, viewControlModel.get('beta')) || 0; - var center = firstNotNull(extraOpts.center, viewControlModel.get('center')) || [0, 0, 0]; - if (animationOpts.animation && animationOpts.animationDurationUpdate > 0 && this._notFirst) { - this.animateTo({ - alpha: alpha, - beta: beta, - center: center, - distance: targetDistance, - targetOrthographicSize: targetOrthographicSize, - easing: animationOpts.animationEasingUpdate, - duration: animationOpts.animationDurationUpdate - }); - } - else { - this.setDistance(targetDistance); - this.setAlpha(alpha); - this.setBeta(beta); - this.setCenter(center); - this.setOrthographicSize(targetOrthographicSize); - } - - this._notFirst = true; - - this._validateProperties(); - }, - - _validateProperties: function () { - if (true) { - if (MOUSE_BUTTON_KEY_MAP[this.panMouseButton] == null) { - console.error('Unkown panMouseButton %s. It should be left|middle|right', this.panMouseButton); - } - if (MOUSE_BUTTON_KEY_MAP[this.rotateMouseButton] == null) { - console.error('Unkown rotateMouseButton %s. It should be left|middle|right', this.rotateMouseButton); - } - if (this.autoRotateDirection !== 'cw' && this.autoRotateDirection !== 'ccw') { - console.error('Unkown autoRotateDirection %s. It should be cw|ccw', this.autoRotateDirection); - } - } - }, - - /** - * @param {Object} opts - * @param {number} opts.distance - * @param {number} opts.alpha - * @param {number} opts.beta - * @param {number} opts.orthographicSize - * @param {number} [opts.duration=1000] - * @param {number} [opts.easing='linear'] - */ - animateTo: function (opts) { - var zr = this.zr; - var self = this; - - var obj = {}; - var target = {}; - - if (opts.distance != null) { - obj.distance = this.getDistance(); - target.distance = opts.distance; - } - if (opts.orthographicSize != null) { - obj.orthographicSize = this.getOrthographicSize(); - target.orthographicSize = opts.orthographicSize; - } - if (opts.alpha != null) { - obj.alpha = this.getAlpha(); - target.alpha = opts.alpha; - } - if (opts.beta != null) { - obj.beta = this.getBeta(); - target.beta = opts.beta; - } - if (opts.center != null) { - obj.center = this.getCenter(); - target.center = opts.center; - } - - return this._addAnimator( - zr.animation.animate(obj) - .when(opts.duration || 1000, target) - .during(function () { - if (obj.alpha != null) { - self.setAlpha(obj.alpha); - } - if (obj.beta != null) { - self.setBeta(obj.beta); - } - if (obj.distance != null) { - self.setDistance(obj.distance); - } - if (obj.center != null) { - self.setCenter(obj.center); - } - if (obj.orthographicSize != null) { - self.setOrthographicSize(obj.orthographicSize); - } - self._needsUpdate = true; - }) - ).start(opts.easing || 'linear'); - }, - - /** - * Stop all animation - */ - stopAllAnimation: function () { - for (var i = 0; i < this._animators.length; i++) { - this._animators[i].stop(); - } - this._animators.length = 0; - }, - - update: function () { - this._needsUpdate = true; - this._update(20); - }, - - _isAnimating: function () { - return this._animators.length > 0; - }, - /** - * Call update each frame - * @param {number} deltaTime Frame time - */ - _update: function (deltaTime) { - - if (this._rotating) { - var radian = (this.autoRotateDirection === 'cw' ? 1 : -1) - * this.autoRotateSpeed / 180 * Math.PI; - this._phi -= radian * deltaTime / 1000; - this._needsUpdate = true; - } - else if (this._rotateVelocity.len() > 0) { - this._needsUpdate = true; - } - - if (Math.abs(this._zoomSpeed) > 0.1 || this._panVelocity.len() > 0) { - this._needsUpdate = true; - } - - if (!this._needsUpdate) { - return; - } - - deltaTime = Math.min(deltaTime, 50); - - this._updateDistanceOrSize(deltaTime); - - this._updatePan(deltaTime); - - this._updateRotate(deltaTime); - - this._updateTransform(); - - this.getCamera().update(); - - this.zr && this.zr.refresh(); - - this.trigger('update'); - - this._needsUpdate = false; - }, - - _updateRotate: function (deltaTime) { - var velocity = this._rotateVelocity; - this._phi = velocity.y * deltaTime / 20 + this._phi; - this._theta = velocity.x * deltaTime / 20 + this._theta; - - this.setAlpha(this.getAlpha()); - this.setBeta(this.getBeta()); - - this._vectorDamping(velocity, Math.pow(this.damping, deltaTime / 16)); - }, - - _updateDistanceOrSize: function (deltaTime) { - if (this._projection === 'perspective') { - this._setDistance(this._distance + this._zoomSpeed * deltaTime / 20); - } - else { - this._setOrthoSize(this._orthoSize + this._zoomSpeed * deltaTime / 20); - } - - this._zoomSpeed *= Math.pow(this.damping, deltaTime / 16); - }, - - - _setDistance: function (distance) { - this._distance = Math.max(Math.min(distance, this.maxDistance), this.minDistance); - }, - - _setOrthoSize: function (size) { - this._orthoSize = Math.max(Math.min(size, this.maxOrthographicSize), this.minOrthographicSize); - var camera = this.getCamera(); - var cameraHeight = this._orthoSize; - var cameraWidth = cameraHeight / this.viewGL.viewport.height * this.viewGL.viewport.width; - camera.left = -cameraWidth / 2; - camera.right = cameraWidth / 2; - camera.top = cameraHeight / 2; - camera.bottom = -cameraHeight / 2; - }, - - _updatePan: function (deltaTime) { - - var velocity = this._panVelocity; - var len = this._distance; - - var target = this.getCamera(); - var yAxis = target.worldTransform.y; - var xAxis = target.worldTransform.x; - - // PENDING - this._center - .scaleAndAdd(xAxis, -velocity.x * len / 200) - .scaleAndAdd(yAxis, -velocity.y * len / 200); - - this._vectorDamping(velocity, 0); - }, - - _updateTransform: function () { - var camera = this.getCamera(); - - var dir = new __WEBPACK_IMPORTED_MODULE_2_claygl_src_math_Vector3__["a" /* default */](); - var theta = this._theta + Math.PI / 2; - var phi = this._phi + Math.PI / 2; - var r = Math.sin(theta); - - dir.x = r * Math.cos(phi); - dir.y = -Math.cos(theta); - dir.z = r * Math.sin(phi); - - camera.position.copy(this._center).scaleAndAdd(dir, this._distance); - camera.rotation.identity() - // First around y, then around x - .rotateY(-this._phi) - .rotateX(-this._theta); - }, - - _startCountingStill: function () { - clearTimeout(this._stillTimeout); - - var time = this.autoRotateAfterStill; - var self = this; - if (!isNaN(time) && time > 0) { - this._stillTimeout = setTimeout(function () { - self._rotating = true; - }, time * 1000); - } - }, - - _vectorDamping: function (v, damping) { - var speed = v.len(); - speed = speed * damping; - if (speed < 1e-4) { - speed = 0; - } - v.normalize().scale(speed); - }, - - _decomposeTransform: function () { - if (!this.getCamera()) { - return; - } - - this.getCamera().updateWorldTransform(); - - var forward = this.getCamera().worldTransform.z; - var alpha = Math.asin(forward.y); - var beta = Math.atan2(forward.x, forward.z); - - this._theta = alpha; - this._phi = -beta; - - this.setBeta(this.getBeta()); - this.setAlpha(this.getAlpha()); - - // Is perspective - if (this.getCamera().aspect) { - this._setDistance(this.getCamera().position.dist(this._center)); - } - else { - this._setOrthoSize(this.getCamera().top - this.getCamera().bottom); - } - }, - - _mouseDownHandler: function (e) { - if (e.target) { - // If mouseon some zrender element. - return; - } - if (this._isAnimating()) { - return; - } - - var x = e.offsetX; - var y = e.offsetY; - if (this.viewGL && !this.viewGL.containPoint(x, y)) { - return; - } - - this.zr.on('mousemove', this._mouseMoveHandler); - this.zr.on('mouseup', this._mouseUpHandler); - - if (e.event.targetTouches) { - if (e.event.targetTouches.length === 1) { - this._mode = 'rotate'; - } - } - else { - if (e.event.button === MOUSE_BUTTON_KEY_MAP[this.rotateMouseButton]) { - this._mode = 'rotate'; - } - else if (e.event.button === MOUSE_BUTTON_KEY_MAP[this.panMouseButton]) { - this._mode = 'pan'; - } - else { - this._mode = ''; - } - } - - // Reset rotate velocity - this._rotateVelocity.set(0, 0); - this._rotating = false; - if (this.autoRotate) { - this._startCountingStill(); - } - - this._mouseX = e.offsetX; - this._mouseY = e.offsetY; - }, - - _mouseMoveHandler: function (e) { - if (e.target && e.target.__isGLToZRProxy) { - return; - } - - if (this._isAnimating()) { - return; - } - - var panSensitivity = convertToArray(this.panSensitivity); - var rotateSensitivity = convertToArray(this.rotateSensitivity); - - if (this._mode === 'rotate') { - this._rotateVelocity.y = (e.offsetX - this._mouseX) / this.zr.getHeight() * 2 * rotateSensitivity[0]; - this._rotateVelocity.x = (e.offsetY - this._mouseY) / this.zr.getWidth() * 2 * rotateSensitivity[1]; - } - else if (this._mode === 'pan') { - this._panVelocity.x = (e.offsetX - this._mouseX) / this.zr.getWidth() * panSensitivity[0] * 400; - this._panVelocity.y = (-e.offsetY + this._mouseY) / this.zr.getHeight() * panSensitivity[1] * 400; - } - - - this._mouseX = e.offsetX; - this._mouseY = e.offsetY; - - e.event.preventDefault(); - }, - - _mouseWheelHandler: function (e) { - if (this._isAnimating()) { - return; - } - var delta = e.event.wheelDelta // Webkit - || -e.event.detail; // Firefox - this._zoomHandler(e, delta); - }, - - _pinchHandler: function (e) { - if (this._isAnimating()) { - return; - } - this._zoomHandler(e, e.pinchScale > 1 ? 1 : -1); - // Not rotate when pinch - this._mode = ''; - }, - - _zoomHandler: function (e, delta) { - if (delta === 0) { - return; - } - - var x = e.offsetX; - var y = e.offsetY; - if (this.viewGL && !this.viewGL.containPoint(x, y)) { - return; - } - - var speed; - if (this._projection === 'perspective') { - speed = Math.max(Math.max(Math.min( - this._distance - this.minDistance, - this.maxDistance - this._distance - )) / 20, 0.5); - } - else { - speed = Math.max(Math.max(Math.min( - this._orthoSize - this.minOrthographicSize, - this.maxOrthographicSize - this._orthoSize - )) / 20, 0.5); - } - this._zoomSpeed = (delta > 0 ? -1 : 1) * speed * this.zoomSensitivity; - - this._rotating = false; - - if (this.autoRotate && this._mode === 'rotate') { - this._startCountingStill(); - } - - e.event.preventDefault(); - }, - - _mouseUpHandler: function () { - this.zr.off('mousemove', this._mouseMoveHandler); - this.zr.off('mouseup', this._mouseUpHandler); - }, - - _isRightMouseButtonUsed: function () { - return this.rotateMouseButton === 'right' - || this.panMouseButton === 'right'; - }, - - _contextMenuHandler: function (e) { - if (this._isRightMouseButtonUsed()) { - e.preventDefault(); - } - }, - - _addAnimator: function (animator) { - var animators = this._animators; - animators.push(animator); - animator.done(function () { - var idx = animators.indexOf(animator); - if (idx >= 0) { - animators.splice(idx, 1); - } - }); - return animator; - } -}); - -/** - * If auto rotate the target - * @type {boolean} - * @default false - */ -Object.defineProperty(OrbitControl.prototype, 'autoRotate', { - get: function (val) { - return this._autoRotate; - }, - set: function (val) { - this._autoRotate = val; - this._rotating = val; - } -}); - - -/* harmony default export */ __webpack_exports__["a"] = (OrbitControl); - -/***/ }), -/* 46 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export ecgl.lines3D.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec3 position: POSITION;\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n\nvoid main()\n{\n gl_Position = worldViewProjection * vec4(position, 1.0);\n v_Color = a_Color;\n}\n\n@end\n\n@export ecgl.lines3D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\n\n@import clay.util.srgb\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color * v_Color);\n#else\n gl_FragColor = color * v_Color;\n#endif\n}\n@end\n\n\n\n@export ecgl.lines3D.clipNear\n\nvec4 clipNear(vec4 p1, vec4 p2) {\n float n = (p1.w - near) / (p1.w - p2.w);\n return vec4(mix(p1.xy, p2.xy, n), -near, near);\n}\n\n@end\n\n@export ecgl.lines3D.expandLine\n#ifdef VERTEX_ANIMATION\n vec4 prevProj = worldViewProjection * vec4(mix(prevPositionPrev, positionPrev, percent), 1.0);\n vec4 currProj = worldViewProjection * vec4(mix(prevPosition, position, percent), 1.0);\n vec4 nextProj = worldViewProjection * vec4(mix(prevPositionNext, positionNext, percent), 1.0);\n#else\n vec4 prevProj = worldViewProjection * vec4(positionPrev, 1.0);\n vec4 currProj = worldViewProjection * vec4(position, 1.0);\n vec4 nextProj = worldViewProjection * vec4(positionNext, 1.0);\n#endif\n\n if (currProj.w < 0.0) {\n if (nextProj.w > 0.0) {\n currProj = clipNear(currProj, nextProj);\n }\n else if (prevProj.w > 0.0) {\n currProj = clipNear(currProj, prevProj);\n }\n }\n\n vec2 prevScreen = (prevProj.xy / abs(prevProj.w) + 1.0) * 0.5 * viewport.zw;\n vec2 currScreen = (currProj.xy / abs(currProj.w) + 1.0) * 0.5 * viewport.zw;\n vec2 nextScreen = (nextProj.xy / abs(nextProj.w) + 1.0) * 0.5 * viewport.zw;\n\n vec2 dir;\n float len = offset;\n if (position == positionPrev) {\n dir = normalize(nextScreen - currScreen);\n }\n else if (position == positionNext) {\n dir = normalize(currScreen - prevScreen);\n }\n else {\n vec2 dirA = normalize(currScreen - prevScreen);\n vec2 dirB = normalize(nextScreen - currScreen);\n\n vec2 tanget = normalize(dirA + dirB);\n\n float miter = 1.0 / max(dot(tanget, dirA), 0.5);\n len *= miter;\n dir = tanget;\n }\n\n dir = vec2(-dir.y, dir.x) * len;\n currScreen += dir;\n\n currProj.xy = (currScreen / viewport.zw - 0.5) * 2.0 * abs(currProj.w);\n@end\n\n\n@export ecgl.meshLines3D.vertex\n\nattribute vec3 position: POSITION;\nattribute vec3 positionPrev;\nattribute vec3 positionNext;\nattribute float offset;\nattribute vec4 a_Color : COLOR;\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute vec3 prevPositionPrev;\nattribute vec3 prevPositionNext;\nuniform float percent : 1.0;\n#endif\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform vec4 viewport : VIEWPORT;\nuniform float near : NEAR;\n\nvarying vec4 v_Color;\n\n@import ecgl.common.wireframe.vertexHeader\n\n@import ecgl.lines3D.clipNear\n\nvoid main()\n{\n @import ecgl.lines3D.expandLine\n\n gl_Position = currProj;\n\n v_Color = a_Color;\n\n @import ecgl.common.wireframe.vertexMain\n}\n@end\n\n\n@export ecgl.meshLines3D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.util.srgb\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color * v_Color);\n#else\n gl_FragColor = color * v_Color;\n#endif\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end"); - - -/***/ }), -/* 47 */ -/***/ (function(module, exports, __webpack_require__) { - -var zrUtil = __webpack_require__(13); - -var BoundingRect = __webpack_require__(82); - -var _number = __webpack_require__(85); - -var parsePercent = _number.parsePercent; - -var formatUtil = __webpack_require__(171); - -/* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -*/ -// Layout helpers for each component positioning -var each = zrUtil.each; -/** - * @public - */ - -var LOCATION_PARAMS = ['left', 'right', 'top', 'bottom', 'width', 'height']; -/** - * @public - */ - -var HV_NAMES = [['width', 'left', 'right'], ['height', 'top', 'bottom']]; - -function boxLayout(orient, group, gap, maxWidth, maxHeight) { - var x = 0; - var y = 0; - - if (maxWidth == null) { - maxWidth = Infinity; - } - - if (maxHeight == null) { - maxHeight = Infinity; - } - - var currentLineMaxSize = 0; - group.eachChild(function (child, idx) { - var position = child.position; - var rect = child.getBoundingRect(); - var nextChild = group.childAt(idx + 1); - var nextChildRect = nextChild && nextChild.getBoundingRect(); - var nextX; - var nextY; - - if (orient === 'horizontal') { - var moveX = rect.width + (nextChildRect ? -nextChildRect.x + rect.x : 0); - nextX = x + moveX; // Wrap when width exceeds maxWidth or meet a `newline` group - // FIXME compare before adding gap? - - if (nextX > maxWidth || child.newline) { - x = 0; - nextX = moveX; - y += currentLineMaxSize + gap; - currentLineMaxSize = rect.height; - } else { - // FIXME: consider rect.y is not `0`? - currentLineMaxSize = Math.max(currentLineMaxSize, rect.height); - } - } else { - var moveY = rect.height + (nextChildRect ? -nextChildRect.y + rect.y : 0); - nextY = y + moveY; // Wrap when width exceeds maxHeight or meet a `newline` group - - if (nextY > maxHeight || child.newline) { - x += currentLineMaxSize + gap; - y = 0; - nextY = moveY; - currentLineMaxSize = rect.width; - } else { - currentLineMaxSize = Math.max(currentLineMaxSize, rect.width); - } - } - - if (child.newline) { - return; - } - - position[0] = x; - position[1] = y; - orient === 'horizontal' ? x = nextX + gap : y = nextY + gap; - }); -} -/** - * VBox or HBox layouting - * @param {string} orient - * @param {module:zrender/container/Group} group - * @param {number} gap - * @param {number} [width=Infinity] - * @param {number} [height=Infinity] - */ - - -var box = boxLayout; -/** - * VBox layouting - * @param {module:zrender/container/Group} group - * @param {number} gap - * @param {number} [width=Infinity] - * @param {number} [height=Infinity] - */ - -var vbox = zrUtil.curry(boxLayout, 'vertical'); -/** - * HBox layouting - * @param {module:zrender/container/Group} group - * @param {number} gap - * @param {number} [width=Infinity] - * @param {number} [height=Infinity] - */ - -var hbox = zrUtil.curry(boxLayout, 'horizontal'); -/** - * If x or x2 is not specified or 'center' 'left' 'right', - * the width would be as long as possible. - * If y or y2 is not specified or 'middle' 'top' 'bottom', - * the height would be as long as possible. - * - * @param {Object} positionInfo - * @param {number|string} [positionInfo.x] - * @param {number|string} [positionInfo.y] - * @param {number|string} [positionInfo.x2] - * @param {number|string} [positionInfo.y2] - * @param {Object} containerRect {width, height} - * @param {string|number} margin - * @return {Object} {width, height} - */ - -function getAvailableSize(positionInfo, containerRect, margin) { - var containerWidth = containerRect.width; - var containerHeight = containerRect.height; - var x = parsePercent(positionInfo.x, containerWidth); - var y = parsePercent(positionInfo.y, containerHeight); - var x2 = parsePercent(positionInfo.x2, containerWidth); - var y2 = parsePercent(positionInfo.y2, containerHeight); - (isNaN(x) || isNaN(parseFloat(positionInfo.x))) && (x = 0); - (isNaN(x2) || isNaN(parseFloat(positionInfo.x2))) && (x2 = containerWidth); - (isNaN(y) || isNaN(parseFloat(positionInfo.y))) && (y = 0); - (isNaN(y2) || isNaN(parseFloat(positionInfo.y2))) && (y2 = containerHeight); - margin = formatUtil.normalizeCssArray(margin || 0); - return { - width: Math.max(x2 - x - margin[1] - margin[3], 0), - height: Math.max(y2 - y - margin[0] - margin[2], 0) - }; -} -/** - * Parse position info. - * - * @param {Object} positionInfo - * @param {number|string} [positionInfo.left] - * @param {number|string} [positionInfo.top] - * @param {number|string} [positionInfo.right] - * @param {number|string} [positionInfo.bottom] - * @param {number|string} [positionInfo.width] - * @param {number|string} [positionInfo.height] - * @param {number|string} [positionInfo.aspect] Aspect is width / height - * @param {Object} containerRect - * @param {string|number} [margin] - * - * @return {module:zrender/core/BoundingRect} - */ - - -function getLayoutRect(positionInfo, containerRect, margin) { - margin = formatUtil.normalizeCssArray(margin || 0); - var containerWidth = containerRect.width; - var containerHeight = containerRect.height; - var left = parsePercent(positionInfo.left, containerWidth); - var top = parsePercent(positionInfo.top, containerHeight); - var right = parsePercent(positionInfo.right, containerWidth); - var bottom = parsePercent(positionInfo.bottom, containerHeight); - var width = parsePercent(positionInfo.width, containerWidth); - var height = parsePercent(positionInfo.height, containerHeight); - var verticalMargin = margin[2] + margin[0]; - var horizontalMargin = margin[1] + margin[3]; - var aspect = positionInfo.aspect; // If width is not specified, calculate width from left and right - - if (isNaN(width)) { - width = containerWidth - right - horizontalMargin - left; - } - - if (isNaN(height)) { - height = containerHeight - bottom - verticalMargin - top; - } - - if (aspect != null) { - // If width and height are not given - // 1. Graph should not exceeds the container - // 2. Aspect must be keeped - // 3. Graph should take the space as more as possible - // FIXME - // Margin is not considered, because there is no case that both - // using margin and aspect so far. - if (isNaN(width) && isNaN(height)) { - if (aspect > containerWidth / containerHeight) { - width = containerWidth * 0.8; - } else { - height = containerHeight * 0.8; - } - } // Calculate width or height with given aspect - - - if (isNaN(width)) { - width = aspect * height; - } - - if (isNaN(height)) { - height = width / aspect; - } - } // If left is not specified, calculate left from right and width - - - if (isNaN(left)) { - left = containerWidth - right - width - horizontalMargin; - } - - if (isNaN(top)) { - top = containerHeight - bottom - height - verticalMargin; - } // Align left and top - - - switch (positionInfo.left || positionInfo.right) { - case 'center': - left = containerWidth / 2 - width / 2 - margin[3]; - break; - - case 'right': - left = containerWidth - width - horizontalMargin; - break; - } - - switch (positionInfo.top || positionInfo.bottom) { - case 'middle': - case 'center': - top = containerHeight / 2 - height / 2 - margin[0]; - break; - - case 'bottom': - top = containerHeight - height - verticalMargin; - break; - } // If something is wrong and left, top, width, height are calculated as NaN - - - left = left || 0; - top = top || 0; - - if (isNaN(width)) { - // Width may be NaN if only one value is given except width - width = containerWidth - horizontalMargin - left - (right || 0); - } - - if (isNaN(height)) { - // Height may be NaN if only one value is given except height - height = containerHeight - verticalMargin - top - (bottom || 0); - } - - var rect = new BoundingRect(left + margin[3], top + margin[0], width, height); - rect.margin = margin; - return rect; -} -/** - * Position a zr element in viewport - * Group position is specified by either - * {left, top}, {right, bottom} - * If all properties exists, right and bottom will be igonred. - * - * Logic: - * 1. Scale (against origin point in parent coord) - * 2. Rotate (against origin point in parent coord) - * 3. Traslate (with el.position by this method) - * So this method only fixes the last step 'Traslate', which does not affect - * scaling and rotating. - * - * If be called repeatly with the same input el, the same result will be gotten. - * - * @param {module:zrender/Element} el Should have `getBoundingRect` method. - * @param {Object} positionInfo - * @param {number|string} [positionInfo.left] - * @param {number|string} [positionInfo.top] - * @param {number|string} [positionInfo.right] - * @param {number|string} [positionInfo.bottom] - * @param {number|string} [positionInfo.width] Only for opt.boundingModel: 'raw' - * @param {number|string} [positionInfo.height] Only for opt.boundingModel: 'raw' - * @param {Object} containerRect - * @param {string|number} margin - * @param {Object} [opt] - * @param {Array.} [opt.hv=[1,1]] Only horizontal or only vertical. - * @param {Array.} [opt.boundingMode='all'] - * Specify how to calculate boundingRect when locating. - * 'all': Position the boundingRect that is transformed and uioned - * both itself and its descendants. - * This mode simplies confine the elements in the bounding - * of their container (e.g., using 'right: 0'). - * 'raw': Position the boundingRect that is not transformed and only itself. - * This mode is useful when you want a element can overflow its - * container. (Consider a rotated circle needs to be located in a corner.) - * In this mode positionInfo.width/height can only be number. - */ - - -function positionElement(el, positionInfo, containerRect, margin, opt) { - var h = !opt || !opt.hv || opt.hv[0]; - var v = !opt || !opt.hv || opt.hv[1]; - var boundingMode = opt && opt.boundingMode || 'all'; - - if (!h && !v) { - return; - } - - var rect; - - if (boundingMode === 'raw') { - rect = el.type === 'group' ? new BoundingRect(0, 0, +positionInfo.width || 0, +positionInfo.height || 0) : el.getBoundingRect(); - } else { - rect = el.getBoundingRect(); - - if (el.needLocalTransform()) { - var transform = el.getLocalTransform(); // Notice: raw rect may be inner object of el, - // which should not be modified. - - rect = rect.clone(); - rect.applyTransform(transform); - } - } // The real width and height can not be specified but calculated by the given el. - - - positionInfo = getLayoutRect(zrUtil.defaults({ - width: rect.width, - height: rect.height - }, positionInfo), containerRect, margin); // Because 'tranlate' is the last step in transform - // (see zrender/core/Transformable#getLocalTransform), - // we can just only modify el.position to get final result. - - var elPos = el.position; - var dx = h ? positionInfo.x - rect.x : 0; - var dy = v ? positionInfo.y - rect.y : 0; - el.attr('position', boundingMode === 'raw' ? [dx, dy] : [elPos[0] + dx, elPos[1] + dy]); -} -/** - * @param {Object} option Contains some of the properties in HV_NAMES. - * @param {number} hvIdx 0: horizontal; 1: vertical. - */ - - -function sizeCalculable(option, hvIdx) { - return option[HV_NAMES[hvIdx][0]] != null || option[HV_NAMES[hvIdx][1]] != null && option[HV_NAMES[hvIdx][2]] != null; -} -/** - * Consider Case: - * When defulat option has {left: 0, width: 100}, and we set {right: 0} - * through setOption or media query, using normal zrUtil.merge will cause - * {right: 0} does not take effect. - * - * @example - * ComponentModel.extend({ - * init: function () { - * ... - * var inputPositionParams = layout.getLayoutParams(option); - * this.mergeOption(inputPositionParams); - * }, - * mergeOption: function (newOption) { - * newOption && zrUtil.merge(thisOption, newOption, true); - * layout.mergeLayoutParam(thisOption, newOption); - * } - * }); - * - * @param {Object} targetOption - * @param {Object} newOption - * @param {Object|string} [opt] - * @param {boolean|Array.} [opt.ignoreSize=false] Used for the components - * that width (or height) should not be calculated by left and right (or top and bottom). - */ - - -function mergeLayoutParam(targetOption, newOption, opt) { - !zrUtil.isObject(opt) && (opt = {}); - var ignoreSize = opt.ignoreSize; - !zrUtil.isArray(ignoreSize) && (ignoreSize = [ignoreSize, ignoreSize]); - var hResult = merge(HV_NAMES[0], 0); - var vResult = merge(HV_NAMES[1], 1); - copy(HV_NAMES[0], targetOption, hResult); - copy(HV_NAMES[1], targetOption, vResult); - - function merge(names, hvIdx) { - var newParams = {}; - var newValueCount = 0; - var merged = {}; - var mergedValueCount = 0; - var enoughParamNumber = 2; - each(names, function (name) { - merged[name] = targetOption[name]; - }); - each(names, function (name) { - // Consider case: newOption.width is null, which is - // set by user for removing width setting. - hasProp(newOption, name) && (newParams[name] = merged[name] = newOption[name]); - hasValue(newParams, name) && newValueCount++; - hasValue(merged, name) && mergedValueCount++; - }); - - if (ignoreSize[hvIdx]) { - // Only one of left/right is premitted to exist. - if (hasValue(newOption, names[1])) { - merged[names[2]] = null; - } else if (hasValue(newOption, names[2])) { - merged[names[1]] = null; - } - - return merged; - } // Case: newOption: {width: ..., right: ...}, - // or targetOption: {right: ...} and newOption: {width: ...}, - // There is no conflict when merged only has params count - // little than enoughParamNumber. - - - if (mergedValueCount === enoughParamNumber || !newValueCount) { - return merged; - } // Case: newOption: {width: ..., right: ...}, - // Than we can make sure user only want those two, and ignore - // all origin params in targetOption. - else if (newValueCount >= enoughParamNumber) { - return newParams; - } else { - // Chose another param from targetOption by priority. - for (var i = 0; i < names.length; i++) { - var name = names[i]; - - if (!hasProp(newParams, name) && hasProp(targetOption, name)) { - newParams[name] = targetOption[name]; - break; - } - } - - return newParams; - } - } - - function hasProp(obj, name) { - return obj.hasOwnProperty(name); - } - - function hasValue(obj, name) { - return obj[name] != null && obj[name] !== 'auto'; - } - - function copy(names, target, source) { - each(names, function (name) { - target[name] = source[name]; - }); - } -} -/** - * Retrieve 'left', 'right', 'top', 'bottom', 'width', 'height' from object. - * @param {Object} source - * @return {Object} Result contains those props. - */ - - -function getLayoutParams(source) { - return copyLayoutParams({}, source); -} -/** - * Retrieve 'left', 'right', 'top', 'bottom', 'width', 'height' from object. - * @param {Object} source - * @return {Object} Result contains those props. - */ - - -function copyLayoutParams(target, source) { - source && target && each(LOCATION_PARAMS, function (name) { - source.hasOwnProperty(name) && (target[name] = source[name]); - }); - return target; -} - -exports.LOCATION_PARAMS = LOCATION_PARAMS; -exports.HV_NAMES = HV_NAMES; -exports.box = box; -exports.vbox = vbox; -exports.hbox = hbox; -exports.getAvailableSize = getAvailableSize; -exports.getLayoutRect = getLayoutRect; -exports.positionElement = positionElement; -exports.sizeCalculable = sizeCalculable; -exports.mergeLayoutParam = mergeLayoutParam; -exports.getLayoutParams = getLayoutParams; -exports.copyLayoutParams = copyLayoutParams; - -/***/ }), -/* 48 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__core_Base__ = __webpack_require__(7); - - -// PENDING -// Use topological sort ? - -/** - * Node of graph based post processing. - * - * @constructor clay.compositor.CompositorNode - * @extends clay.core.Base - * - */ -var CompositorNode = __WEBPACK_IMPORTED_MODULE_0__core_Base__["a" /* default */].extend(function () { - return /** @lends clay.compositor.CompositorNode# */ { - /** - * @type {string} - */ - name: '', - - /** - * Input links, will be updated by the graph - * @example: - * inputName: { - * node: someNode, - * pin: 'xxxx' - * } - * @type {Object} - */ - inputLinks: {}, - - /** - * Output links, will be updated by the graph - * @example: - * outputName: { - * node: someNode, - * pin: 'xxxx' - * } - * @type {Object} - */ - outputLinks: {}, - - // Save the output texture of previous frame - // Will be used when there exist a circular reference - _prevOutputTextures: {}, - _outputTextures: {}, - - // Example: { name: 2 } - _outputReferences: {}, - - _rendering: false, - // If rendered in this frame - _rendered: false, - - _compositor: null - }; -}, -/** @lends clay.compositor.CompositorNode.prototype */ -{ - - // TODO Remove parameter function callback - updateParameter: function (outputName, renderer) { - var outputInfo = this.outputs[outputName]; - var parameters = outputInfo.parameters; - var parametersCopy = outputInfo._parametersCopy; - if (!parametersCopy) { - parametersCopy = outputInfo._parametersCopy = {}; - } - if (parameters) { - for (var key in parameters) { - if (key !== 'width' && key !== 'height') { - parametersCopy[key] = parameters[key]; - } - } - } - var width, height; - if (parameters.width instanceof Function) { - width = parameters.width.call(this, renderer); - } - else { - width = parameters.width; - } - if (parameters.height instanceof Function) { - height = parameters.height.call(this, renderer); - } - else { - height = parameters.height; - } - if ( - parametersCopy.width !== width - || parametersCopy.height !== height - ) { - if (this._outputTextures[outputName]) { - this._outputTextures[outputName].dispose(renderer.gl); - } - } - parametersCopy.width = width; - parametersCopy.height = height; - - return parametersCopy; - }, - - /** - * Set parameter - * @param {string} name - * @param {} value - */ - setParameter: function (name, value) {}, - /** - * Get parameter value - * @param {string} name - * @return {} - */ - getParameter: function (name) {}, - /** - * Set parameters - * @param {Object} obj - */ - setParameters: function (obj) { - for (var name in obj) { - this.setParameter(name, obj[name]); - } - }, - - render: function () {}, - - getOutput: function (renderer /*optional*/, name) { - if (name == null) { - // Return the output texture without rendering - name = renderer; - return this._outputTextures[name]; - } - var outputInfo = this.outputs[name]; - if (!outputInfo) { - return ; - } - - // Already been rendered in this frame - if (this._rendered) { - // Force return texture in last frame - if (outputInfo.outputLastFrame) { - return this._prevOutputTextures[name]; - } - else { - return this._outputTextures[name]; - } - } - else if ( - // TODO - this._rendering // Solve Circular Reference - ) { - if (!this._prevOutputTextures[name]) { - // Create a blank texture at first pass - this._prevOutputTextures[name] = this._compositor.allocateTexture(outputInfo.parameters || {}); - } - return this._prevOutputTextures[name]; - } - - this.render(renderer); - - return this._outputTextures[name]; - }, - - removeReference: function (outputName) { - this._outputReferences[outputName]--; - if (this._outputReferences[outputName] === 0) { - var outputInfo = this.outputs[outputName]; - if (outputInfo.keepLastFrame) { - if (this._prevOutputTextures[outputName]) { - this._compositor.releaseTexture(this._prevOutputTextures[outputName]); - } - this._prevOutputTextures[outputName] = this._outputTextures[outputName]; - } - else { - // Output of this node have alreay been used by all other nodes - // Put the texture back to the pool. - this._compositor.releaseTexture(this._outputTextures[outputName]); - } - } - }, - - link: function (inputPinName, fromNode, fromPinName) { - - // The relationship from output pin to input pin is one-on-multiple - this.inputLinks[inputPinName] = { - node: fromNode, - pin: fromPinName - }; - if (!fromNode.outputLinks[fromPinName]) { - fromNode.outputLinks[fromPinName] = []; - } - fromNode.outputLinks[fromPinName].push({ - node: this, - pin: inputPinName - }); - - // Enabled the pin texture in shader - this.pass.material.enableTexture(inputPinName); - }, - - clear: function () { - this.inputLinks = {}; - this.outputLinks = {}; - }, - - updateReference: function (outputName) { - if (!this._rendering) { - this._rendering = true; - for (var inputName in this.inputLinks) { - var link = this.inputLinks[inputName]; - link.node.updateReference(link.pin); - } - this._rendering = false; - } - if (outputName) { - this._outputReferences[outputName] ++; - } - }, - - beforeFrame: function () { - this._rendered = false; - - for (var name in this.outputLinks) { - this._outputReferences[name] = 0; - } - }, - - afterFrame: function () { - // Put back all the textures to pool - for (var name in this.outputLinks) { - if (this._outputReferences[name] > 0) { - var outputInfo = this.outputs[name]; - if (outputInfo.keepLastFrame) { - if (this._prevOutputTextures[name]) { - this._compositor.releaseTexture(this._prevOutputTextures[name]); - } - this._prevOutputTextures[name] = this._outputTextures[name]; - } - else { - this._compositor.releaseTexture(this._outputTextures[name]); - } - } - } - } -}); - -/* harmony default export */ __webpack_exports__["a"] = (CompositorNode); - - -/***/ }), -/* 49 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; - -// Generate halton sequence -// https://en.wikipedia.org/wiki/Halton_sequence -function halton(index, base) { - - var result = 0; - var f = 1 / base; - var i = index; - while (i > 0) { - result = result + f * (i % base); - i = Math.floor(i / base); - f = f / base; - } - return result; -} - - -/* harmony default export */ __webpack_exports__["a"] = (halton); - -/***/ }), -/* 50 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); - - -/* harmony default export */ __webpack_exports__["a"] = (function (seriesModel, dims, source) { - source = source || seriesModel.getSource(); - - var coordSysDimensions = dims || __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.getCoordinateSystemDimensions(seriesModel.get('coordinateSystem')) || ['x', 'y', 'z']; - - var dimensions = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.helper.createDimensions(source, { - dimensionsDefine: source.dimensionsDefine || seriesModel.get('dimensions'), - encodeDefine: source.encodeDefine || seriesModel.get('encode'), - coordDimensions: coordSysDimensions.map(function (dim) { - var axis3DModel = seriesModel.getReferringComponents(dim + 'Axis3D')[0]; - return { - type: (axis3DModel && axis3DModel.get('type') === 'category') ? 'ordinal' : 'float', - name: dim - // Find stackable dimension. Which will represent value. - // stackable: dim === 'z' - }; - }) - }); - if (seriesModel.get('coordinateSystem') === 'cartesian3D') { - dimensions.forEach(function (dimInfo) { - if (coordSysDimensions.indexOf(dimInfo.coordDim) >= 0) { - var axis3DModel = seriesModel.getReferringComponents(dimInfo.coordDim + 'Axis3D')[0]; - if (axis3DModel && axis3DModel.get('type') === 'category') { - dimInfo.ordinalMeta = axis3DModel.getOrdinalMeta(); - } - } - }); - } - - var stackCalculationInfo = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.helper.dataStack.enableDataStack( - // Only support 'z' and `byIndex` now. - seriesModel, dimensions, {byIndex: true, stackedCoordDimension: 'z'} - ); - - var data = new __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.List(dimensions, seriesModel); - - data.setCalculationInfo(stackCalculationInfo); - - data.initData(source); - - return data; -}); - -/***/ }), -/* 51 */ -/***/ (function(module, exports) { - -/* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -*/ -function _default(seriesType, defaultSymbolType, legendSymbol) { - // Encoding visual for all series include which is filtered for legend drawing - return { - seriesType: seriesType, - // For legend. - performRawSeries: true, - reset: function (seriesModel, ecModel, api) { - var data = seriesModel.getData(); - var symbolType = seriesModel.get('symbol') || defaultSymbolType; - var symbolSize = seriesModel.get('symbolSize'); - var keepAspect = seriesModel.get('symbolKeepAspect'); - data.setVisual({ - legendSymbol: legendSymbol || symbolType, - symbol: symbolType, - symbolSize: symbolSize, - symbolKeepAspect: keepAspect - }); // Only visible series has each data be visual encoded - - if (ecModel.isSeriesFiltered(seriesModel)) { - return; - } - - var hasCallback = typeof symbolSize === 'function'; - - function dataEach(data, idx) { - if (typeof symbolSize === 'function') { - var rawValue = seriesModel.getRawValue(idx); // FIXME - - var params = seriesModel.getDataParams(idx); - data.setItemVisual(idx, 'symbolSize', symbolSize(rawValue, params)); - } - - if (data.hasItemOption) { - var itemModel = data.getItemModel(idx); - var itemSymbolType = itemModel.getShallow('symbol', true); - var itemSymbolSize = itemModel.getShallow('symbolSize', true); - var itemSymbolKeepAspect = itemModel.getShallow('symbolKeepAspect', true); // If has item symbol - - if (itemSymbolType != null) { - data.setItemVisual(idx, 'symbol', itemSymbolType); - } - - if (itemSymbolSize != null) { - // PENDING Transform symbolSize ? - data.setItemVisual(idx, 'symbolSize', itemSymbolSize); - } - - if (itemSymbolKeepAspect != null) { - data.setItemVisual(idx, 'symbolKeepAspect', itemSymbolKeepAspect); - } - } - } - - return { - dataEach: data.hasItemOption || hasCallback ? dataEach : null - }; - } - }; -} - -module.exports = _default; - -/***/ }), -/* 52 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__core_Base__ = __webpack_require__(7); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__core_GLInfo__ = __webpack_require__(111); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__core_glenum__ = __webpack_require__(11); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__core_vendor__ = __webpack_require__(14); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__Material__ = __webpack_require__(19); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__math_Vector2__ = __webpack_require__(26); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__gpu_ProgramManager__ = __webpack_require__(115); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Shader__ = __webpack_require__(8); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__shader_source_prez_glsl_js__ = __webpack_require__(71); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__glmatrix_mat4__ = __webpack_require__(21); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__glmatrix_vec3__ = __webpack_require__(12); -// TODO Resources like shader, texture, geometry reference management -// Trace and find out which shader, texture, geometry can be destroyed - - - - - - - - - -// Light header - - - -__WEBPACK_IMPORTED_MODULE_7__Shader__["a" /* default */]['import'](__WEBPACK_IMPORTED_MODULE_8__shader_source_prez_glsl_js__["a" /* default */]); - - - - -var mat4Create = __WEBPACK_IMPORTED_MODULE_9__glmatrix_mat4__["a" /* default */].create; - -var errorShader = {}; - -function defaultGetMaterial(renderable) { - return renderable.material; -} -function defaultGetUniform(renderable, material, symbol) { - return material.uniforms[symbol].value; -} -function defaultIsMaterialChanged(renderabled, prevRenderable, material, prevMaterial) { - return material !== prevMaterial; -} -function defaultIfRender(renderable) { - return true; -} - -function noop() {} - -var attributeBufferTypeMap = { - float: __WEBPACK_IMPORTED_MODULE_2__core_glenum__["a" /* default */].FLOAT, - byte: __WEBPACK_IMPORTED_MODULE_2__core_glenum__["a" /* default */].BYTE, - ubyte: __WEBPACK_IMPORTED_MODULE_2__core_glenum__["a" /* default */].UNSIGNED_BYTE, - short: __WEBPACK_IMPORTED_MODULE_2__core_glenum__["a" /* default */].SHORT, - ushort: __WEBPACK_IMPORTED_MODULE_2__core_glenum__["a" /* default */].UNSIGNED_SHORT -}; - -function VertexArrayObject(availableAttributes, availableAttributeSymbols, indicesBuffer) { - this.availableAttributes = availableAttributes; - this.availableAttributeSymbols = availableAttributeSymbols; - this.indicesBuffer = indicesBuffer; - - this.vao = null; -} - -function PlaceHolderTexture(renderer) { - var blankCanvas; - var webglTexture; - this.bind = function (renderer) { - if (!blankCanvas) { - // TODO Environment not support createCanvas. - blankCanvas = __WEBPACK_IMPORTED_MODULE_3__core_vendor__["a" /* default */].createCanvas(); - blankCanvas.width = blankCanvas.height = 1; - blankCanvas.getContext('2d'); - } - - var gl = renderer.gl; - var firstBind = !webglTexture; - if (firstBind) { - webglTexture = gl.createTexture(); - } - gl.bindTexture(gl.TEXTURE_2D, webglTexture); - if (firstBind) { - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, blankCanvas); - } - }; - this.unbind = function (renderer) { - renderer.gl.bindTexture(renderer.gl.TEXTURE_2D, null); - }; - this.isRenderable = function () { - return true; - }; -} -/** - * @constructor clay.Renderer - * @extends clay.core.Base - */ -var Renderer = __WEBPACK_IMPORTED_MODULE_0__core_Base__["a" /* default */].extend(function () { - return /** @lends clay.Renderer# */ { - - /** - * @type {HTMLCanvasElement} - * @readonly - */ - canvas: null, - - /** - * Canvas width, set by resize method - * @type {number} - * @private - */ - _width: 100, - - /** - * Canvas width, set by resize method - * @type {number} - * @private - */ - _height: 100, - - /** - * Device pixel ratio, set by setDevicePixelRatio method - * Specially for high defination display - * @see http://www.khronos.org/webgl/wiki/HandlingHighDPI - * @type {number} - * @private - */ - devicePixelRatio: (typeof window !== 'undefined' && window.devicePixelRatio) || 1.0, - - /** - * Clear color - * @type {number[]} - */ - clearColor: [0.0, 0.0, 0.0, 0.0], - - /** - * Default: - * _gl.COLOR_BUFFER_BIT | _gl.DEPTH_BUFFER_BIT | _gl.STENCIL_BUFFER_BIT - * @type {number} - */ - clearBit: 17664, - - // Settings when getting context - // http://www.khronos.org/registry/webgl/specs/latest/#2.4 - - /** - * If enable alpha, default true - * @type {boolean} - */ - alpha: true, - /** - * If enable depth buffer, default true - * @type {boolean} - */ - depth: true, - /** - * If enable stencil buffer, default false - * @type {boolean} - */ - stencil: false, - /** - * If enable antialias, default true - * @type {boolean} - */ - antialias: true, - /** - * If enable premultiplied alpha, default true - * @type {boolean} - */ - premultipliedAlpha: true, - /** - * If preserve drawing buffer, default false - * @type {boolean} - */ - preserveDrawingBuffer: false, - /** - * If throw context error, usually turned on in debug mode - * @type {boolean} - */ - throwError: true, - /** - * WebGL Context created from given canvas - * @type {WebGLRenderingContext} - */ - gl: null, - /** - * Renderer viewport, read-only, can be set by setViewport method - * @type {Object} - */ - viewport: {}, - - // Set by FrameBuffer#bind - __currentFrameBuffer: null, - - _viewportStack: [], - _clearStack: [], - - _sceneRendering: null - }; -}, function () { - - if (!this.canvas) { - this.canvas = __WEBPACK_IMPORTED_MODULE_3__core_vendor__["a" /* default */].createCanvas(); - } - var canvas = this.canvas; - try { - var opts = { - alpha: this.alpha, - depth: this.depth, - stencil: this.stencil, - antialias: this.antialias, - premultipliedAlpha: this.premultipliedAlpha, - preserveDrawingBuffer: this.preserveDrawingBuffer - }; - - this.gl = canvas.getContext('webgl', opts) - || canvas.getContext('experimental-webgl', opts); - - if (!this.gl) { - throw new Error(); - } - - this._glinfo = new __WEBPACK_IMPORTED_MODULE_1__core_GLInfo__["a" /* default */](this.gl); - - if (this.gl.targetRenderer) { - console.error('Already created a renderer'); - } - this.gl.targetRenderer = this; - - this.resize(); - } - catch (e) { - throw 'Error creating WebGL Context ' + e; - } - - // Init managers - this._programMgr = new __WEBPACK_IMPORTED_MODULE_6__gpu_ProgramManager__["a" /* default */](this); - - this._placeholderTexture = new PlaceHolderTexture(this); -}, -/** @lends clay.Renderer.prototype. **/ -{ - /** - * Resize the canvas - * @param {number} width - * @param {number} height - */ - resize: function(width, height) { - var canvas = this.canvas; - // http://www.khronos.org/webgl/wiki/HandlingHighDPI - // set the display size of the canvas. - var dpr = this.devicePixelRatio; - if (width != null) { - canvas.style.width = width + 'px'; - canvas.style.height = height + 'px'; - // set the size of the drawingBuffer - canvas.width = width * dpr; - canvas.height = height * dpr; - - this._width = width; - this._height = height; - } - else { - this._width = canvas.width / dpr; - this._height = canvas.height / dpr; - } - - this.setViewport(0, 0, this._width, this._height); - }, - - /** - * Get renderer width - * @return {number} - */ - getWidth: function () { - return this._width; - }, - - /** - * Get renderer height - * @return {number} - */ - getHeight: function () { - return this._height; - }, - - /** - * Get viewport aspect, - * @return {number} - */ - getViewportAspect: function () { - var viewport = this.viewport; - return viewport.width / viewport.height; - }, - - /** - * Set devicePixelRatio - * @param {number} devicePixelRatio - */ - setDevicePixelRatio: function(devicePixelRatio) { - this.devicePixelRatio = devicePixelRatio; - this.resize(this._width, this._height); - }, - - /** - * Get devicePixelRatio - * @param {number} devicePixelRatio - */ - getDevicePixelRatio: function () { - return this.devicePixelRatio; - }, - - /** - * Get WebGL extension - * @param {string} name - * @return {object} - */ - getGLExtension: function (name) { - return this._glinfo.getExtension(name); - }, - - /** - * Get WebGL parameter - * @param {string} name - * @return {*} - */ - getGLParameter: function (name) { - return this._glinfo.getParameter(name); - }, - - /** - * Set rendering viewport - * @param {number|Object} x - * @param {number} [y] - * @param {number} [width] - * @param {number} [height] - * @param {number} [devicePixelRatio] - * Defaultly use the renderere devicePixelRatio - * It needs to be 1 when setViewport is called by frameBuffer - * - * @example - * setViewport(0,0,width,height,1) - * setViewport({ - * x: 0, - * y: 0, - * width: width, - * height: height, - * devicePixelRatio: 1 - * }) - */ - setViewport: function (x, y, width, height, dpr) { - - if (typeof x === 'object') { - var obj = x; - - x = obj.x; - y = obj.y; - width = obj.width; - height = obj.height; - dpr = obj.devicePixelRatio; - } - dpr = dpr || this.devicePixelRatio; - - this.gl.viewport( - x * dpr, y * dpr, width * dpr, height * dpr - ); - // Use a fresh new object, not write property. - this.viewport = { - x: x, - y: y, - width: width, - height: height, - devicePixelRatio: dpr - }; - }, - - /** - * Push current viewport into a stack - */ - saveViewport: function () { - this._viewportStack.push(this.viewport); - }, - - /** - * Pop viewport from stack, restore in the renderer - */ - restoreViewport: function () { - if (this._viewportStack.length > 0) { - this.setViewport(this._viewportStack.pop()); - } - }, - - /** - * Push current clear into a stack - */ - saveClear: function () { - this._clearStack.push({ - clearBit: this.clearBit, - clearColor: this.clearColor - }); - }, - - /** - * Pop clear from stack, restore in the renderer - */ - restoreClear: function () { - if (this._clearStack.length > 0) { - var opt = this._clearStack.pop(); - this.clearColor = opt.clearColor; - this.clearBit = opt.clearBit; - } - }, - - bindSceneRendering: function (scene) { - this._sceneRendering = scene; - }, - - /** - * Render the scene in camera to the screen or binded offline framebuffer - * @param {clay.Scene} scene - * @param {clay.Camera} camera - * @param {boolean} [notUpdateScene] If not call the scene.update methods in the rendering, default true - * @param {boolean} [preZ] If use preZ optimization, default false - * @return {IRenderInfo} - */ - render: function(scene, camera, notUpdateScene, preZ) { - var _gl = this.gl; - - var clearColor = this.clearColor; - - if (this.clearBit) { - - // Must set depth and color mask true before clear - _gl.colorMask(true, true, true, true); - _gl.depthMask(true); - var viewport = this.viewport; - var needsScissor = false; - var viewportDpr = viewport.devicePixelRatio; - if (viewport.width !== this._width || viewport.height !== this._height - || (viewportDpr && viewportDpr !== this.devicePixelRatio) - || viewport.x || viewport.y - ) { - needsScissor = true; - // http://stackoverflow.com/questions/11544608/how-to-clear-a-rectangle-area-in-webgl - // Only clear the viewport - _gl.enable(_gl.SCISSOR_TEST); - _gl.scissor(viewport.x * viewportDpr, viewport.y * viewportDpr, viewport.width * viewportDpr, viewport.height * viewportDpr); - } - _gl.clearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]); - _gl.clear(this.clearBit); - if (needsScissor) { - _gl.disable(_gl.SCISSOR_TEST); - } - } - - // If the scene have been updated in the prepass like shadow map - // There is no need to update it again - if (!notUpdateScene) { - scene.update(false); - } - scene.updateLights(); - - camera = camera || scene.getMainCamera(); - if (!camera) { - console.error('Can\'t find camera in the scene.'); - return; - } - camera.update(); - var renderList = scene.updateRenderList(camera, true); - - this._sceneRendering = scene; - - var opaqueList = renderList.opaque; - var transparentList = renderList.transparent; - var sceneMaterial = scene.material; - - scene.trigger('beforerender', this, scene, camera, renderList); - - // Render pre z - if (preZ) { - this.renderPreZ(opaqueList, scene, camera); - _gl.depthFunc(_gl.LEQUAL); - } - else { - _gl.depthFunc(_gl.LESS); - } - - // Update the depth of transparent list. - var worldViewMat = mat4Create(); - var posViewSpace = __WEBPACK_IMPORTED_MODULE_10__glmatrix_vec3__["a" /* default */].create(); - for (var i = 0; i < transparentList.length; i++) { - var renderable = transparentList[i]; - __WEBPACK_IMPORTED_MODULE_9__glmatrix_mat4__["a" /* default */].multiplyAffine(worldViewMat, camera.viewMatrix.array, renderable.worldTransform.array); - __WEBPACK_IMPORTED_MODULE_10__glmatrix_vec3__["a" /* default */].transformMat4(posViewSpace, renderable.position.array, worldViewMat); - renderable.__depth = posViewSpace[2]; - } - - // Render opaque list - this.renderPass(opaqueList, camera, { - getMaterial: function (renderable) { - return sceneMaterial || renderable.material; - }, - sortCompare: this.opaqueSortCompare - }); - - this.renderPass(transparentList, camera, { - getMaterial: function (renderable) { - return sceneMaterial || renderable.material; - }, - sortCompare: this.transparentSortCompare - }); - - scene.trigger('afterrender', this, scene, camera, renderList); - - // Cleanup - this._sceneRendering = null; - }, - - getProgram: function (renderable, renderMaterial, scene) { - renderMaterial = renderMaterial || renderable.material; - return this._programMgr.getProgram(renderable, renderMaterial, scene); - }, - - validateProgram: function (program) { - if (program.__error) { - var errorMsg = program.__error; - if (errorShader[program.__uid__]) { - return; - } - errorShader[program.__uid__] = true; - - if (this.throwError) { - throw new Error(errorMsg); - } - else { - this.trigger('error', errorMsg); - } - } - - }, - - updatePrograms: function (list, scene, passConfig) { - var getMaterial = (passConfig && passConfig.getMaterial) || defaultGetMaterial; - scene = scene || null; - for (var i = 0; i < list.length; i++) { - var renderable = list[i]; - var renderMaterial = getMaterial.call(this, renderable); - if (i > 0) { - var prevRenderable = list[i - 1]; - var prevJointsLen = prevRenderable.joints ? prevRenderable.joints.length : 0; - var jointsLen = renderable.joints ? renderable.joints.length : 0; - // Keep program not change if joints, material, lightGroup are same of two renderables. - if (jointsLen === prevJointsLen - && renderable.material === prevRenderable.material - && renderable.lightGroup === prevRenderable.lightGroup - ) { - renderable.__program = prevRenderable.__program; - continue; - } - } - - var program = this._programMgr.getProgram(renderable, renderMaterial, scene); - - this.validateProgram(program); - - renderable.__program = program; - } - }, - - /** - * Render a single renderable list in camera in sequence - * @param {clay.Renderable[]} list List of all renderables. - * @param {clay.Camera} [camera] Camera provide view matrix and porjection matrix. It can be null. - * @param {Object} [passConfig] - * @param {Function} [passConfig.getMaterial] Get renderable material. - * @param {Function} [passConfig.getUniform] Get material uniform value. - * @param {Function} [passConfig.isMaterialChanged] If material changed. - * @param {Function} [passConfig.beforeRender] Before render each renderable. - * @param {Function} [passConfig.afterRender] After render each renderable - * @param {Function} [passConfig.ifRender] If render the renderable. - * @param {Function} [passConfig.sortCompare] Sort compare function. - * @return {IRenderInfo} - */ - renderPass: function(list, camera, passConfig) { - this.trigger('beforerenderpass', this, list, camera, passConfig); - - passConfig = passConfig || {}; - passConfig.getMaterial = passConfig.getMaterial || defaultGetMaterial; - passConfig.getUniform = passConfig.getUniform || defaultGetUniform; - // PENDING Better solution? - passConfig.isMaterialChanged = passConfig.isMaterialChanged || defaultIsMaterialChanged; - passConfig.beforeRender = passConfig.beforeRender || noop; - passConfig.afterRender = passConfig.afterRender || noop; - - var ifRenderObject = passConfig.ifRender || defaultIfRender; - - this.updatePrograms(list, this._sceneRendering, passConfig); - if (passConfig.sortCompare) { - list.sort(passConfig.sortCompare); - } - - // Some common builtin uniforms - var viewport = this.viewport; - var vDpr = viewport.devicePixelRatio; - var viewportUniform = [ - viewport.x * vDpr, viewport.y * vDpr, - viewport.width * vDpr, viewport.height * vDpr - ]; - var windowDpr = this.devicePixelRatio; - var windowSizeUniform = this.__currentFrameBuffer - ? [this.__currentFrameBuffer.getTextureWidth(), this.__currentFrameBuffer.getTextureHeight()] - : [this._width * windowDpr, this._height * windowDpr]; - // DEPRECATED - var viewportSizeUniform = [ - viewportUniform[2], viewportUniform[3] - ]; - var time = Date.now(); - - // Calculate view and projection matrix - if (camera) { - __WEBPACK_IMPORTED_MODULE_9__glmatrix_mat4__["a" /* default */].copy(matrices.VIEW, camera.viewMatrix.array); - __WEBPACK_IMPORTED_MODULE_9__glmatrix_mat4__["a" /* default */].copy(matrices.PROJECTION, camera.projectionMatrix.array); - __WEBPACK_IMPORTED_MODULE_9__glmatrix_mat4__["a" /* default */].copy(matrices.VIEWINVERSE, camera.worldTransform.array); - } - else { - __WEBPACK_IMPORTED_MODULE_9__glmatrix_mat4__["a" /* default */].identity(matrices.VIEW); - __WEBPACK_IMPORTED_MODULE_9__glmatrix_mat4__["a" /* default */].identity(matrices.PROJECTION); - __WEBPACK_IMPORTED_MODULE_9__glmatrix_mat4__["a" /* default */].identity(matrices.VIEWINVERSE); - } - __WEBPACK_IMPORTED_MODULE_9__glmatrix_mat4__["a" /* default */].multiply(matrices.VIEWPROJECTION, matrices.PROJECTION, matrices.VIEW); - __WEBPACK_IMPORTED_MODULE_9__glmatrix_mat4__["a" /* default */].invert(matrices.PROJECTIONINVERSE, matrices.PROJECTION); - __WEBPACK_IMPORTED_MODULE_9__glmatrix_mat4__["a" /* default */].invert(matrices.VIEWPROJECTIONINVERSE, matrices.VIEWPROJECTION); - - var _gl = this.gl; - var scene = this._sceneRendering; - - var prevMaterial; - var prevProgram; - var prevRenderable; - - // Status - var depthTest, depthMask; - var culling, cullFace, frontFace; - var transparent; - var drawID; - var currentVAO; - var materialTakesTextureSlot; - - var vaoExt = this.getGLExtension('OES_vertex_array_object'); - - for (var i = 0; i < list.length; i++) { - var renderable = list[i]; - var isSceneNode = renderable.worldTransform != null; - var worldM; - - if (!ifRenderObject(renderable)) { - continue; - } - - // Skinned mesh will transformed to joint space. Ignore the mesh transform - if (isSceneNode) { - worldM = (renderable.isSkinnedMesh && renderable.isSkinnedMesh()) - ? matrices.IDENTITY : renderable.worldTransform.array; - } - var geometry = renderable.geometry; - var material = passConfig.getMaterial.call(this, renderable); - - var program = renderable.__program; - var shader = material.shader; - - var currentDrawID = geometry.__uid__ + '-' + program.__uid__; - var drawIDChanged = currentDrawID !== drawID; - drawID = currentDrawID; - if (drawIDChanged && vaoExt) { - // TODO Seems need to be bound to null immediately (or before bind another program?) if vao is changed - vaoExt.bindVertexArrayOES(null); - } - if (isSceneNode) { - __WEBPACK_IMPORTED_MODULE_9__glmatrix_mat4__["a" /* default */].copy(matrices.WORLD, worldM); - __WEBPACK_IMPORTED_MODULE_9__glmatrix_mat4__["a" /* default */].multiply(matrices.WORLDVIEWPROJECTION, matrices.VIEWPROJECTION, worldM); - __WEBPACK_IMPORTED_MODULE_9__glmatrix_mat4__["a" /* default */].multiplyAffine(matrices.WORLDVIEW, matrices.VIEW, worldM); - if (shader.matrixSemantics.WORLDINVERSE || - shader.matrixSemantics.WORLDINVERSETRANSPOSE) { - __WEBPACK_IMPORTED_MODULE_9__glmatrix_mat4__["a" /* default */].invert(matrices.WORLDINVERSE, worldM); - } - if (shader.matrixSemantics.WORLDVIEWINVERSE || - shader.matrixSemantics.WORLDVIEWINVERSETRANSPOSE) { - __WEBPACK_IMPORTED_MODULE_9__glmatrix_mat4__["a" /* default */].invert(matrices.WORLDVIEWINVERSE, matrices.WORLDVIEW); - } - if (shader.matrixSemantics.WORLDVIEWPROJECTIONINVERSE || - shader.matrixSemantics.WORLDVIEWPROJECTIONINVERSETRANSPOSE) { - __WEBPACK_IMPORTED_MODULE_9__glmatrix_mat4__["a" /* default */].invert(matrices.WORLDVIEWPROJECTIONINVERSE, matrices.WORLDVIEWPROJECTION); - } - } - - // Before render hook - renderable.beforeRender && renderable.beforeRender(this); - passConfig.beforeRender.call(this, renderable, material, prevMaterial); - - var programChanged = program !== prevProgram; - if (programChanged) { - // Set lights number - program.bind(this); - // Set some common uniforms - program.setUniformOfSemantic(_gl, 'VIEWPORT', viewportUniform); - program.setUniformOfSemantic(_gl, 'WINDOW_SIZE', windowSizeUniform); - if (camera) { - program.setUniformOfSemantic(_gl, 'NEAR', camera.near); - program.setUniformOfSemantic(_gl, 'FAR', camera.far); - } - program.setUniformOfSemantic(_gl, 'DEVICEPIXELRATIO', vDpr); - program.setUniformOfSemantic(_gl, 'TIME', time); - // DEPRECATED - program.setUniformOfSemantic(_gl, 'VIEWPORT_SIZE', viewportSizeUniform); - - // Set lights uniforms - // TODO needs optimized - if (scene) { - scene.setLightUniforms(program, renderable.lightGroup, this); - } - } - else { - program = prevProgram; - } - - // Program changes also needs reset the materials. - if (programChanged || passConfig.isMaterialChanged( - renderable, prevRenderable, material, prevMaterial - )) { - if (material.depthTest !== depthTest) { - material.depthTest ? _gl.enable(_gl.DEPTH_TEST) : _gl.disable(_gl.DEPTH_TEST); - depthTest = material.depthTest; - } - if (material.depthMask !== depthMask) { - _gl.depthMask(material.depthMask); - depthMask = material.depthMask; - } - if (material.transparent !== transparent) { - material.transparent ? _gl.enable(_gl.BLEND) : _gl.disable(_gl.BLEND); - transparent = material.transparent; - } - // TODO cache blending - if (material.transparent) { - if (material.blend) { - material.blend(_gl); - } - else { - // Default blend function - _gl.blendEquationSeparate(_gl.FUNC_ADD, _gl.FUNC_ADD); - _gl.blendFuncSeparate(_gl.SRC_ALPHA, _gl.ONE_MINUS_SRC_ALPHA, _gl.ONE, _gl.ONE_MINUS_SRC_ALPHA); - } - } - - materialTakesTextureSlot = this._bindMaterial( - renderable, material, program, - prevRenderable || null, prevMaterial || null, prevProgram || null, - passConfig.getUniform - ); - prevMaterial = material; - } - - var matrixSemanticKeys = shader.matrixSemanticKeys; - - if (isSceneNode) { - for (var k = 0; k < matrixSemanticKeys.length; k++) { - var semantic = matrixSemanticKeys[k]; - var semanticInfo = shader.matrixSemantics[semantic]; - var matrix = matrices[semantic]; - if (semanticInfo.isTranspose) { - var matrixNoTranspose = matrices[semanticInfo.semanticNoTranspose]; - __WEBPACK_IMPORTED_MODULE_9__glmatrix_mat4__["a" /* default */].transpose(matrix, matrixNoTranspose); - } - program.setUniform(_gl, semanticInfo.type, semanticInfo.symbol, matrix); - } - } - - if (renderable.cullFace !== cullFace) { - cullFace = renderable.cullFace; - _gl.cullFace(cullFace); - } - if (renderable.frontFace !== frontFace) { - frontFace = renderable.frontFace; - _gl.frontFace(frontFace); - } - if (renderable.culling !== culling) { - culling = renderable.culling; - culling ? _gl.enable(_gl.CULL_FACE) : _gl.disable(_gl.CULL_FACE); - } - // TODO Not update skeleton in each renderable. - this._updateSkeleton(renderable, program, materialTakesTextureSlot); - if (drawIDChanged) { - currentVAO = this._bindVAO(vaoExt, shader, geometry, program); - } - this._renderObject(renderable, currentVAO); - - // After render hook - passConfig.afterRender(this, renderable); - renderable.afterRender && renderable.afterRender(this); - - prevProgram = program; - prevRenderable = renderable; - } - - // TODO Seems need to be bound to null immediately if vao is changed? - if (vaoExt) { - vaoExt.bindVertexArrayOES(null); - } - - this.trigger('afterrenderpass', this, list, camera, passConfig); - }, - - getMaxJointNumber: function () { - return this._glinfo.getMaxJointNumber(); - }, - - _updateSkeleton: function (object, program, slot) { - var _gl = this.gl; - var skeleton = object.skeleton; - // Set pose matrices of skinned mesh - if (skeleton) { - // TODO Update before culling. - skeleton.update(); - if (object.joints.length > this._glinfo.getMaxJointNumber()) { - var skinMatricesTexture = skeleton.getSubSkinMatricesTexture(object.__uid__, object.joints); - program.useTextureSlot(this, skinMatricesTexture, slot); - program.setUniform(_gl, '1i', 'skinMatricesTexture', slot); - program.setUniform(_gl, '1f', 'skinMatricesTextureSize', skinMatricesTexture.width); - } - else { - var skinMatricesArray = skeleton.getSubSkinMatrices(object.__uid__, object.joints); - program.setUniformOfSemantic(_gl, 'SKIN_MATRIX', skinMatricesArray); - } - } - }, - - _renderObject: function (renderable, vao) { - var _gl = this.gl; - var geometry = renderable.geometry; - - var glDrawMode = renderable.mode; - if (glDrawMode == null) { - glDrawMode = 0x0004; - } - - // if (glDrawMode === glenum.LINES || glDrawMode === glenum.LINE_STRIP || glDrawMode === glenum.LINE_LOOP) { - // _gl.lineWidth(this.lineWidth); - // } - - if (vao.indicesBuffer) { - var uintExt = this.getGLExtension('OES_element_index_uint'); - var useUintExt = uintExt && (geometry.indices instanceof Uint32Array); - var indicesType = useUintExt ? _gl.UNSIGNED_INT : _gl.UNSIGNED_SHORT; - - _gl.drawElements(glDrawMode, vao.indicesBuffer.count, indicesType, 0); - } - else { - // FIXME Use vertex number in buffer - // vertexCount may get the wrong value when geometry forget to mark dirty after update - _gl.drawArrays(glDrawMode, 0, geometry.vertexCount); - } - }, - - _bindMaterial: function (renderable, material, program, prevRenderable, prevMaterial, prevProgram, getUniformValue) { - var _gl = this.gl; - // PENDING Same texture in different material take different slot? - - // May use shader of other material if shader code are same - var sameProgram = prevProgram === program; - - var currentTextureSlot = program.currentTextureSlot(); - var enabledUniforms = material.getEnabledUniforms(); - var textureUniforms = material.getTextureUniforms(); - var placeholderTexture = this._placeholderTexture; - - for (var u = 0; u < textureUniforms.length; u++) { - var symbol = textureUniforms[u]; - var uniformValue = getUniformValue(renderable, material, symbol); - var uniformType = material.uniforms[symbol].type; - // Not use `instanceof` to determine if a value is texture in Material#bind. - // Use type instead, in some case texture may be in different namespaces. - // TODO Duck type validate. - if (uniformType === 't' && uniformValue) { - // Reset slot - uniformValue.__slot = -1; - } - else if (uniformType === 'tv') { - for (var i = 0; i < uniformValue.length; i++) { - if (uniformValue[i]) { - uniformValue[i].__slot = -1; - } - } - } - } - - placeholderTexture.__slot = -1; - - // Set uniforms - for (var u = 0; u < enabledUniforms.length; u++) { - var symbol = enabledUniforms[u]; - var uniform = material.uniforms[symbol]; - var uniformValue = getUniformValue(renderable, material, symbol); - var uniformType = uniform.type; - var isTexture = uniformType === 't'; - - if (isTexture) { - if (!uniformValue || !uniformValue.isRenderable()) { - uniformValue = placeholderTexture; - } - } - // PENDING - // When binding two materials with the same shader - // Many uniforms will be be set twice even if they have the same value - // So add a evaluation to see if the uniform is really needed to be set - if (prevMaterial && sameProgram) { - var prevUniformValue = getUniformValue(prevRenderable, prevMaterial, symbol); - if (isTexture) { - if (!prevUniformValue || !prevUniformValue.isRenderable()) { - prevUniformValue = placeholderTexture; - } - } - - if (prevUniformValue === uniformValue) { - if (isTexture) { - // Still take the slot to make sure same texture in different materials have same slot. - program.takeCurrentTextureSlot(this, null); - } - else if (uniformType === 'tv' && uniformValue) { - for (var i = 0; i < uniformValue.length; i++) { - program.takeCurrentTextureSlot(this, null); - } - } - continue; - } - } - - if (uniformValue == null) { - continue; - } - else if (isTexture) { - if (uniformValue.__slot < 0) { - var slot = program.currentTextureSlot(); - var res = program.setUniform(_gl, '1i', symbol, slot); - if (res) { // Texture uniform is enabled - program.takeCurrentTextureSlot(this, uniformValue); - uniformValue.__slot = slot; - } - } - // Multiple uniform use same texture.. - else { - program.setUniform(_gl, '1i', symbol, uniformValue.__slot); - } - } - else if (Array.isArray(uniformValue)) { - if (uniformValue.length === 0) { - continue; - } - // Texture Array - if (uniformType === 'tv') { - if (!program.hasUniform(symbol)) { - continue; - } - - var arr = []; - for (var i = 0; i < uniformValue.length; i++) { - var texture = uniformValue[i]; - - if (texture.__slot < 0) { - var slot = program.currentTextureSlot(); - arr.push(slot); - program.takeCurrentTextureSlot(this, texture); - texture.__slot = slot; - } - else { - arr.push(texture.__slot); - } - } - - program.setUniform(_gl, '1iv', symbol, arr); - } - else { - program.setUniform(_gl, uniform.type, symbol, uniformValue); - } - } - else{ - program.setUniform(_gl, uniform.type, symbol, uniformValue); - } - } - var newSlot = program.currentTextureSlot(); - // Texture slot maybe used out of material. - program.resetTextureSlot(currentTextureSlot); - return newSlot; - }, - - _bindVAO: function (vaoExt, shader, geometry, program) { - var isStatic = !geometry.dynamic; - var _gl = this.gl; - - var vaoId = this.__uid__ + '-' + program.__uid__; - var vao = geometry.__vaoCache[vaoId]; - if (!vao) { - var chunks = geometry.getBufferChunks(this); - if (!chunks || !chunks.length) { // Empty mesh - return; - } - var chunk = chunks[0]; - var attributeBuffers = chunk.attributeBuffers; - var indicesBuffer = chunk.indicesBuffer; - - var availableAttributes = []; - var availableAttributeSymbols = []; - for (var a = 0; a < attributeBuffers.length; a++) { - var attributeBufferInfo = attributeBuffers[a]; - var name = attributeBufferInfo.name; - var semantic = attributeBufferInfo.semantic; - var symbol; - if (semantic) { - var semanticInfo = shader.attributeSemantics[semantic]; - symbol = semanticInfo && semanticInfo.symbol; - } - else { - symbol = name; - } - if (symbol && program.attributes[symbol]) { - availableAttributes.push(attributeBufferInfo); - availableAttributeSymbols.push(symbol); - } - } - - vao = new VertexArrayObject( - availableAttributes, - availableAttributeSymbols, - indicesBuffer - ); - - if (isStatic) { - geometry.__vaoCache[vaoId] = vao; - } - } - - var needsBindAttributes = true; - - // Create vertex object array cost a lot - // So we don't use it on the dynamic object - if (vaoExt && isStatic) { - // Use vertex array object - // http://blog.tojicode.com/2012/10/oesvertexarrayobject-extension.html - if (vao.vao == null) { - vao.vao = vaoExt.createVertexArrayOES(); - } - else { - needsBindAttributes = false; - } - vaoExt.bindVertexArrayOES(vao.vao); - } - - var availableAttributes = vao.availableAttributes; - var indicesBuffer = vao.indicesBuffer; - - if (needsBindAttributes) { - var locationList = program.enableAttributes(this, vao.availableAttributeSymbols, (vaoExt && isStatic && vao)); - // Setting attributes; - for (var a = 0; a < availableAttributes.length; a++) { - var location = locationList[a]; - if (location === -1) { - continue; - } - var attributeBufferInfo = availableAttributes[a]; - var buffer = attributeBufferInfo.buffer; - var size = attributeBufferInfo.size; - var glType = attributeBufferTypeMap[attributeBufferInfo.type] || _gl.FLOAT; - - _gl.bindBuffer(_gl.ARRAY_BUFFER, buffer); - _gl.vertexAttribPointer(location, size, glType, false, 0, 0); - } - - if (geometry.isUseIndices()) { - _gl.bindBuffer(_gl.ELEMENT_ARRAY_BUFFER, indicesBuffer.buffer); - } - } - - return vao; - }, - - renderPreZ: function (list, scene, camera) { - var _gl = this.gl; - var preZPassMaterial = this._prezMaterial || new __WEBPACK_IMPORTED_MODULE_4__Material__["a" /* default */]({ - shader: new __WEBPACK_IMPORTED_MODULE_7__Shader__["a" /* default */](__WEBPACK_IMPORTED_MODULE_7__Shader__["a" /* default */].source('clay.prez.vertex'), __WEBPACK_IMPORTED_MODULE_7__Shader__["a" /* default */].source('clay.prez.fragment')) - }); - this._prezMaterial = preZPassMaterial; - - _gl.colorMask(false, false, false, false); - _gl.depthMask(true); - - // Status - this.renderPass(list, camera, { - ifRender: function (renderable) { - return !renderable.ignorePreZ; - }, - isMaterialChanged: function (renderable, prevRenderable) { - var matA = renderable.material; - var matB = prevRenderable.material; - return matA.get('diffuseMap') !== matB.get('diffuseMap') - || (matA.get('alphaCutoff') || 0) !== (matB.get('alphaCutoff') || 0); - }, - getUniform: function (renderable, depthMaterial, symbol) { - if (symbol === 'alphaMap') { - return renderable.material.get('diffuseMap'); - } - else if (symbol === 'alphaCutoff') { - if (renderable.material.isDefined('fragment', 'ALPHA_TEST') - && renderable.material.get('diffuseMap') - ) { - var alphaCutoff = renderable.material.get('alphaCutoff'); - return alphaCutoff || 0; - } - return 0; - } - else { - return depthMaterial.get(symbol); - } - }, - getMaterial: function () { - return preZPassMaterial; - }, - sort: this.opaqueSortCompare - }); - - _gl.colorMask(true, true, true, true); - _gl.depthMask(true); - }, - - /** - * Dispose given scene, including all geometris, textures and shaders in the scene - * @param {clay.Scene} scene - */ - disposeScene: function(scene) { - this.disposeNode(scene, true, true); - scene.dispose(); - }, - - /** - * Dispose given node, including all geometries, textures and shaders attached on it or its descendant - * @param {clay.Node} node - * @param {boolean} [disposeGeometry=false] If dispose the geometries used in the descendant mesh - * @param {boolean} [disposeTexture=false] If dispose the textures used in the descendant mesh - */ - disposeNode: function(root, disposeGeometry, disposeTexture) { - // Dettached from parent - if (root.getParent()) { - root.getParent().remove(root); - } - var disposedMap = {}; - root.traverse(function(node) { - var material = node.material; - if (node.geometry && disposeGeometry) { - node.geometry.dispose(this); - } - if (disposeTexture && material && !disposedMap[material.__uid__]) { - var textureUniforms = material.getTextureUniforms(); - for (var u = 0; u < textureUniforms.length; u++) { - var uniformName = textureUniforms[u]; - var val = material.uniforms[uniformName].value; - var uniformType = material.uniforms[uniformName].type; - if (!val) { - continue; - } - if (uniformType === 't') { - val.dispose && val.dispose(this); - } - else if (uniformType === 'tv') { - for (var k = 0; k < val.length; k++) { - if (val[k]) { - val[k].dispose && val[k].dispose(this); - } - } - } - } - disposedMap[material.__uid__] = true; - } - // Particle system and AmbientCubemap light need to dispose - if (node.dispose) { - node.dispose(this); - } - }, this); - }, - - /** - * Dispose given geometry - * @param {clay.Geometry} geometry - */ - disposeGeometry: function(geometry) { - geometry.dispose(this); - }, - - /** - * Dispose given texture - * @param {clay.Texture} texture - */ - disposeTexture: function(texture) { - texture.dispose(this); - }, - - /** - * Dispose given frame buffer - * @param {clay.FrameBuffer} frameBuffer - */ - disposeFrameBuffer: function(frameBuffer) { - frameBuffer.dispose(this); - }, - - /** - * Dispose renderer - */ - dispose: function () {}, - - /** - * Convert screen coords to normalized device coordinates(NDC) - * Screen coords can get from mouse event, it is positioned relative to canvas element - * NDC can be used in ray casting with Camera.prototype.castRay methods - * - * @param {number} x - * @param {number} y - * @param {clay.Vector2} [out] - * @return {clay.Vector2} - */ - screenToNDC: function(x, y, out) { - if (!out) { - out = new __WEBPACK_IMPORTED_MODULE_5__math_Vector2__["a" /* default */](); - } - // Invert y; - y = this._height - y; - - var viewport = this.viewport; - var arr = out.array; - arr[0] = (x - viewport.x) / viewport.width; - arr[0] = arr[0] * 2 - 1; - arr[1] = (y - viewport.y) / viewport.height; - arr[1] = arr[1] * 2 - 1; - - return out; - } -}); - -/** - * Opaque renderables compare function - * @param {clay.Renderable} x - * @param {clay.Renderable} y - * @return {boolean} - * @static - */ -Renderer.opaqueSortCompare = Renderer.prototype.opaqueSortCompare = function(x, y) { - // Priority renderOrder -> program -> material -> geometry - if (x.renderOrder === y.renderOrder) { - if (x.__program === y.__program) { - if (x.material === y.material) { - return x.geometry.__uid__ - y.geometry.__uid__; - } - return x.material.__uid__ - y.material.__uid__; - } - if (x.__program && y.__program) { - return x.__program.__uid__ - y.__program.__uid__; - } - return 0; - } - return x.renderOrder - y.renderOrder; -}; - -/** - * Transparent renderables compare function - * @param {clay.Renderable} a - * @param {clay.Renderable} b - * @return {boolean} - * @static - */ -Renderer.transparentSortCompare = Renderer.prototype.transparentSortCompare = function(x, y) { - // Priority renderOrder -> depth -> program -> material -> geometry - - if (x.renderOrder === y.renderOrder) { - if (x.__depth === y.__depth) { - if (x.__program === y.__program) { - if (x.material === y.material) { - return x.geometry.__uid__ - y.geometry.__uid__; - } - return x.material.__uid__ - y.material.__uid__; - } - if (x.__program && y.__program) { - return x.__program.__uid__ - y.__program.__uid__; - } - return 0; - } - // Depth is negative - // So farther object has smaller depth value - return x.__depth - y.__depth; - } - return x.renderOrder - y.renderOrder; -}; - -// Temporary variables -var matrices = { - IDENTITY: mat4Create(), - - WORLD: mat4Create(), - VIEW: mat4Create(), - PROJECTION: mat4Create(), - WORLDVIEW: mat4Create(), - VIEWPROJECTION: mat4Create(), - WORLDVIEWPROJECTION: mat4Create(), - - WORLDINVERSE: mat4Create(), - VIEWINVERSE: mat4Create(), - PROJECTIONINVERSE: mat4Create(), - WORLDVIEWINVERSE: mat4Create(), - VIEWPROJECTIONINVERSE: mat4Create(), - WORLDVIEWPROJECTIONINVERSE: mat4Create(), - - WORLDTRANSPOSE: mat4Create(), - VIEWTRANSPOSE: mat4Create(), - PROJECTIONTRANSPOSE: mat4Create(), - WORLDVIEWTRANSPOSE: mat4Create(), - VIEWPROJECTIONTRANSPOSE: mat4Create(), - WORLDVIEWPROJECTIONTRANSPOSE: mat4Create(), - WORLDINVERSETRANSPOSE: mat4Create(), - VIEWINVERSETRANSPOSE: mat4Create(), - PROJECTIONINVERSETRANSPOSE: mat4Create(), - WORLDVIEWINVERSETRANSPOSE: mat4Create(), - VIEWPROJECTIONINVERSETRANSPOSE: mat4Create(), - WORLDVIEWPROJECTIONINVERSETRANSPOSE: mat4Create() -}; - -/** - * @name clay.Renderer.COLOR_BUFFER_BIT - * @type {number} - */ -Renderer.COLOR_BUFFER_BIT = __WEBPACK_IMPORTED_MODULE_2__core_glenum__["a" /* default */].COLOR_BUFFER_BIT; -/** - * @name clay.Renderer.DEPTH_BUFFER_BIT - * @type {number} - */ -Renderer.DEPTH_BUFFER_BIT = __WEBPACK_IMPORTED_MODULE_2__core_glenum__["a" /* default */].DEPTH_BUFFER_BIT; -/** - * @name clay.Renderer.STENCIL_BUFFER_BIT - * @type {number} - */ -Renderer.STENCIL_BUFFER_BIT = __WEBPACK_IMPORTED_MODULE_2__core_glenum__["a" /* default */].STENCIL_BUFFER_BIT; - -/* harmony default export */ __webpack_exports__["a"] = (Renderer); - - -/***/ }), -/* 53 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -function Handler(action, context) { - this.action = action; - this.context = context; -} -/** - * @mixin - * @alias clay.core.mixin.notifier - */ -var notifier = { - /** - * Trigger event - * @param {string} name - */ - trigger: function(name) { - if (!this.hasOwnProperty('__handlers__')) { - return; - } - if (!this.__handlers__.hasOwnProperty(name)) { - return; - } - - var hdls = this.__handlers__[name]; - var l = hdls.length, i = -1, args = arguments; - // Optimize advise from backbone - switch (args.length) { - case 1: - while (++i < l) { - hdls[i].action.call(hdls[i].context); - } - return; - case 2: - while (++i < l) { - hdls[i].action.call(hdls[i].context, args[1]); - } - return; - case 3: - while (++i < l) { - hdls[i].action.call(hdls[i].context, args[1], args[2]); - } - return; - case 4: - while (++i < l) { - hdls[i].action.call(hdls[i].context, args[1], args[2], args[3]); - } - return; - case 5: - while (++i < l) { - hdls[i].action.call(hdls[i].context, args[1], args[2], args[3], args[4]); - } - return; - default: - while (++i < l) { - hdls[i].action.apply(hdls[i].context, Array.prototype.slice.call(args, 1)); - } - return; - } - }, - /** - * Register event handler - * @param {string} name - * @param {Function} action - * @param {Object} [context] - * @chainable - */ - on: function(name, action, context) { - if (!name || !action) { - return; - } - var handlers = this.__handlers__ || (this.__handlers__={}); - if (!handlers[name]) { - handlers[name] = []; - } - else { - if (this.has(name, action)) { - return; - } - } - var handler = new Handler(action, context || this); - handlers[name].push(handler); - - return this; - }, - - /** - * Register event, event will only be triggered once and then removed - * @param {string} name - * @param {Function} action - * @param {Object} [context] - * @chainable - */ - once: function(name, action, context) { - if (!name || !action) { - return; - } - var self = this; - function wrapper() { - self.off(name, wrapper); - action.apply(this, arguments); - } - return this.on(name, wrapper, context); - }, - - /** - * Alias of once('before' + name) - * @param {string} name - * @param {Function} action - * @param {Object} [context] - * @chainable - */ - before: function(name, action, context) { - if (!name || !action) { - return; - } - name = 'before' + name; - return this.on(name, action, context); - }, - - /** - * Alias of once('after' + name) - * @param {string} name - * @param {Function} action - * @param {Object} [context] - * @chainable - */ - after: function(name, action, context) { - if (!name || !action) { - return; - } - name = 'after' + name; - return this.on(name, action, context); - }, - - /** - * Alias of on('success') - * @param {Function} action - * @param {Object} [context] - * @chainable - */ - success: function(action, context) { - return this.once('success', action, context); - }, - - /** - * Alias of on('error') - * @param {Function} action - * @param {Object} [context] - * @chainable - */ - error: function(action, context) { - return this.once('error', action, context); - }, - - /** - * Remove event listener - * @param {Function} action - * @param {Object} [context] - * @chainable - */ - off: function(name, action) { - - var handlers = this.__handlers__ || (this.__handlers__={}); - - if (!action) { - handlers[name] = []; - return; - } - if (handlers[name]) { - var hdls = handlers[name]; - var retains = []; - for (var i = 0; i < hdls.length; i++) { - if (action && hdls[i].action !== action) { - retains.push(hdls[i]); - } - } - handlers[name] = retains; - } - - return this; - }, - - /** - * If registered the event handler - * @param {string} name - * @param {Function} action - * @return {boolean} - */ - has: function(name, action) { - var handlers = this.__handlers__; - - if (! handlers || - ! handlers[name]) { - return false; - } - var hdls = handlers[name]; - for (var i = 0; i < hdls.length; i++) { - if (hdls[i].action === action) { - return true; - } - } - } -}; - -/* harmony default export */ __webpack_exports__["a"] = (notifier); - -/***/ }), -/* 54 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Vector3__ = __webpack_require__(3); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__ = __webpack_require__(12); - - - -var EPSILON = 1e-5; - -/** - * @constructor - * @alias clay.Ray - * @param {clay.Vector3} [origin] - * @param {clay.Vector3} [direction] - */ -var Ray = function (origin, direction) { - /** - * @type {clay.Vector3} - */ - this.origin = origin || new __WEBPACK_IMPORTED_MODULE_0__Vector3__["a" /* default */](); - /** - * @type {clay.Vector3} - */ - this.direction = direction || new __WEBPACK_IMPORTED_MODULE_0__Vector3__["a" /* default */](); -}; - -Ray.prototype = { - - constructor: Ray, - - // http://www.siggraph.org/education/materials/HyperGraph/raytrace/rayplane_intersection.htm - /** - * Calculate intersection point between ray and a give plane - * @param {clay.Plane} plane - * @param {clay.Vector3} [out] - * @return {clay.Vector3} - */ - intersectPlane: function (plane, out) { - var pn = plane.normal.array; - var d = plane.distance; - var ro = this.origin.array; - var rd = this.direction.array; - - var divider = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].dot(pn, rd); - // ray is parallel to the plane - if (divider === 0) { - return null; - } - if (!out) { - out = new __WEBPACK_IMPORTED_MODULE_0__Vector3__["a" /* default */](); - } - var t = (__WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].dot(pn, ro) - d) / divider; - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].scaleAndAdd(out.array, ro, rd, -t); - out._dirty = true; - return out; - }, - - /** - * Mirror the ray against plane - * @param {clay.Plane} plane - */ - mirrorAgainstPlane: function (plane) { - // Distance to plane - var d = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].dot(plane.normal.array, this.direction.array); - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].scaleAndAdd(this.direction.array, this.direction.array, plane.normal.array, -d * 2); - this.direction._dirty = true; - }, - - distanceToPoint: (function () { - var v = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].create(); - return function (point) { - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].sub(v, point, this.origin.array); - // Distance from projection point to origin - var b = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].dot(v, this.direction.array); - if (b < 0) { - return __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].distance(this.origin.array, point); - } - // Squared distance from center to origin - var c2 = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].lenSquared(v); - // Squared distance from center to projection point - return Math.sqrt(c2 - b * b); - }; - })(), - - /** - * Calculate intersection point between ray and sphere - * @param {clay.Vector3} center - * @param {number} radius - * @param {clay.Vector3} out - * @return {clay.Vector3} - */ - intersectSphere: (function () { - var v = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].create(); - return function (center, radius, out) { - var origin = this.origin.array; - var direction = this.direction.array; - center = center.array; - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].sub(v, center, origin); - // Distance from projection point to origin - var b = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].dot(v, direction); - // Squared distance from center to origin - var c2 = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].squaredLength(v); - // Squared distance from center to projection point - var d2 = c2 - b * b; - - var r2 = radius * radius; - // No intersection - if (d2 > r2) { - return; - } - - var a = Math.sqrt(r2 - d2); - // First intersect point - var t0 = b - a; - // Second intersect point - var t1 = b + a; - - if (!out) { - out = new __WEBPACK_IMPORTED_MODULE_0__Vector3__["a" /* default */](); - } - if (t0 < 0) { - if (t1 < 0) { - return null; - } - else { - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].scaleAndAdd(out.array, origin, direction, t1); - return out; - } - } - else { - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].scaleAndAdd(out.array, origin, direction, t0); - return out; - } - }; - })(), - - // http://www.scratchapixel.com/lessons/3d-basic-lessons/lesson-7-intersecting-simple-shapes/ray-box-intersection/ - /** - * Calculate intersection point between ray and bounding box - * @param {clay.BoundingBox} bbox - * @param {clay.Vector3} - * @return {clay.Vector3} - */ - intersectBoundingBox: function (bbox, out) { - var dir = this.direction.array; - var origin = this.origin.array; - var min = bbox.min.array; - var max = bbox.max.array; - - var invdirx = 1 / dir[0]; - var invdiry = 1 / dir[1]; - var invdirz = 1 / dir[2]; - - var tmin, tmax, tymin, tymax, tzmin, tzmax; - if (invdirx >= 0) { - tmin = (min[0] - origin[0]) * invdirx; - tmax = (max[0] - origin[0]) * invdirx; - } - else { - tmax = (min[0] - origin[0]) * invdirx; - tmin = (max[0] - origin[0]) * invdirx; - } - if (invdiry >= 0) { - tymin = (min[1] - origin[1]) * invdiry; - tymax = (max[1] - origin[1]) * invdiry; - } - else { - tymax = (min[1] - origin[1]) * invdiry; - tymin = (max[1] - origin[1]) * invdiry; - } - - if ((tmin > tymax) || (tymin > tmax)) { - return null; - } - - if (tymin > tmin || tmin !== tmin) { - tmin = tymin; - } - if (tymax < tmax || tmax !== tmax) { - tmax = tymax; - } - - if (invdirz >= 0) { - tzmin = (min[2] - origin[2]) * invdirz; - tzmax = (max[2] - origin[2]) * invdirz; - } - else { - tzmax = (min[2] - origin[2]) * invdirz; - tzmin = (max[2] - origin[2]) * invdirz; - } - - if ((tmin > tzmax) || (tzmin > tmax)) { - return null; - } - - if (tzmin > tmin || tmin !== tmin) { - tmin = tzmin; - } - if (tzmax < tmax || tmax !== tmax) { - tmax = tzmax; - } - if (tmax < 0) { - return null; - } - - var t = tmin >= 0 ? tmin : tmax; - - if (!out) { - out = new __WEBPACK_IMPORTED_MODULE_0__Vector3__["a" /* default */](); - } - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].scaleAndAdd(out.array, origin, dir, t); - return out; - }, - - // http://en.wikipedia.org/wiki/M%C3%B6ller%E2%80%93Trumbore_intersection_algorithm - /** - * Calculate intersection point between ray and three triangle vertices - * @param {clay.Vector3} a - * @param {clay.Vector3} b - * @param {clay.Vector3} c - * @param {boolean} singleSided, CW triangle will be ignored - * @param {clay.Vector3} [out] - * @param {clay.Vector3} [barycenteric] barycentric coords - * @return {clay.Vector3} - */ - intersectTriangle: (function () { - - var eBA = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].create(); - var eCA = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].create(); - var AO = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].create(); - var vCross = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].create(); - - return function (a, b, c, singleSided, out, barycenteric) { - var dir = this.direction.array; - var origin = this.origin.array; - a = a.array; - b = b.array; - c = c.array; - - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].sub(eBA, b, a); - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].sub(eCA, c, a); - - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].cross(vCross, eCA, dir); - - var det = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].dot(eBA, vCross); - - if (singleSided) { - if (det > -EPSILON) { - return null; - } - } - else { - if (det > -EPSILON && det < EPSILON) { - return null; - } - } - - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].sub(AO, origin, a); - var u = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].dot(vCross, AO) / det; - if (u < 0 || u > 1) { - return null; - } - - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].cross(vCross, eBA, AO); - var v = __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].dot(dir, vCross) / det; - - if (v < 0 || v > 1 || (u + v > 1)) { - return null; - } - - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].cross(vCross, eBA, eCA); - var t = -__WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].dot(AO, vCross) / det; - - if (t < 0) { - return null; - } - - if (!out) { - out = new __WEBPACK_IMPORTED_MODULE_0__Vector3__["a" /* default */](); - } - if (barycenteric) { - __WEBPACK_IMPORTED_MODULE_0__Vector3__["a" /* default */].set(barycenteric, (1 - u - v), u, v); - } - __WEBPACK_IMPORTED_MODULE_1__glmatrix_vec3__["a" /* default */].scaleAndAdd(out.array, origin, dir, t); - - return out; - }; - })(), - - /** - * Apply an affine transform matrix to the ray - * @return {clay.Matrix4} matrix - */ - applyTransform: function (matrix) { - __WEBPACK_IMPORTED_MODULE_0__Vector3__["a" /* default */].add(this.direction, this.direction, this.origin); - __WEBPACK_IMPORTED_MODULE_0__Vector3__["a" /* default */].transformMat4(this.origin, this.origin, matrix); - __WEBPACK_IMPORTED_MODULE_0__Vector3__["a" /* default */].transformMat4(this.direction, this.direction, matrix); - - __WEBPACK_IMPORTED_MODULE_0__Vector3__["a" /* default */].sub(this.direction, this.direction, this.origin); - __WEBPACK_IMPORTED_MODULE_0__Vector3__["a" /* default */].normalize(this.direction, this.direction); - }, - - /** - * Copy values from another ray - * @param {clay.Ray} ray - */ - copy: function (ray) { - __WEBPACK_IMPORTED_MODULE_0__Vector3__["a" /* default */].copy(this.origin, ray.origin); - __WEBPACK_IMPORTED_MODULE_0__Vector3__["a" /* default */].copy(this.direction, ray.direction); - }, - - /** - * Clone a new ray - * @return {clay.Ray} - */ - clone: function () { - var ray = new Ray(); - ray.copy(this); - return ray; - } -}; - -/* harmony default export */ __webpack_exports__["a"] = (Ray); - - -/***/ }), -/* 55 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__common__ = __webpack_require__(20); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__vec3__ = __webpack_require__(12); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__vec4__ = __webpack_require__(33); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__mat3__ = __webpack_require__(34); - - -/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - - - - - - -/** - * @class Quaternion - * @name quat - */ - -var quat = {}; - -/** - * Creates a new identity quat - * - * @returns {quat} a new quaternion - */ -quat.create = function() { - var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" /* GLMAT_ARRAY_TYPE */](4); - out[0] = 0; - out[1] = 0; - out[2] = 0; - out[3] = 1; - return out; -}; - -/** - * Sets a quaternion to represent the shortest rotation from one - * vector to another. - * - * Both vectors are assumed to be unit length. - * - * @param {quat} out the receiving quaternion. - * @param {vec3} a the initial vector - * @param {vec3} b the destination vector - * @returns {quat} out - */ -quat.rotationTo = (function() { - var tmpvec3 = __WEBPACK_IMPORTED_MODULE_1__vec3__["a" /* default */].create(); - var xUnitVec3 = __WEBPACK_IMPORTED_MODULE_1__vec3__["a" /* default */].fromValues(1,0,0); - var yUnitVec3 = __WEBPACK_IMPORTED_MODULE_1__vec3__["a" /* default */].fromValues(0,1,0); - - return function(out, a, b) { - var dot = __WEBPACK_IMPORTED_MODULE_1__vec3__["a" /* default */].dot(a, b); - if (dot < -0.999999) { - __WEBPACK_IMPORTED_MODULE_1__vec3__["a" /* default */].cross(tmpvec3, xUnitVec3, a); - if (__WEBPACK_IMPORTED_MODULE_1__vec3__["a" /* default */].length(tmpvec3) < 0.000001) - __WEBPACK_IMPORTED_MODULE_1__vec3__["a" /* default */].cross(tmpvec3, yUnitVec3, a); - __WEBPACK_IMPORTED_MODULE_1__vec3__["a" /* default */].normalize(tmpvec3, tmpvec3); - quat.setAxisAngle(out, tmpvec3, Math.PI); - return out; - } else if (dot > 0.999999) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - out[3] = 1; - return out; - } else { - __WEBPACK_IMPORTED_MODULE_1__vec3__["a" /* default */].cross(tmpvec3, a, b); - out[0] = tmpvec3[0]; - out[1] = tmpvec3[1]; - out[2] = tmpvec3[2]; - out[3] = 1 + dot; - return quat.normalize(out, out); - } - }; -})(); - -/** - * Sets the specified quaternion with values corresponding to the given - * axes. Each axis is a vec3 and is expected to be unit length and - * perpendicular to all other specified axes. - * - * @param {vec3} view the vector representing the viewing direction - * @param {vec3} right the vector representing the local "right" direction - * @param {vec3} up the vector representing the local "up" direction - * @returns {quat} out - */ -quat.setAxes = (function() { - var matr = __WEBPACK_IMPORTED_MODULE_3__mat3__["a" /* default */].create(); - - return function(out, view, right, up) { - matr[0] = right[0]; - matr[3] = right[1]; - matr[6] = right[2]; - - matr[1] = up[0]; - matr[4] = up[1]; - matr[7] = up[2]; - - matr[2] = -view[0]; - matr[5] = -view[1]; - matr[8] = -view[2]; - - return quat.normalize(out, quat.fromMat3(out, matr)); - }; -})(); - -/** - * Creates a new quat initialized with values from an existing quaternion - * - * @param {quat} a quaternion to clone - * @returns {quat} a new quaternion - * @function - */ -quat.clone = __WEBPACK_IMPORTED_MODULE_2__vec4__["a" /* default */].clone; - -/** - * Creates a new quat initialized with the given values - * - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @param {Number} w W component - * @returns {quat} a new quaternion - * @function - */ -quat.fromValues = __WEBPACK_IMPORTED_MODULE_2__vec4__["a" /* default */].fromValues; - -/** - * Copy the values from one quat to another - * - * @param {quat} out the receiving quaternion - * @param {quat} a the source quaternion - * @returns {quat} out - * @function - */ -quat.copy = __WEBPACK_IMPORTED_MODULE_2__vec4__["a" /* default */].copy; - -/** - * Set the components of a quat to the given values - * - * @param {quat} out the receiving quaternion - * @param {Number} x X component - * @param {Number} y Y component - * @param {Number} z Z component - * @param {Number} w W component - * @returns {quat} out - * @function - */ -quat.set = __WEBPACK_IMPORTED_MODULE_2__vec4__["a" /* default */].set; - -/** - * Set a quat to the identity quaternion - * - * @param {quat} out the receiving quaternion - * @returns {quat} out - */ -quat.identity = function(out) { - out[0] = 0; - out[1] = 0; - out[2] = 0; - out[3] = 1; - return out; -}; - -/** - * Sets a quat from the given angle and rotation axis, - * then returns it. - * - * @param {quat} out the receiving quaternion - * @param {vec3} axis the axis around which to rotate - * @param {Number} rad the angle in radians - * @returns {quat} out - **/ -quat.setAxisAngle = function(out, axis, rad) { - rad = rad * 0.5; - var s = Math.sin(rad); - out[0] = s * axis[0]; - out[1] = s * axis[1]; - out[2] = s * axis[2]; - out[3] = Math.cos(rad); - return out; -}; - -/** - * Adds two quat's - * - * @param {quat} out the receiving quaternion - * @param {quat} a the first operand - * @param {quat} b the second operand - * @returns {quat} out - * @function - */ -quat.add = __WEBPACK_IMPORTED_MODULE_2__vec4__["a" /* default */].add; - -/** - * Multiplies two quat's - * - * @param {quat} out the receiving quaternion - * @param {quat} a the first operand - * @param {quat} b the second operand - * @returns {quat} out - */ -quat.multiply = function(out, a, b) { - var ax = a[0], ay = a[1], az = a[2], aw = a[3], - bx = b[0], by = b[1], bz = b[2], bw = b[3]; - - out[0] = ax * bw + aw * bx + ay * bz - az * by; - out[1] = ay * bw + aw * by + az * bx - ax * bz; - out[2] = az * bw + aw * bz + ax * by - ay * bx; - out[3] = aw * bw - ax * bx - ay * by - az * bz; - return out; -}; - -/** - * Alias for {@link quat.multiply} - * @function - */ -quat.mul = quat.multiply; - -/** - * Scales a quat by a scalar number - * - * @param {quat} out the receiving vector - * @param {quat} a the vector to scale - * @param {Number} b amount to scale the vector by - * @returns {quat} out - * @function - */ -quat.scale = __WEBPACK_IMPORTED_MODULE_2__vec4__["a" /* default */].scale; - -/** - * Rotates a quaternion by the given angle about the X axis - * - * @param {quat} out quat receiving operation result - * @param {quat} a quat to rotate - * @param {number} rad angle (in radians) to rotate - * @returns {quat} out - */ -quat.rotateX = function (out, a, rad) { - rad *= 0.5; - - var ax = a[0], ay = a[1], az = a[2], aw = a[3], - bx = Math.sin(rad), bw = Math.cos(rad); - - out[0] = ax * bw + aw * bx; - out[1] = ay * bw + az * bx; - out[2] = az * bw - ay * bx; - out[3] = aw * bw - ax * bx; - return out; -}; - -/** - * Rotates a quaternion by the given angle about the Y axis - * - * @param {quat} out quat receiving operation result - * @param {quat} a quat to rotate - * @param {number} rad angle (in radians) to rotate - * @returns {quat} out - */ -quat.rotateY = function (out, a, rad) { - rad *= 0.5; - - var ax = a[0], ay = a[1], az = a[2], aw = a[3], - by = Math.sin(rad), bw = Math.cos(rad); - - out[0] = ax * bw - az * by; - out[1] = ay * bw + aw * by; - out[2] = az * bw + ax * by; - out[3] = aw * bw - ay * by; - return out; -}; - -/** - * Rotates a quaternion by the given angle about the Z axis - * - * @param {quat} out quat receiving operation result - * @param {quat} a quat to rotate - * @param {number} rad angle (in radians) to rotate - * @returns {quat} out - */ -quat.rotateZ = function (out, a, rad) { - rad *= 0.5; - - var ax = a[0], ay = a[1], az = a[2], aw = a[3], - bz = Math.sin(rad), bw = Math.cos(rad); - - out[0] = ax * bw + ay * bz; - out[1] = ay * bw - ax * bz; - out[2] = az * bw + aw * bz; - out[3] = aw * bw - az * bz; - return out; -}; - -/** - * Calculates the W component of a quat from the X, Y, and Z components. - * Assumes that quaternion is 1 unit in length. - * Any existing W component will be ignored. - * - * @param {quat} out the receiving quaternion - * @param {quat} a quat to calculate W component of - * @returns {quat} out - */ -quat.calculateW = function (out, a) { - var x = a[0], y = a[1], z = a[2]; - - out[0] = x; - out[1] = y; - out[2] = z; - out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z)); - return out; -}; - -/** - * Calculates the dot product of two quat's - * - * @param {quat} a the first operand - * @param {quat} b the second operand - * @returns {Number} dot product of a and b - * @function - */ -quat.dot = __WEBPACK_IMPORTED_MODULE_2__vec4__["a" /* default */].dot; - -/** - * Performs a linear interpolation between two quat's - * - * @param {quat} out the receiving quaternion - * @param {quat} a the first operand - * @param {quat} b the second operand - * @param {Number} t interpolation amount between the two inputs - * @returns {quat} out - * @function - */ -quat.lerp = __WEBPACK_IMPORTED_MODULE_2__vec4__["a" /* default */].lerp; - -/** - * Performs a spherical linear interpolation between two quat - * - * @param {quat} out the receiving quaternion - * @param {quat} a the first operand - * @param {quat} b the second operand - * @param {Number} t interpolation amount between the two inputs - * @returns {quat} out - */ -quat.slerp = function (out, a, b, t) { - // benchmarks: - // http://jsperf.com/quaternion-slerp-implementations - - var ax = a[0], ay = a[1], az = a[2], aw = a[3], - bx = b[0], by = b[1], bz = b[2], bw = b[3]; - - var omega, cosom, sinom, scale0, scale1; - - // calc cosine - cosom = ax * bx + ay * by + az * bz + aw * bw; - // adjust signs (if necessary) - if ( cosom < 0.0 ) { - cosom = -cosom; - bx = - bx; - by = - by; - bz = - bz; - bw = - bw; - } - // calculate coefficients - if ( (1.0 - cosom) > 0.000001 ) { - // standard case (slerp) - omega = Math.acos(cosom); - sinom = Math.sin(omega); - scale0 = Math.sin((1.0 - t) * omega) / sinom; - scale1 = Math.sin(t * omega) / sinom; - } else { - // "from" and "to" quaternions are very close - // ... so we can do a linear interpolation - scale0 = 1.0 - t; - scale1 = t; - } - // calculate final values - out[0] = scale0 * ax + scale1 * bx; - out[1] = scale0 * ay + scale1 * by; - out[2] = scale0 * az + scale1 * bz; - out[3] = scale0 * aw + scale1 * bw; - - return out; -}; - -/** - * Calculates the inverse of a quat - * - * @param {quat} out the receiving quaternion - * @param {quat} a quat to calculate inverse of - * @returns {quat} out - */ -quat.invert = function(out, a) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], - dot = a0*a0 + a1*a1 + a2*a2 + a3*a3, - invDot = dot ? 1.0/dot : 0; - - // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0 - - out[0] = -a0*invDot; - out[1] = -a1*invDot; - out[2] = -a2*invDot; - out[3] = a3*invDot; - return out; -}; - -/** - * Calculates the conjugate of a quat - * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result. - * - * @param {quat} out the receiving quaternion - * @param {quat} a quat to calculate conjugate of - * @returns {quat} out - */ -quat.conjugate = function (out, a) { - out[0] = -a[0]; - out[1] = -a[1]; - out[2] = -a[2]; - out[3] = a[3]; - return out; -}; - -/** - * Calculates the length of a quat - * - * @param {quat} a vector to calculate length of - * @returns {Number} length of a - * @function - */ -quat.length = __WEBPACK_IMPORTED_MODULE_2__vec4__["a" /* default */].length; - -/** - * Alias for {@link quat.length} - * @function - */ -quat.len = quat.length; - -/** - * Calculates the squared length of a quat - * - * @param {quat} a vector to calculate squared length of - * @returns {Number} squared length of a - * @function - */ -quat.squaredLength = __WEBPACK_IMPORTED_MODULE_2__vec4__["a" /* default */].squaredLength; - -/** - * Alias for {@link quat.squaredLength} - * @function - */ -quat.sqrLen = quat.squaredLength; - -/** - * Normalize a quat - * - * @param {quat} out the receiving quaternion - * @param {quat} a quaternion to normalize - * @returns {quat} out - * @function - */ -quat.normalize = __WEBPACK_IMPORTED_MODULE_2__vec4__["a" /* default */].normalize; - -/** - * Creates a quaternion from the given 3x3 rotation matrix. - * - * NOTE: The resultant quaternion is not normalized, so you should be sure - * to renormalize the quaternion yourself where necessary. - * - * @param {quat} out the receiving quaternion - * @param {mat3} m rotation matrix - * @returns {quat} out - * @function - */ -quat.fromMat3 = function(out, m) { - // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes - // article "Quaternion Calculus and Fast Animation". - var fTrace = m[0] + m[4] + m[8]; - var fRoot; - - if ( fTrace > 0.0 ) { - // |w| > 1/2, may as well choose w > 1/2 - fRoot = Math.sqrt(fTrace + 1.0); // 2w - out[3] = 0.5 * fRoot; - fRoot = 0.5/fRoot; // 1/(4w) - out[0] = (m[5]-m[7])*fRoot; - out[1] = (m[6]-m[2])*fRoot; - out[2] = (m[1]-m[3])*fRoot; - } else { - // |w| <= 1/2 - var i = 0; - if ( m[4] > m[0] ) - i = 1; - if ( m[8] > m[i*3+i] ) - i = 2; - var j = (i+1)%3; - var k = (i+2)%3; - - fRoot = Math.sqrt(m[i*3+i]-m[j*3+j]-m[k*3+k] + 1.0); - out[i] = 0.5 * fRoot; - fRoot = 0.5 / fRoot; - out[3] = (m[j*3+k] - m[k*3+j]) * fRoot; - out[j] = (m[j*3+i] + m[i*3+j]) * fRoot; - out[k] = (m[k*3+i] + m[i*3+k]) * fRoot; - } - - return out; -}; - -/* harmony default export */ __webpack_exports__["a"] = (quat); - -/***/ }), -/* 56 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__ = __webpack_require__(55); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__glmatrix_mat3__ = __webpack_require__(34); - - - -/** - * @constructor - * @alias clay.Quaternion - * @param {number} x - * @param {number} y - * @param {number} z - * @param {number} w - */ -var Quaternion = function (x, y, z, w) { - - x = x || 0; - y = y || 0; - z = z || 0; - w = w === undefined ? 1 : w; - - /** - * Storage of Quaternion, read and write of x, y, z, w will change the values in array - * All methods also operate on the array instead of x, y, z, w components - * @name array - * @type {Float32Array} - * @memberOf clay.Quaternion# - */ - this.array = __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].fromValues(x, y, z, w); - - /** - * Dirty flag is used by the Node to determine - * if the matrix is updated to latest - * @name _dirty - * @type {boolean} - * @memberOf clay.Quaternion# - */ - this._dirty = true; -}; - -Quaternion.prototype = { - - constructor: Quaternion, - - /** - * Add b to self - * @param {clay.Quaternion} b - * @return {clay.Quaternion} - */ - add: function (b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].add(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Calculate the w component from x, y, z component - * @return {clay.Quaternion} - */ - calculateW: function () { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].calculateW(this.array, this.array); - this._dirty = true; - return this; - }, - - /** - * Set x, y and z components - * @param {number} x - * @param {number} y - * @param {number} z - * @param {number} w - * @return {clay.Quaternion} - */ - set: function (x, y, z, w) { - this.array[0] = x; - this.array[1] = y; - this.array[2] = z; - this.array[3] = w; - this._dirty = true; - return this; - }, - - /** - * Set x, y, z and w components from array - * @param {Float32Array|number[]} arr - * @return {clay.Quaternion} - */ - setArray: function (arr) { - this.array[0] = arr[0]; - this.array[1] = arr[1]; - this.array[2] = arr[2]; - this.array[3] = arr[3]; - - this._dirty = true; - return this; - }, - - /** - * Clone a new Quaternion - * @return {clay.Quaternion} - */ - clone: function () { - return new Quaternion(this.x, this.y, this.z, this.w); - }, - - /** - * Calculates the conjugate of self If the quaternion is normalized, - * this function is faster than invert and produces the same result. - * - * @return {clay.Quaternion} - */ - conjugate: function () { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].conjugate(this.array, this.array); - this._dirty = true; - return this; - }, - - /** - * Copy from b - * @param {clay.Quaternion} b - * @return {clay.Quaternion} - */ - copy: function (b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].copy(this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Dot product of self and b - * @param {clay.Quaternion} b - * @return {number} - */ - dot: function (b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].dot(this.array, b.array); - }, - - /** - * Set from the given 3x3 rotation matrix - * @param {clay.Matrix3} m - * @return {clay.Quaternion} - */ - fromMat3: function (m) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].fromMat3(this.array, m.array); - this._dirty = true; - return this; - }, - - /** - * Set from the given 4x4 rotation matrix - * The 4th column and 4th row will be droped - * @param {clay.Matrix4} m - * @return {clay.Quaternion} - */ - fromMat4: (function () { - var m3 = __WEBPACK_IMPORTED_MODULE_1__glmatrix_mat3__["a" /* default */].create(); - return function (m) { - __WEBPACK_IMPORTED_MODULE_1__glmatrix_mat3__["a" /* default */].fromMat4(m3, m.array); - // TODO Not like mat4, mat3 in glmatrix seems to be row-based - __WEBPACK_IMPORTED_MODULE_1__glmatrix_mat3__["a" /* default */].transpose(m3, m3); - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].fromMat3(this.array, m3); - this._dirty = true; - return this; - }; - })(), - - /** - * Set to identity quaternion - * @return {clay.Quaternion} - */ - identity: function () { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].identity(this.array); - this._dirty = true; - return this; - }, - /** - * Invert self - * @return {clay.Quaternion} - */ - invert: function () { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].invert(this.array, this.array); - this._dirty = true; - return this; - }, - /** - * Alias of length - * @return {number} - */ - len: function () { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].len(this.array); - }, - - /** - * Calculate the length - * @return {number} - */ - length: function () { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].length(this.array); - }, - - /** - * Linear interpolation between a and b - * @param {clay.Quaternion} a - * @param {clay.Quaternion} b - * @param {number} t - * @return {clay.Quaternion} - */ - lerp: function (a, b, t) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].lerp(this.array, a.array, b.array, t); - this._dirty = true; - return this; - }, - - /** - * Alias for multiply - * @param {clay.Quaternion} b - * @return {clay.Quaternion} - */ - mul: function (b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].mul(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Alias for multiplyLeft - * @param {clay.Quaternion} a - * @return {clay.Quaternion} - */ - mulLeft: function (a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].multiply(this.array, a.array, this.array); - this._dirty = true; - return this; - }, - - /** - * Mutiply self and b - * @param {clay.Quaternion} b - * @return {clay.Quaternion} - */ - multiply: function (b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].multiply(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Mutiply a and self - * Quaternion mutiply is not commutative, so the result of mutiplyLeft is different with multiply. - * @param {clay.Quaternion} a - * @return {clay.Quaternion} - */ - multiplyLeft: function (a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].multiply(this.array, a.array, this.array); - this._dirty = true; - return this; - }, - - /** - * Normalize self - * @return {clay.Quaternion} - */ - normalize: function () { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].normalize(this.array, this.array); - this._dirty = true; - return this; - }, - - /** - * Rotate self by a given radian about X axis - * @param {number} rad - * @return {clay.Quaternion} - */ - rotateX: function (rad) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].rotateX(this.array, this.array, rad); - this._dirty = true; - return this; - }, - - /** - * Rotate self by a given radian about Y axis - * @param {number} rad - * @return {clay.Quaternion} - */ - rotateY: function (rad) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].rotateY(this.array, this.array, rad); - this._dirty = true; - return this; - }, - - /** - * Rotate self by a given radian about Z axis - * @param {number} rad - * @return {clay.Quaternion} - */ - rotateZ: function (rad) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].rotateZ(this.array, this.array, rad); - this._dirty = true; - return this; - }, - - /** - * Sets self to represent the shortest rotation from Vector3 a to Vector3 b. - * a and b needs to be normalized - * @param {clay.Vector3} a - * @param {clay.Vector3} b - * @return {clay.Quaternion} - */ - rotationTo: function (a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].rotationTo(this.array, a.array, b.array); - this._dirty = true; - return this; - }, - /** - * Sets self with values corresponding to the given axes - * @param {clay.Vector3} view - * @param {clay.Vector3} right - * @param {clay.Vector3} up - * @return {clay.Quaternion} - */ - setAxes: function (view, right, up) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].setAxes(this.array, view.array, right.array, up.array); - this._dirty = true; - return this; - }, - - /** - * Sets self with a rotation axis and rotation angle - * @param {clay.Vector3} axis - * @param {number} rad - * @return {clay.Quaternion} - */ - setAxisAngle: function (axis, rad) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].setAxisAngle(this.array, axis.array, rad); - this._dirty = true; - return this; - }, - /** - * Perform spherical linear interpolation between a and b - * @param {clay.Quaternion} a - * @param {clay.Quaternion} b - * @param {number} t - * @return {clay.Quaternion} - */ - slerp: function (a, b, t) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].slerp(this.array, a.array, b.array, t); - this._dirty = true; - return this; - }, - - /** - * Alias for squaredLength - * @return {number} - */ - sqrLen: function () { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].sqrLen(this.array); - }, - - /** - * Squared length of self - * @return {number} - */ - squaredLength: function () { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].squaredLength(this.array); - }, - - /** - * Set from euler - * @param {clay.Vector3} v - * @param {String} order - */ - fromEuler: function (v, order) { - return Quaternion.fromEuler(this, v, order); - }, - - toString: function () { - return '[' + Array.prototype.join.call(this.array, ',') + ']'; - }, - - toArray: function () { - return Array.prototype.slice.call(this.array); - } -}; - -var defineProperty = Object.defineProperty; -// Getter and Setter -if (defineProperty) { - - var proto = Quaternion.prototype; - /** - * @name x - * @type {number} - * @memberOf clay.Quaternion - * @instance - */ - defineProperty(proto, 'x', { - get: function () { - return this.array[0]; - }, - set: function (value) { - this.array[0] = value; - this._dirty = true; - } - }); - - /** - * @name y - * @type {number} - * @memberOf clay.Quaternion - * @instance - */ - defineProperty(proto, 'y', { - get: function () { - return this.array[1]; - }, - set: function (value) { - this.array[1] = value; - this._dirty = true; - } - }); - - /** - * @name z - * @type {number} - * @memberOf clay.Quaternion - * @instance - */ - defineProperty(proto, 'z', { - get: function () { - return this.array[2]; - }, - set: function (value) { - this.array[2] = value; - this._dirty = true; - } - }); - - /** - * @name w - * @type {number} - * @memberOf clay.Quaternion - * @instance - */ - defineProperty(proto, 'w', { - get: function () { - return this.array[3]; - }, - set: function (value) { - this.array[3] = value; - this._dirty = true; - } - }); -} - -// Supply methods that are not in place - -/** - * @param {clay.Quaternion} out - * @param {clay.Quaternion} a - * @param {clay.Quaternion} b - * @return {clay.Quaternion} - */ -Quaternion.add = function (out, a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].add(out.array, a.array, b.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Quaternion} out - * @param {number} x - * @param {number} y - * @param {number} z - * @param {number} w - * @return {clay.Quaternion} - */ -Quaternion.set = function (out, x, y, z, w) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].set(out.array, x, y, z, w); - out._dirty = true; -}; - -/** - * @param {clay.Quaternion} out - * @param {clay.Quaternion} b - * @return {clay.Quaternion} - */ -Quaternion.copy = function (out, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].copy(out.array, b.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Quaternion} out - * @param {clay.Quaternion} a - * @return {clay.Quaternion} - */ -Quaternion.calculateW = function (out, a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].calculateW(out.array, a.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Quaternion} out - * @param {clay.Quaternion} a - * @return {clay.Quaternion} - */ -Quaternion.conjugate = function (out, a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].conjugate(out.array, a.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Quaternion} out - * @return {clay.Quaternion} - */ -Quaternion.identity = function (out) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].identity(out.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Quaternion} out - * @param {clay.Quaternion} a - * @return {clay.Quaternion} - */ -Quaternion.invert = function (out, a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].invert(out.array, a.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Quaternion} a - * @param {clay.Quaternion} b - * @return {number} - */ -Quaternion.dot = function (a, b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].dot(a.array, b.array); -}; - -/** - * @param {clay.Quaternion} a - * @return {number} - */ -Quaternion.len = function (a) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].length(a.array); -}; - -// Quaternion.length = Quaternion.len; - -/** - * @param {clay.Quaternion} out - * @param {clay.Quaternion} a - * @param {clay.Quaternion} b - * @param {number} t - * @return {clay.Quaternion} - */ -Quaternion.lerp = function (out, a, b, t) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].lerp(out.array, a.array, b.array, t); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Quaternion} out - * @param {clay.Quaternion} a - * @param {clay.Quaternion} b - * @param {number} t - * @return {clay.Quaternion} - */ -Quaternion.slerp = function (out, a, b, t) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].slerp(out.array, a.array, b.array, t); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Quaternion} out - * @param {clay.Quaternion} a - * @param {clay.Quaternion} b - * @return {clay.Quaternion} - */ -Quaternion.mul = function (out, a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].multiply(out.array, a.array, b.array); - out._dirty = true; - return out; -}; - -/** - * @function - * @param {clay.Quaternion} out - * @param {clay.Quaternion} a - * @param {clay.Quaternion} b - * @return {clay.Quaternion} - */ -Quaternion.multiply = Quaternion.mul; - -/** - * @param {clay.Quaternion} out - * @param {clay.Quaternion} a - * @param {number} rad - * @return {clay.Quaternion} - */ -Quaternion.rotateX = function (out, a, rad) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].rotateX(out.array, a.array, rad); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Quaternion} out - * @param {clay.Quaternion} a - * @param {number} rad - * @return {clay.Quaternion} - */ -Quaternion.rotateY = function (out, a, rad) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].rotateY(out.array, a.array, rad); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Quaternion} out - * @param {clay.Quaternion} a - * @param {number} rad - * @return {clay.Quaternion} - */ -Quaternion.rotateZ = function (out, a, rad) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].rotateZ(out.array, a.array, rad); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Quaternion} out - * @param {clay.Vector3} axis - * @param {number} rad - * @return {clay.Quaternion} - */ -Quaternion.setAxisAngle = function (out, axis, rad) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].setAxisAngle(out.array, axis.array, rad); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Quaternion} out - * @param {clay.Quaternion} a - * @return {clay.Quaternion} - */ -Quaternion.normalize = function (out, a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].normalize(out.array, a.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Quaternion} a - * @return {number} - */ -Quaternion.sqrLen = function (a) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].sqrLen(a.array); -}; - -/** - * @function - * @param {clay.Quaternion} a - * @return {number} - */ -Quaternion.squaredLength = Quaternion.sqrLen; - -/** - * @param {clay.Quaternion} out - * @param {clay.Matrix3} m - * @return {clay.Quaternion} - */ -Quaternion.fromMat3 = function (out, m) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].fromMat3(out.array, m.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Quaternion} out - * @param {clay.Vector3} view - * @param {clay.Vector3} right - * @param {clay.Vector3} up - * @return {clay.Quaternion} - */ -Quaternion.setAxes = function (out, view, right, up) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].setAxes(out.array, view.array, right.array, up.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Quaternion} out - * @param {clay.Vector3} a - * @param {clay.Vector3} b - * @return {clay.Quaternion} - */ -Quaternion.rotationTo = function (out, a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_quat__["a" /* default */].rotationTo(out.array, a.array, b.array); - out._dirty = true; - return out; -}; - -/** - * Set quaternion from euler - * @param {clay.Quaternion} out - * @param {clay.Vector3} v - * @param {String} order - */ -Quaternion.fromEuler = function (out, v, order) { - - out._dirty = true; - - v = v.array; - var target = out.array; - var c1 = Math.cos(v[0] / 2); - var c2 = Math.cos(v[1] / 2); - var c3 = Math.cos(v[2] / 2); - var s1 = Math.sin(v[0] / 2); - var s2 = Math.sin(v[1] / 2); - var s3 = Math.sin(v[2] / 2); - - var order = (order || 'XYZ').toUpperCase(); - - // http://www.mathworks.com/matlabcentral/fileexchange/ - // 20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/ - // content/SpinCalc.m - - switch (order) { - case 'XYZ': - target[0] = s1 * c2 * c3 + c1 * s2 * s3; - target[1] = c1 * s2 * c3 - s1 * c2 * s3; - target[2] = c1 * c2 * s3 + s1 * s2 * c3; - target[3] = c1 * c2 * c3 - s1 * s2 * s3; - break; - case 'YXZ': - target[0] = s1 * c2 * c3 + c1 * s2 * s3; - target[1] = c1 * s2 * c3 - s1 * c2 * s3; - target[2] = c1 * c2 * s3 - s1 * s2 * c3; - target[3] = c1 * c2 * c3 + s1 * s2 * s3; - break; - case 'ZXY': - target[0] = s1 * c2 * c3 - c1 * s2 * s3; - target[1] = c1 * s2 * c3 + s1 * c2 * s3; - target[2] = c1 * c2 * s3 + s1 * s2 * c3; - target[3] = c1 * c2 * c3 - s1 * s2 * s3; - break; - case 'ZYX': - target[0] = s1 * c2 * c3 - c1 * s2 * s3; - target[1] = c1 * s2 * c3 + s1 * c2 * s3; - target[2] = c1 * c2 * s3 - s1 * s2 * c3; - target[3] = c1 * c2 * c3 + s1 * s2 * s3; - break; - case 'YZX': - target[0] = s1 * c2 * c3 + c1 * s2 * s3; - target[1] = c1 * s2 * c3 + s1 * c2 * s3; - target[2] = c1 * c2 * s3 - s1 * s2 * c3; - target[3] = c1 * c2 * c3 - s1 * s2 * s3; - break; - case 'XZY': - target[0] = s1 * c2 * c3 - c1 * s2 * s3; - target[1] = c1 * s2 * c3 - s1 * c2 * s3; - target[2] = c1 * c2 * s3 + s1 * s2 * c3; - target[3] = c1 * c2 * c3 + s1 * s2 * s3; - break; - } -}; - -/* harmony default export */ __webpack_exports__["a"] = (Quaternion); - - -/***/ }), -/* 57 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -var DIRTY_PREFIX = '__dt__'; - -var Cache = function () { - - this._contextId = 0; - - this._caches = []; - - this._context = {}; -}; - -Cache.prototype = { - - use: function (contextId, documentSchema) { - var caches = this._caches; - if (!caches[contextId]) { - caches[contextId] = {}; - - if (documentSchema) { - caches[contextId] = documentSchema(); - } - } - this._contextId = contextId; - - this._context = caches[contextId]; - }, - - put: function (key, value) { - this._context[key] = value; - }, - - get: function (key) { - return this._context[key]; - }, - - dirty: function (field) { - field = field || ''; - var key = DIRTY_PREFIX + field; - this.put(key, true); - }, - - dirtyAll: function (field) { - field = field || ''; - var key = DIRTY_PREFIX + field; - var caches = this._caches; - for (var i = 0; i < caches.length; i++) { - if (caches[i]) { - caches[i][key] = true; - } - } - }, - - fresh: function (field) { - field = field || ''; - var key = DIRTY_PREFIX + field; - this.put(key, false); - }, - - freshAll: function (field) { - field = field || ''; - var key = DIRTY_PREFIX + field; - var caches = this._caches; - for (var i = 0; i < caches.length; i++) { - if (caches[i]) { - caches[i][key] = false; - } - } - }, - - isDirty: function (field) { - field = field || ''; - var key = DIRTY_PREFIX + field; - var context = this._context; - return !context.hasOwnProperty(key) - || context[key] === true; - }, - - deleteContext: function (contextId) { - delete this._caches[contextId]; - this._context = {}; - }, - - delete: function (key) { - delete this._context[key]; - }, - - clearAll: function () { - this._caches = {}; - }, - - getContext: function () { - return this._context; - }, - - eachContext : function (cb, context) { - var keys = Object.keys(this._caches); - keys.forEach(function (key) { - cb && cb.call(context, key); - }); - }, - - miss: function (key) { - return ! this._context.hasOwnProperty(key); - } -}; - -Cache.prototype.constructor = Cache; - -/* harmony default export */ __webpack_exports__["a"] = (Cache); - - -/***/ }), -/* 58 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Node__ = __webpack_require__(35); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__math_Matrix4__ = __webpack_require__(9); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__math_Frustum__ = __webpack_require__(59); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__math_Ray__ = __webpack_require__(54); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__glmatrix_vec4__ = __webpack_require__(33); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__glmatrix_vec3__ = __webpack_require__(12); - - - - - - - - - -/** - * @constructor clay.Camera - * @extends clay.Node - */ -var Camera = __WEBPACK_IMPORTED_MODULE_0__Node__["a" /* default */].extend(function () { - return /** @lends clay.Camera# */ { - /** - * Camera projection matrix - * @type {clay.Matrix4} - */ - projectionMatrix: new __WEBPACK_IMPORTED_MODULE_1__math_Matrix4__["a" /* default */](), - - /** - * Inverse of camera projection matrix - * @type {clay.Matrix4} - */ - invProjectionMatrix: new __WEBPACK_IMPORTED_MODULE_1__math_Matrix4__["a" /* default */](), - - /** - * View matrix, equal to inverse of camera's world matrix - * @type {clay.Matrix4} - */ - viewMatrix: new __WEBPACK_IMPORTED_MODULE_1__math_Matrix4__["a" /* default */](), - - /** - * Camera frustum in view space - * @type {clay.Frustum} - */ - frustum: new __WEBPACK_IMPORTED_MODULE_2__math_Frustum__["a" /* default */]() - }; -}, function () { - this.update(true); -}, -/** @lends clay.Camera.prototype */ -{ - - update: function (force) { - __WEBPACK_IMPORTED_MODULE_0__Node__["a" /* default */].prototype.update.call(this, force); - __WEBPACK_IMPORTED_MODULE_1__math_Matrix4__["a" /* default */].invert(this.viewMatrix, this.worldTransform); - - this.updateProjectionMatrix(); - __WEBPACK_IMPORTED_MODULE_1__math_Matrix4__["a" /* default */].invert(this.invProjectionMatrix, this.projectionMatrix); - - this.frustum.setFromProjection(this.projectionMatrix); - }, - - /** - * Set camera view matrix - */ - setViewMatrix: function (viewMatrix) { - __WEBPACK_IMPORTED_MODULE_1__math_Matrix4__["a" /* default */].copy(this.viewMatrix, viewMatrix); - __WEBPACK_IMPORTED_MODULE_1__math_Matrix4__["a" /* default */].invert(this.worldTransform, viewMatrix); - this.decomposeWorldTransform(); - }, - - /** - * Decompose camera projection matrix - */ - decomposeProjectionMatrix: function () {}, - - /** - * Set camera projection matrix - * @param {clay.Matrix4} projectionMatrix - */ - setProjectionMatrix: function (projectionMatrix) { - __WEBPACK_IMPORTED_MODULE_1__math_Matrix4__["a" /* default */].copy(this.projectionMatrix, projectionMatrix); - __WEBPACK_IMPORTED_MODULE_1__math_Matrix4__["a" /* default */].invert(this.invProjectionMatrix, projectionMatrix); - this.decomposeProjectionMatrix(); - }, - /** - * Update projection matrix, called after update - */ - updateProjectionMatrix: function () {}, - - /** - * Cast a picking ray from camera near plane to far plane - * @function - * @param {clay.Vector2} ndc - * @param {clay.Ray} [out] - * @return {clay.Ray} - */ - castRay: (function () { - var v4 = __WEBPACK_IMPORTED_MODULE_4__glmatrix_vec4__["a" /* default */].create(); - return function (ndc, out) { - var ray = out !== undefined ? out : new __WEBPACK_IMPORTED_MODULE_3__math_Ray__["a" /* default */](); - var x = ndc.array[0]; - var y = ndc.array[1]; - __WEBPACK_IMPORTED_MODULE_4__glmatrix_vec4__["a" /* default */].set(v4, x, y, -1, 1); - __WEBPACK_IMPORTED_MODULE_4__glmatrix_vec4__["a" /* default */].transformMat4(v4, v4, this.invProjectionMatrix.array); - __WEBPACK_IMPORTED_MODULE_4__glmatrix_vec4__["a" /* default */].transformMat4(v4, v4, this.worldTransform.array); - __WEBPACK_IMPORTED_MODULE_5__glmatrix_vec3__["a" /* default */].scale(ray.origin.array, v4, 1 / v4[3]); - - __WEBPACK_IMPORTED_MODULE_4__glmatrix_vec4__["a" /* default */].set(v4, x, y, 1, 1); - __WEBPACK_IMPORTED_MODULE_4__glmatrix_vec4__["a" /* default */].transformMat4(v4, v4, this.invProjectionMatrix.array); - __WEBPACK_IMPORTED_MODULE_4__glmatrix_vec4__["a" /* default */].transformMat4(v4, v4, this.worldTransform.array); - __WEBPACK_IMPORTED_MODULE_5__glmatrix_vec3__["a" /* default */].scale(v4, v4, 1 / v4[3]); - __WEBPACK_IMPORTED_MODULE_5__glmatrix_vec3__["a" /* default */].sub(ray.direction.array, v4, ray.origin.array); - - __WEBPACK_IMPORTED_MODULE_5__glmatrix_vec3__["a" /* default */].normalize(ray.direction.array, ray.direction.array); - ray.direction._dirty = true; - ray.origin._dirty = true; - - return ray; - }; - })(), - - /** - * @function - * @name clone - * @return {clay.Camera} - * @memberOf clay.Camera.prototype - */ -}); - -/* harmony default export */ __webpack_exports__["a"] = (Camera); - - -/***/ }), -/* 59 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__BoundingBox__ = __webpack_require__(18); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Plane__ = __webpack_require__(74); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__glmatrix_vec3__ = __webpack_require__(12); - - - - - -var vec3Set = __WEBPACK_IMPORTED_MODULE_2__glmatrix_vec3__["a" /* default */].set; -var vec3Copy = __WEBPACK_IMPORTED_MODULE_2__glmatrix_vec3__["a" /* default */].copy; -var vec3TranformMat4 = __WEBPACK_IMPORTED_MODULE_2__glmatrix_vec3__["a" /* default */].transformMat4; -var mathMin = Math.min; -var mathMax = Math.max; -/** - * @constructor - * @alias clay.Frustum - */ -var Frustum = function() { - - /** - * Eight planes to enclose the frustum - * @type {clay.Plane[]} - */ - this.planes = []; - - for (var i = 0; i < 6; i++) { - this.planes.push(new __WEBPACK_IMPORTED_MODULE_1__Plane__["a" /* default */]()); - } - - /** - * Bounding box of frustum - * @type {clay.BoundingBox} - */ - this.boundingBox = new __WEBPACK_IMPORTED_MODULE_0__BoundingBox__["a" /* default */](); - - /** - * Eight vertices of frustum - * @type {Float32Array[]} - */ - this.vertices = []; - for (var i = 0; i < 8; i++) { - this.vertices[i] = __WEBPACK_IMPORTED_MODULE_2__glmatrix_vec3__["a" /* default */].fromValues(0, 0, 0); - } -}; - -Frustum.prototype = { - - // http://web.archive.org/web/20120531231005/http://crazyjoke.free.fr/doc/3D/plane%20extraction.pdf - /** - * Set frustum from a projection matrix - * @param {clay.Matrix4} projectionMatrix - */ - setFromProjection: function(projectionMatrix) { - - var planes = this.planes; - var m = projectionMatrix.array; - var m0 = m[0], m1 = m[1], m2 = m[2], m3 = m[3]; - var m4 = m[4], m5 = m[5], m6 = m[6], m7 = m[7]; - var m8 = m[8], m9 = m[9], m10 = m[10], m11 = m[11]; - var m12 = m[12], m13 = m[13], m14 = m[14], m15 = m[15]; - - // Update planes - vec3Set(planes[0].normal.array, m3 - m0, m7 - m4, m11 - m8); - planes[0].distance = -(m15 - m12); - planes[0].normalize(); - - vec3Set(planes[1].normal.array, m3 + m0, m7 + m4, m11 + m8); - planes[1].distance = -(m15 + m12); - planes[1].normalize(); - - vec3Set(planes[2].normal.array, m3 + m1, m7 + m5, m11 + m9); - planes[2].distance = -(m15 + m13); - planes[2].normalize(); - - vec3Set(planes[3].normal.array, m3 - m1, m7 - m5, m11 - m9); - planes[3].distance = -(m15 - m13); - planes[3].normalize(); - - vec3Set(planes[4].normal.array, m3 - m2, m7 - m6, m11 - m10); - planes[4].distance = -(m15 - m14); - planes[4].normalize(); - - vec3Set(planes[5].normal.array, m3 + m2, m7 + m6, m11 + m10); - planes[5].distance = -(m15 + m14); - planes[5].normalize(); - - // Perspective projection - var boundingBox = this.boundingBox; - var vertices = this.vertices; - if (m15 === 0) { - var aspect = m5 / m0; - var zNear = -m14 / (m10 - 1); - var zFar = -m14 / (m10 + 1); - var farY = -zFar / m5; - var nearY = -zNear / m5; - // Update bounding box - boundingBox.min.set(-farY * aspect, -farY, zFar); - boundingBox.max.set(farY * aspect, farY, zNear); - // update vertices - //--- min z - // min x - vec3Set(vertices[0], -farY * aspect, -farY, zFar); - vec3Set(vertices[1], -farY * aspect, farY, zFar); - // max x - vec3Set(vertices[2], farY * aspect, -farY, zFar); - vec3Set(vertices[3], farY * aspect, farY, zFar); - //-- max z - vec3Set(vertices[4], -nearY * aspect, -nearY, zNear); - vec3Set(vertices[5], -nearY * aspect, nearY, zNear); - vec3Set(vertices[6], nearY * aspect, -nearY, zNear); - vec3Set(vertices[7], nearY * aspect, nearY, zNear); - } - else { // Orthographic projection - var left = (-1 - m12) / m0; - var right = (1 - m12) / m0; - var top = (1 - m13) / m5; - var bottom = (-1 - m13) / m5; - var near = (-1 - m14) / m10; - var far = (1 - m14) / m10; - - - boundingBox.min.set(Math.min(left, right), Math.min(bottom, top), Math.min(far, near)); - boundingBox.max.set(Math.max(right, left), Math.max(top, bottom), Math.max(near, far)); - - var min = boundingBox.min.array; - var max = boundingBox.max.array; - //--- min z - // min x - vec3Set(vertices[0], min[0], min[1], min[2]); - vec3Set(vertices[1], min[0], max[1], min[2]); - // max x - vec3Set(vertices[2], max[0], min[1], min[2]); - vec3Set(vertices[3], max[0], max[1], min[2]); - //-- max z - vec3Set(vertices[4], min[0], min[1], max[2]); - vec3Set(vertices[5], min[0], max[1], max[2]); - vec3Set(vertices[6], max[0], min[1], max[2]); - vec3Set(vertices[7], max[0], max[1], max[2]); - } - }, - - /** - * Apply a affine transform matrix and set to the given bounding box - * @function - * @param {clay.BoundingBox} - * @param {clay.Matrix4} - * @return {clay.BoundingBox} - */ - getTransformedBoundingBox: (function() { - - var tmpVec3 = __WEBPACK_IMPORTED_MODULE_2__glmatrix_vec3__["a" /* default */].create(); - - return function(bbox, matrix) { - var vertices = this.vertices; - - var m4 = matrix.array; - var min = bbox.min; - var max = bbox.max; - var minArr = min.array; - var maxArr = max.array; - var v = vertices[0]; - vec3TranformMat4(tmpVec3, v, m4); - vec3Copy(minArr, tmpVec3); - vec3Copy(maxArr, tmpVec3); - - for (var i = 1; i < 8; i++) { - v = vertices[i]; - vec3TranformMat4(tmpVec3, v, m4); - - minArr[0] = mathMin(tmpVec3[0], minArr[0]); - minArr[1] = mathMin(tmpVec3[1], minArr[1]); - minArr[2] = mathMin(tmpVec3[2], minArr[2]); - - maxArr[0] = mathMax(tmpVec3[0], maxArr[0]); - maxArr[1] = mathMax(tmpVec3[1], maxArr[1]); - maxArr[2] = mathMax(tmpVec3[2], maxArr[2]); - } - - min._dirty = true; - max._dirty = true; - - return bbox; - }; - }) () -}; -/* harmony default export */ __webpack_exports__["a"] = (Frustum); - - -/***/ }), -/* 60 */ -/***/ (function(module, exports) { - -// Simple LRU cache use doubly linked list -// @module zrender/core/LRU - -/** - * Simple double linked list. Compared with array, it has O(1) remove operation. - * @constructor - */ -var LinkedList = function () { - /** - * @type {module:zrender/core/LRU~Entry} - */ - this.head = null; - /** - * @type {module:zrender/core/LRU~Entry} - */ - - this.tail = null; - this._len = 0; -}; - -var linkedListProto = LinkedList.prototype; -/** - * Insert a new value at the tail - * @param {} val - * @return {module:zrender/core/LRU~Entry} - */ - -linkedListProto.insert = function (val) { - var entry = new Entry(val); - this.insertEntry(entry); - return entry; -}; -/** - * Insert an entry at the tail - * @param {module:zrender/core/LRU~Entry} entry - */ - - -linkedListProto.insertEntry = function (entry) { - if (!this.head) { - this.head = this.tail = entry; - } else { - this.tail.next = entry; - entry.prev = this.tail; - entry.next = null; - this.tail = entry; - } - - this._len++; -}; -/** - * Remove entry. - * @param {module:zrender/core/LRU~Entry} entry - */ - - -linkedListProto.remove = function (entry) { - var prev = entry.prev; - var next = entry.next; - - if (prev) { - prev.next = next; - } else { - // Is head - this.head = next; - } - - if (next) { - next.prev = prev; - } else { - // Is tail - this.tail = prev; - } - - entry.next = entry.prev = null; - this._len--; -}; -/** - * @return {number} - */ - - -linkedListProto.len = function () { - return this._len; -}; -/** - * Clear list - */ - - -linkedListProto.clear = function () { - this.head = this.tail = null; - this._len = 0; -}; -/** - * @constructor - * @param {} val - */ - - -var Entry = function (val) { - /** - * @type {} - */ - this.value = val; - /** - * @type {module:zrender/core/LRU~Entry} - */ - - this.next; - /** - * @type {module:zrender/core/LRU~Entry} - */ - - this.prev; -}; -/** - * LRU Cache - * @constructor - * @alias module:zrender/core/LRU - */ - - -var LRU = function (maxSize) { - this._list = new LinkedList(); - this._map = {}; - this._maxSize = maxSize || 10; - this._lastRemovedEntry = null; -}; - -var LRUProto = LRU.prototype; -/** - * @param {string} key - * @param {} value - * @return {} Removed value - */ - -LRUProto.put = function (key, value) { - var list = this._list; - var map = this._map; - var removed = null; - - if (map[key] == null) { - var len = list.len(); // Reuse last removed entry - - var entry = this._lastRemovedEntry; - - if (len >= this._maxSize && len > 0) { - // Remove the least recently used - var leastUsedEntry = list.head; - list.remove(leastUsedEntry); - delete map[leastUsedEntry.key]; - removed = leastUsedEntry.value; - this._lastRemovedEntry = leastUsedEntry; - } - - if (entry) { - entry.value = value; - } else { - entry = new Entry(value); - } - - entry.key = key; - list.insertEntry(entry); - map[key] = entry; - } - - return removed; -}; -/** - * @param {string} key - * @return {} - */ - - -LRUProto.get = function (key) { - var entry = this._map[key]; - var list = this._list; - - if (entry != null) { - // Put the latest used entry in the tail - if (entry !== list.tail) { - list.remove(entry); - list.insertEntry(entry); - } - - return entry.value; - } -}; -/** - * Clear the cache - */ - - -LRUProto.clear = function () { - this._list.clear(); - - this._map = {}; -}; - -var _default = LRU; -module.exports = _default; - -/***/ }), -/* 61 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Texture2D__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__TextureCube__ = __webpack_require__(27); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__core_vendor__ = __webpack_require__(14); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__prePass_EnvironmentMap__ = __webpack_require__(62); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__plugin_Skydome__ = __webpack_require__(75); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Scene__ = __webpack_require__(36); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__dds__ = __webpack_require__(122); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__hdr__ = __webpack_require__(123); - - - - - - - - - - -/** - * @alias clay.util.texture - */ -var textureUtil = { - /** - * @param {string|object} path - * @param {object} [option] - * @param {Function} [onsuccess] - * @param {Function} [onerror] - * @return {clay.Texture} - */ - loadTexture: function (path, option, onsuccess, onerror) { - var texture; - if (typeof(option) === 'function') { - onsuccess = option; - onerror = onsuccess; - option = {}; - } - else { - option = option || {}; - } - if (typeof(path) === 'string') { - if (path.match(/.hdr$/) || option.fileType === 'hdr') { - texture = new __WEBPACK_IMPORTED_MODULE_0__Texture2D__["a" /* default */]({ - width: 0, - height: 0, - sRGB: false - }); - textureUtil._fetchTexture( - path, - function (data) { - __WEBPACK_IMPORTED_MODULE_7__hdr__["a" /* default */].parseRGBE(data, texture, option.exposure); - texture.dirty(); - onsuccess && onsuccess(texture); - }, - onerror - ); - return texture; - } - else if (path.match(/.dds$/) || option.fileType === 'dds') { - texture = new __WEBPACK_IMPORTED_MODULE_0__Texture2D__["a" /* default */]({ - width: 0, - height: 0 - }); - textureUtil._fetchTexture( - path, - function (data) { - __WEBPACK_IMPORTED_MODULE_6__dds__["a" /* default */].parse(data, texture); - texture.dirty(); - onsuccess && onsuccess(texture); - }, - onerror - ); - } - else { - texture = new __WEBPACK_IMPORTED_MODULE_0__Texture2D__["a" /* default */](); - texture.load(path); - texture.success(onsuccess); - texture.error(onerror); - } - } - else if (typeof path === 'object' && typeof(path.px) !== 'undefined') { - texture = new __WEBPACK_IMPORTED_MODULE_1__TextureCube__["a" /* default */](); - texture.load(path); - texture.success(onsuccess); - texture.error(onerror); - } - return texture; - }, - - /** - * Load a panorama texture and render it to a cube map - * @param {clay.Renderer} renderer - * @param {string} path - * @param {clay.TextureCube} cubeMap - * @param {object} [option] - * @param {boolean} [option.encodeRGBM] - * @param {number} [option.exposure] - * @param {Function} [onsuccess] - * @param {Function} [onerror] - */ - loadPanorama: function (renderer, path, cubeMap, option, onsuccess, onerror) { - var self = this; - - if (typeof(option) === 'function') { - onsuccess = option; - onerror = onsuccess; - option = {}; - } - else { - option = option || {}; - } - - textureUtil.loadTexture(path, option, function (texture) { - // PENDING - texture.flipY = option.flipY || false; - self.panoramaToCubeMap(renderer, texture, cubeMap, option); - texture.dispose(renderer); - onsuccess && onsuccess(cubeMap); - }, onerror); - }, - - /** - * Render a panorama texture to a cube map - * @param {clay.Renderer} renderer - * @param {clay.Texture2D} panoramaMap - * @param {clay.TextureCube} cubeMap - * @param {Object} option - * @param {boolean} [option.encodeRGBM] - */ - panoramaToCubeMap: function (renderer, panoramaMap, cubeMap, option) { - var environmentMapPass = new __WEBPACK_IMPORTED_MODULE_3__prePass_EnvironmentMap__["a" /* default */](); - var skydome = new __WEBPACK_IMPORTED_MODULE_4__plugin_Skydome__["a" /* default */]({ - scene: new __WEBPACK_IMPORTED_MODULE_5__Scene__["a" /* default */]() - }); - skydome.setEnvironmentMap(panoramaMap); - - option = option || {}; - if (option.encodeRGBM) { - skydome.material.define('fragment', 'RGBM_ENCODE'); - } - - // Share sRGB - cubeMap.sRGB = panoramaMap.sRGB; - - environmentMapPass.texture = cubeMap; - environmentMapPass.render(renderer, skydome.scene); - environmentMapPass.texture = null; - environmentMapPass.dispose(renderer); - return cubeMap; - }, - - /** - * Convert height map to normal map - * @param {HTMLImageElement|HTMLCanvasElement} image - * @param {boolean} [checkBump=false] - * @return {HTMLCanvasElement} - */ - heightToNormal: function (image, checkBump) { - var canvas = document.createElement('canvas'); - var width = canvas.width = image.width; - var height = canvas.height = image.height; - var ctx = canvas.getContext('2d'); - ctx.drawImage(image, 0, 0, width, height); - checkBump = checkBump || false; - var srcData = ctx.getImageData(0, 0, width, height); - var dstData = ctx.createImageData(width, height); - for (var i = 0; i < srcData.data.length; i += 4) { - if (checkBump) { - var r = srcData.data[i]; - var g = srcData.data[i + 1]; - var b = srcData.data[i + 2]; - var diff = Math.abs(r - g) + Math.abs(g - b); - if (diff > 20) { - console.warn('Given image is not a height map'); - return image; - } - } - // Modified from http://mrdoob.com/lab/javascript/height2normal/ - var x1, y1, x2, y2; - if (i % (width * 4) === 0) { - // left edge - x1 = srcData.data[i]; - x2 = srcData.data[i + 4]; - } - else if (i % (width * 4) === (width - 1) * 4) { - // right edge - x1 = srcData.data[i - 4]; - x2 = srcData.data[i]; - } - else { - x1 = srcData.data[i - 4]; - x2 = srcData.data[i + 4]; - } - - if (i < width * 4) { - // top edge - y1 = srcData.data[i]; - y2 = srcData.data[i + width * 4]; - } - else if (i > width * (height - 1) * 4) { - // bottom edge - y1 = srcData.data[i - width * 4]; - y2 = srcData.data[i]; - } - else { - y1 = srcData.data[i - width * 4]; - y2 = srcData.data[i + width * 4]; - } - - dstData.data[i] = (x1 - x2) + 127; - dstData.data[i + 1] = (y1 - y2) + 127; - dstData.data[i + 2] = 255; - dstData.data[i + 3] = 255; - } - ctx.putImageData(dstData, 0, 0); - return canvas; - }, - - /** - * Convert height map to normal map - * @param {HTMLImageElement|HTMLCanvasElement} image - * @param {boolean} [checkBump=false] - * @param {number} [threshold=20] - * @return {HTMLCanvasElement} - */ - isHeightImage: function (img, downScaleSize, threshold) { - if (!img || !img.width || !img.height) { - return false; - } - - var canvas = document.createElement('canvas'); - var ctx = canvas.getContext('2d'); - var size = downScaleSize || 32; - threshold = threshold || 20; - canvas.width = canvas.height = size; - ctx.drawImage(img, 0, 0, size, size); - var srcData = ctx.getImageData(0, 0, size, size); - for (var i = 0; i < srcData.data.length; i += 4) { - var r = srcData.data[i]; - var g = srcData.data[i + 1]; - var b = srcData.data[i + 2]; - var diff = Math.abs(r - g) + Math.abs(g - b); - if (diff > threshold) { - return false; - } - } - return true; - }, - - _fetchTexture: function (path, onsuccess, onerror) { - __WEBPACK_IMPORTED_MODULE_2__core_vendor__["a" /* default */].request.get({ - url: path, - responseType: 'arraybuffer', - onload: onsuccess, - onerror: onerror - }); - }, - - /** - * Create a chessboard texture - * @param {number} [size] - * @param {number} [unitSize] - * @param {string} [color1] - * @param {string} [color2] - * @return {clay.Texture2D} - */ - createChessboard: function (size, unitSize, color1, color2) { - size = size || 512; - unitSize = unitSize || 64; - color1 = color1 || 'black'; - color2 = color2 || 'white'; - - var repeat = Math.ceil(size / unitSize); - - var canvas = document.createElement('canvas'); - canvas.width = size; - canvas.height = size; - var ctx = canvas.getContext('2d'); - ctx.fillStyle = color2; - ctx.fillRect(0, 0, size, size); - - ctx.fillStyle = color1; - for (var i = 0; i < repeat; i++) { - for (var j = 0; j < repeat; j++) { - var isFill = j % 2 ? (i % 2) : (i % 2 - 1); - if (isFill) { - ctx.fillRect(i * unitSize, j * unitSize, unitSize, unitSize); - } - } - } - - var texture = new __WEBPACK_IMPORTED_MODULE_0__Texture2D__["a" /* default */]({ - image: canvas, - anisotropic: 8 - }); - - return texture; - }, - - /** - * Create a blank pure color 1x1 texture - * @param {string} color - * @return {clay.Texture2D} - */ - createBlank: function (color) { - var canvas = document.createElement('canvas'); - canvas.width = 1; - canvas.height = 1; - var ctx = canvas.getContext('2d'); - ctx.fillStyle = color; - ctx.fillRect(0, 0, 1, 1); - - var texture = new __WEBPACK_IMPORTED_MODULE_0__Texture2D__["a" /* default */]({ - image: canvas - }); - - return texture; - } -}; - -/* harmony default export */ __webpack_exports__["a"] = (textureUtil); - - -/***/ }), -/* 62 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__core_Base__ = __webpack_require__(7); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__math_Vector3__ = __webpack_require__(3); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__camera_Perspective__ = __webpack_require__(41); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__FrameBuffer__ = __webpack_require__(10); - - - - - -var targets = ['px', 'nx', 'py', 'ny', 'pz', 'nz']; - -/** - * Pass rendering scene to a environment cube map - * - * @constructor clay.prePass.EnvironmentMap - * @extends clay.core.Base - * @example - * // Example of car reflection - * var envMap = new clay.TextureCube({ - * width: 256, - * height: 256 - * }); - * var envPass = new clay.prePass.EnvironmentMap({ - * position: car.position, - * texture: envMap - * }); - * var carBody = car.getChildByName('body'); - * carBody.material.enableTexture('environmentMap'); - * carBody.material.set('environmentMap', envMap); - * ... - * animation.on('frame', function(frameTime) { - * envPass.render(renderer, scene); - * renderer.render(scene, camera); - * }); - */ -var EnvironmentMapPass = __WEBPACK_IMPORTED_MODULE_0__core_Base__["a" /* default */].extend(function() { - var ret = /** @lends clay.prePass.EnvironmentMap# */ { - /** - * Camera position - * @type {clay.Vector3} - * @memberOf clay.prePass.EnvironmentMap# - */ - position: new __WEBPACK_IMPORTED_MODULE_1__math_Vector3__["a" /* default */](), - /** - * Camera far plane - * @type {number} - * @memberOf clay.prePass.EnvironmentMap# - */ - far: 1000, - /** - * Camera near plane - * @type {number} - * @memberOf clay.prePass.EnvironmentMap# - */ - near: 0.1, - /** - * Environment cube map - * @type {clay.TextureCube} - * @memberOf clay.prePass.EnvironmentMap# - */ - texture: null, - - /** - * Used if you wan't have shadow in environment map - * @type {clay.prePass.ShadowMap} - */ - shadowMapPass: null, - }; - var cameras = ret._cameras = { - px: new __WEBPACK_IMPORTED_MODULE_2__camera_Perspective__["a" /* default */]({ fov: 90 }), - nx: new __WEBPACK_IMPORTED_MODULE_2__camera_Perspective__["a" /* default */]({ fov: 90 }), - py: new __WEBPACK_IMPORTED_MODULE_2__camera_Perspective__["a" /* default */]({ fov: 90 }), - ny: new __WEBPACK_IMPORTED_MODULE_2__camera_Perspective__["a" /* default */]({ fov: 90 }), - pz: new __WEBPACK_IMPORTED_MODULE_2__camera_Perspective__["a" /* default */]({ fov: 90 }), - nz: new __WEBPACK_IMPORTED_MODULE_2__camera_Perspective__["a" /* default */]({ fov: 90 }) - }; - cameras.px.lookAt(__WEBPACK_IMPORTED_MODULE_1__math_Vector3__["a" /* default */].POSITIVE_X, __WEBPACK_IMPORTED_MODULE_1__math_Vector3__["a" /* default */].NEGATIVE_Y); - cameras.nx.lookAt(__WEBPACK_IMPORTED_MODULE_1__math_Vector3__["a" /* default */].NEGATIVE_X, __WEBPACK_IMPORTED_MODULE_1__math_Vector3__["a" /* default */].NEGATIVE_Y); - cameras.py.lookAt(__WEBPACK_IMPORTED_MODULE_1__math_Vector3__["a" /* default */].POSITIVE_Y, __WEBPACK_IMPORTED_MODULE_1__math_Vector3__["a" /* default */].POSITIVE_Z); - cameras.ny.lookAt(__WEBPACK_IMPORTED_MODULE_1__math_Vector3__["a" /* default */].NEGATIVE_Y, __WEBPACK_IMPORTED_MODULE_1__math_Vector3__["a" /* default */].NEGATIVE_Z); - cameras.pz.lookAt(__WEBPACK_IMPORTED_MODULE_1__math_Vector3__["a" /* default */].POSITIVE_Z, __WEBPACK_IMPORTED_MODULE_1__math_Vector3__["a" /* default */].NEGATIVE_Y); - cameras.nz.lookAt(__WEBPACK_IMPORTED_MODULE_1__math_Vector3__["a" /* default */].NEGATIVE_Z, __WEBPACK_IMPORTED_MODULE_1__math_Vector3__["a" /* default */].NEGATIVE_Y); - - // FIXME In windows, use one framebuffer only renders one side of cubemap - ret._frameBuffer = new __WEBPACK_IMPORTED_MODULE_3__FrameBuffer__["a" /* default */](); - - return ret; -}, /** @lends clay.prePass.EnvironmentMap# */ { - /** - * @param {string} target - * @return {clay.Camera} - */ - getCamera: function (target) { - return this._cameras[target]; - }, - /** - * @param {clay.Renderer} renderer - * @param {clay.Scene} scene - * @param {boolean} [notUpdateScene=false] - */ - render: function(renderer, scene, notUpdateScene) { - var _gl = renderer.gl; - if (!notUpdateScene) { - scene.update(); - } - // Tweak fov - // http://the-witness.net/news/2012/02/seamless-cube-map-filtering/ - var n = this.texture.width; - var fov = 2 * Math.atan(n / (n - 0.5)) / Math.PI * 180; - - for (var i = 0; i < 6; i++) { - var target = targets[i]; - var camera = this._cameras[target]; - __WEBPACK_IMPORTED_MODULE_1__math_Vector3__["a" /* default */].copy(camera.position, this.position); - - camera.far = this.far; - camera.near = this.near; - camera.fov = fov; - - if (this.shadowMapPass) { - camera.update(); - - // update boundingBoxLastFrame - var bbox = scene.getBoundingBox(); - bbox.applyTransform(camera.viewMatrix); - scene.viewBoundingBoxLastFrame.copy(bbox); - - this.shadowMapPass.render(renderer, scene, camera, true); - } - this._frameBuffer.attach( - this.texture, _gl.COLOR_ATTACHMENT0, - _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i - ); - this._frameBuffer.bind(renderer); - renderer.render(scene, camera, true); - this._frameBuffer.unbind(renderer); - } - }, - /** - * @param {clay.Renderer} renderer - */ - dispose: function (renderer) { - this._frameBuffer.dispose(renderer); - } -}); - -/* harmony default export */ __webpack_exports__["a"] = (EnvironmentMapPass); - - -/***/ }), -/* 63 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__graphicGL__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__geometry_Sprites__ = __webpack_require__(165); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__shader_labels_glsl_js__ = __webpack_require__(166); - - - - -__WEBPACK_IMPORTED_MODULE_0__graphicGL__["a" /* default */].Shader.import(__WEBPACK_IMPORTED_MODULE_2__shader_labels_glsl_js__["a" /* default */]); - -/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__graphicGL__["a" /* default */].Mesh.extend(function () { - var geometry = new __WEBPACK_IMPORTED_MODULE_1__geometry_Sprites__["a" /* default */]({ - dynamic: true - }); - var material = new __WEBPACK_IMPORTED_MODULE_0__graphicGL__["a" /* default */].Material({ - shader: __WEBPACK_IMPORTED_MODULE_0__graphicGL__["a" /* default */].createShader('ecgl.labels'), - transparent: true, - depthMask: false - }); - - return { - geometry: geometry, - material: material, - culling: false, - castShadow: false, - ignorePicking: true - }; -})); - -/***/ }), -/* 64 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_earcut__ = __webpack_require__(204); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_geometry_Lines3D__ = __webpack_require__(25); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_retrieve__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_claygl_src_dep_glmatrix__ = __webpack_require__(6); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__util_geometry_trianglesSortMixin__ = __webpack_require__(65); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__LabelsBuilder__ = __webpack_require__(66); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__util_shader_lines3D_glsl_js__ = __webpack_require__(46); - - - - - - - - - - -var vec3 = __WEBPACK_IMPORTED_MODULE_5_claygl_src_dep_glmatrix__["a" /* default */].vec3; - -__WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Shader.import(__WEBPACK_IMPORTED_MODULE_8__util_shader_lines3D_glsl_js__["a" /* default */]); - -function Geo3DBuilder(api) { - - this.rootNode = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Node(); - - // Cache triangulation result - this._triangulationResults = {}; - - this._shadersMap = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].COMMON_SHADERS.reduce(function (obj, shaderName) { - obj[shaderName] = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].createShader('ecgl.' + shaderName); - return obj; - }, {}); - - this._linesShader = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].createShader('ecgl.meshLines3D'); - - var groundMaterials = {}; - __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].COMMON_SHADERS.forEach(function (shading) { - groundMaterials[shading] = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Material({ - shader: __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].createShader('ecgl.' + shading) - }); - }); - this._groundMaterials = groundMaterials; - - this._groundMesh = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Mesh({ - geometry: new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].PlaneGeometry({ dynamic: true }), - castShadow: false, - renderNormal: true, - $ignorePicking: true - }); - this._groundMesh.rotation.rotateX(-Math.PI / 2); - - this._labelsBuilder = new __WEBPACK_IMPORTED_MODULE_7__LabelsBuilder__["a" /* default */](512, 512, api); - - // Give a large render order. - this._labelsBuilder.getMesh().renderOrder = 100; - this._labelsBuilder.getMesh().material.depthTest = false; - - this.rootNode.add(this._labelsBuilder.getMesh()); - - this._initMeshes(); - - this._api = api; -} - -Geo3DBuilder.prototype = { - - constructor: Geo3DBuilder, - - // Which dimension to extrude. Y or Z - extrudeY: true, - - update: function (componentModel, ecModel, api, start, end) { - - var data = componentModel.getData(); - - if (start == null) { - start = 0; - } - if (end == null) { - end = data.count(); - } - - this._startIndex = start; - this._endIndex = end - 1; - - this._triangulation(componentModel, start, end); - - var shader = this._getShader(componentModel.get('shading')); - - this._prepareMesh(componentModel, shader, api, start, end); - - this.rootNode.updateWorldTransform(); - - this._updateRegionMesh(componentModel, api, start, end); - - var coordSys = componentModel.coordinateSystem; - // PENDING - if (coordSys.type === 'geo3D') { - this._updateGroundPlane(componentModel, coordSys, api); - } - - var self = this; - this._labelsBuilder.updateData(data, start, end); - this._labelsBuilder.getLabelPosition = function (dataIndex, positionDesc, distance) { - var name = data.getName(dataIndex); - - var center; - var height = distance; - if (coordSys.type === 'geo3D') { - var region = coordSys.getRegion(name); - if (!region) { - return [NaN, NaN, NaN]; - } - center = region.center; - var pos = coordSys.dataToPoint([center[0], center[1], height]); - return pos; - } - else { - var tmp = self._triangulationResults[dataIndex - self._startIndex]; - var center = self.extrudeY ? [ - (tmp.max[0] + tmp.min[0]) / 2, - tmp.max[1] + height, - (tmp.max[2] + tmp.min[2]) / 2 - ] : [ - (tmp.max[0] + tmp.min[0]) / 2, - (tmp.max[1] + tmp.min[1]) / 2, - tmp.max[2] + height - ]; - } - }; - - this._data = data; - - this._labelsBuilder.updateLabels(); - - this._updateDebugWireframe(componentModel); - - // Reset some state. - this._lastHoverDataIndex = 0; - }, - - _initMeshes: function () { - var self = this; - function createPolygonMesh() { - var mesh = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Mesh({ - name: 'Polygon', - material: new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Material({ - shader: self._shadersMap.lambert - }), - geometry: new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Geometry({ - sortTriangles: true, - dynamic: true - }), - // TODO Disable culling - culling: false, - ignorePicking: true, - // Render normal in normal pass - renderNormal: true - }); - __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.extend(mesh.geometry, __WEBPACK_IMPORTED_MODULE_6__util_geometry_trianglesSortMixin__["a" /* default */]); - return mesh; - } - - var polygonMesh = createPolygonMesh(); - - var linesMesh = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Mesh({ - material: new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Material({ - shader: this._linesShader - }), - castShadow: false, - ignorePicking: true, - $ignorePicking: true, - geometry: new __WEBPACK_IMPORTED_MODULE_3__util_geometry_Lines3D__["a" /* default */]({ - useNativeLine: false - }) - }); - - this.rootNode.add(polygonMesh); - this.rootNode.add(linesMesh); - - polygonMesh.material.define('both', 'VERTEX_COLOR'); - polygonMesh.material.define('fragment', 'DOUBLE_SIDED'); - - this._polygonMesh = polygonMesh; - this._linesMesh = linesMesh; - - this.rootNode.add(this._groundMesh); - }, - - _getShader: function (shading) { - var shader = this._shadersMap[shading]; - if (!shader) { - if (true) { - console.warn('Unkown shading ' + shading); - } - // Default use lambert shader. - shader = this._shadersMap.lambert; - } - shader.__shading = shading; - return shader; - }, - - _prepareMesh: function (componentModel, shader, api, start, end) { - var polygonVertexCount = 0; - var polygonTriangleCount = 0; - var linesVertexCount = 0; - var linesTriangleCount = 0; - // TODO Lines - for (var idx = start; idx < end; idx++) { - var polyInfo = this._getRegionPolygonInfo(idx); - var lineInfo = this._getRegionLinesInfo(idx, componentModel, this._linesMesh.geometry); - polygonVertexCount += polyInfo.vertexCount; - polygonTriangleCount += polyInfo.triangleCount; - linesVertexCount += lineInfo.vertexCount; - linesTriangleCount += lineInfo.triangleCount; - } - - var polygonMesh = this._polygonMesh; - var polygonGeo = polygonMesh.geometry; - ['position', 'normal', 'texcoord0', 'color'].forEach(function (attrName) { - polygonGeo.attributes[attrName].init(polygonVertexCount); - }); - polygonGeo.indices = polygonVertexCount > 0xffff ? new Uint32Array(polygonTriangleCount * 3) : new Uint16Array(polygonTriangleCount * 3); - - if (polygonMesh.material.shader !== shader) { - polygonMesh.material.attachShader(shader, true); - } - __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].setMaterialFromModel(shader.__shading, polygonMesh.material, componentModel, api); - - if (linesVertexCount > 0) { - this._linesMesh.geometry.resetOffset(); - this._linesMesh.geometry.setVertexCount(linesVertexCount); - this._linesMesh.geometry.setTriangleCount(linesTriangleCount); - } - - // Indexing data index from vertex index. - this._dataIndexOfVertex = new Uint32Array(polygonVertexCount); - // Indexing vertex index range from data index - this._vertexRangeOfDataIndex = new Uint32Array((end - start) * 2); - }, - - _updateRegionMesh: function (componentModel, api, start, end) { - - var data = componentModel.getData(); - - var vertexOffset = 0; - var triangleOffset = 0; - - // Materials configurations. - var hasTranparentRegion = false; - - var polygonMesh = this._polygonMesh; - var linesMesh = this._linesMesh; - - for (var dataIndex = start; dataIndex < end; dataIndex++) { - // Get bunch of visual properties. - var regionModel = componentModel.getRegionModel(dataIndex); - var itemStyleModel = regionModel.getModel('itemStyle'); - var color = itemStyleModel.get('color'); - var opacity = __WEBPACK_IMPORTED_MODULE_4__util_retrieve__["a" /* default */].firstNotNull(itemStyleModel.get('opacity'), 1.0); - - // Use visual color if it is encoded by visualMap component - var visualColor = data.getItemVisual(dataIndex, 'color', true); - if (visualColor != null && data.hasValue(dataIndex)) { - color = visualColor; - } - // Set color, opacity to visual for label usage. - data.setItemVisual(dataIndex, 'color', color); - data.setItemVisual(dataIndex, 'opacity', opacity); - - color = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor(color); - var borderColor = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor(itemStyleModel.get('borderColor')); - - color[3] *= opacity; - borderColor[3] *= opacity; - - var isTransparent = color[3] < 0.99; - - polygonMesh.material.set('color', [1,1,1,1]); - hasTranparentRegion = hasTranparentRegion || isTransparent; - - var regionHeight = __WEBPACK_IMPORTED_MODULE_4__util_retrieve__["a" /* default */].firstNotNull(regionModel.get('height', true), componentModel.get('regionHeight')); - - var newOffsets = this._updatePolygonGeometry( - componentModel, polygonMesh.geometry, dataIndex, regionHeight, - vertexOffset, triangleOffset, color - ); - - for (var i = vertexOffset; i < newOffsets.vertexOffset; i++) { - this._dataIndexOfVertex[i] = dataIndex; - } - this._vertexRangeOfDataIndex[(dataIndex - start) * 2] = vertexOffset; - this._vertexRangeOfDataIndex[(dataIndex - start) * 2 + 1] = newOffsets.vertexOffset; - - vertexOffset = newOffsets.vertexOffset; - triangleOffset = newOffsets.triangleOffset; - - // Update lines. - var lineWidth = itemStyleModel.get('borderWidth'); - var hasLine = lineWidth > 0; - if (hasLine) { - lineWidth *= api.getDevicePixelRatio(); - this._updateLinesGeometry( - linesMesh.geometry, componentModel, dataIndex, regionHeight, lineWidth, - componentModel.coordinateSystem.transform - ); - } - linesMesh.invisible = !hasLine; - linesMesh.material.set({ - color: borderColor - }); - } - - var polygonMesh = this._polygonMesh; - polygonMesh.material.transparent = hasTranparentRegion; - polygonMesh.material.depthMask = !hasTranparentRegion; - polygonMesh.geometry.updateBoundingBox(); - - polygonMesh.frontFace = this.extrudeY ? __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Mesh.CCW : __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Mesh.CW; - - // Update tangents - if (polygonMesh.material.get('normalMap')) { - polygonMesh.geometry.generateTangents(); - } - - polygonMesh.seriesIndex = componentModel.seriesIndex; - - polygonMesh.on('mousemove', this._onmousemove, this); - polygonMesh.on('mouseout', this._onmouseout, this); - }, - - _updateDebugWireframe: function (componentModel) { - var debugWireframeModel = componentModel.getModel('debug.wireframe'); - - // TODO Unshow - if (debugWireframeModel.get('show')) { - var color = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor( - debugWireframeModel.get('lineStyle.color') || 'rgba(0,0,0,0.5)' - ); - var width = __WEBPACK_IMPORTED_MODULE_4__util_retrieve__["a" /* default */].firstNotNull( - debugWireframeModel.get('lineStyle.width'), 1 - ); - - // TODO Will cause highlight wrong - var mesh = this._polygonMesh; - mesh.geometry.generateBarycentric(); - mesh.material.define('both', 'WIREFRAME_TRIANGLE'); - mesh.material.set('wireframeLineColor', color); - mesh.material.set('wireframeLineWidth', width); - } - }, - - _onmousemove: function (e) { - var dataIndex = this._dataIndexOfVertex[e.triangle[0]]; - if (dataIndex == null) { - dataIndex = -1; - } - if (dataIndex !== this._lastHoverDataIndex) { - this.downplay(this._lastHoverDataIndex); - this.highlight(dataIndex); - this._labelsBuilder.updateLabels([dataIndex]); - } - this._lastHoverDataIndex = dataIndex; - this._polygonMesh.dataIndex = dataIndex; - }, - - _onmouseout: function (e) { - if (e.target) { - this.downplay(this._lastHoverDataIndex); - this._lastHoverDataIndex = -1; - this._polygonMesh.dataIndex = -1; - } - - this._labelsBuilder.updateLabels([]); - }, - - _updateGroundPlane: function (componentModel, geo3D, api) { - var groundModel = componentModel.getModel('groundPlane', componentModel); - this._groundMesh.invisible = !groundModel.get('show', true); - if (this._groundMesh.invisible) { - return; - } - - var shading = componentModel.get('shading'); - var material = this._groundMaterials[shading]; - if (!material) { - if (true) { - console.warn('Unkown shading ' + shading); - } - material = this._groundMaterials.lambert; - } - - __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].setMaterialFromModel(shading, material, groundModel, api); - if (material.get('normalMap')) { - this._groundMesh.geometry.generateTangents(); - } - - this._groundMesh.material = material; - this._groundMesh.material.set('color', __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor(groundModel.get('color'))); - - this._groundMesh.scale.set(geo3D.size[0], geo3D.size[2], 1); - }, - - _triangulation: function (componentModel, start, end) { - this._triangulationResults = []; - - var minAll = [Infinity, Infinity, Infinity]; - var maxAll = [-Infinity, -Infinity, -Infinity]; - - var coordSys = componentModel.coordinateSystem; - - for (var idx = start; idx < end; idx++) { - var polygons = []; - var polygonCoords = componentModel.getRegionPolygonCoords(idx); - for (var i = 0; i < polygonCoords.length; i++) { - var exterior = polygonCoords[i].exterior; - var interiors = polygonCoords[i].interiors; - var points = []; - var holes = []; - if (exterior.length < 3) { - continue; - } - var offset = 0; - for (var j = 0; j < exterior.length; j++) { - var p = exterior[j]; - points[offset++] = p[0]; - points[offset++] = p[1]; - } - - for (var j = 0; j < interiors.length; j++) { - if (interiors[j].length < 3) { - continue; - } - var startIdx = points.length / 2; - for (var k = 0; k < interiors[j].length; k++) { - var p = interiors[j][k]; - points.push(p[0]); - points.push(p[1]); - } - - holes.push(startIdx); - } - var triangles = Object(__WEBPACK_IMPORTED_MODULE_2__util_earcut__["a" /* default */])(points, holes); - - var points3 = new Float64Array(points.length / 2 * 3); - var pos = []; - var min = [Infinity, Infinity, Infinity]; - var max = [-Infinity, -Infinity, -Infinity]; - var off3 = 0; - for (var j = 0; j < points.length;) { - vec3.set(pos, points[j++], 0, points[j++]); - if (coordSys && coordSys.transform) { - vec3.transformMat4(pos, pos, coordSys.transform); - } - vec3.min(min, min, pos); - vec3.max(max, max, pos); - points3[off3++] = pos[0]; - points3[off3++] = pos[1]; - points3[off3++] = pos[2]; - } - vec3.min(minAll, minAll, min); - vec3.max(maxAll, maxAll, max); - polygons.push({ - points: points3, - indices: triangles, - min: min, - max: max - }); - } - this._triangulationResults.push(polygons); - } - - this._geoBoundingBox = [minAll, maxAll]; - }, - - /** - * Get region vertex and triangle count - */ - _getRegionPolygonInfo: function (idx) { - - var polygons = this._triangulationResults[idx - this._startIndex]; - - var sideVertexCount = 0; - var sideTriangleCount = 0; - - for (var i = 0; i < polygons.length; i++) { - sideVertexCount += polygons[i].points.length / 3; - sideTriangleCount += polygons[i].indices.length / 3; - } - - var vertexCount = sideVertexCount * 2 + sideVertexCount * 4; - var triangleCount = sideTriangleCount * 2 + sideVertexCount * 2; - - return { - vertexCount: vertexCount, - triangleCount: triangleCount - }; - }, - - _updatePolygonGeometry: function ( - componentModel, geometry, dataIndex, regionHeight, - vertexOffset, triangleOffset, color - ) { - // FIXME - var projectUVOnGround = componentModel.get('projectUVOnGround'); - - var positionAttr = geometry.attributes.position; - var normalAttr = geometry.attributes.normal; - var texcoordAttr = geometry.attributes.texcoord0; - var colorAttr = geometry.attributes.color; - var polygons = this._triangulationResults[dataIndex - this._startIndex]; - - var hasColor = colorAttr.value && color; - - var indices = geometry.indices; - - var extrudeCoordIndex = this.extrudeY ? 1 : 2; - var sideCoordIndex = this.extrudeY ? 2 : 1; - - var scale = [ - this.rootNode.worldTransform.x.len(), - this.rootNode.worldTransform.y.len(), - this.rootNode.worldTransform.z.len() - ]; - - var min = vec3.mul([], this._geoBoundingBox[0], scale); - var max = vec3.mul([], this._geoBoundingBox[1], scale); - var maxDimSize = Math.max(max[0] - min[0], max[2] - min[2]); - - function addVertices(polygon, y, insideOffset) { - var points = polygon.points; - - var pointsLen = points.length; - var currentPosition = []; - var uv = []; - - for (var k = 0; k < pointsLen; k += 3) { - currentPosition[0] = points[k]; - currentPosition[extrudeCoordIndex] = y; - currentPosition[sideCoordIndex] = points[k + 2]; - - uv[0] = (points[k] * scale[0] - min[0]) / maxDimSize; - uv[1] = (points[k + 2] * scale[sideCoordIndex] - min[2]) / maxDimSize; - - positionAttr.set(vertexOffset, currentPosition); - if (hasColor) { - colorAttr.set(vertexOffset, color); - } - texcoordAttr.set(vertexOffset++, uv); - } - } - - function buildTopBottom(polygon, y, insideOffset) { - - var startVertexOffset = vertexOffset; - - addVertices(polygon, y, insideOffset); - - var len = polygon.indices.length; - for (var k = 0; k < len; k++) { - indices[triangleOffset * 3 + k] = polygon.indices[k] + startVertexOffset; - } - triangleOffset += polygon.indices.length / 3; - } - - var normalTop = this.extrudeY ? [0, 1, 0] : [0, 0, 1]; - var normalBottom = vec3.negate([], normalTop); - for (var p = 0; p < polygons.length; p++) { - var startVertexOffset = vertexOffset; - var polygon = polygons[p]; - // BOTTOM - buildTopBottom(polygon, 0, 0); - // TOP - buildTopBottom(polygon, regionHeight, 0); - - var ringVertexCount = polygon.points.length / 3; - for (var v = 0; v < ringVertexCount; v++) { - normalAttr.set(startVertexOffset + v, normalBottom); - normalAttr.set(startVertexOffset + v + ringVertexCount, normalTop); - } - - var quadToTriangle = [0, 3, 1, 1, 3, 2]; - - var quadPos = [[], [], [], []]; - var a = []; - var b = []; - var normal = []; - var uv = []; - var len = 0; - for (var v = 0; v < ringVertexCount; v++) { - var next = (v + 1) % ringVertexCount; - - var dx = (polygon.points[next * 3] - polygon.points[v * 3]) * scale[0]; - var dy = (polygon.points[next * 3 + 2] - polygon.points[v * 3 + 2]) * scale[sideCoordIndex]; - var sideLen = Math.sqrt(dx * dx + dy * dy); - - // 0----1 - // 3----2 - for (var k = 0; k < 4; k++) { - var isCurrent = (k === 0 || k === 3); - var idx3 = (isCurrent ? v : next) * 3; - quadPos[k][0] = polygon.points[idx3]; - quadPos[k][extrudeCoordIndex] = k > 1 ? regionHeight : 0; - quadPos[k][sideCoordIndex] = polygon.points[idx3 + 2]; - - positionAttr.set(vertexOffset + k, quadPos[k]); - - if (projectUVOnGround) { - uv[0] = (polygon.points[idx3] * scale[0] - min[0]) / maxDimSize; - uv[1] = (polygon.points[idx3 + 2] * scale[sideCoordIndex] - min[sideCoordIndex]) / maxDimSize; - } - else { - uv[0] = (isCurrent ? len : (len + sideLen)) / maxDimSize; - uv[1] = (quadPos[k][extrudeCoordIndex] * scale[extrudeCoordIndex] - min[extrudeCoordIndex]) / maxDimSize; - } - texcoordAttr.set(vertexOffset + k, uv); - } - vec3.sub(a, quadPos[1], quadPos[0]); - vec3.sub(b, quadPos[3], quadPos[0]); - vec3.cross(normal, a, b); - vec3.normalize(normal, normal); - - for (var k = 0; k < 4; k++) { - normalAttr.set(vertexOffset + k, normal); - if (hasColor) { - colorAttr.set(vertexOffset + k, color); - } - } - - for (var k = 0; k < 6; k++) { - indices[triangleOffset * 3 + k] = quadToTriangle[k] + vertexOffset; - } - - vertexOffset += 4; - triangleOffset += 2; - - len += sideLen; - } - } - - geometry.dirty(); - - return { - vertexOffset: vertexOffset, - triangleOffset: triangleOffset - }; - }, - - _getRegionLinesInfo: function (idx, componentModel, geometry) { - var vertexCount = 0; - var triangleCount = 0; - - var regionModel = componentModel.getRegionModel(idx); - var itemStyleModel = regionModel.getModel('itemStyle'); - - var lineWidth = itemStyleModel.get('borderWidth'); - if (lineWidth > 0) { - var polygonCoords = componentModel.getRegionPolygonCoords(idx); - polygonCoords.forEach(function (coords) { - var exterior = coords.exterior; - var interiors = coords.interiors; - vertexCount += geometry.getPolylineVertexCount(exterior); - triangleCount += geometry.getPolylineTriangleCount(exterior); - for (var i = 0; i < interiors.length; i++) { - vertexCount += geometry.getPolylineVertexCount(interiors[i]); - triangleCount += geometry.getPolylineTriangleCount(interiors[i]); - } - }, this); - } - - return { - vertexCount: vertexCount, - triangleCount: triangleCount - }; - - }, - - _updateLinesGeometry: function (geometry, componentModel, dataIndex, regionHeight, lineWidth, transform) { - function convertToPoints3(polygon) { - var points = new Float64Array(polygon.length * 3); - var offset = 0; - var pos = []; - for (var i = 0; i < polygon.length; i++) { - pos[0] = polygon[i][0]; - // Add a offset to avoid z-fighting - pos[1] = regionHeight + 0.1; - pos[2] = polygon[i][1]; - - if (transform) { - vec3.transformMat4(pos, pos, transform); - } - - points[offset++] = pos[0]; - points[offset++] = pos[1]; - points[offset++] = pos[2]; - } - return points; - } - - var whiteColor = [1, 1, 1, 1]; - var coords = componentModel.getRegionPolygonCoords(dataIndex); - coords.forEach(function (geo) { - var exterior = geo.exterior; - var interiors = geo.interiors; - - geometry.addPolyline(convertToPoints3(exterior), whiteColor, lineWidth); - - for (var i = 0; i < interiors.length; i++) { - geometry.addPolyline(convertToPoints3(interiors[i]), whiteColor, lineWidth); - } - }); - }, - - highlight: function (dataIndex) { - var data = this._data; - if (!data) { - return; - } - - var itemModel = data.getItemModel(dataIndex); - var emphasisItemStyleModel = itemModel.getModel('emphasis.itemStyle'); - var emphasisColor = emphasisItemStyleModel.get('color'); - var emphasisOpacity = __WEBPACK_IMPORTED_MODULE_4__util_retrieve__["a" /* default */].firstNotNull( - emphasisItemStyleModel.get('opacity'), - data.getItemVisual(dataIndex, 'opacity'), - 1 - ); - if (emphasisColor == null) { - var color = data.getItemVisual(dataIndex, 'color'); - emphasisColor = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.color.lift(color, -0.4); - } - if (emphasisOpacity == null) { - emphasisOpacity = data.getItemVisual(dataIndex, 'opacity'); - } - var colorArr = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor(emphasisColor); - colorArr[3] *= emphasisOpacity; - - this._setColorOfDataIndex(data, dataIndex, colorArr); - }, - - downplay: function (dataIndex) { - - var data = this._data; - if (!data) { - return; - } - - var color = data.getItemVisual(dataIndex, 'color'); - var opacity = __WEBPACK_IMPORTED_MODULE_4__util_retrieve__["a" /* default */].firstNotNull(data.getItemVisual(dataIndex, 'opacity'), 1); - - var colorArr = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor(color); - colorArr[3] *= opacity; - - this._setColorOfDataIndex(data, dataIndex, colorArr); - }, - - _setColorOfDataIndex: function (data, dataIndex, colorArr) { - if (dataIndex < this._startIndex && dataIndex > this._endIndex) { - return; - } - dataIndex -= this._startIndex; - for (var i = this._vertexRangeOfDataIndex[dataIndex * 2]; i < this._vertexRangeOfDataIndex[dataIndex * 2 + 1]; i++) { - this._polygonMesh.geometry.attributes.color.set(i, colorArr); - } - this._polygonMesh.geometry.dirty(); - this._api.getZr().refresh(); - } -}; - -/* harmony default export */ __webpack_exports__["a"] = (Geo3DBuilder); - -/***/ }), -/* 65 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ProgressiveQuickSort__ = __webpack_require__(97); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_claygl_src_dep_glmatrix__ = __webpack_require__(6); - - -var vec3 = __WEBPACK_IMPORTED_MODULE_1_claygl_src_dep_glmatrix__["a" /* default */].vec3; - -var p0 = vec3.create(); -var p1 = vec3.create(); -var p2 = vec3.create(); -// var cp = vec3.create(); - -/* harmony default export */ __webpack_exports__["a"] = ({ - - needsSortTriangles: function () { - return this.indices && this.sortTriangles; - }, - - needsSortTrianglesProgressively: function () { - return this.needsSortTriangles() && this.triangleCount >= 2e4; - }, - - doSortTriangles: function (cameraPos, frame) { - var indices = this.indices; - // Do progressive quick sort. - if (frame === 0) { - var posAttr = this.attributes.position; - var cameraPos = cameraPos.array; - - if (!this._triangleZList || this._triangleZList.length !== this.triangleCount) { - this._triangleZList = new Float32Array(this.triangleCount); - this._sortedTriangleIndices = new Uint32Array(this.triangleCount); - - this._indicesTmp = new indices.constructor(indices.length); - this._triangleZListTmp = new Float32Array(this.triangleCount); - } - - var cursor = 0; - var firstZ; - for (var i = 0; i < indices.length;) { - posAttr.get(indices[i++], p0); - posAttr.get(indices[i++], p1); - posAttr.get(indices[i++], p2); - - // FIXME If use center ? - // cp[0] = (p0[0] + p1[0] + p2[0]) / 3; - // cp[1] = (p0[1] + p1[1] + p2[1]) / 3; - // cp[2] = (p0[2] + p1[2] + p2[2]) / 3; - // Camera position is in object space - - // Use max of three points, PENDING - var z0 = vec3.sqrDist(p0, cameraPos); - var z1 = vec3.sqrDist(p1, cameraPos); - var z2 = vec3.sqrDist(p2, cameraPos); - var zMax = Math.min(z0, z1); - zMax = Math.min(zMax, z2); - if (i === 3) { - firstZ = zMax; - zMax = 0; - } - else { - // Only store the difference to avoid the precision issue. - zMax = zMax - firstZ; - } - this._triangleZList[cursor++] = zMax; - } - } - - - var sortedTriangleIndices = this._sortedTriangleIndices; - for (var i = 0; i < sortedTriangleIndices.length; i++) { - sortedTriangleIndices[i] = i; - } - - if (this.triangleCount < 2e4) { - // Use simple timsort for simple geometries. - if (frame === 0) { - // Use native sort temporary. - this._simpleSort(true); - } - } - else { - for (var i = 0; i < 3; i++) { - this._progressiveQuickSort(frame * 3 + i); - } - } - - var targetIndices = this._indicesTmp; - var targetTriangleZList = this._triangleZListTmp; - var faceZList = this._triangleZList; - for (var i = 0; i < this.triangleCount; i++) { - var fromIdx3 = sortedTriangleIndices[i] * 3; - var toIdx3 = i * 3; - targetIndices[toIdx3++] = indices[fromIdx3++]; - targetIndices[toIdx3++] = indices[fromIdx3++]; - targetIndices[toIdx3] = indices[fromIdx3]; - - targetTriangleZList[i] = faceZList[sortedTriangleIndices[i]]; - } - - // Swap indices. - var tmp = this._indicesTmp; - this._indicesTmp = this.indices; - this.indices = tmp; - var tmp = this._triangleZListTmp; - this._triangleZListTmp = this._triangleZList; - this._triangleZList = tmp; - - this.dirtyIndices(); - }, - - _simpleSort: function (useNativeQuickSort) { - var faceZList = this._triangleZList; - var sortedTriangleIndices = this._sortedTriangleIndices; - - function compare(a, b) { - // Sort from far to near. which is descending order - return faceZList[b] - faceZList[a]; - } - if (useNativeQuickSort) { - Array.prototype.sort.call(sortedTriangleIndices, compare); - } - else { - __WEBPACK_IMPORTED_MODULE_0__ProgressiveQuickSort__["a" /* default */].sort(sortedTriangleIndices, compare, 0, sortedTriangleIndices.length - 1); - } - }, - - _progressiveQuickSort: function (frame) { - var faceZList = this._triangleZList; - var sortedTriangleIndices = this._sortedTriangleIndices; - - this._quickSort = this._quickSort || new __WEBPACK_IMPORTED_MODULE_0__ProgressiveQuickSort__["a" /* default */](); - - this._quickSort.step(sortedTriangleIndices, function (a, b) { - return faceZList[b] - faceZList[a]; - }, frame); - } -}); - -/***/ }), -/* 66 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_ZRTextureAtlasSurface__ = __webpack_require__(81); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_mesh_LabelsMesh__ = __webpack_require__(63); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_retrieve__ = __webpack_require__(2); - - - - - -var LABEL_NORMAL_SHOW_BIT = 1; -var LABEL_EMPHASIS_SHOW_BIT = 2; - -function LabelsBuilder(width, height, api) { - - this._labelsMesh = new __WEBPACK_IMPORTED_MODULE_2__util_mesh_LabelsMesh__["a" /* default */](); - - this._labelTextureSurface = new __WEBPACK_IMPORTED_MODULE_1__util_ZRTextureAtlasSurface__["a" /* default */]({ - width: 512, - height: 512, - devicePixelRatio: api.getDevicePixelRatio(), - onupdate: function () { - api.getZr().refresh(); - } - }); - this._api = api; - - this._labelsMesh.material.set('textureAtlas', this._labelTextureSurface.getTexture()); -} - -LabelsBuilder.prototype.getLabelPosition = function (dataIndex, positionDesc, distance) { - return [0, 0, 0]; -}; - -LabelsBuilder.prototype.getLabelDistance = function (dataIndex, positionDesc, distance) { - return 0; -}; - -LabelsBuilder.prototype.getMesh = function () { - return this._labelsMesh; -}; - -LabelsBuilder.prototype.updateData = function (data, start, end) { - if (start == null) { - start = 0; - } - if (end == null) { - end = data.count(); - } - - if (!this._labelsVisibilitiesBits || this._labelsVisibilitiesBits.length !== (end - start)) { - this._labelsVisibilitiesBits = new Uint8Array(end - start); - } - var normalLabelVisibilityQuery = ['label', 'show']; - var emphasisLabelVisibilityQuery = ['emphasis', 'label', 'show']; - - for (var idx = start; idx < end; idx++) { - var itemModel = data.getItemModel(idx); - var normalVisibility = itemModel.get(normalLabelVisibilityQuery); - var emphasisVisibility = itemModel.get(emphasisLabelVisibilityQuery); - if (emphasisVisibility == null) { - emphasisVisibility = normalVisibility; - } - var bit = (normalVisibility ? LABEL_NORMAL_SHOW_BIT : 0) - | (emphasisVisibility ? LABEL_EMPHASIS_SHOW_BIT : 0); - this._labelsVisibilitiesBits[idx - start] = bit; - } - - this._start = start; - this._end = end; - - this._data = data; -}; - -LabelsBuilder.prototype.updateLabels = function (highlightDataIndices) { - - if (!this._data) { - return; - } - - highlightDataIndices = highlightDataIndices || []; - - var hasHighlightData = highlightDataIndices.length > 0; - var highlightDataIndicesMap = {}; - for (var i = 0; i < highlightDataIndices.length; i++) { - highlightDataIndicesMap[highlightDataIndices[i]] = true; - } - - this._labelsMesh.geometry.convertToDynamicArray(true); - this._labelTextureSurface.clear(); - - var normalLabelQuery = ['label']; - var emphasisLabelQuery = ['emphasis', 'label']; - var seriesModel = this._data.hostModel; - var data = this._data; - - var seriesLabelModel = seriesModel.getModel(normalLabelQuery); - var seriesLabelEmphasisModel = seriesModel.getModel(emphasisLabelQuery, seriesLabelModel); - - var textAlignMap = { - left: 'right', - right: 'left', - top: 'center', - bottom: 'center' - }; - var textVerticalAlignMap = { - left: 'middle', - right: 'middle', - top: 'bottom', - bottom: 'top' - }; - - for (var dataIndex = this._start; dataIndex < this._end; dataIndex++) { - var isEmphasis = false; - if (hasHighlightData && highlightDataIndicesMap[dataIndex]) { - isEmphasis = true; - } - var ifShow = this._labelsVisibilitiesBits[dataIndex - this._start] - & (isEmphasis ? LABEL_EMPHASIS_SHOW_BIT : LABEL_NORMAL_SHOW_BIT); - if (!ifShow) { - continue; - } - - var itemModel = data.getItemModel(dataIndex); - var labelModel = itemModel.getModel( - isEmphasis ? emphasisLabelQuery : normalLabelQuery, - isEmphasis ? seriesLabelEmphasisModel : seriesLabelModel - ); - var distance = labelModel.get('distance') || 0; - var position = labelModel.get('position'); - var textStyleModel = labelModel.getModel('textStyle'); - - var dpr = this._api.getDevicePixelRatio(); - var text = seriesModel.getFormattedLabel(dataIndex, isEmphasis ? 'emphasis' : 'normal'); - if (text == null || text === '') { - return; - } - - // TODO Background. - var textEl = new __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.graphic.Text(); - __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.graphic.setTextStyle(textEl.style, textStyleModel, { - text: text, - textFill: textStyleModel.get('color') || data.getItemVisual(dataIndex, 'color') || '#000', - textAlign: 'left', - textVerticalAlign: 'top', - opacity: __WEBPACK_IMPORTED_MODULE_3__util_retrieve__["a" /* default */].firstNotNull(textStyleModel.get('opacity'), data.getItemVisual(dataIndex, 'opacity'), 1) - }); - var rect = textEl.getBoundingRect(); - var lineHeight = 1.2; - rect.height *= lineHeight; - - var coords = this._labelTextureSurface.add(textEl); - - var textAlign = textAlignMap[position] || 'center'; - var textVerticalAlign = textVerticalAlignMap[position] || 'bottom'; - - this._labelsMesh.geometry.addSprite( - this.getLabelPosition(dataIndex, position, distance), - [rect.width * dpr, rect.height * dpr], coords, - textAlign, textVerticalAlign, - this.getLabelDistance(dataIndex, position, distance) * dpr - ); - } - - this._labelsMesh.material.set('uvScale', this._labelTextureSurface.getCoordsScale()); - - // var canvas = this._labelTextureSurface.getTexture().image; - // document.body.appendChild(canvas); - // canvas.style.cssText = 'position:absolute;z-index: 1000'; - - // Update image. - this._labelTextureSurface.getZr().refreshImmediately(); - this._labelsMesh.geometry.convertToTypedArray(); - this._labelsMesh.geometry.dirty(); -}; - -/* harmony default export */ __webpack_exports__["a"] = (LabelsBuilder); - -/***/ }), -/* 67 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_sprite__ = __webpack_require__(239); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__PointsMesh__ = __webpack_require__(240); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__component_common_LabelsBuilder__ = __webpack_require__(66); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_claygl_src_math_Matrix4__ = __webpack_require__(9); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__util_retrieve__ = __webpack_require__(2); - - - - - - - - -var SDF_RANGE = 20; - -var Z_2D = -10; - -function isSymbolSizeSame(a, b) { - return a && b && a[0] === b[0] && a[1] === b[1]; -} -// TODO gl_PointSize has max value. -function PointsBuilder(is2D, api) { - this.rootNode = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Node(); - - /** - * @type {boolean} - */ - this.is2D = is2D; - - this._labelsBuilder = new __WEBPACK_IMPORTED_MODULE_4__component_common_LabelsBuilder__["a" /* default */](256, 256, api); - - // Give a large render order. - this._labelsBuilder.getMesh().renderOrder = 100; - this.rootNode.add(this._labelsBuilder.getMesh()); - - this._api = api; - - this._spriteImageCanvas = document.createElement('canvas'); - - this._startDataIndex = 0; - this._endDataIndex = 0; - - this._sizeScale = 1; -} - -PointsBuilder.prototype = { - - constructor: PointsBuilder, - - /** - * If highlight on over - */ - highlightOnMouseover: true, - - update: function (seriesModel, ecModel, api, start, end) { - // Swap barMesh - var tmp = this._prevMesh; - this._prevMesh = this._mesh; - this._mesh = tmp; - - var data = seriesModel.getData(); - - if (start == null) { - start = 0; - } - if (end == null) { - end = data.count(); - } - this._startDataIndex = start; - this._endDataIndex = end - 1; - - if (!this._mesh) { - var material = this._prevMesh && this._prevMesh.material; - this._mesh = new __WEBPACK_IMPORTED_MODULE_3__PointsMesh__["a" /* default */]({ - // Render after axes - renderOrder: 10, - // FIXME - frustumCulling: false - }); - if (material) { - this._mesh.material = material; - } - } - var material = this._mesh.material; - var geometry = this._mesh.geometry; - var attributes = geometry.attributes; - - this.rootNode.remove(this._prevMesh); - this.rootNode.add(this._mesh); - - this._setPositionTextureToMesh(this._mesh, this._positionTexture); - - var symbolInfo = this._getSymbolInfo(seriesModel, start, end); - var dpr = api.getDevicePixelRatio(); - - // TODO image symbol - var itemStyle = seriesModel.getModel('itemStyle').getItemStyle(); - var largeMode = seriesModel.get('large'); - - var pointSizeScale = 1; - if (symbolInfo.maxSize > 2) { - pointSizeScale = this._updateSymbolSprite(seriesModel, itemStyle, symbolInfo, dpr); - material.enableTexture('sprite'); - } - else { - material.disableTexture('sprite'); - } - - attributes.position.init(end - start); - var rgbaArr = []; - if (largeMode) { - material.undefine('VERTEX_SIZE'); - material.undefine('VERTEX_COLOR'); - - var color = data.getVisual('color'); - var opacity = data.getVisual('opacity'); - __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor(color, rgbaArr); - rgbaArr[3] *= opacity; - - material.set({ - color: rgbaArr, - 'u_Size': symbolInfo.maxSize * this._sizeScale - }); - } - else { - material.set({ - color: [1, 1, 1, 1] - }); - material.define('VERTEX_SIZE'); - material.define('VERTEX_COLOR'); - attributes.size.init(end - start); - attributes.color.init(end - start); - this._originalOpacity = new Float32Array(end - start); - } - - var points = data.getLayout('points'); - - var positionArr = attributes.position.value; - - var hasTransparentPoint = false; - - for (var i = 0; i < end - start; i++) { - var i3 = i * 3; - var i2 = i * 2; - if (this.is2D) { - positionArr[i3] = points[i2]; - positionArr[i3 + 1] = points[i2 + 1]; - positionArr[i3 + 2] = Z_2D; - } - else { - positionArr[i3] = points[i3]; - positionArr[i3 + 1] = points[i3 + 1]; - positionArr[i3 + 2] = points[i3 + 2]; - } - - if (!largeMode) { - var color = data.getItemVisual(i, 'color'); - var opacity = data.getItemVisual(i, 'opacity'); - __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor(color, rgbaArr); - rgbaArr[3] *= opacity; - attributes.color.set(i, rgbaArr); - if (rgbaArr[3] < 0.99) { - hasTransparentPoint = true; - } - var symbolSize = data.getItemVisual(i, 'symbolSize'); - symbolSize = (symbolSize instanceof Array - ? Math.max(symbolSize[0], symbolSize[1]) : symbolSize); - - // NaN pointSize may have strange result. - if (isNaN(symbolSize)) { - symbolSize = 0; - } - // Scale point size because canvas has margin. - attributes.size.value[i] = symbolSize * pointSizeScale * this._sizeScale; - - // Save the original opacity for recover from fadeIn. - this._originalOpacity[i] = rgbaArr[3]; - } - - } - - this._mesh.sizeScale = pointSizeScale; - - geometry.updateBoundingBox(); - geometry.dirty(); - - // Update material. - this._updateMaterial(seriesModel, itemStyle); - - var coordSys = seriesModel.coordinateSystem; - if (coordSys && coordSys.viewGL) { - var methodName = coordSys.viewGL.isLinearSpace() ? 'define' : 'undefine'; - material[methodName]('fragment', 'SRGB_DECODE'); - } - - if (!largeMode) { - this._updateLabelBuilder(seriesModel, start, end); - } - - this._updateHandler(seriesModel, ecModel, api); - - this._updateAnimation(seriesModel); - - this._api = api; - }, - - getPointsMesh: function () { - return this._mesh; - }, - - updateLabels: function (highlightDataIndices) { - this._labelsBuilder.updateLabels(highlightDataIndices); - }, - - hideLabels: function () { - this.rootNode.remove(this._labelsBuilder.getMesh()); - }, - - showLabels: function () { - this.rootNode.add(this._labelsBuilder.getMesh()); - }, - - _updateSymbolSprite: function (seriesModel, itemStyle, symbolInfo, dpr) { - symbolInfo.maxSize = Math.min(symbolInfo.maxSize * 2, 200); - var symbolSize = []; - if (symbolInfo.aspect > 1) { - symbolSize[0] = symbolInfo.maxSize; - symbolSize[1] = symbolInfo.maxSize / symbolInfo.aspect; - } - else { - symbolSize[1] = symbolInfo.maxSize; - symbolSize[0] = symbolInfo.maxSize * symbolInfo.aspect; - } - - // In case invalid data. - symbolSize[0] = symbolSize[0] || 1; - symbolSize[1] = symbolSize[1] || 1; - - if (this._symbolType !== symbolInfo.type - || !isSymbolSizeSame(this._symbolSize, symbolSize) - || this._lineWidth !== itemStyle.lineWidth - ) { - __WEBPACK_IMPORTED_MODULE_2__util_sprite__["a" /* default */].createSymbolSprite(symbolInfo.type, symbolSize, { - fill: '#fff', - lineWidth: itemStyle.lineWidth, - stroke: 'transparent', - shadowColor: 'transparent', - minMargin: Math.min(symbolSize[0] / 2, 10) - }, this._spriteImageCanvas); - - __WEBPACK_IMPORTED_MODULE_2__util_sprite__["a" /* default */].createSDFFromCanvas( - this._spriteImageCanvas, Math.min(this._spriteImageCanvas.width, 32), SDF_RANGE, - this._mesh.material.get('sprite').image - ); - - this._symbolType = symbolInfo.type; - this._symbolSize = symbolSize; - this._lineWidth = itemStyle.lineWidth; - } - return this._spriteImageCanvas.width / symbolInfo.maxSize * dpr; - - }, - - _updateMaterial: function (seriesModel, itemStyle) { - var blendFunc = seriesModel.get('blendMode') === 'lighter' - ? __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].additiveBlend : null; - var material = this._mesh.material; - material.blend = blendFunc; - - material.set('lineWidth', itemStyle.lineWidth / SDF_RANGE); - - var strokeColor = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor(itemStyle.stroke); - material.set('strokeColor', strokeColor); - - // Because of symbol texture, we always needs it be transparent. - material.transparent = true; - material.depthMask = false; - material.depthTest = !this.is2D; - material.sortVertices = !this.is2D; - }, - - _updateLabelBuilder: function (seriesModel, start, end) { - var data =seriesModel.getData(); - var geometry = this._mesh.geometry; - var positionArr = geometry.attributes.position.value; - var start = this._startDataIndex; - var pointSizeScale = this._mesh.sizeScale; - this._labelsBuilder.updateData(data, start, end); - - this._labelsBuilder.getLabelPosition = function (dataIndex, positionDesc, distance) { - var idx3 = (dataIndex - start) * 3; - return [positionArr[idx3], positionArr[idx3 + 1], positionArr[idx3 + 2]]; - }; - - this._labelsBuilder.getLabelDistance = function (dataIndex, positionDesc, distance) { - var size = geometry.attributes.size.get(dataIndex - start) / pointSizeScale; - return size / 2 + distance; - }; - this._labelsBuilder.updateLabels(); - - }, - - _updateAnimation: function (seriesModel) { - __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].updateVertexAnimation( - [['prevPosition', 'position'], - ['prevSize', 'size']], - this._prevMesh, - this._mesh, - seriesModel - ); - }, - - _updateHandler: function (seriesModel, ecModel, api) { - var data = seriesModel.getData(); - var pointsMesh = this._mesh; - var self = this; - - var lastDataIndex = -1; - var isCartesian3D = seriesModel.coordinateSystem - && seriesModel.coordinateSystem.type === 'cartesian3D'; - - var grid3DModel; - if (isCartesian3D) { - grid3DModel = seriesModel.coordinateSystem.model; - } - - pointsMesh.seriesIndex = seriesModel.seriesIndex; - - pointsMesh.off('mousemove'); - pointsMesh.off('mouseout'); - - pointsMesh.on('mousemove', function (e) { - var dataIndex = e.vertexIndex + self._startDataIndex; - if (dataIndex !== lastDataIndex) { - if (this.highlightOnMouseover) { - this.downplay(data, lastDataIndex); - this.highlight(data, dataIndex); - this._labelsBuilder.updateLabels([dataIndex]); - } - - if (isCartesian3D) { - api.dispatchAction({ - type: 'grid3DShowAxisPointer', - value: [ - data.get(seriesModel.coordDimToDataDim('x')[0], dataIndex), - data.get(seriesModel.coordDimToDataDim('y')[0], dataIndex), - data.get(seriesModel.coordDimToDataDim('z')[0], dataIndex) - ], - grid3DIndex: grid3DModel.componentIndex - }); - } - } - - pointsMesh.dataIndex = dataIndex; - lastDataIndex = dataIndex; - }, this); - pointsMesh.on('mouseout', function (e) { - var dataIndex = e.vertexIndex + self._startDataIndex; - if (this.highlightOnMouseover) { - this.downplay(data, dataIndex); - this._labelsBuilder.updateLabels(); - } - lastDataIndex = -1; - pointsMesh.dataIndex = -1; - - if (isCartesian3D) { - api.dispatchAction({ - type: 'grid3DHideAxisPointer', - grid3DIndex: grid3DModel.componentIndex - }); - } - }, this); - }, - - updateLayout: function (seriesModel, ecModel, api) { - var data = seriesModel.getData(); - if (!this._mesh) { - return; - } - - var positionArr = this._mesh.geometry.attributes.position.value; - var points = data.getLayout('points'); - if (this.is2D) { - for (var i = 0; i < points.length / 2; i++) { - var i3 = i * 3; - var i2 = i * 2; - positionArr[i3] = points[i2]; - positionArr[i3 + 1] = points[i2 + 1]; - positionArr[i3 + 2] = Z_2D; - } - } - else { - for (var i = 0; i < points.length; i++) { - positionArr[i] = points[i]; - } - } - this._mesh.geometry.dirty(); - - api.getZr().refresh(); - }, - - updateView: function (camera) { - if (!this._mesh) { - return; - } - - var worldViewProjection = new __WEBPACK_IMPORTED_MODULE_5_claygl_src_math_Matrix4__["a" /* default */](); - __WEBPACK_IMPORTED_MODULE_5_claygl_src_math_Matrix4__["a" /* default */].mul(worldViewProjection, camera.viewMatrix, this._mesh.worldTransform); - __WEBPACK_IMPORTED_MODULE_5_claygl_src_math_Matrix4__["a" /* default */].mul(worldViewProjection, camera.projectionMatrix, worldViewProjection); - - this._mesh.updateNDCPosition(worldViewProjection, this.is2D, this._api); - }, - - highlight: function (data, dataIndex) { - if (dataIndex > this._endDataIndex || dataIndex < this._startDataIndex) { - return; - } - var itemModel = data.getItemModel(dataIndex); - var emphasisItemStyleModel = itemModel.getModel('emphasis.itemStyle'); - var emphasisColor = emphasisItemStyleModel.get('color'); - var emphasisOpacity = emphasisItemStyleModel.get('opacity'); - if (emphasisColor == null) { - var color = data.getItemVisual(dataIndex, 'color'); - emphasisColor = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.color.lift(color, -0.4); - } - if (emphasisOpacity == null) { - emphasisOpacity = data.getItemVisual(dataIndex, 'opacity'); - } - var colorArr = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor(emphasisColor); - colorArr[3] *= emphasisOpacity; - - this._mesh.geometry.attributes.color.set(dataIndex - this._startDataIndex, colorArr); - this._mesh.geometry.dirtyAttribute('color'); - - this._api.getZr().refresh(); - }, - - downplay: function (data, dataIndex) { - if (dataIndex > this._endDataIndex || dataIndex < this._startDataIndex) { - return; - } - var color = data.getItemVisual(dataIndex, 'color'); - var opacity = data.getItemVisual(dataIndex, 'opacity'); - - var colorArr = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor(color); - colorArr[3] *= opacity; - - this._mesh.geometry.attributes.color.set(dataIndex - this._startDataIndex, colorArr); - this._mesh.geometry.dirtyAttribute('color'); - - this._api.getZr().refresh(); - }, - - fadeOutAll: function (fadeOutPercent) { - if (this._originalOpacity) { - var geo = this._mesh.geometry; - for (var i = 0; i < geo.vertexCount; i++) { - var fadeOutOpacity = this._originalOpacity[i] * fadeOutPercent; - geo.attributes.color.value[i * 4 + 3] = fadeOutOpacity; - } - geo.dirtyAttribute('color'); - - this._api.getZr().refresh(); - } - }, - - fadeInAll: function () { - this.fadeOutAll(1); - }, - - setPositionTexture: function (texture) { - if (this._mesh) { - this._setPositionTextureToMesh(this._mesh, texture); - } - - this._positionTexture = texture; - }, - - removePositionTexture: function () { - this._positionTexture = null; - if (this._mesh) { - this._setPositionTextureToMesh(this._mesh, null); - } - }, - - setSizeScale: function (sizeScale) { - if (sizeScale !== this._sizeScale) { - if (this._mesh) { - var originalSize = this._mesh.material.get('u_Size'); - this._mesh.material.set('u_Size', originalSize / this._sizeScale * sizeScale); - - var attributes = this._mesh.geometry.attributes; - if (attributes.size.value) { - for (var i = 0; i < attributes.size.value.length; i++) { - attributes.size.value[i] = attributes.size.value[i] / this._sizeScale * sizeScale; - } - } - } - this._sizeScale = sizeScale; - } - }, - - _setPositionTextureToMesh: function (mesh, texture) { - if (texture) { - mesh.material.set('positionTexture', texture); - } - mesh.material[ - texture ? 'enableTexture' : 'disableTexture' - ]('positionTexture'); - }, - - _getSymbolInfo: function (seriesModel, start, end) { - if (seriesModel.get('large')) { - var symbolSize = __WEBPACK_IMPORTED_MODULE_6__util_retrieve__["a" /* default */].firstNotNull(seriesModel.get('symbolSize'), 1); - var maxSymbolSize; - var symbolAspect; - if (symbolSize instanceof Array) { - maxSymbolSize = Math.max(symbolSize[0], symbolSize[1]); - symbolAspect = symbolSize[0] / symbolSize[1]; - } - else { - maxSymbolSize = symbolSize; - symbolAspect = 1; - } - return { - maxSize: symbolSize, - type: seriesModel.get('symbol'), - aspect: symbolAspect - } - } - var data = seriesModel.getData(); - var symbolAspect; - var differentSymbolAspect = false; - var symbolType = data.getItemVisual(0, 'symbol') || 'circle'; - var differentSymbolType = false; - var maxSymbolSize = 0; - - for (var idx = start; idx < end; idx++) { - var symbolSize = data.getItemVisual(idx, 'symbolSize'); - var currentSymbolType = data.getItemVisual(idx, 'symbol'); - var currentSymbolAspect; - if (!(symbolSize instanceof Array)) { - // Ignore NaN value. - if (isNaN(symbolSize)) { - return; - } - - currentSymbolAspect = 1; - maxSymbolSize = Math.max(symbolSize, maxSymbolSize); - } - else { - currentSymbolAspect = symbolSize[0] / symbolSize[1]; - maxSymbolSize = Math.max(Math.max(symbolSize[0], symbolSize[1]), maxSymbolSize); - } - if (true) { - if (symbolAspect != null && Math.abs(currentSymbolAspect - symbolAspect) > 0.05) { - differentSymbolAspect = true; - } - if (currentSymbolType !== symbolType) { - differentSymbolType = true; - } - } - symbolType = currentSymbolType; - symbolAspect = currentSymbolAspect; - } - - if (true) { - if (differentSymbolAspect) { - console.warn('Different symbol width / height ratio will be ignored.'); - } - if (differentSymbolType) { - console.warn('Different symbol type will be ignored.'); - } - } - - return { - maxSize: maxSymbolSize, - type: symbolType, - aspect: symbolAspect - }; - } -}; - -/* harmony default export */ __webpack_exports__["a"] = (PointsBuilder); - - -/***/ }), -/* 68 */ -/***/ (function(module, exports) { - -var g; - -// This works in non-strict mode -g = (function() { - return this; -})(); - -try { - // This works if eval is allowed (see CSP) - g = g || Function("return this")() || (1,eval)("this"); -} catch(e) { - // This works if the window reference is available - if(typeof window === "object") - g = window; -} - -// g can still be undefined, but nothing to do about it... -// We return undefined, instead of nothing here, so it's -// easier to handle this case. if(!global) { ...} - -module.exports = g; - - -/***/ }), -/* 69 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__LinkedList__ = __webpack_require__(114); - - -/** - * LRU Cache - * @constructor - * @alias clay.core.LRU - */ -var LRU = function (maxSize) { - - this._list = new __WEBPACK_IMPORTED_MODULE_0__LinkedList__["a" /* default */](); - - this._map = {}; - - this._maxSize = maxSize || 10; -}; - -/** - * Set cache max size - * @param {number} size - */ -LRU.prototype.setMaxSize = function (size) { - this._maxSize = size; -}; - -/** - * @param {string} key - * @param {} value - */ -LRU.prototype.put = function (key, value) { - if (!this._map.hasOwnProperty(key)) { - var len = this._list.length(); - if (len >= this._maxSize && len > 0) { - // Remove the least recently used - var leastUsedEntry = this._list.head; - this._list.remove(leastUsedEntry); - delete this._map[leastUsedEntry.key]; - } - - var entry = this._list.insert(value); - entry.key = key; - this._map[key] = entry; - } -}; - -/** - * @param {string} key - * @return {} - */ -LRU.prototype.get = function (key) { - var entry = this._map[key]; - if (this._map.hasOwnProperty(key)) { - // Put the latest used entry in the tail - if (entry !== this._list.tail) { - this._list.remove(entry); - this._list.insertEntry(entry); - } - - return entry.value; - } -}; - -/** - * @param {string} key - */ -LRU.prototype.remove = function (key) { - var entry = this._map[key]; - if (typeof(entry) !== 'undefined') { - delete this._map[key]; - this._list.remove(entry); - } -}; - -/** - * Clear the cache - */ -LRU.prototype.clear = function () { - this._list.clear(); - this._map = {}; -}; - -/* harmony default export */ __webpack_exports__["a"] = (LRU); - - -/***/ }), -/* 70 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__common__ = __webpack_require__(20); - -/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - - -/** - * @class 2 Dimensional Vector - * @name vec2 - */ - -var vec2 = {}; - -/** - * Creates a new, empty vec2 - * - * @returns {vec2} a new 2D vector - */ -vec2.create = function() { - var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" /* GLMAT_ARRAY_TYPE */](2); - out[0] = 0; - out[1] = 0; - return out; -}; - -/** - * Creates a new vec2 initialized with values from an existing vector - * - * @param {vec2} a vector to clone - * @returns {vec2} a new 2D vector - */ -vec2.clone = function(a) { - var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" /* GLMAT_ARRAY_TYPE */](2); - out[0] = a[0]; - out[1] = a[1]; - return out; -}; - -/** - * Creates a new vec2 initialized with the given values - * - * @param {Number} x X component - * @param {Number} y Y component - * @returns {vec2} a new 2D vector - */ -vec2.fromValues = function(x, y) { - var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" /* GLMAT_ARRAY_TYPE */](2); - out[0] = x; - out[1] = y; - return out; -}; - -/** - * Copy the values from one vec2 to another - * - * @param {vec2} out the receiving vector - * @param {vec2} a the source vector - * @returns {vec2} out - */ -vec2.copy = function(out, a) { - out[0] = a[0]; - out[1] = a[1]; - return out; -}; - -/** - * Set the components of a vec2 to the given values - * - * @param {vec2} out the receiving vector - * @param {Number} x X component - * @param {Number} y Y component - * @returns {vec2} out - */ -vec2.set = function(out, x, y) { - out[0] = x; - out[1] = y; - return out; -}; - -/** - * Adds two vec2's - * - * @param {vec2} out the receiving vector - * @param {vec2} a the first operand - * @param {vec2} b the second operand - * @returns {vec2} out - */ -vec2.add = function(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - return out; -}; - -/** - * Subtracts vector b from vector a - * - * @param {vec2} out the receiving vector - * @param {vec2} a the first operand - * @param {vec2} b the second operand - * @returns {vec2} out - */ -vec2.subtract = function(out, a, b) { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - return out; -}; - -/** - * Alias for {@link vec2.subtract} - * @function - */ -vec2.sub = vec2.subtract; - -/** - * Multiplies two vec2's - * - * @param {vec2} out the receiving vector - * @param {vec2} a the first operand - * @param {vec2} b the second operand - * @returns {vec2} out - */ -vec2.multiply = function(out, a, b) { - out[0] = a[0] * b[0]; - out[1] = a[1] * b[1]; - return out; -}; - -/** - * Alias for {@link vec2.multiply} - * @function - */ -vec2.mul = vec2.multiply; - -/** - * Divides two vec2's - * - * @param {vec2} out the receiving vector - * @param {vec2} a the first operand - * @param {vec2} b the second operand - * @returns {vec2} out - */ -vec2.divide = function(out, a, b) { - out[0] = a[0] / b[0]; - out[1] = a[1] / b[1]; - return out; -}; - -/** - * Alias for {@link vec2.divide} - * @function - */ -vec2.div = vec2.divide; - -/** - * Returns the minimum of two vec2's - * - * @param {vec2} out the receiving vector - * @param {vec2} a the first operand - * @param {vec2} b the second operand - * @returns {vec2} out - */ -vec2.min = function(out, a, b) { - out[0] = Math.min(a[0], b[0]); - out[1] = Math.min(a[1], b[1]); - return out; -}; - -/** - * Returns the maximum of two vec2's - * - * @param {vec2} out the receiving vector - * @param {vec2} a the first operand - * @param {vec2} b the second operand - * @returns {vec2} out - */ -vec2.max = function(out, a, b) { - out[0] = Math.max(a[0], b[0]); - out[1] = Math.max(a[1], b[1]); - return out; -}; - -/** - * Scales a vec2 by a scalar number - * - * @param {vec2} out the receiving vector - * @param {vec2} a the vector to scale - * @param {Number} b amount to scale the vector by - * @returns {vec2} out - */ -vec2.scale = function(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - return out; -}; - -/** - * Adds two vec2's after scaling the second operand by a scalar value - * - * @param {vec2} out the receiving vector - * @param {vec2} a the first operand - * @param {vec2} b the second operand - * @param {Number} scale the amount to scale b by before adding - * @returns {vec2} out - */ -vec2.scaleAndAdd = function(out, a, b, scale) { - out[0] = a[0] + (b[0] * scale); - out[1] = a[1] + (b[1] * scale); - return out; -}; - -/** - * Calculates the euclidian distance between two vec2's - * - * @param {vec2} a the first operand - * @param {vec2} b the second operand - * @returns {Number} distance between a and b - */ -vec2.distance = function(a, b) { - var x = b[0] - a[0], - y = b[1] - a[1]; - return Math.sqrt(x*x + y*y); -}; - -/** - * Alias for {@link vec2.distance} - * @function - */ -vec2.dist = vec2.distance; - -/** - * Calculates the squared euclidian distance between two vec2's - * - * @param {vec2} a the first operand - * @param {vec2} b the second operand - * @returns {Number} squared distance between a and b - */ -vec2.squaredDistance = function(a, b) { - var x = b[0] - a[0], - y = b[1] - a[1]; - return x*x + y*y; -}; - -/** - * Alias for {@link vec2.squaredDistance} - * @function - */ -vec2.sqrDist = vec2.squaredDistance; - -/** - * Calculates the length of a vec2 - * - * @param {vec2} a vector to calculate length of - * @returns {Number} length of a - */ -vec2.length = function (a) { - var x = a[0], - y = a[1]; - return Math.sqrt(x*x + y*y); -}; - -/** - * Alias for {@link vec2.length} - * @function - */ -vec2.len = vec2.length; - -/** - * Calculates the squared length of a vec2 - * - * @param {vec2} a vector to calculate squared length of - * @returns {Number} squared length of a - */ -vec2.squaredLength = function (a) { - var x = a[0], - y = a[1]; - return x*x + y*y; -}; - -/** - * Alias for {@link vec2.squaredLength} - * @function - */ -vec2.sqrLen = vec2.squaredLength; - -/** - * Negates the components of a vec2 - * - * @param {vec2} out the receiving vector - * @param {vec2} a vector to negate - * @returns {vec2} out - */ -vec2.negate = function(out, a) { - out[0] = -a[0]; - out[1] = -a[1]; - return out; -}; - -/** - * Returns the inverse of the components of a vec2 - * - * @param {vec2} out the receiving vector - * @param {vec2} a vector to invert - * @returns {vec2} out - */ -vec2.inverse = function(out, a) { - out[0] = 1.0 / a[0]; - out[1] = 1.0 / a[1]; - return out; -}; - -/** - * Normalize a vec2 - * - * @param {vec2} out the receiving vector - * @param {vec2} a vector to normalize - * @returns {vec2} out - */ -vec2.normalize = function(out, a) { - var x = a[0], - y = a[1]; - var len = x*x + y*y; - if (len > 0) { - //TODO: evaluate use of glm_invsqrt here? - len = 1 / Math.sqrt(len); - out[0] = a[0] * len; - out[1] = a[1] * len; - } - return out; -}; - -/** - * Calculates the dot product of two vec2's - * - * @param {vec2} a the first operand - * @param {vec2} b the second operand - * @returns {Number} dot product of a and b - */ -vec2.dot = function (a, b) { - return a[0] * b[0] + a[1] * b[1]; -}; - -/** - * Computes the cross product of two vec2's - * Note that the cross product must by definition produce a 3D vector - * - * @param {vec3} out the receiving vector - * @param {vec2} a the first operand - * @param {vec2} b the second operand - * @returns {vec3} out - */ -vec2.cross = function(out, a, b) { - var z = a[0] * b[1] - a[1] * b[0]; - out[0] = out[1] = 0; - out[2] = z; - return out; -}; - -/** - * Performs a linear interpolation between two vec2's - * - * @param {vec2} out the receiving vector - * @param {vec2} a the first operand - * @param {vec2} b the second operand - * @param {Number} t interpolation amount between the two inputs - * @returns {vec2} out - */ -vec2.lerp = function (out, a, b, t) { - var ax = a[0], - ay = a[1]; - out[0] = ax + t * (b[0] - ax); - out[1] = ay + t * (b[1] - ay); - return out; -}; - -/** - * Generates a random vector with the given scale - * - * @param {vec2} out the receiving vector - * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned - * @returns {vec2} out - */ -vec2.random = function (out, scale) { - scale = scale || 1.0; - var r = GLMAT_RANDOM() * 2.0 * Math.PI; - out[0] = Math.cos(r) * scale; - out[1] = Math.sin(r) * scale; - return out; -}; - -/** - * Transforms the vec2 with a mat2 - * - * @param {vec2} out the receiving vector - * @param {vec2} a the vector to transform - * @param {mat2} m matrix to transform with - * @returns {vec2} out - */ -vec2.transformMat2 = function(out, a, m) { - var x = a[0], - y = a[1]; - out[0] = m[0] * x + m[2] * y; - out[1] = m[1] * x + m[3] * y; - return out; -}; - -/** - * Transforms the vec2 with a mat2d - * - * @param {vec2} out the receiving vector - * @param {vec2} a the vector to transform - * @param {mat2d} m matrix to transform with - * @returns {vec2} out - */ -vec2.transformMat2d = function(out, a, m) { - var x = a[0], - y = a[1]; - out[0] = m[0] * x + m[2] * y + m[4]; - out[1] = m[1] * x + m[3] * y + m[5]; - return out; -}; - -/** - * Transforms the vec2 with a mat3 - * 3rd vector component is implicitly '1' - * - * @param {vec2} out the receiving vector - * @param {vec2} a the vector to transform - * @param {mat3} m matrix to transform with - * @returns {vec2} out - */ -vec2.transformMat3 = function(out, a, m) { - var x = a[0], - y = a[1]; - out[0] = m[0] * x + m[3] * y + m[6]; - out[1] = m[1] * x + m[4] * y + m[7]; - return out; -}; - -/** - * Transforms the vec2 with a mat4 - * 3rd vector component is implicitly '0' - * 4th vector component is implicitly '1' - * - * @param {vec2} out the receiving vector - * @param {vec2} a the vector to transform - * @param {mat4} m matrix to transform with - * @returns {vec2} out - */ -vec2.transformMat4 = function(out, a, m) { - var x = a[0], - y = a[1]; - out[0] = m[0] * x + m[4] * y + m[12]; - out[1] = m[1] * x + m[5] * y + m[13]; - return out; -}; - -/** - * Perform some operation over an array of vec2s. - * - * @param {Array} a the array of vectors to iterate over - * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed - * @param {Number} offset Number of elements to skip at the beginning of the array - * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array - * @param {Function} fn Function to call for each vector in the array - * @param {Object} [arg] additional argument to pass to fn - * @returns {Array} a - * @function - */ -vec2.forEach = (function() { - var vec = vec2.create(); - - return function(a, stride, offset, count, fn, arg) { - var i, l; - if(!stride) { - stride = 2; - } - - if(!offset) { - offset = 0; - } - - if(count) { - l = Math.min((count * stride) + offset, a.length); - } else { - l = a.length; - } - - for(i = offset; i < l; i += stride) { - vec[0] = a[i]; vec[1] = a[i+1]; - fn(vec, vec, arg); - a[i] = vec[0]; a[i+1] = vec[1]; - } - - return a; - }; -})(); - -/* harmony default export */ __webpack_exports__["a"] = (vec2); - -/***/ }), -/* 71 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export clay.prez.vertex\nuniform mat4 WVP : WORLDVIEWPROJECTION;\nattribute vec3 pos : POSITION;\nattribute vec2 uv : TEXCOORD_0;\n@import clay.chunk.skinning_header\nvarying vec2 v_Texcoord;\nvoid main()\n{\n vec3 P = pos;\n#ifdef SKINNING\n @import clay.chunk.skin_matrix\n P = (skinMatrixWS * vec4(pos, 1.0)).xyz;\n#endif\n gl_Position = WVP * vec4(P, 1.0);\n v_Texcoord = uv;\n}\n@end\n@export clay.prez.fragment\nuniform sampler2D alphaMap;\nuniform float alphaCutoff: 0.0;\nvarying vec2 v_Texcoord;\nvoid main()\n{\n if (alphaCutoff > 0.0) {\n if (texture2D(alphaMap, v_Texcoord).a <= alphaCutoff) {\n discard;\n }\n }\n gl_FragColor = vec4(0.0,0.0,0.0,1.0);\n}\n@end"); - - -/***/ }), -/* 72 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Node__ = __webpack_require__(35); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__core_glenum__ = __webpack_require__(11); - - - -/** - * @constructor - * @alias clay.Renderable - * @extends clay.Node - */ -var Renderable = __WEBPACK_IMPORTED_MODULE_0__Node__["a" /* default */].extend(/** @lends clay.Renderable# */ { - /** - * @type {clay.Material} - */ - material: null, - - /** - * @type {clay.Geometry} - */ - geometry: null, - - /** - * @type {number} - */ - mode: __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].TRIANGLES, - - _renderInfo: null -}, -/** @lends clay.Renderable.prototype */ -{ - - __program: null, - - /** - * Group of received light. - */ - lightGroup: 0, - /** - * Render order, Nodes with smaller value renders before nodes with larger values. - * @type {Number} - */ - renderOrder: 0, - - /** - * Used when mode is LINES, LINE_STRIP or LINE_LOOP - * @type {number} - */ - // lineWidth: 1, - - /** - * If enable culling - * @type {boolean} - */ - culling: true, - /** - * Specify which side of polygon will be culled. - * Possible values: - * + {@link clay.Renderable.BACK} - * + {@link clay.Renderable.FRONT} - * + {@link clay.Renderable.FRONT_AND_BACK} - * @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/cullFace - * @type {number} - */ - cullFace: __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].BACK, - /** - * Specify which side is front face. - * Possible values: - * + {@link clay.Renderable.CW} - * + {@link clay.Renderable.CCW} - * @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/frontFace - * @type {number} - */ - frontFace: __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].CCW, - - /** - * If enable software frustum culling - * @type {boolean} - */ - frustumCulling: true, - /** - * @type {boolean} - */ - receiveShadow: true, - /** - * @type {boolean} - */ - castShadow: true, - /** - * @type {boolean} - */ - ignorePicking: false, - /** - * @type {boolean} - */ - ignorePreZ: false, - - /** - * @type {boolean} - */ - ignoreGBuffer: false, - - /** - * @return {boolean} - */ - isRenderable: function() { - // TODO Shader ? - return this.geometry && this.material && this.material.shader && !this.invisible - && this.geometry.vertexCount > 0; - }, - - /** - * Before render hook - * @type {Function} - */ - beforeRender: function (_gl) {}, - - /** - * Before render hook - * @type {Function} - */ - afterRender: function (_gl, renderStat) {}, - - getBoundingBox: function (filter, out) { - out = __WEBPACK_IMPORTED_MODULE_0__Node__["a" /* default */].prototype.getBoundingBox.call(this, filter, out); - if (this.geometry && this.geometry.boundingBox) { - out.union(this.geometry.boundingBox); - } - - return out; - }, - - /** - * Clone a new renderable - * @function - * @return {clay.Renderable} - */ - clone: (function() { - var properties = [ - 'castShadow', 'receiveShadow', - 'mode', 'culling', 'cullFace', 'frontFace', - 'frustumCulling', - 'renderOrder', 'lineWidth', - 'ignorePicking', 'ignorePreZ', 'ignoreGBuffer' - ]; - return function() { - var renderable = __WEBPACK_IMPORTED_MODULE_0__Node__["a" /* default */].prototype.clone.call(this); - - renderable.geometry = this.geometry; - renderable.material = this.material; - - for (var i = 0; i < properties.length; i++) { - var name = properties[i]; - // Try not to overwrite the prototype property - if (renderable[name] !== this[name]) { - renderable[name] = this[name]; - } - } - - return renderable; - }; - })() -}); - -/** - * @type {number} - */ -Renderable.POINTS = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].POINTS; -/** - * @type {number} - */ -Renderable.LINES = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LINES; -/** - * @type {number} - */ -Renderable.LINE_LOOP = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LINE_LOOP; -/** - * @type {number} - */ -Renderable.LINE_STRIP = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LINE_STRIP; -/** - * @type {number} - */ -Renderable.TRIANGLES = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].TRIANGLES; -/** - * @type {number} - */ -Renderable.TRIANGLE_STRIP = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].TRIANGLE_STRIP; -/** - * @type {number} - */ -Renderable.TRIANGLE_FAN = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].TRIANGLE_FAN; -/** - * @type {number} - */ -Renderable.BACK = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].BACK; -/** - * @type {number} - */ -Renderable.FRONT = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].FRONT; -/** - * @type {number} - */ -Renderable.FRONT_AND_BACK = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].FRONT_AND_BACK; -/** - * @type {number} - */ -Renderable.CW = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].CW; -/** - * @type {number} - */ -Renderable.CCW = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].CCW; - -/* harmony default export */ __webpack_exports__["a"] = (Renderable); - - -/***/ }), -/* 73 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -var mathUtil = {}; - -mathUtil.isPowerOfTwo = function (value) { - return (value & (value - 1)) === 0; -}; - -mathUtil.nextPowerOfTwo = function (value) { - value --; - value |= value >> 1; - value |= value >> 2; - value |= value >> 4; - value |= value >> 8; - value |= value >> 16; - value ++; - - return value; -}; - -mathUtil.nearestPowerOfTwo = function (value) { - return Math.pow( 2, Math.round( Math.log( value ) / Math.LN2 ) ); -}; - -/* harmony default export */ __webpack_exports__["a"] = (mathUtil); - - -/***/ }), -/* 74 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Vector3__ = __webpack_require__(3); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__glmatrix_mat4__ = __webpack_require__(21); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__glmatrix_vec3__ = __webpack_require__(12); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__glmatrix_vec4__ = __webpack_require__(33); - - - - - -/** - * @constructor - * @alias clay.Plane - * @param {clay.Vector3} [normal] - * @param {number} [distance] - */ -var Plane = function(normal, distance) { - /** - * Normal of the plane - * @type {clay.Vector3} - */ - this.normal = normal || new __WEBPACK_IMPORTED_MODULE_0__Vector3__["a" /* default */](0, 1, 0); - - /** - * Constant of the plane equation, used as distance to the origin - * @type {number} - */ - this.distance = distance || 0; -}; - -Plane.prototype = { - - constructor: Plane, - - /** - * Distance from a given point to the plane - * @param {clay.Vector3} point - * @return {number} - */ - distanceToPoint: function(point) { - return __WEBPACK_IMPORTED_MODULE_2__glmatrix_vec3__["a" /* default */].dot(point.array, this.normal.array) - this.distance; - }, - - /** - * Calculate the projection point on the plane - * @param {clay.Vector3} point - * @param {clay.Vector3} out - * @return {clay.Vector3} - */ - projectPoint: function(point, out) { - if (!out) { - out = new __WEBPACK_IMPORTED_MODULE_0__Vector3__["a" /* default */](); - } - var d = this.distanceToPoint(point); - __WEBPACK_IMPORTED_MODULE_2__glmatrix_vec3__["a" /* default */].scaleAndAdd(out.array, point.array, this.normal.array, -d); - out._dirty = true; - return out; - }, - - /** - * Normalize the plane's normal and calculate the distance - */ - normalize: function() { - var invLen = 1 / __WEBPACK_IMPORTED_MODULE_2__glmatrix_vec3__["a" /* default */].len(this.normal.array); - __WEBPACK_IMPORTED_MODULE_2__glmatrix_vec3__["a" /* default */].scale(this.normal.array, invLen); - this.distance *= invLen; - }, - - /** - * If the plane intersect a frustum - * @param {clay.Frustum} Frustum - * @return {boolean} - */ - intersectFrustum: function(frustum) { - // Check if all coords of frustum is on plane all under plane - var coords = frustum.vertices; - var normal = this.normal.array; - var onPlane = __WEBPACK_IMPORTED_MODULE_2__glmatrix_vec3__["a" /* default */].dot(coords[0].array, normal) > this.distance; - for (var i = 1; i < 8; i++) { - if ((__WEBPACK_IMPORTED_MODULE_2__glmatrix_vec3__["a" /* default */].dot(coords[i].array, normal) > this.distance) != onPlane) { - return true; - } - } - }, - - /** - * Calculate the intersection point between plane and a given line - * @function - * @param {clay.Vector3} start start point of line - * @param {clay.Vector3} end end point of line - * @param {clay.Vector3} [out] - * @return {clay.Vector3} - */ - intersectLine: (function() { - var rd = __WEBPACK_IMPORTED_MODULE_2__glmatrix_vec3__["a" /* default */].create(); - return function(start, end, out) { - var d0 = this.distanceToPoint(start); - var d1 = this.distanceToPoint(end); - if ((d0 > 0 && d1 > 0) || (d0 < 0 && d1 < 0)) { - return null; - } - // Ray intersection - var pn = this.normal.array; - var d = this.distance; - var ro = start.array; - // direction - __WEBPACK_IMPORTED_MODULE_2__glmatrix_vec3__["a" /* default */].sub(rd, end.array, start.array); - __WEBPACK_IMPORTED_MODULE_2__glmatrix_vec3__["a" /* default */].normalize(rd, rd); - - var divider = __WEBPACK_IMPORTED_MODULE_2__glmatrix_vec3__["a" /* default */].dot(pn, rd); - // ray is parallel to the plane - if (divider === 0) { - return null; - } - if (!out) { - out = new __WEBPACK_IMPORTED_MODULE_0__Vector3__["a" /* default */](); - } - var t = (__WEBPACK_IMPORTED_MODULE_2__glmatrix_vec3__["a" /* default */].dot(pn, ro) - d) / divider; - __WEBPACK_IMPORTED_MODULE_2__glmatrix_vec3__["a" /* default */].scaleAndAdd(out.array, ro, rd, -t); - out._dirty = true; - return out; - }; - })(), - - /** - * Apply an affine transform matrix to plane - * @function - * @return {clay.Matrix4} - */ - applyTransform: (function() { - var inverseTranspose = __WEBPACK_IMPORTED_MODULE_1__glmatrix_mat4__["a" /* default */].create(); - var normalv4 = __WEBPACK_IMPORTED_MODULE_3__glmatrix_vec4__["a" /* default */].create(); - var pointv4 = __WEBPACK_IMPORTED_MODULE_3__glmatrix_vec4__["a" /* default */].create(); - pointv4[3] = 1; - return function(m4) { - m4 = m4.array; - // Transform point on plane - __WEBPACK_IMPORTED_MODULE_2__glmatrix_vec3__["a" /* default */].scale(pointv4, this.normal.array, this.distance); - __WEBPACK_IMPORTED_MODULE_3__glmatrix_vec4__["a" /* default */].transformMat4(pointv4, pointv4, m4); - this.distance = __WEBPACK_IMPORTED_MODULE_2__glmatrix_vec3__["a" /* default */].dot(pointv4, this.normal.array); - // Transform plane normal - __WEBPACK_IMPORTED_MODULE_1__glmatrix_mat4__["a" /* default */].invert(inverseTranspose, m4); - __WEBPACK_IMPORTED_MODULE_1__glmatrix_mat4__["a" /* default */].transpose(inverseTranspose, inverseTranspose); - normalv4[3] = 0; - __WEBPACK_IMPORTED_MODULE_2__glmatrix_vec3__["a" /* default */].copy(normalv4, this.normal.array); - __WEBPACK_IMPORTED_MODULE_3__glmatrix_vec4__["a" /* default */].transformMat4(normalv4, normalv4, inverseTranspose); - __WEBPACK_IMPORTED_MODULE_2__glmatrix_vec3__["a" /* default */].copy(this.normal.array, normalv4); - }; - })(), - - /** - * Copy from another plane - * @param {clay.Vector3} plane - */ - copy: function(plane) { - __WEBPACK_IMPORTED_MODULE_2__glmatrix_vec3__["a" /* default */].copy(this.normal.array, plane.normal.array); - this.normal._dirty = true; - this.distance = plane.distance; - }, - - /** - * Clone a new plane - * @return {clay.Plane} - */ - clone: function() { - var plane = new Plane(); - plane.copy(this); - return plane; - } -}; - -/* harmony default export */ __webpack_exports__["a"] = (Plane); - - -/***/ }), -/* 75 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Skybox__ = __webpack_require__(42); - - -/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__Skybox__["a" /* default */]); - -/***/ }), -/* 76 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Geometry__ = __webpack_require__(15); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Plane__ = __webpack_require__(43); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__math_Matrix4__ = __webpack_require__(9); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__math_Vector3__ = __webpack_require__(3); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__math_BoundingBox__ = __webpack_require__(18); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__core_vendor__ = __webpack_require__(14); - - - - - - - -var planeMatrix = new __WEBPACK_IMPORTED_MODULE_2__math_Matrix4__["a" /* default */](); - -/** - * @constructor clay.geometry.Cube - * @extends clay.Geometry - * @param {Object} [opt] - * @param {number} [opt.widthSegments] - * @param {number} [opt.heightSegments] - * @param {number} [opt.depthSegments] - * @param {boolean} [opt.inside] - */ -var Cube = __WEBPACK_IMPORTED_MODULE_0__Geometry__["a" /* default */].extend( -/**@lends clay.geometry.Cube# */ -{ - dynamic: false, - /** - * @type {number} - */ - widthSegments: 1, - /** - * @type {number} - */ - heightSegments: 1, - /** - * @type {number} - */ - depthSegments: 1, - /** - * @type {boolean} - */ - inside: false -}, function() { - this.build(); -}, -/** @lends clay.geometry.Cube.prototype */ -{ - /** - * Build cube geometry - */ - build: function() { - - var planes = { - 'px': createPlane('px', this.depthSegments, this.heightSegments), - 'nx': createPlane('nx', this.depthSegments, this.heightSegments), - 'py': createPlane('py', this.widthSegments, this.depthSegments), - 'ny': createPlane('ny', this.widthSegments, this.depthSegments), - 'pz': createPlane('pz', this.widthSegments, this.heightSegments), - 'nz': createPlane('nz', this.widthSegments, this.heightSegments), - }; - - var attrList = ['position', 'texcoord0', 'normal']; - var vertexNumber = 0; - var faceNumber = 0; - for (var pos in planes) { - vertexNumber += planes[pos].vertexCount; - faceNumber += planes[pos].indices.length; - } - for (var k = 0; k < attrList.length; k++) { - this.attributes[attrList[k]].init(vertexNumber); - } - this.indices = new __WEBPACK_IMPORTED_MODULE_5__core_vendor__["a" /* default */].Uint16Array(faceNumber); - var faceOffset = 0; - var vertexOffset = 0; - for (var pos in planes) { - var plane = planes[pos]; - for (var k = 0; k < attrList.length; k++) { - var attrName = attrList[k]; - var attrArray = plane.attributes[attrName].value; - var attrSize = plane.attributes[attrName].size; - var isNormal = attrName === 'normal'; - for (var i = 0; i < attrArray.length; i++) { - var value = attrArray[i]; - if (this.inside && isNormal) { - value = -value; - } - this.attributes[attrName].value[i + attrSize * vertexOffset] = value; - } - } - var len = plane.indices.length; - for (var i = 0; i < plane.indices.length; i++) { - this.indices[i + faceOffset] = vertexOffset + plane.indices[this.inside ? (len - i - 1) : i]; - } - faceOffset += plane.indices.length; - vertexOffset += plane.vertexCount; - } - - this.boundingBox = new __WEBPACK_IMPORTED_MODULE_4__math_BoundingBox__["a" /* default */](); - this.boundingBox.max.set(1, 1, 1); - this.boundingBox.min.set(-1, -1, -1); - } -}); - -function createPlane(pos, widthSegments, heightSegments) { - - planeMatrix.identity(); - - var plane = new __WEBPACK_IMPORTED_MODULE_1__Plane__["a" /* default */]({ - widthSegments: widthSegments, - heightSegments: heightSegments - }); - - switch(pos) { - case 'px': - __WEBPACK_IMPORTED_MODULE_2__math_Matrix4__["a" /* default */].translate(planeMatrix, planeMatrix, __WEBPACK_IMPORTED_MODULE_3__math_Vector3__["a" /* default */].POSITIVE_X); - __WEBPACK_IMPORTED_MODULE_2__math_Matrix4__["a" /* default */].rotateY(planeMatrix, planeMatrix, Math.PI / 2); - break; - case 'nx': - __WEBPACK_IMPORTED_MODULE_2__math_Matrix4__["a" /* default */].translate(planeMatrix, planeMatrix, __WEBPACK_IMPORTED_MODULE_3__math_Vector3__["a" /* default */].NEGATIVE_X); - __WEBPACK_IMPORTED_MODULE_2__math_Matrix4__["a" /* default */].rotateY(planeMatrix, planeMatrix, -Math.PI / 2); - break; - case 'py': - __WEBPACK_IMPORTED_MODULE_2__math_Matrix4__["a" /* default */].translate(planeMatrix, planeMatrix, __WEBPACK_IMPORTED_MODULE_3__math_Vector3__["a" /* default */].POSITIVE_Y); - __WEBPACK_IMPORTED_MODULE_2__math_Matrix4__["a" /* default */].rotateX(planeMatrix, planeMatrix, -Math.PI / 2); - break; - case 'ny': - __WEBPACK_IMPORTED_MODULE_2__math_Matrix4__["a" /* default */].translate(planeMatrix, planeMatrix, __WEBPACK_IMPORTED_MODULE_3__math_Vector3__["a" /* default */].NEGATIVE_Y); - __WEBPACK_IMPORTED_MODULE_2__math_Matrix4__["a" /* default */].rotateX(planeMatrix, planeMatrix, Math.PI / 2); - break; - case 'pz': - __WEBPACK_IMPORTED_MODULE_2__math_Matrix4__["a" /* default */].translate(planeMatrix, planeMatrix, __WEBPACK_IMPORTED_MODULE_3__math_Vector3__["a" /* default */].POSITIVE_Z); - break; - case 'nz': - __WEBPACK_IMPORTED_MODULE_2__math_Matrix4__["a" /* default */].translate(planeMatrix, planeMatrix, __WEBPACK_IMPORTED_MODULE_3__math_Vector3__["a" /* default */].NEGATIVE_Z); - __WEBPACK_IMPORTED_MODULE_2__math_Matrix4__["a" /* default */].rotateY(planeMatrix, planeMatrix, Math.PI); - break; - } - plane.applyTransform(planeMatrix); - return plane; -} - -/* harmony default export */ __webpack_exports__["a"] = (Cube); - - -/***/ }), -/* 77 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Texture2D__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__TextureCube__ = __webpack_require__(27); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Texture__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__FrameBuffer__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__compositor_Pass__ = __webpack_require__(16); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Material__ = __webpack_require__(19); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Shader__ = __webpack_require__(8); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__plugin_Skybox__ = __webpack_require__(42); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Scene__ = __webpack_require__(36); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__prePass_EnvironmentMap__ = __webpack_require__(62); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__core_vendor__ = __webpack_require__(14); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__texture__ = __webpack_require__(61); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__shader_integrateBRDF_glsl_js__ = __webpack_require__(127); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__shader_prefilter_glsl_js__ = __webpack_require__(128); -// Cubemap prefilter utility -// http://www.unrealengine.com/files/downloads/2013SiggraphPresentationsNotes.pdf -// http://http.developer.nvidia.com/GPUGems3/gpugems3_ch20.html - - - - - - - - - - - - - - - - -var cubemapUtil = {}; - -var targets = ['px', 'nx', 'py', 'ny', 'pz', 'nz']; - -// TODO Downsample -/** - * @name clay.util.cubemap.prefilterEnvironmentMap - * @param {clay.Renderer} renderer - * @param {clay.Texture} envMap - * @param {Object} [textureOpts] - * @param {number} [textureOpts.width=64] - * @param {number} [textureOpts.height=64] - * @param {number} [textureOpts.type] - * @param {boolean} [textureOpts.encodeRGBM=false] - * @param {boolean} [textureOpts.decodeRGBM=false] - * @param {clay.Texture2D} [normalDistribution] - * @param {clay.Texture2D} [brdfLookup] - */ -cubemapUtil.prefilterEnvironmentMap = function ( - renderer, envMap, textureOpts, normalDistribution, brdfLookup -) { - // Not create other renderer, it is easy having issue of cross reference of resources like framebuffer - // PENDING preserveDrawingBuffer? - if (!brdfLookup || !normalDistribution) { - normalDistribution = cubemapUtil.generateNormalDistribution(); - brdfLookup = cubemapUtil.integrateBRDF(renderer, normalDistribution); - } - textureOpts = textureOpts || {}; - - var width = textureOpts.width || 64; - var height = textureOpts.height || 64; - - var textureType = textureOpts.type || envMap.type; - - // Use same type with given envMap - var prefilteredCubeMap = new __WEBPACK_IMPORTED_MODULE_1__TextureCube__["a" /* default */]({ - width: width, - height: height, - type: textureType, - flipY: false, - mipmaps: [] - }); - - if (!prefilteredCubeMap.isPowerOfTwo()) { - console.warn('Width and height must be power of two to enable mipmap.'); - } - - var size = Math.min(width, height); - var mipmapNum = Math.log(size) / Math.log(2) + 1; - - var prefilterMaterial = new __WEBPACK_IMPORTED_MODULE_5__Material__["a" /* default */]({ - shader: new __WEBPACK_IMPORTED_MODULE_6__Shader__["a" /* default */]({ - vertex: __WEBPACK_IMPORTED_MODULE_6__Shader__["a" /* default */].source('clay.skybox.vertex'), - fragment: __WEBPACK_IMPORTED_MODULE_13__shader_prefilter_glsl_js__["a" /* default */] - }) - }); - prefilterMaterial.set('normalDistribution', normalDistribution); - - textureOpts.encodeRGBM && prefilterMaterial.define('fragment', 'RGBM_ENCODE'); - textureOpts.decodeRGBM && prefilterMaterial.define('fragment', 'RGBM_DECODE'); - - var dummyScene = new __WEBPACK_IMPORTED_MODULE_8__Scene__["a" /* default */](); - var skyEnv; - - if (envMap.textureType === 'texture2D') { - // Convert panorama to cubemap - var envCubemap = new __WEBPACK_IMPORTED_MODULE_1__TextureCube__["a" /* default */]({ - width: width, - height: height, - // FIXME FLOAT type will cause GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT error on iOS - type: textureType === __WEBPACK_IMPORTED_MODULE_2__Texture__["a" /* default */].FLOAT ? - __WEBPACK_IMPORTED_MODULE_2__Texture__["a" /* default */].HALF_FLOAT : textureType - }); - __WEBPACK_IMPORTED_MODULE_11__texture__["a" /* default */].panoramaToCubeMap(renderer, envMap, envCubemap, { - // PENDING encodeRGBM so it can be decoded as RGBM - encodeRGBM: textureOpts.decodeRGBM - }); - envMap = envCubemap; - } - skyEnv = new __WEBPACK_IMPORTED_MODULE_7__plugin_Skybox__["a" /* default */]({ - scene: dummyScene, - material: prefilterMaterial - }); - skyEnv.material.set('environmentMap', envMap); - - var envMapPass = new __WEBPACK_IMPORTED_MODULE_9__prePass_EnvironmentMap__["a" /* default */]({ - texture: prefilteredCubeMap - }); - - // Force to be UNSIGNED_BYTE - if (textureOpts.encodeRGBM) { - textureType = prefilteredCubeMap.type = __WEBPACK_IMPORTED_MODULE_2__Texture__["a" /* default */].UNSIGNED_BYTE; - } - - var renderTargetTmp = new __WEBPACK_IMPORTED_MODULE_0__Texture2D__["a" /* default */]({ - width: width, - height: height, - type: textureType - }); - var frameBuffer = new __WEBPACK_IMPORTED_MODULE_3__FrameBuffer__["a" /* default */]({ - depthBuffer: false - }); - var ArrayCtor = __WEBPACK_IMPORTED_MODULE_10__core_vendor__["a" /* default */][textureType === __WEBPACK_IMPORTED_MODULE_2__Texture__["a" /* default */].UNSIGNED_BYTE ? 'Uint8Array' : 'Float32Array']; - for (var i = 0; i < mipmapNum; i++) { - // console.time('prefilter'); - prefilteredCubeMap.mipmaps[i] = { - pixels: {} - }; - skyEnv.material.set('roughness', i / (mipmapNum - 1)); - - // Tweak fov - // http://the-witness.net/news/2012/02/seamless-cube-map-filtering/ - var n = renderTargetTmp.width; - var fov = 2 * Math.atan(n / (n - 0.5)) / Math.PI * 180; - - for (var j = 0; j < targets.length; j++) { - var pixels = new ArrayCtor(renderTargetTmp.width * renderTargetTmp.height * 4); - frameBuffer.attach(renderTargetTmp); - frameBuffer.bind(renderer); - - var camera = envMapPass.getCamera(targets[j]); - camera.fov = fov; - renderer.render(dummyScene, camera); - renderer.gl.readPixels( - 0, 0, renderTargetTmp.width, renderTargetTmp.height, - __WEBPACK_IMPORTED_MODULE_2__Texture__["a" /* default */].RGBA, textureType, pixels - ); - - // var canvas = document.createElement('canvas'); - // var ctx = canvas.getContext('2d'); - // canvas.width = renderTargetTmp.width; - // canvas.height = renderTargetTmp.height; - // var imageData = ctx.createImageData(renderTargetTmp.width, renderTargetTmp.height); - // for (var k = 0; k < pixels.length; k++) { - // imageData.data[k] = pixels[k]; - // } - // ctx.putImageData(imageData, 0, 0); - // document.body.appendChild(canvas); - - frameBuffer.unbind(renderer); - prefilteredCubeMap.mipmaps[i].pixels[targets[j]] = pixels; - } - - renderTargetTmp.width /= 2; - renderTargetTmp.height /= 2; - renderTargetTmp.dirty(); - // console.timeEnd('prefilter'); - } - - frameBuffer.dispose(renderer); - renderTargetTmp.dispose(renderer); - skyEnv.dispose(renderer); - // Remove gpu resource allucated in renderer - normalDistribution.dispose(renderer); - - // renderer.dispose(); - - return { - environmentMap: prefilteredCubeMap, - brdfLookup: brdfLookup, - normalDistribution: normalDistribution, - maxMipmapLevel: mipmapNum - }; -}; - -cubemapUtil.integrateBRDF = function (renderer, normalDistribution) { - normalDistribution = normalDistribution || cubemapUtil.generateNormalDistribution(); - var framebuffer = new __WEBPACK_IMPORTED_MODULE_3__FrameBuffer__["a" /* default */]({ - depthBuffer: false - }); - var pass = new __WEBPACK_IMPORTED_MODULE_4__compositor_Pass__["a" /* default */]({ - fragment: __WEBPACK_IMPORTED_MODULE_12__shader_integrateBRDF_glsl_js__["a" /* default */] - }); - - var texture = new __WEBPACK_IMPORTED_MODULE_0__Texture2D__["a" /* default */]({ - width: 512, - height: 256, - type: __WEBPACK_IMPORTED_MODULE_2__Texture__["a" /* default */].HALF_FLOAT, - wrapS: __WEBPACK_IMPORTED_MODULE_2__Texture__["a" /* default */].CLAMP_TO_EDGE, - wrapT: __WEBPACK_IMPORTED_MODULE_2__Texture__["a" /* default */].CLAMP_TO_EDGE, - minFilter: __WEBPACK_IMPORTED_MODULE_2__Texture__["a" /* default */].NEAREST, - magFilter: __WEBPACK_IMPORTED_MODULE_2__Texture__["a" /* default */].NEAREST, - useMipmap: false - }); - pass.setUniform('normalDistribution', normalDistribution); - pass.setUniform('viewportSize', [512, 256]); - pass.attachOutput(texture); - pass.render(renderer, framebuffer); - - // FIXME Only chrome and firefox can readPixels with float type. - // framebuffer.bind(renderer); - // var pixels = new Float32Array(512 * 256 * 4); - // renderer.gl.readPixels( - // 0, 0, texture.width, texture.height, - // Texture.RGBA, Texture.FLOAT, pixels - // ); - // texture.pixels = pixels; - // texture.flipY = false; - // texture.dirty(); - // framebuffer.unbind(renderer); - - framebuffer.dispose(renderer); - - return texture; -}; - -cubemapUtil.generateNormalDistribution = function (roughnessLevels, sampleSize) { - - // http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html - // GLSL not support bit operation, use lookup instead - // V -> i / N, U -> roughness - var roughnessLevels = roughnessLevels || 256; - var sampleSize = sampleSize || 1024; - - var normalDistribution = new __WEBPACK_IMPORTED_MODULE_0__Texture2D__["a" /* default */]({ - width: roughnessLevels, - height: sampleSize, - type: __WEBPACK_IMPORTED_MODULE_2__Texture__["a" /* default */].FLOAT, - minFilter: __WEBPACK_IMPORTED_MODULE_2__Texture__["a" /* default */].NEAREST, - magFilter: __WEBPACK_IMPORTED_MODULE_2__Texture__["a" /* default */].NEAREST, - wrapS: __WEBPACK_IMPORTED_MODULE_2__Texture__["a" /* default */].CLAMP_TO_EDGE, - wrapT: __WEBPACK_IMPORTED_MODULE_2__Texture__["a" /* default */].CLAMP_TO_EDGE, - useMipmap: false - }); - var pixels = new Float32Array(sampleSize * roughnessLevels * 4); - var tmp = []; - - // function sortFunc(a, b) { - // return Math.abs(b) - Math.abs(a); - // } - for (var j = 0; j < roughnessLevels; j++) { - var roughness = j / roughnessLevels; - var a = roughness * roughness; - - for (var i = 0; i < sampleSize; i++) { - // http://holger.dammertz.org/stuff/notes_HammersleyOnHemisphere.html - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators - // http://stackoverflow.com/questions/1908492/unsigned-integer-in-javascript - // http://stackoverflow.com/questions/1822350/what-is-the-javascript-operator-and-how-do-you-use-it - var y = (i << 16 | i >>> 16) >>> 0; - y = ((y & 1431655765) << 1 | (y & 2863311530) >>> 1) >>> 0; - y = ((y & 858993459) << 2 | (y & 3435973836) >>> 2) >>> 0; - y = ((y & 252645135) << 4 | (y & 4042322160) >>> 4) >>> 0; - y = (((y & 16711935) << 8 | (y & 4278255360) >>> 8) >>> 0) / 4294967296; - - // CDF - var cosTheta = Math.sqrt((1 - y) / (1 + (a * a - 1.0) * y)); - tmp[i] = cosTheta; - } - - for (var i = 0; i < sampleSize; i++) { - var offset = (i * roughnessLevels + j) * 4; - var cosTheta = tmp[i]; - var sinTheta = Math.sqrt(1.0 - cosTheta * cosTheta); - var x = i / sampleSize; - var phi = 2.0 * Math.PI * x; - pixels[offset] = sinTheta * Math.cos(phi); - pixels[offset + 1] = cosTheta; - pixels[offset + 2] = sinTheta * Math.sin(phi); - pixels[offset + 3] = 1.0; - } - } - normalDistribution.pixels = pixels; - - return normalDistribution; -}; - -/* harmony default export */ __webpack_exports__["a"] = (cubemapUtil); - - -/***/ }), -/* 78 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__common__ = __webpack_require__(20); - - -/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - - -/** - * @class 2x2 Matrix - * @name mat2 - */ - -var mat2 = {}; - -/** - * Creates a new identity mat2 - * - * @returns {mat2} a new 2x2 matrix - */ -mat2.create = function() { - var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" /* GLMAT_ARRAY_TYPE */](4); - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 1; - return out; -}; - -/** - * Creates a new mat2 initialized with values from an existing matrix - * - * @param {mat2} a matrix to clone - * @returns {mat2} a new 2x2 matrix - */ -mat2.clone = function(a) { - var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" /* GLMAT_ARRAY_TYPE */](4); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - return out; -}; - -/** - * Copy the values from one mat2 to another - * - * @param {mat2} out the receiving matrix - * @param {mat2} a the source matrix - * @returns {mat2} out - */ -mat2.copy = function(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - return out; -}; - -/** - * Set a mat2 to the identity matrix - * - * @param {mat2} out the receiving matrix - * @returns {mat2} out - */ -mat2.identity = function(out) { - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 1; - return out; -}; - -/** - * Transpose the values of a mat2 - * - * @param {mat2} out the receiving matrix - * @param {mat2} a the source matrix - * @returns {mat2} out - */ -mat2.transpose = function(out, a) { - // If we are transposing ourselves we can skip a few steps but have to cache some values - if (out === a) { - var a1 = a[1]; - out[1] = a[2]; - out[2] = a1; - } else { - out[0] = a[0]; - out[1] = a[2]; - out[2] = a[1]; - out[3] = a[3]; - } - - return out; -}; - -/** - * Inverts a mat2 - * - * @param {mat2} out the receiving matrix - * @param {mat2} a the source matrix - * @returns {mat2} out - */ -mat2.invert = function(out, a) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], - - // Calculate the determinant - det = a0 * a3 - a2 * a1; - - if (!det) { - return null; - } - det = 1.0 / det; - - out[0] = a3 * det; - out[1] = -a1 * det; - out[2] = -a2 * det; - out[3] = a0 * det; - - return out; -}; - -/** - * Calculates the adjugate of a mat2 - * - * @param {mat2} out the receiving matrix - * @param {mat2} a the source matrix - * @returns {mat2} out - */ -mat2.adjoint = function(out, a) { - // Caching this value is nessecary if out == a - var a0 = a[0]; - out[0] = a[3]; - out[1] = -a[1]; - out[2] = -a[2]; - out[3] = a0; - - return out; -}; - -/** - * Calculates the determinant of a mat2 - * - * @param {mat2} a the source matrix - * @returns {Number} determinant of a - */ -mat2.determinant = function (a) { - return a[0] * a[3] - a[2] * a[1]; -}; - -/** - * Multiplies two mat2's - * - * @param {mat2} out the receiving matrix - * @param {mat2} a the first operand - * @param {mat2} b the second operand - * @returns {mat2} out - */ -mat2.multiply = function (out, a, b) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3]; - var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; - out[0] = a0 * b0 + a2 * b1; - out[1] = a1 * b0 + a3 * b1; - out[2] = a0 * b2 + a2 * b3; - out[3] = a1 * b2 + a3 * b3; - return out; -}; - -/** - * Alias for {@link mat2.multiply} - * @function - */ -mat2.mul = mat2.multiply; - -/** - * Rotates a mat2 by the given angle - * - * @param {mat2} out the receiving matrix - * @param {mat2} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat2} out - */ -mat2.rotate = function (out, a, rad) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], - s = Math.sin(rad), - c = Math.cos(rad); - out[0] = a0 * c + a2 * s; - out[1] = a1 * c + a3 * s; - out[2] = a0 * -s + a2 * c; - out[3] = a1 * -s + a3 * c; - return out; -}; - -/** - * Scales the mat2 by the dimensions in the given vec2 - * - * @param {mat2} out the receiving matrix - * @param {mat2} a the matrix to rotate - * @param {vec2} v the vec2 to scale the matrix by - * @returns {mat2} out - **/ -mat2.scale = function(out, a, v) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], - v0 = v[0], v1 = v[1]; - out[0] = a0 * v0; - out[1] = a1 * v0; - out[2] = a2 * v1; - out[3] = a3 * v1; - return out; -}; - -/** - * Returns Frobenius norm of a mat2 - * - * @param {mat2} a the matrix to calculate Frobenius norm of - * @returns {Number} Frobenius norm - */ -mat2.frob = function (a) { - return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2))) -}; - -/** - * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix - * @param {mat2} L the lower triangular matrix - * @param {mat2} D the diagonal matrix - * @param {mat2} U the upper triangular matrix - * @param {mat2} a the input matrix to factorize - */ - -mat2.LDU = function (L, D, U, a) { - L[2] = a[2]/a[0]; - U[0] = a[0]; - U[1] = a[1]; - U[3] = a[3] - L[2] * U[1]; - return [L, D, U]; -}; - - -/* harmony default export */ __webpack_exports__["a"] = (mat2); - -/***/ }), -/* 79 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__common__ = __webpack_require__(20); - -/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - - -/** - * @class 2x3 Matrix - * @name mat2d - * - * @description - * A mat2d contains six elements defined as: - *
- * [a, c, tx,
- *  b, d, ty]
- * 
- * This is a short form for the 3x3 matrix: - *
- * [a, c, tx,
- *  b, d, ty,
- *  0, 0, 1]
- * 
- * The last row is ignored so the array is shorter and operations are faster. - */ - -var mat2d = {}; - -/** - * Creates a new identity mat2d - * - * @returns {mat2d} a new 2x3 matrix - */ -mat2d.create = function() { - var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" /* GLMAT_ARRAY_TYPE */](6); - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 1; - out[4] = 0; - out[5] = 0; - return out; -}; - -/** - * Creates a new mat2d initialized with values from an existing matrix - * - * @param {mat2d} a matrix to clone - * @returns {mat2d} a new 2x3 matrix - */ -mat2d.clone = function(a) { - var out = new __WEBPACK_IMPORTED_MODULE_0__common__["a" /* GLMAT_ARRAY_TYPE */](6); - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - return out; -}; - -/** - * Copy the values from one mat2d to another - * - * @param {mat2d} out the receiving matrix - * @param {mat2d} a the source matrix - * @returns {mat2d} out - */ -mat2d.copy = function(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4]; - out[5] = a[5]; - return out; -}; - -/** - * Set a mat2d to the identity matrix - * - * @param {mat2d} out the receiving matrix - * @returns {mat2d} out - */ -mat2d.identity = function(out) { - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 1; - out[4] = 0; - out[5] = 0; - return out; -}; - -/** - * Inverts a mat2d - * - * @param {mat2d} out the receiving matrix - * @param {mat2d} a the source matrix - * @returns {mat2d} out - */ -mat2d.invert = function(out, a) { - var aa = a[0], ab = a[1], ac = a[2], ad = a[3], - atx = a[4], aty = a[5]; - - var det = aa * ad - ab * ac; - if(!det){ - return null; - } - det = 1.0 / det; - - out[0] = ad * det; - out[1] = -ab * det; - out[2] = -ac * det; - out[3] = aa * det; - out[4] = (ac * aty - ad * atx) * det; - out[5] = (ab * atx - aa * aty) * det; - return out; -}; - -/** - * Calculates the determinant of a mat2d - * - * @param {mat2d} a the source matrix - * @returns {Number} determinant of a - */ -mat2d.determinant = function (a) { - return a[0] * a[3] - a[1] * a[2]; -}; - -/** - * Multiplies two mat2d's - * - * @param {mat2d} out the receiving matrix - * @param {mat2d} a the first operand - * @param {mat2d} b the second operand - * @returns {mat2d} out - */ -mat2d.multiply = function (out, a, b) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5], - b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5]; - out[0] = a0 * b0 + a2 * b1; - out[1] = a1 * b0 + a3 * b1; - out[2] = a0 * b2 + a2 * b3; - out[3] = a1 * b2 + a3 * b3; - out[4] = a0 * b4 + a2 * b5 + a4; - out[5] = a1 * b4 + a3 * b5 + a5; - return out; -}; - -/** - * Alias for {@link mat2d.multiply} - * @function - */ -mat2d.mul = mat2d.multiply; - - -/** - * Rotates a mat2d by the given angle - * - * @param {mat2d} out the receiving matrix - * @param {mat2d} a the matrix to rotate - * @param {Number} rad the angle to rotate the matrix by - * @returns {mat2d} out - */ -mat2d.rotate = function (out, a, rad) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5], - s = Math.sin(rad), - c = Math.cos(rad); - out[0] = a0 * c + a2 * s; - out[1] = a1 * c + a3 * s; - out[2] = a0 * -s + a2 * c; - out[3] = a1 * -s + a3 * c; - out[4] = a4; - out[5] = a5; - return out; -}; - -/** - * Scales the mat2d by the dimensions in the given vec2 - * - * @param {mat2d} out the receiving matrix - * @param {mat2d} a the matrix to translate - * @param {vec2} v the vec2 to scale the matrix by - * @returns {mat2d} out - **/ -mat2d.scale = function(out, a, v) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5], - v0 = v[0], v1 = v[1]; - out[0] = a0 * v0; - out[1] = a1 * v0; - out[2] = a2 * v1; - out[3] = a3 * v1; - out[4] = a4; - out[5] = a5; - return out; -}; - -/** - * Translates the mat2d by the dimensions in the given vec2 - * - * @param {mat2d} out the receiving matrix - * @param {mat2d} a the matrix to translate - * @param {vec2} v the vec2 to translate the matrix by - * @returns {mat2d} out - **/ -mat2d.translate = function(out, a, v) { - var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5], - v0 = v[0], v1 = v[1]; - out[0] = a0; - out[1] = a1; - out[2] = a2; - out[3] = a3; - out[4] = a0 * v0 + a2 * v1 + a4; - out[5] = a1 * v0 + a3 * v1 + a5; - return out; -}; - -/** - * Returns Frobenius norm of a mat2d - * - * @param {mat2d} a the matrix to calculate Frobenius norm of - * @returns {Number} Frobenius norm - */ -mat2d.frob = function (a) { - return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + 1)) -}; - - -/* harmony default export */ __webpack_exports__["a"] = (mat2d); - -/***/ }), -/* 80 */ -/***/ (function(module, exports) { - -var _default = typeof window !== 'undefined' && (window.requestAnimationFrame && window.requestAnimationFrame.bind(window) || // https://github.com/ecomfe/zrender/issues/189#issuecomment-224919809 -window.msRequestAnimationFrame && window.msRequestAnimationFrame.bind(window) || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame) || function (func) { - setTimeout(func, 16); -}; - -module.exports = _default; - -/***/ }), -/* 81 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_claygl_src_Texture2D__ = __webpack_require__(5); -/** - * Texture Atlas for the sprites. - * It uses zrender for 2d element management and rendering - * @module echarts-gl/util/ZRTextureAtlasSurface - */ - -// TODO Expand. - - - -function ZRTextureAtlasSurfaceNode(zr, offsetX, offsetY, width, height, gap, dpr) { - this._zr = zr; - - /** - * Current cursor x - * @type {number} - * @private - */ - this._x = 0; - - /** - * Current cursor y - * @type {number} - */ - this._y = 0; - - this._rowHeight = 0; - /** - * width without dpr. - * @type {number} - * @private - */ - this.width = width; - - /** - * height without dpr. - * @type {number} - * @private - */ - this.height = height; - - /** - * offsetX without dpr - * @type {number} - */ - this.offsetX = offsetX; - /** - * offsetY without dpr - * @type {number} - */ - this.offsetY = offsetY; - - this.dpr = dpr; - - this.gap = gap; -} - -ZRTextureAtlasSurfaceNode.prototype = { - - constructor: ZRTextureAtlasSurfaceNode, - - clear: function () { - this._x = 0; - this._y = 0; - this._rowHeight = 0; - }, - - /** - * Add shape to atlas - * @param {module:zrender/graphic/Displayable} shape - * @param {number} width - * @param {number} height - * @return {Array} - */ - add: function (el, width, height) { - // FIXME Text element not consider textAlign and textVerticalAlign. - - // TODO, inner text, shadow - var rect = el.getBoundingRect(); - - // FIXME aspect ratio - if (width == null) { - width = rect.width; - } - if (height == null) { - height = rect.height; - } - width *= this.dpr; - height *= this.dpr; - - this._fitElement(el, width, height); - - // var aspect = el.scale[1] / el.scale[0]; - // Adjust aspect ratio to make the text more clearly - // FIXME If height > width, width is useless ? - // width = height * aspect; - // el.position[0] *= aspect; - // el.scale[0] = el.scale[1]; - - var x = this._x; - var y = this._y; - - var canvasWidth = this.width * this.dpr; - var canvasHeight = this.height * this.dpr; - var gap = this.gap; - - if (x + width + gap > canvasWidth) { - // Change a new row - x = this._x = 0; - y += this._rowHeight + gap; - this._y = y; - // Reset row height - this._rowHeight = 0; - } - - this._x += width + gap; - - this._rowHeight = Math.max(this._rowHeight, height); - - if (y + height + gap > canvasHeight) { - // There is no space anymore - return null; - } - - // Shift the el - el.position[0] += this.offsetX * this.dpr + x; - el.position[1] += this.offsetY * this.dpr + y; - - this._zr.add(el); - - var coordsOffset = [ - this.offsetX / this.width, - this.offsetY / this.height - ]; - var coords = [ - [x / canvasWidth + coordsOffset[0], y / canvasHeight + coordsOffset[1]], - [(x + width) / canvasWidth + coordsOffset[0], (y + height) / canvasHeight + coordsOffset[1]] - ]; - - return coords; - }, - - /** - * Fit element size by correct its position and scaling - * @param {module:zrender/graphic/Displayable} el - * @param {number} spriteWidth - * @param {number} spriteHeight - */ - _fitElement: function (el, spriteWidth, spriteHeight) { - // TODO, inner text, shadow - var rect = el.getBoundingRect(); - - var scaleX = spriteWidth / rect.width; - var scaleY = spriteHeight / rect.height; - el.position = [-rect.x * scaleX, -rect.y * scaleY]; - el.scale = [scaleX, scaleY]; - el.update(); - } -} -/** - * constructor - * @alias module:echarts-gl/util/ZRTextureAtlasSurface - * @param {number} opt.width - * @param {number} opt.height - * @param {number} opt.devicePixelRatio - * @param {number} opt.gap Gap for safe. - * @param {Function} opt.onupdate - */ -function ZRTextureAtlasSurface (opt) { - - opt = opt || {}; - opt.width = opt.width || 512; - opt.height = opt.height || 512; - opt.devicePixelRatio = opt.devicePixelRatio || 1; - opt.gap = opt.gap == null ? 2 : opt.gap; - - var canvas = document.createElement('canvas'); - canvas.width = opt.width * opt.devicePixelRatio; - canvas.height = opt.height * opt.devicePixelRatio; - - this._canvas = canvas; - - this._texture = new __WEBPACK_IMPORTED_MODULE_1_claygl_src_Texture2D__["a" /* default */]({ - image: canvas, - flipY: false - }); - - var self = this; - /** - * zrender instance in the Chart - * @type {zrender~ZRender} - */ - this._zr = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.zrender.init(canvas); - var oldRefreshImmediately = this._zr.refreshImmediately; - this._zr.refreshImmediately = function () { - oldRefreshImmediately.call(this); - self._texture.dirty(); - self.onupdate && self.onupdate(); - }; - - this._dpr = opt.devicePixelRatio; - - /** - * Texture coords map for each sprite image - * @type {Object} - */ - this._coords = {}; - - this.onupdate = opt.onupdate; - - this._gap = opt.gap; - - // Left sub atlas. - this._textureAtlasNodes = [new ZRTextureAtlasSurfaceNode( - this._zr, 0, 0, opt.width, opt.height, this._gap, this._dpr - )]; - - this._nodeWidth = opt.width; - this._nodeHeight = opt.height; - - this._currentNodeIdx = 0; -} - -ZRTextureAtlasSurface.prototype = { - - /** - * Clear the texture atlas - */ - clear: function () { - - for (var i = 0; i < this._textureAtlasNodes.length; i++) { - this._textureAtlasNodes[i].clear(); - } - - this._currentNodeIdx = 0; - - this._zr.clear(); - this._coords = {}; - }, - - /** - * @return {number} - */ - getWidth: function () { - return this._width; - }, - - /** - * @return {number} - */ - getHeight: function () { - return this._height; - }, - - /** - * @return {number} - */ - getTexture: function () { - return this._texture; - }, - - /** - * @return {number} - */ - getDevicePixelRatio: function () { - return this._dpr; - }, - - getZr: function () { - return this._zr; - }, - - _getCurrentNode: function () { - return this._textureAtlasNodes[this._currentNodeIdx]; - }, - - _expand: function () { - this._currentNodeIdx++; - if (this._textureAtlasNodes[this._currentNodeIdx]) { - // Use the node created previously. - return this._textureAtlasNodes[this._currentNodeIdx]; - } - - var maxSize = 4096 / this._dpr; - var textureAtlasNodes = this._textureAtlasNodes; - var nodeLen = textureAtlasNodes.length; - var offsetX = (nodeLen * this._nodeWidth) % maxSize; - var offsetY = Math.floor(nodeLen * this._nodeWidth / maxSize) * this._nodeHeight; - if (offsetY >= maxSize) { - // Failed if image is too large. - if (true) { - console.error('Too much labels. Some will be ignored.'); - } - return; - } - - var width = (offsetX + this._nodeWidth) * this._dpr; - var height = (offsetY + this._nodeHeight) * this._dpr; - try { - // Resize will error in node. - this._zr.resize({ - width: width, - height: height - }); - } - catch (e) { - this._canvas.width = width; - this._canvas.height = height; - } - - var newNode = new ZRTextureAtlasSurfaceNode( - this._zr, offsetX, offsetY, this._nodeWidth, this._nodeHeight, this._gap, this._dpr - ); - this._textureAtlasNodes.push(newNode); - - return newNode; - }, - - add: function (el, width, height) { - if (this._coords[el.id]) { - if (true) { - console.warn('Element already been add'); - } - return this._coords[el.id]; - } - var coords = this._getCurrentNode().add(el, width, height); - if (!coords) { - var newNode = this._expand(); - if (!newNode) { - // To maximum - return; - } - coords = newNode.add(el, width, height); - } - - this._coords[el.id] = coords; - - return coords; - }, - - /** - * Get coord scale after texture atlas is expanded. - * @return {Array.} - */ - getCoordsScale: function () { - var dpr = this._dpr; - return [this._nodeWidth / this._canvas.width * dpr, this._nodeHeight / this._canvas.height * dpr]; - }, - - /** - * Get texture coords of sprite image - * @param {string} id Image id - * @return {Array} - */ - getCoords: function (id) { - return this._coords[id]; - } -}; - -/* harmony default export */ __webpack_exports__["a"] = (ZRTextureAtlasSurface); - -/***/ }), -/* 82 */ -/***/ (function(module, exports, __webpack_require__) { - -var vec2 = __webpack_require__(83); - -var matrix = __webpack_require__(84); - -/** - * @module echarts/core/BoundingRect - */ -var v2ApplyTransform = vec2.applyTransform; -var mathMin = Math.min; -var mathMax = Math.max; -/** - * @alias module:echarts/core/BoundingRect - */ - -function BoundingRect(x, y, width, height) { - if (width < 0) { - x = x + width; - width = -width; - } - - if (height < 0) { - y = y + height; - height = -height; - } - /** - * @type {number} - */ - - - this.x = x; - /** - * @type {number} - */ - - this.y = y; - /** - * @type {number} - */ - - this.width = width; - /** - * @type {number} - */ - - this.height = height; -} - -BoundingRect.prototype = { - constructor: BoundingRect, - - /** - * @param {module:echarts/core/BoundingRect} other - */ - union: function (other) { - var x = mathMin(other.x, this.x); - var y = mathMin(other.y, this.y); - this.width = mathMax(other.x + other.width, this.x + this.width) - x; - this.height = mathMax(other.y + other.height, this.y + this.height) - y; - this.x = x; - this.y = y; - }, - - /** - * @param {Array.} m - * @methods - */ - applyTransform: function () { - var lt = []; - var rb = []; - var lb = []; - var rt = []; - return function (m) { - // In case usage like this - // el.getBoundingRect().applyTransform(el.transform) - // And element has no transform - if (!m) { - return; - } - - lt[0] = lb[0] = this.x; - lt[1] = rt[1] = this.y; - rb[0] = rt[0] = this.x + this.width; - rb[1] = lb[1] = this.y + this.height; - v2ApplyTransform(lt, lt, m); - v2ApplyTransform(rb, rb, m); - v2ApplyTransform(lb, lb, m); - v2ApplyTransform(rt, rt, m); - this.x = mathMin(lt[0], rb[0], lb[0], rt[0]); - this.y = mathMin(lt[1], rb[1], lb[1], rt[1]); - var maxX = mathMax(lt[0], rb[0], lb[0], rt[0]); - var maxY = mathMax(lt[1], rb[1], lb[1], rt[1]); - this.width = maxX - this.x; - this.height = maxY - this.y; - }; - }(), - - /** - * Calculate matrix of transforming from self to target rect - * @param {module:zrender/core/BoundingRect} b - * @return {Array.} - */ - calculateTransform: function (b) { - var a = this; - var sx = b.width / a.width; - var sy = b.height / a.height; - var m = matrix.create(); // 矩阵右乘 - - matrix.translate(m, m, [-a.x, -a.y]); - matrix.scale(m, m, [sx, sy]); - matrix.translate(m, m, [b.x, b.y]); - return m; - }, - - /** - * @param {(module:echarts/core/BoundingRect|Object)} b - * @return {boolean} - */ - intersect: function (b) { - if (!b) { - return false; - } - - if (!(b instanceof BoundingRect)) { - // Normalize negative width/height. - b = BoundingRect.create(b); - } - - var a = this; - var ax0 = a.x; - var ax1 = a.x + a.width; - var ay0 = a.y; - var ay1 = a.y + a.height; - var bx0 = b.x; - var bx1 = b.x + b.width; - var by0 = b.y; - var by1 = b.y + b.height; - return !(ax1 < bx0 || bx1 < ax0 || ay1 < by0 || by1 < ay0); - }, - contain: function (x, y) { - var rect = this; - return x >= rect.x && x <= rect.x + rect.width && y >= rect.y && y <= rect.y + rect.height; - }, - - /** - * @return {module:echarts/core/BoundingRect} - */ - clone: function () { - return new BoundingRect(this.x, this.y, this.width, this.height); - }, - - /** - * Copy from another rect - */ - copy: function (other) { - this.x = other.x; - this.y = other.y; - this.width = other.width; - this.height = other.height; - }, - plain: function () { - return { - x: this.x, - y: this.y, - width: this.width, - height: this.height - }; - } -}; -/** - * @param {Object|module:zrender/core/BoundingRect} rect - * @param {number} rect.x - * @param {number} rect.y - * @param {number} rect.width - * @param {number} rect.height - * @return {module:zrender/core/BoundingRect} - */ - -BoundingRect.create = function (rect) { - return new BoundingRect(rect.x, rect.y, rect.width, rect.height); -}; - -var _default = BoundingRect; -module.exports = _default; - -/***/ }), -/* 83 */ -/***/ (function(module, exports) { - -var ArrayCtor = typeof Float32Array === 'undefined' ? Array : Float32Array; -/** - * 创建一个向量 - * @param {number} [x=0] - * @param {number} [y=0] - * @return {Vector2} - */ - -function create(x, y) { - var out = new ArrayCtor(2); - - if (x == null) { - x = 0; - } - - if (y == null) { - y = 0; - } - - out[0] = x; - out[1] = y; - return out; -} -/** - * 复制向量数据 - * @param {Vector2} out - * @param {Vector2} v - * @return {Vector2} - */ - - -function copy(out, v) { - out[0] = v[0]; - out[1] = v[1]; - return out; -} -/** - * 克隆一个向量 - * @param {Vector2} v - * @return {Vector2} - */ - - -function clone(v) { - var out = new ArrayCtor(2); - out[0] = v[0]; - out[1] = v[1]; - return out; -} -/** - * 设置向量的两个项 - * @param {Vector2} out - * @param {number} a - * @param {number} b - * @return {Vector2} 结果 - */ - - -function set(out, a, b) { - out[0] = a; - out[1] = b; - return out; -} -/** - * 向量相加 - * @param {Vector2} out - * @param {Vector2} v1 - * @param {Vector2} v2 - */ - - -function add(out, v1, v2) { - out[0] = v1[0] + v2[0]; - out[1] = v1[1] + v2[1]; - return out; -} -/** - * 向量缩放后相加 - * @param {Vector2} out - * @param {Vector2} v1 - * @param {Vector2} v2 - * @param {number} a - */ - - -function scaleAndAdd(out, v1, v2, a) { - out[0] = v1[0] + v2[0] * a; - out[1] = v1[1] + v2[1] * a; - return out; -} -/** - * 向量相减 - * @param {Vector2} out - * @param {Vector2} v1 - * @param {Vector2} v2 - */ - - -function sub(out, v1, v2) { - out[0] = v1[0] - v2[0]; - out[1] = v1[1] - v2[1]; - return out; -} -/** - * 向量长度 - * @param {Vector2} v - * @return {number} - */ - - -function len(v) { - return Math.sqrt(lenSquare(v)); -} - -var length = len; // jshint ignore:line - -/** - * 向量长度平方 - * @param {Vector2} v - * @return {number} - */ - -function lenSquare(v) { - return v[0] * v[0] + v[1] * v[1]; -} - -var lengthSquare = lenSquare; -/** - * 向量乘法 - * @param {Vector2} out - * @param {Vector2} v1 - * @param {Vector2} v2 - */ - -function mul(out, v1, v2) { - out[0] = v1[0] * v2[0]; - out[1] = v1[1] * v2[1]; - return out; -} -/** - * 向量除法 - * @param {Vector2} out - * @param {Vector2} v1 - * @param {Vector2} v2 - */ - - -function div(out, v1, v2) { - out[0] = v1[0] / v2[0]; - out[1] = v1[1] / v2[1]; - return out; -} -/** - * 向量点乘 - * @param {Vector2} v1 - * @param {Vector2} v2 - * @return {number} - */ - - -function dot(v1, v2) { - return v1[0] * v2[0] + v1[1] * v2[1]; -} -/** - * 向量缩放 - * @param {Vector2} out - * @param {Vector2} v - * @param {number} s - */ - - -function scale(out, v, s) { - out[0] = v[0] * s; - out[1] = v[1] * s; - return out; -} -/** - * 向量归一化 - * @param {Vector2} out - * @param {Vector2} v - */ - - -function normalize(out, v) { - var d = len(v); - - if (d === 0) { - out[0] = 0; - out[1] = 0; - } else { - out[0] = v[0] / d; - out[1] = v[1] / d; - } - - return out; -} -/** - * 计算向量间距离 - * @param {Vector2} v1 - * @param {Vector2} v2 - * @return {number} - */ - - -function distance(v1, v2) { - return Math.sqrt((v1[0] - v2[0]) * (v1[0] - v2[0]) + (v1[1] - v2[1]) * (v1[1] - v2[1])); -} - -var dist = distance; -/** - * 向量距离平方 - * @param {Vector2} v1 - * @param {Vector2} v2 - * @return {number} - */ - -function distanceSquare(v1, v2) { - return (v1[0] - v2[0]) * (v1[0] - v2[0]) + (v1[1] - v2[1]) * (v1[1] - v2[1]); -} - -var distSquare = distanceSquare; -/** - * 求负向量 - * @param {Vector2} out - * @param {Vector2} v - */ - -function negate(out, v) { - out[0] = -v[0]; - out[1] = -v[1]; - return out; -} -/** - * 插值两个点 - * @param {Vector2} out - * @param {Vector2} v1 - * @param {Vector2} v2 - * @param {number} t - */ - - -function lerp(out, v1, v2, t) { - out[0] = v1[0] + t * (v2[0] - v1[0]); - out[1] = v1[1] + t * (v2[1] - v1[1]); - return out; -} -/** - * 矩阵左乘向量 - * @param {Vector2} out - * @param {Vector2} v - * @param {Vector2} m - */ - - -function applyTransform(out, v, m) { - var x = v[0]; - var y = v[1]; - out[0] = m[0] * x + m[2] * y + m[4]; - out[1] = m[1] * x + m[3] * y + m[5]; - return out; -} -/** - * 求两个向量最小值 - * @param {Vector2} out - * @param {Vector2} v1 - * @param {Vector2} v2 - */ - - -function min(out, v1, v2) { - out[0] = Math.min(v1[0], v2[0]); - out[1] = Math.min(v1[1], v2[1]); - return out; -} -/** - * 求两个向量最大值 - * @param {Vector2} out - * @param {Vector2} v1 - * @param {Vector2} v2 - */ - - -function max(out, v1, v2) { - out[0] = Math.max(v1[0], v2[0]); - out[1] = Math.max(v1[1], v2[1]); - return out; -} - -exports.create = create; -exports.copy = copy; -exports.clone = clone; -exports.set = set; -exports.add = add; -exports.scaleAndAdd = scaleAndAdd; -exports.sub = sub; -exports.len = len; -exports.length = length; -exports.lenSquare = lenSquare; -exports.lengthSquare = lengthSquare; -exports.mul = mul; -exports.div = div; -exports.dot = dot; -exports.scale = scale; -exports.normalize = normalize; -exports.distance = distance; -exports.dist = dist; -exports.distanceSquare = distanceSquare; -exports.distSquare = distSquare; -exports.negate = negate; -exports.lerp = lerp; -exports.applyTransform = applyTransform; -exports.min = min; -exports.max = max; - -/***/ }), -/* 84 */ -/***/ (function(module, exports) { - -/** - * 3x2矩阵操作类 - * @exports zrender/tool/matrix - */ -var ArrayCtor = typeof Float32Array === 'undefined' ? Array : Float32Array; -/** - * Create a identity matrix. - * @return {Float32Array|Array.} - */ - -function create() { - var out = new ArrayCtor(6); - identity(out); - return out; -} -/** - * 设置矩阵为单位矩阵 - * @param {Float32Array|Array.} out - */ - - -function identity(out) { - out[0] = 1; - out[1] = 0; - out[2] = 0; - out[3] = 1; - out[4] = 0; - out[5] = 0; - return out; -} -/** - * 复制矩阵 - * @param {Float32Array|Array.} out - * @param {Float32Array|Array.} m - */ - - -function copy(out, m) { - out[0] = m[0]; - out[1] = m[1]; - out[2] = m[2]; - out[3] = m[3]; - out[4] = m[4]; - out[5] = m[5]; - return out; -} -/** - * 矩阵相乘 - * @param {Float32Array|Array.} out - * @param {Float32Array|Array.} m1 - * @param {Float32Array|Array.} m2 - */ - - -function mul(out, m1, m2) { - // Consider matrix.mul(m, m2, m); - // where out is the same as m2. - // So use temp variable to escape error. - var out0 = m1[0] * m2[0] + m1[2] * m2[1]; - var out1 = m1[1] * m2[0] + m1[3] * m2[1]; - var out2 = m1[0] * m2[2] + m1[2] * m2[3]; - var out3 = m1[1] * m2[2] + m1[3] * m2[3]; - var out4 = m1[0] * m2[4] + m1[2] * m2[5] + m1[4]; - var out5 = m1[1] * m2[4] + m1[3] * m2[5] + m1[5]; - out[0] = out0; - out[1] = out1; - out[2] = out2; - out[3] = out3; - out[4] = out4; - out[5] = out5; - return out; -} -/** - * 平移变换 - * @param {Float32Array|Array.} out - * @param {Float32Array|Array.} a - * @param {Float32Array|Array.} v - */ - - -function translate(out, a, v) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - out[4] = a[4] + v[0]; - out[5] = a[5] + v[1]; - return out; -} -/** - * 旋转变换 - * @param {Float32Array|Array.} out - * @param {Float32Array|Array.} a - * @param {number} rad - */ - - -function rotate(out, a, rad) { - var aa = a[0]; - var ac = a[2]; - var atx = a[4]; - var ab = a[1]; - var ad = a[3]; - var aty = a[5]; - var st = Math.sin(rad); - var ct = Math.cos(rad); - out[0] = aa * ct + ab * st; - out[1] = -aa * st + ab * ct; - out[2] = ac * ct + ad * st; - out[3] = -ac * st + ct * ad; - out[4] = ct * atx + st * aty; - out[5] = ct * aty - st * atx; - return out; -} -/** - * 缩放变换 - * @param {Float32Array|Array.} out - * @param {Float32Array|Array.} a - * @param {Float32Array|Array.} v - */ - - -function scale(out, a, v) { - var vx = v[0]; - var vy = v[1]; - out[0] = a[0] * vx; - out[1] = a[1] * vy; - out[2] = a[2] * vx; - out[3] = a[3] * vy; - out[4] = a[4] * vx; - out[5] = a[5] * vy; - return out; -} -/** - * 求逆矩阵 - * @param {Float32Array|Array.} out - * @param {Float32Array|Array.} a - */ - - -function invert(out, a) { - var aa = a[0]; - var ac = a[2]; - var atx = a[4]; - var ab = a[1]; - var ad = a[3]; - var aty = a[5]; - var det = aa * ad - ab * ac; - - if (!det) { - return null; - } - - det = 1.0 / det; - out[0] = ad * det; - out[1] = -ab * det; - out[2] = -ac * det; - out[3] = aa * det; - out[4] = (ac * aty - ad * atx) * det; - out[5] = (ab * atx - aa * aty) * det; - return out; -} -/** - * Clone a new matrix. - * @param {Float32Array|Array.} a - */ - - -function clone(a) { - var b = create(); - copy(b, a); - return b; -} - -exports.create = create; -exports.identity = identity; -exports.copy = copy; -exports.mul = mul; -exports.translate = translate; -exports.rotate = rotate; -exports.scale = scale; -exports.invert = invert; -exports.clone = clone; - -/***/ }), -/* 85 */ -/***/ (function(module, exports, __webpack_require__) { - -var zrUtil = __webpack_require__(13); - -/* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -*/ -var RADIAN_EPSILON = 1e-4; - -function _trim(str) { - return str.replace(/^\s+/, '').replace(/\s+$/, ''); -} -/** - * Linear mapping a value from domain to range - * @memberOf module:echarts/util/number - * @param {(number|Array.)} val - * @param {Array.} domain Domain extent domain[0] can be bigger than domain[1] - * @param {Array.} range Range extent range[0] can be bigger than range[1] - * @param {boolean} clamp - * @return {(number|Array.} - */ - - -function linearMap(val, domain, range, clamp) { - var subDomain = domain[1] - domain[0]; - var subRange = range[1] - range[0]; - - if (subDomain === 0) { - return subRange === 0 ? range[0] : (range[0] + range[1]) / 2; - } // Avoid accuracy problem in edge, such as - // 146.39 - 62.83 === 83.55999999999999. - // See echarts/test/ut/spec/util/number.js#linearMap#accuracyError - // It is a little verbose for efficiency considering this method - // is a hotspot. - - - if (clamp) { - if (subDomain > 0) { - if (val <= domain[0]) { - return range[0]; - } else if (val >= domain[1]) { - return range[1]; - } - } else { - if (val >= domain[0]) { - return range[0]; - } else if (val <= domain[1]) { - return range[1]; - } - } - } else { - if (val === domain[0]) { - return range[0]; - } - - if (val === domain[1]) { - return range[1]; - } - } - - return (val - domain[0]) / subDomain * subRange + range[0]; -} -/** - * Convert a percent string to absolute number. - * Returns NaN if percent is not a valid string or number - * @memberOf module:echarts/util/number - * @param {string|number} percent - * @param {number} all - * @return {number} - */ - - -function parsePercent(percent, all) { - switch (percent) { - case 'center': - case 'middle': - percent = '50%'; - break; - - case 'left': - case 'top': - percent = '0%'; - break; - - case 'right': - case 'bottom': - percent = '100%'; - break; - } - - if (typeof percent === 'string') { - if (_trim(percent).match(/%$/)) { - return parseFloat(percent) / 100 * all; - } - - return parseFloat(percent); - } - - return percent == null ? NaN : +percent; -} -/** - * (1) Fix rounding error of float numbers. - * (2) Support return string to avoid scientific notation like '3.5e-7'. - * - * @param {number} x - * @param {number} [precision] - * @param {boolean} [returnStr] - * @return {number|string} - */ - - -function round(x, precision, returnStr) { - if (precision == null) { - precision = 10; - } // Avoid range error - - - precision = Math.min(Math.max(0, precision), 20); - x = (+x).toFixed(precision); - return returnStr ? x : +x; -} - -function asc(arr) { - arr.sort(function (a, b) { - return a - b; - }); - return arr; -} -/** - * Get precision - * @param {number} val - */ - - -function getPrecision(val) { - val = +val; - - if (isNaN(val)) { - return 0; - } // It is much faster than methods converting number to string as follows - // var tmp = val.toString(); - // return tmp.length - 1 - tmp.indexOf('.'); - // especially when precision is low - - - var e = 1; - var count = 0; - - while (Math.round(val * e) / e !== val) { - e *= 10; - count++; - } - - return count; -} -/** - * @param {string|number} val - * @return {number} - */ - - -function getPrecisionSafe(val) { - var str = val.toString(); // Consider scientific notation: '3.4e-12' '3.4e+12' - - var eIndex = str.indexOf('e'); - - if (eIndex > 0) { - var precision = +str.slice(eIndex + 1); - return precision < 0 ? -precision : 0; - } else { - var dotIndex = str.indexOf('.'); - return dotIndex < 0 ? 0 : str.length - 1 - dotIndex; - } -} -/** - * Minimal dicernible data precisioin according to a single pixel. - * - * @param {Array.} dataExtent - * @param {Array.} pixelExtent - * @return {number} precision - */ - - -function getPixelPrecision(dataExtent, pixelExtent) { - var log = Math.log; - var LN10 = Math.LN10; - var dataQuantity = Math.floor(log(dataExtent[1] - dataExtent[0]) / LN10); - var sizeQuantity = Math.round(log(Math.abs(pixelExtent[1] - pixelExtent[0])) / LN10); // toFixed() digits argument must be between 0 and 20. - - var precision = Math.min(Math.max(-dataQuantity + sizeQuantity, 0), 20); - return !isFinite(precision) ? 20 : precision; -} -/** - * Get a data of given precision, assuring the sum of percentages - * in valueList is 1. - * The largest remainer method is used. - * https://en.wikipedia.org/wiki/Largest_remainder_method - * - * @param {Array.} valueList a list of all data - * @param {number} idx index of the data to be processed in valueList - * @param {number} precision integer number showing digits of precision - * @return {number} percent ranging from 0 to 100 - */ - - -function getPercentWithPrecision(valueList, idx, precision) { - if (!valueList[idx]) { - return 0; - } - - var sum = zrUtil.reduce(valueList, function (acc, val) { - return acc + (isNaN(val) ? 0 : val); - }, 0); - - if (sum === 0) { - return 0; - } - - var digits = Math.pow(10, precision); - var votesPerQuota = zrUtil.map(valueList, function (val) { - return (isNaN(val) ? 0 : val) / sum * digits * 100; - }); - var targetSeats = digits * 100; - var seats = zrUtil.map(votesPerQuota, function (votes) { - // Assign automatic seats. - return Math.floor(votes); - }); - var currentSum = zrUtil.reduce(seats, function (acc, val) { - return acc + val; - }, 0); - var remainder = zrUtil.map(votesPerQuota, function (votes, idx) { - return votes - seats[idx]; - }); // Has remainding votes. - - while (currentSum < targetSeats) { - // Find next largest remainder. - var max = Number.NEGATIVE_INFINITY; - var maxId = null; - - for (var i = 0, len = remainder.length; i < len; ++i) { - if (remainder[i] > max) { - max = remainder[i]; - maxId = i; - } - } // Add a vote to max remainder. - - - ++seats[maxId]; - remainder[maxId] = 0; - ++currentSum; - } - - return seats[idx] / digits; -} // Number.MAX_SAFE_INTEGER, ie do not support. - - -var MAX_SAFE_INTEGER = 9007199254740991; -/** - * To 0 - 2 * PI, considering negative radian. - * @param {number} radian - * @return {number} - */ - -function remRadian(radian) { - var pi2 = Math.PI * 2; - return (radian % pi2 + pi2) % pi2; -} -/** - * @param {type} radian - * @return {boolean} - */ - - -function isRadianAroundZero(val) { - return val > -RADIAN_EPSILON && val < RADIAN_EPSILON; -} - -var TIME_REG = /^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d\d)(?::(\d\d)(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/; // jshint ignore:line - -/** - * @param {string|Date|number} value These values can be accepted: - * + An instance of Date, represent a time in its own time zone. - * + Or string in a subset of ISO 8601, only including: - * + only year, month, date: '2012-03', '2012-03-01', '2012-03-01 05', '2012-03-01 05:06', - * + separated with T or space: '2012-03-01T12:22:33.123', '2012-03-01 12:22:33.123', - * + time zone: '2012-03-01T12:22:33Z', '2012-03-01T12:22:33+8000', '2012-03-01T12:22:33-05:00', - * all of which will be treated as local time if time zone is not specified - * (see ). - * + Or other string format, including (all of which will be treated as loacal time): - * '2012', '2012-3-1', '2012/3/1', '2012/03/01', - * '2009/6/12 2:00', '2009/6/12 2:05:08', '2009/6/12 2:05:08.123' - * + a timestamp, which represent a time in UTC. - * @return {Date} date - */ - -function parseDate(value) { - if (value instanceof Date) { - return value; - } else if (typeof value === 'string') { - // Different browsers parse date in different way, so we parse it manually. - // Some other issues: - // new Date('1970-01-01') is UTC, - // new Date('1970/01/01') and new Date('1970-1-01') is local. - // See issue #3623 - var match = TIME_REG.exec(value); - - if (!match) { - // return Invalid Date. - return new Date(NaN); - } // Use local time when no timezone offset specifed. - - - if (!match[8]) { - // match[n] can only be string or undefined. - // But take care of '12' + 1 => '121'. - return new Date(+match[1], +(match[2] || 1) - 1, +match[3] || 1, +match[4] || 0, +(match[5] || 0), +match[6] || 0, +match[7] || 0); - } // Timezoneoffset of Javascript Date has considered DST (Daylight Saving Time, - // https://tc39.github.io/ecma262/#sec-daylight-saving-time-adjustment). - // For example, system timezone is set as "Time Zone: America/Toronto", - // then these code will get different result: - // `new Date(1478411999999).getTimezoneOffset(); // get 240` - // `new Date(1478412000000).getTimezoneOffset(); // get 300` - // So we should not use `new Date`, but use `Date.UTC`. - else { - var hour = +match[4] || 0; - - if (match[8].toUpperCase() !== 'Z') { - hour -= match[8].slice(0, 3); - } - - return new Date(Date.UTC(+match[1], +(match[2] || 1) - 1, +match[3] || 1, hour, +(match[5] || 0), +match[6] || 0, +match[7] || 0)); - } - } else if (value == null) { - return new Date(NaN); - } - - return new Date(Math.round(value)); -} -/** - * Quantity of a number. e.g. 0.1, 1, 10, 100 - * - * @param {number} val - * @return {number} - */ - - -function quantity(val) { - return Math.pow(10, quantityExponent(val)); -} - -function quantityExponent(val) { - return Math.floor(Math.log(val) / Math.LN10); -} -/** - * find a “nice” number approximately equal to x. Round the number if round = true, - * take ceiling if round = false. The primary observation is that the “nicest” - * numbers in decimal are 1, 2, and 5, and all power-of-ten multiples of these numbers. - * - * See "Nice Numbers for Graph Labels" of Graphic Gems. - * - * @param {number} val Non-negative value. - * @param {boolean} round - * @return {number} - */ - - -function nice(val, round) { - var exponent = quantityExponent(val); - var exp10 = Math.pow(10, exponent); - var f = val / exp10; // 1 <= f < 10 - - var nf; - - if (round) { - if (f < 1.5) { - nf = 1; - } else if (f < 2.5) { - nf = 2; - } else if (f < 4) { - nf = 3; - } else if (f < 7) { - nf = 5; - } else { - nf = 10; - } - } else { - if (f < 1) { - nf = 1; - } else if (f < 2) { - nf = 2; - } else if (f < 3) { - nf = 3; - } else if (f < 5) { - nf = 5; - } else { - nf = 10; - } - } - - val = nf * exp10; // Fix 3 * 0.1 === 0.30000000000000004 issue (see IEEE 754). - // 20 is the uppper bound of toFixed. - - return exponent >= -20 ? +val.toFixed(exponent < 0 ? -exponent : 0) : val; -} -/** - * Order intervals asc, and split them when overlap. - * expect(numberUtil.reformIntervals([ - * {interval: [18, 62], close: [1, 1]}, - * {interval: [-Infinity, -70], close: [0, 0]}, - * {interval: [-70, -26], close: [1, 1]}, - * {interval: [-26, 18], close: [1, 1]}, - * {interval: [62, 150], close: [1, 1]}, - * {interval: [106, 150], close: [1, 1]}, - * {interval: [150, Infinity], close: [0, 0]} - * ])).toEqual([ - * {interval: [-Infinity, -70], close: [0, 0]}, - * {interval: [-70, -26], close: [1, 1]}, - * {interval: [-26, 18], close: [0, 1]}, - * {interval: [18, 62], close: [0, 1]}, - * {interval: [62, 150], close: [0, 1]}, - * {interval: [150, Infinity], close: [0, 0]} - * ]); - * @param {Array.} list, where `close` mean open or close - * of the interval, and Infinity can be used. - * @return {Array.} The origin list, which has been reformed. - */ - - -function reformIntervals(list) { - list.sort(function (a, b) { - return littleThan(a, b, 0) ? -1 : 1; - }); - var curr = -Infinity; - var currClose = 1; - - for (var i = 0; i < list.length;) { - var interval = list[i].interval; - var close = list[i].close; - - for (var lg = 0; lg < 2; lg++) { - if (interval[lg] <= curr) { - interval[lg] = curr; - close[lg] = !lg ? 1 - currClose : 1; - } - - curr = interval[lg]; - currClose = close[lg]; - } - - if (interval[0] === interval[1] && close[0] * close[1] !== 1) { - list.splice(i, 1); - } else { - i++; - } - } - - return list; - - function littleThan(a, b, lg) { - return a.interval[lg] < b.interval[lg] || a.interval[lg] === b.interval[lg] && (a.close[lg] - b.close[lg] === (!lg ? 1 : -1) || !lg && littleThan(a, b, 1)); - } -} -/** - * parseFloat NaNs numeric-cast false positives (null|true|false|"") - * ...but misinterprets leading-number strings, particularly hex literals ("0x...") - * subtraction forces infinities to NaN - * - * @param {*} v - * @return {boolean} - */ - - -function isNumeric(v) { - return v - parseFloat(v) >= 0; -} - -exports.linearMap = linearMap; -exports.parsePercent = parsePercent; -exports.round = round; -exports.asc = asc; -exports.getPrecision = getPrecision; -exports.getPrecisionSafe = getPrecisionSafe; -exports.getPixelPrecision = getPixelPrecision; -exports.getPercentWithPrecision = getPercentWithPrecision; -exports.MAX_SAFE_INTEGER = MAX_SAFE_INTEGER; -exports.remRadian = remRadian; -exports.isRadianAroundZero = isRadianAroundZero; -exports.parseDate = parseDate; -exports.quantity = quantity; -exports.nice = nice; -exports.reformIntervals = reformIntervals; -exports.isNumeric = isNumeric; - -/***/ }), -/* 86 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Texture2D__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__core_glenum__ = __webpack_require__(11); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__core_util__ = __webpack_require__(23); - - - - -var TexturePool = function () { - - this._pool = {}; - - this._allocatedTextures = []; -}; - -TexturePool.prototype = { - - constructor: TexturePool, - - get: function (parameters) { - var key = generateKey(parameters); - if (!this._pool.hasOwnProperty(key)) { - this._pool[key] = []; - } - var list = this._pool[key]; - if (!list.length) { - var texture = new __WEBPACK_IMPORTED_MODULE_0__Texture2D__["a" /* default */](parameters); - this._allocatedTextures.push(texture); - return texture; - } - return list.pop(); - }, - - put: function (texture) { - var key = generateKey(texture); - if (!this._pool.hasOwnProperty(key)) { - this._pool[key] = []; - } - var list = this._pool[key]; - list.push(texture); - }, - - clear: function (renderer) { - for (var i = 0; i < this._allocatedTextures.length; i++) { - this._allocatedTextures[i].dispose(renderer); - } - this._pool = {}; - this._allocatedTextures = []; - } -}; - -var defaultParams = { - width: 512, - height: 512, - type: __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].UNSIGNED_BYTE, - format: __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].RGBA, - wrapS: __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].CLAMP_TO_EDGE, - wrapT: __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].CLAMP_TO_EDGE, - minFilter: __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LINEAR_MIPMAP_LINEAR, - magFilter: __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LINEAR, - useMipmap: true, - anisotropic: 1, - flipY: true, - unpackAlignment: 4, - premultiplyAlpha: false -}; - -var defaultParamPropList = Object.keys(defaultParams); - -function generateKey(parameters) { - __WEBPACK_IMPORTED_MODULE_2__core_util__["a" /* default */].defaultsWithPropList(parameters, defaultParams, defaultParamPropList); - fallBack(parameters); - - var key = ''; - for (var i = 0; i < defaultParamPropList.length; i++) { - var name = defaultParamPropList[i]; - var chunk = parameters[name].toString(); - key += chunk; - } - return key; -} - -function fallBack(target) { - - var IPOT = isPowerOfTwo(target.width, target.height); - - if (target.format === __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].DEPTH_COMPONENT) { - target.useMipmap = false; - } - - if (!IPOT || !target.useMipmap) { - if (target.minFilter == __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].NEAREST_MIPMAP_NEAREST || - target.minFilter == __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].NEAREST_MIPMAP_LINEAR) { - target.minFilter = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].NEAREST; - } else if ( - target.minFilter == __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LINEAR_MIPMAP_LINEAR || - target.minFilter == __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LINEAR_MIPMAP_NEAREST - ) { - target.minFilter = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LINEAR; - } - } - if (!IPOT) { - target.wrapS = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].CLAMP_TO_EDGE; - target.wrapT = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].CLAMP_TO_EDGE; - } -} - -function isPowerOfTwo(width, height) { - return (width & (width-1)) === 0 && - (height & (height-1)) === 0; -} - -/* harmony default export */ __webpack_exports__["a"] = (TexturePool); - - -/***/ }), -/* 87 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export clay.compositor.kernel.gaussian_9\nfloat gaussianKernel[9];\ngaussianKernel[0] = 0.07;\ngaussianKernel[1] = 0.09;\ngaussianKernel[2] = 0.12;\ngaussianKernel[3] = 0.14;\ngaussianKernel[4] = 0.16;\ngaussianKernel[5] = 0.14;\ngaussianKernel[6] = 0.12;\ngaussianKernel[7] = 0.09;\ngaussianKernel[8] = 0.07;\n@end\n@export clay.compositor.kernel.gaussian_13\nfloat gaussianKernel[13];\ngaussianKernel[0] = 0.02;\ngaussianKernel[1] = 0.03;\ngaussianKernel[2] = 0.06;\ngaussianKernel[3] = 0.08;\ngaussianKernel[4] = 0.11;\ngaussianKernel[5] = 0.13;\ngaussianKernel[6] = 0.14;\ngaussianKernel[7] = 0.13;\ngaussianKernel[8] = 0.11;\ngaussianKernel[9] = 0.08;\ngaussianKernel[10] = 0.06;\ngaussianKernel[11] = 0.03;\ngaussianKernel[12] = 0.02;\n@end\n@export clay.compositor.gaussian_blur\n#define SHADER_NAME gaussian_blur\nuniform sampler2D texture;varying vec2 v_Texcoord;\nuniform float blurSize : 2.0;\nuniform vec2 textureSize : [512.0, 512.0];\nuniform float blurDir : 0.0;\n@import clay.util.rgbm\n@import clay.util.clamp_sample\nvoid main (void)\n{\n @import clay.compositor.kernel.gaussian_9\n vec2 off = blurSize / textureSize;\n off *= vec2(1.0 - blurDir, blurDir);\n vec4 sum = vec4(0.0);\n float weightAll = 0.0;\n for (int i = 0; i < 9; i++) {\n float w = gaussianKernel[i];\n vec4 texel = decodeHDR(clampSample(texture, v_Texcoord + float(i - 4) * off));\n sum += texel * w;\n weightAll += w;\n }\n gl_FragColor = encodeHDR(sum / max(weightAll, 0.01));\n}\n@end\n"); - - -/***/ }), -/* 88 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("\n@export clay.compositor.lut\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform sampler2D lookup;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n float blueColor = tex.b * 63.0;\n vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0);\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0);\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.g);\n vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * tex.g);\n vec4 newColor1 = texture2D(lookup, texPos1);\n vec4 newColor2 = texture2D(lookup, texPos2);\n vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n gl_FragColor = vec4(newColor.rgb, tex.w);\n}\n@end"); - - -/***/ }), -/* 89 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export clay.compositor.output\n#define OUTPUT_ALPHA\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = decodeHDR(texture2D(texture, v_Texcoord));\n gl_FragColor.rgb = tex.rgb;\n#ifdef OUTPUT_ALPHA\n gl_FragColor.a = tex.a;\n#else\n gl_FragColor.a = 1.0;\n#endif\n gl_FragColor = encodeHDR(gl_FragColor);\n#ifdef PREMULTIPLY_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n}\n@end"); - - -/***/ }), -/* 90 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export clay.compositor.bright\nuniform sampler2D texture;\nuniform float threshold : 1;\nuniform float scale : 1.0;\nuniform vec2 textureSize: [512, 512];\nvarying vec2 v_Texcoord;\nconst vec3 lumWeight = vec3(0.2125, 0.7154, 0.0721);\n@import clay.util.rgbm\nvec4 median(vec4 a, vec4 b, vec4 c)\n{\n return a + b + c - min(min(a, b), c) - max(max(a, b), c);\n}\nvoid main()\n{\n vec4 texel = decodeHDR(texture2D(texture, v_Texcoord));\n#ifdef ANTI_FLICKER\n vec3 d = 1.0 / textureSize.xyx * vec3(1.0, 1.0, 0.0);\n vec4 s1 = decodeHDR(texture2D(texture, v_Texcoord - d.xz));\n vec4 s2 = decodeHDR(texture2D(texture, v_Texcoord + d.xz));\n vec4 s3 = decodeHDR(texture2D(texture, v_Texcoord - d.zy));\n vec4 s4 = decodeHDR(texture2D(texture, v_Texcoord + d.zy));\n texel = median(median(texel, s1, s2), s3, s4);\n#endif\n float lum = dot(texel.rgb , lumWeight);\n vec4 color;\n if (lum > threshold && texel.a > 0.0)\n {\n color = vec4(texel.rgb * scale, texel.a * scale);\n }\n else\n {\n color = vec4(0.0);\n }\n gl_FragColor = encodeHDR(color);\n}\n@end\n"); - - -/***/ }), -/* 91 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export clay.compositor.downsample\nuniform sampler2D texture;\nuniform vec2 textureSize : [512, 512];\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nfloat brightness(vec3 c)\n{\n return max(max(c.r, c.g), c.b);\n}\n@import clay.util.clamp_sample\nvoid main()\n{\n vec4 d = vec4(-1.0, -1.0, 1.0, 1.0) / textureSize.xyxy;\n#ifdef ANTI_FLICKER\n vec3 s1 = decodeHDR(clampSample(texture, v_Texcoord + d.xy)).rgb;\n vec3 s2 = decodeHDR(clampSample(texture, v_Texcoord + d.zy)).rgb;\n vec3 s3 = decodeHDR(clampSample(texture, v_Texcoord + d.xw)).rgb;\n vec3 s4 = decodeHDR(clampSample(texture, v_Texcoord + d.zw)).rgb;\n float s1w = 1.0 / (brightness(s1) + 1.0);\n float s2w = 1.0 / (brightness(s2) + 1.0);\n float s3w = 1.0 / (brightness(s3) + 1.0);\n float s4w = 1.0 / (brightness(s4) + 1.0);\n float oneDivideSum = 1.0 / (s1w + s2w + s3w + s4w);\n vec4 color = vec4(\n (s1 * s1w + s2 * s2w + s3 * s3w + s4 * s4w) * oneDivideSum,\n 1.0\n );\n#else\n vec4 color = decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.xw));\n color += decodeHDR(clampSample(texture, v_Texcoord + d.zw));\n color *= 0.25;\n#endif\n gl_FragColor = encodeHDR(color);\n}\n@end"); - - -/***/ }), -/* 92 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("\n@export clay.compositor.upsample\n#define HIGH_QUALITY\nuniform sampler2D texture;\nuniform vec2 textureSize : [512, 512];\nuniform float sampleScale: 0.5;\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\n@import clay.util.clamp_sample\nvoid main()\n{\n#ifdef HIGH_QUALITY\n vec4 d = vec4(1.0, 1.0, -1.0, 0.0) / textureSize.xyxy * sampleScale;\n vec4 s;\n s = decodeHDR(clampSample(texture, v_Texcoord - d.xy));\n s += decodeHDR(clampSample(texture, v_Texcoord - d.wy)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord - d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zw)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord )) * 4.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xw)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.wy)) * 2.0;\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n gl_FragColor = encodeHDR(s / 16.0);\n#else\n vec4 d = vec4(-1.0, -1.0, +1.0, +1.0) / textureSize.xyxy;\n vec4 s;\n s = decodeHDR(clampSample(texture, v_Texcoord + d.xy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zy));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.xw));\n s += decodeHDR(clampSample(texture, v_Texcoord + d.zw));\n gl_FragColor = encodeHDR(s / 4.0);\n#endif\n}\n@end"); - - -/***/ }), -/* 93 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export clay.compositor.hdr.composite\n#define TONEMAPPING\nuniform sampler2D texture;\n#ifdef BLOOM_ENABLED\nuniform sampler2D bloom;\n#endif\n#ifdef LENSFLARE_ENABLED\nuniform sampler2D lensflare;\nuniform sampler2D lensdirt;\n#endif\n#ifdef LUM_ENABLED\nuniform sampler2D lum;\n#endif\n#ifdef LUT_ENABLED\nuniform sampler2D lut;\n#endif\n#ifdef COLOR_CORRECTION\nuniform float brightness : 0.0;\nuniform float contrast : 1.0;\nuniform float saturation : 1.0;\n#endif\n#ifdef VIGNETTE\nuniform float vignetteDarkness: 1.0;\nuniform float vignetteOffset: 1.0;\n#endif\nuniform float exposure : 1.0;\nuniform float bloomIntensity : 0.25;\nuniform float lensflareIntensity : 1;\nvarying vec2 v_Texcoord;\n@import clay.util.srgb\nvec3 ACESToneMapping(vec3 color)\n{\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\nfloat eyeAdaption(float fLum)\n{\n return mix(0.2, fLum, 0.5);\n}\n#ifdef LUT_ENABLED\nvec3 lutTransform(vec3 color) {\n float blueColor = color.b * 63.0;\n vec2 quad1;\n quad1.y = floor(floor(blueColor) / 8.0);\n quad1.x = floor(blueColor) - (quad1.y * 8.0);\n vec2 quad2;\n quad2.y = floor(ceil(blueColor) / 8.0);\n quad2.x = ceil(blueColor) - (quad2.y * 8.0);\n vec2 texPos1;\n texPos1.x = (quad1.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\n texPos1.y = (quad1.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\n vec2 texPos2;\n texPos2.x = (quad2.x * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.r);\n texPos2.y = (quad2.y * 0.125) + 0.5/512.0 + ((0.125 - 1.0/512.0) * color.g);\n vec4 newColor1 = texture2D(lut, texPos1);\n vec4 newColor2 = texture2D(lut, texPos2);\n vec4 newColor = mix(newColor1, newColor2, fract(blueColor));\n return newColor.rgb;\n}\n#endif\n@import clay.util.rgbm\nvoid main()\n{\n vec4 texel = vec4(0.0);\n vec4 originalTexel = vec4(0.0);\n#ifdef TEXTURE_ENABLED\n texel = decodeHDR(texture2D(texture, v_Texcoord));\n originalTexel = texel;\n#endif\n#ifdef BLOOM_ENABLED\n vec4 bloomTexel = decodeHDR(texture2D(bloom, v_Texcoord));\n texel.rgb += bloomTexel.rgb * bloomIntensity;\n texel.a += bloomTexel.a * bloomIntensity;\n#endif\n#ifdef LENSFLARE_ENABLED\n texel += decodeHDR(texture2D(lensflare, v_Texcoord)) * texture2D(lensdirt, v_Texcoord) * lensflareIntensity;\n#endif\n texel.a = min(texel.a, 1.0);\n#ifdef LUM_ENABLED\n float fLum = texture2D(lum, vec2(0.5, 0.5)).r;\n float adaptedLumDest = 3.0 / (max(0.1, 1.0 + 10.0*eyeAdaption(fLum)));\n float exposureBias = adaptedLumDest * exposure;\n#else\n float exposureBias = exposure;\n#endif\n#ifdef TONEMAPPING\n texel.rgb *= exposureBias;\n texel.rgb = ACESToneMapping(texel.rgb);\n#endif\n texel = linearTosRGB(texel);\n#ifdef LUT_ENABLED\n texel.rgb = lutTransform(clamp(texel.rgb,vec3(0.0),vec3(1.0)));\n#endif\n#ifdef COLOR_CORRECTION\n texel.rgb = clamp(texel.rgb + vec3(brightness), 0.0, 1.0);\n texel.rgb = clamp((texel.rgb - vec3(0.5))*contrast+vec3(0.5), 0.0, 1.0);\n float lum = dot(texel.rgb, vec3(0.2125, 0.7154, 0.0721));\n texel.rgb = mix(vec3(lum), texel.rgb, saturation);\n#endif\n#ifdef VIGNETTE\n vec2 uv = (v_Texcoord - vec2(0.5)) * vec2(vignetteOffset);\n texel.rgb = mix(texel.rgb, vec3(1.0 - vignetteDarkness), dot(uv, uv));\n#endif\n gl_FragColor = encodeHDR(texel);\n#ifdef DEBUG\n #if DEBUG == 1\n gl_FragColor = encodeHDR(decodeHDR(texture2D(texture, v_Texcoord)));\n #elif DEBUG == 2\n gl_FragColor = encodeHDR(decodeHDR(texture2D(bloom, v_Texcoord)) * bloomIntensity);\n #elif DEBUG == 3\n gl_FragColor = encodeHDR(decodeHDR(texture2D(lensflare, v_Texcoord) * lensflareIntensity));\n #endif\n#endif\n if (originalTexel.a <= 0.01 && gl_FragColor.a > 1e-5) {\n gl_FragColor.a = dot(gl_FragColor.rgb, vec3(0.2125, 0.7154, 0.0721));\n }\n#ifdef PREMULTIPLY_ALPHA\n gl_FragColor.rgb *= gl_FragColor.a;\n#endif\n}\n@end"); - - -/***/ }), -/* 94 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export clay.compositor.blend\n#define SHADER_NAME blend\n#ifdef TEXTURE1_ENABLED\nuniform sampler2D texture1;\nuniform float weight1 : 1.0;\n#endif\n#ifdef TEXTURE2_ENABLED\nuniform sampler2D texture2;\nuniform float weight2 : 1.0;\n#endif\n#ifdef TEXTURE3_ENABLED\nuniform sampler2D texture3;\nuniform float weight3 : 1.0;\n#endif\n#ifdef TEXTURE4_ENABLED\nuniform sampler2D texture4;\nuniform float weight4 : 1.0;\n#endif\n#ifdef TEXTURE5_ENABLED\nuniform sampler2D texture5;\nuniform float weight5 : 1.0;\n#endif\n#ifdef TEXTURE6_ENABLED\nuniform sampler2D texture6;\nuniform float weight6 : 1.0;\n#endif\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = vec4(0.0);\n#ifdef TEXTURE1_ENABLED\n tex += decodeHDR(texture2D(texture1, v_Texcoord)) * weight1;\n#endif\n#ifdef TEXTURE2_ENABLED\n tex += decodeHDR(texture2D(texture2, v_Texcoord)) * weight2;\n#endif\n#ifdef TEXTURE3_ENABLED\n tex += decodeHDR(texture2D(texture3, v_Texcoord)) * weight3;\n#endif\n#ifdef TEXTURE4_ENABLED\n tex += decodeHDR(texture2D(texture4, v_Texcoord)) * weight4;\n#endif\n#ifdef TEXTURE5_ENABLED\n tex += decodeHDR(texture2D(texture5, v_Texcoord)) * weight5;\n#endif\n#ifdef TEXTURE6_ENABLED\n tex += decodeHDR(texture2D(texture6, v_Texcoord)) * weight6;\n#endif\n gl_FragColor = encodeHDR(tex);\n}\n@end"); - - -/***/ }), -/* 95 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export clay.compositor.fxaa\nuniform sampler2D texture;\nuniform vec4 viewport : VIEWPORT;\nvarying vec2 v_Texcoord;\n#define FXAA_REDUCE_MIN (1.0/128.0)\n#define FXAA_REDUCE_MUL (1.0/8.0)\n#define FXAA_SPAN_MAX 8.0\n@import clay.util.rgbm\nvoid main()\n{\n vec2 resolution = 1.0 / viewport.zw;\n vec3 rgbNW = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( -1.0, -1.0 ) ) * resolution ) ).xyz;\n vec3 rgbNE = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( 1.0, -1.0 ) ) * resolution ) ).xyz;\n vec3 rgbSW = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( -1.0, 1.0 ) ) * resolution ) ).xyz;\n vec3 rgbSE = decodeHDR( texture2D( texture, ( gl_FragCoord.xy + vec2( 1.0, 1.0 ) ) * resolution ) ).xyz;\n vec4 rgbaM = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution ) );\n vec3 rgbM = rgbaM.xyz;\n float opacity = rgbaM.w;\n vec3 luma = vec3( 0.299, 0.587, 0.114 );\n float lumaNW = dot( rgbNW, luma );\n float lumaNE = dot( rgbNE, luma );\n float lumaSW = dot( rgbSW, luma );\n float lumaSE = dot( rgbSE, luma );\n float lumaM = dot( rgbM, luma );\n float lumaMin = min( lumaM, min( min( lumaNW, lumaNE ), min( lumaSW, lumaSE ) ) );\n float lumaMax = max( lumaM, max( max( lumaNW, lumaNE) , max( lumaSW, lumaSE ) ) );\n vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n float dirReduce = max( ( lumaNW + lumaNE + lumaSW + lumaSE ) * ( 0.25 * FXAA_REDUCE_MUL ), FXAA_REDUCE_MIN );\n float rcpDirMin = 1.0 / ( min( abs( dir.x ), abs( dir.y ) ) + dirReduce );\n dir = min( vec2( FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max( vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * resolution;\n vec3 rgbA = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * ( 1.0 / 3.0 - 0.5 ) ) ).xyz;\n rgbA += decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * ( 2.0 / 3.0 - 0.5 ) ) ).xyz;\n rgbA *= 0.5;\n vec3 rgbB = decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * -0.5 ) ).xyz;\n rgbB += decodeHDR( texture2D( texture, gl_FragCoord.xy * resolution + dir * 0.5 ) ).xyz;\n rgbB *= 0.25;\n rgbB += rgbA * 0.5;\n float lumaB = dot( rgbB, luma );\n if ( ( lumaB < lumaMin ) || ( lumaB > lumaMax ) )\n {\n gl_FragColor = vec4( rgbA, opacity );\n }\n else {\n gl_FragColor = vec4( rgbB, opacity );\n }\n}\n@end"); - - -/***/ }), -/* 96 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); - - -/* harmony default export */ __webpack_exports__["a"] = ({ - - getFilledRegions: function (regions, mapData) { - var regionsArr = (regions || []).slice(); - - var geoJson; - if (typeof mapData === 'string') { - mapData = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.getMap(mapData); - geoJson = mapData && mapData.geoJson; - } - else { - if (mapData && mapData.features) { - geoJson = mapData; - } - } - if (!geoJson) { - if (true) { - console.error('Map ' + mapData + ' not exists. You can download map file on http://echarts.baidu.com/download-map.html'); - if (!geoJson.features) { - console.error('Invalid GeoJSON for map3D'); - } - } - return []; - } - - var dataNameMap = {}; - var features = geoJson.features; - for (var i = 0; i < regionsArr.length; i++) { - dataNameMap[regionsArr[i].name] = regionsArr[i]; - } - - for (var i = 0; i < features.length; i++) { - var name = features[i].properties.name; - if (!dataNameMap[name]) { - regionsArr.push({ - name: name - }); - } - } - - return regionsArr; - }, - - defaultOption: { - show: true, - - zlevel: -10, - - // geoJson used by geo3D - map: '', - - // Layout used for viewport - left: 0, - top: 0, - width: '100%', - height: '100%', - - boxWidth: 100, - boxHeight: 10, - boxDepth: 'auto', - - regionHeight: 3, - - environment: 'auto', - - groundPlane: { - show: false, - color: '#aaa' - }, - - shading: 'lambert', - - light: { - main: { - alpha: 40, - beta: 30 - } - }, - - viewControl: { - alpha: 40, - beta: 0, - distance: 100, - orthographicSize: 60, - - minAlpha: 5, - minBeta: -80, - maxBeta: 80 - }, - - label: { - show: false, - // Distance in 3d space. - distance: 2, - - textStyle: { - fontSize: 20, - color: '#000', - backgroundColor: 'rgba(255,255,255,0.7)', - padding: 3, - borderRadius: 4 - } - }, - - // TODO - // altitude: { - // min: 'auto', - // max: 'auto', - - // height: [] - // }, - - - // labelLine - - // light - // postEffect - // temporalSuperSampling - - itemStyle: { - color: '#fff', - borderWidth: 0, - borderColor: '#333' - }, - - emphasis: { - itemStyle: { - // color: '#f94b59' - color: '#639fc0' - }, - label: { - show: true - } - } - } -}); - -/***/ }), -/* 97 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; - -function swap(arr, a, b) { - var tmp = arr[a]; - arr[a] = arr[b]; - arr[b] = tmp; -} -function partition(arr, pivot, left, right, compare) { - var storeIndex = left; - var pivotValue = arr[pivot]; - - // put the pivot on the right - swap(arr, pivot, right); - - // go through the rest - for(var v = left; v < right; v++) { - if(compare(arr[v], pivotValue) < 0) { - swap(arr, v, storeIndex); - storeIndex++; - } - } - - // finally put the pivot in the correct place - swap(arr, right, storeIndex); - - return storeIndex; -} - -function quickSort(array, compare, left, right) { - if(left < right) { - var pivot = Math.floor((left + right) / 2); - var newPivot = partition(array, pivot, left, right, compare); - quickSort(array, compare, left, newPivot - 1); - quickSort(array, compare, newPivot + 1, right); - } -} - - -// TODO Test. -function ProgressiveQuickSort() { - - // this._pivotList = new LinkedList(); - this._parts = []; -} - -ProgressiveQuickSort.prototype.step = function (arr, compare, frame) { - - var len = arr.length; - if (frame === 0) { - this._parts = []; - this._sorted = false; - - // Pick a start pivot; - var pivot = Math.floor(len / 2); - this._parts.push({ - pivot: pivot, - left: 0, - right: len - 1 - }); - - this._currentSortPartIdx = 0; - } - - if (this._sorted) { - return; - } - - var parts = this._parts; - if (parts.length === 0) { - this._sorted = true; - // Already finished. - return true; - } - else if (parts.length < 512) { - // Sort large parts in about 10 frames. - for (var i = 0; i < parts.length; i++) { - // Partition and Modify the pivot index. - parts[i].pivot = partition( - arr, parts[i].pivot, parts[i].left, parts[i].right, compare - ); - } - - var subdividedParts = []; - for (var i = 0; i < parts.length; i++) { - // Subdivide left - var left = parts[i].left; - var right = parts[i].pivot - 1; - if (right > left) { - subdividedParts.push({ - pivot: Math.floor((right + left) / 2), - left: left, right: right - }); - } - // Subdivide right - var left = parts[i].pivot + 1; - var right = parts[i].right; - if (right > left) { - subdividedParts.push({ - pivot: Math.floor((right + left) / 2), - left: left, right: right - }); - } - } - parts = this._parts = subdividedParts; - } - else { - // console.time('sort'); - // Finally quick sort each parts in 10 frames. - for (var i = 0; i < Math.floor(parts.length / 10); i++) { - // Sort near parts first. - var idx = parts.length - 1 - this._currentSortPartIdx; - quickSort(arr, compare, parts[idx].left, parts[idx].right); - this._currentSortPartIdx++; - - // Finish sort - if (this._currentSortPartIdx === parts.length) { - this._sorted = true; - return true; - } - } - // console.timeEnd('sort'); - - } - - return false; -}; - -ProgressiveQuickSort.sort = quickSort; - -/* harmony default export */ __webpack_exports__["a"] = (ProgressiveQuickSort); - -/***/ }), -/* 98 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__geo3D_Geo3D__ = __webpack_require__(99); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_echarts_lib_util_layout__ = __webpack_require__(47); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_echarts_lib_util_layout___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_echarts_lib_util_layout__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__core_ViewGL__ = __webpack_require__(22); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_retrieve__ = __webpack_require__(2); - - - - - - -function resizeGeo3D(geo3DModel, api) { - // Use left/top/width/height - var boxLayoutOption = geo3DModel.getBoxLayoutParams(); - - var viewport = __WEBPACK_IMPORTED_MODULE_2_echarts_lib_util_layout___default.a.getLayoutRect(boxLayoutOption, { - width: api.getWidth(), - height: api.getHeight() - }); - - // Flip Y - viewport.y = api.getHeight() - viewport.y - viewport.height; - - this.viewGL.setViewport(viewport.x, viewport.y, viewport.width, viewport.height, api.getDevicePixelRatio()); - - var geoRect = this.getGeoBoundingRect(); - var aspect = geoRect.width / geoRect.height * (geo3DModel.get('aspectScale') || 0.75); - - var width = geo3DModel.get('boxWidth'); - var depth = geo3DModel.get('boxDepth'); - var height = geo3DModel.get('boxHeight'); - if (height == null) { - height = 5; - } - if (isNaN(width) && isNaN(depth)) { - // Default to have 100 width - width = 100; - } - if (isNaN(depth)) { - depth = width / aspect; - } - else if (isNaN(width)) { - width = depth / aspect; - } - - this.setSize(width, height, depth); - - this.regionHeight = geo3DModel.get('regionHeight'); - - if (this.altitudeAxis) { - this.altitudeAxis.setExtent(0, Math.max(height - this.regionHeight, 0)); - } -} - -function updateGeo3D(ecModel, api) { - - var altitudeDataExtent = [Infinity, -Infinity]; - - ecModel.eachSeries(function (seriesModel) { - if (seriesModel.coordinateSystem !== this) { - return; - } - if (seriesModel.type === 'series.map3D') { - return; - } - // Get altitude data extent. - var data = seriesModel.getData(); - var altDims = seriesModel.coordDimToDataDim('alt'); - var altDim = altDims && altDims[0]; - if (altDim) { - // TODO altitiude is in coords of lines. - var dataExtent = data.getDataExtent(altDim, true); - altitudeDataExtent[0] = Math.min( - altitudeDataExtent[0], dataExtent[0] - ); - altitudeDataExtent[1] = Math.max( - altitudeDataExtent[1], dataExtent[1] - ); - } - }, this); - // Create altitude axis - if (altitudeDataExtent && isFinite(altitudeDataExtent[1] - altitudeDataExtent[0])) { - var scale = __WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts___default.a.helper.createScale( - altitudeDataExtent, { - type: 'value', - // PENDING - min: 'dataMin', - max: 'dataMax' - } - ); - this.altitudeAxis = new __WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts___default.a.Axis('altitude', scale); - // Resize again - this.resize(this.model, api); - } -} - - -if (true) { - var mapNotExistsError = function (name) { - console.error('Map ' + name + ' not exists. You can download map file on http://echarts.baidu.com/download-map.html'); - }; -} - - -var idStart = 0; - -var geo3DCreator = { - - dimensions: __WEBPACK_IMPORTED_MODULE_0__geo3D_Geo3D__["a" /* default */].prototype.dimensions, - - create: function (ecModel, api) { - - var geo3DList = []; - - if (!__WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts___default.a.getMap) { - throw new Error('geo3D component depends on geo component'); - } - - function createGeo3D(componentModel, idx) { - - var geo3D = geo3DCreator.createGeo3D(componentModel); - - // FIXME - componentModel.__viewGL = componentModel.__viewGL || new __WEBPACK_IMPORTED_MODULE_3__core_ViewGL__["a" /* default */](); - - geo3D.viewGL = componentModel.__viewGL; - - componentModel.coordinateSystem = geo3D; - geo3D.model = componentModel; - - geo3DList.push(geo3D); - - // Inject resize - geo3D.resize = resizeGeo3D; - geo3D.resize(componentModel, api); - - geo3D.update = updateGeo3D; - } - - ecModel.eachComponent('geo3D', function (geo3DModel, idx) { - createGeo3D(geo3DModel, idx); - }); - - ecModel.eachSeriesByType('map3D', function (map3DModel, idx) { - var coordSys = map3DModel.get('coordinateSystem'); - if (coordSys == null) { - coordSys = 'geo3D'; - } - if (coordSys === 'geo3D') { - createGeo3D(map3DModel, idx); - } - }); - - ecModel.eachSeries(function (seriesModel) { - if (seriesModel.get('coordinateSystem') === 'geo3D') { - if (seriesModel.type === 'series.map3D') { - return; - } - var geo3DModel = seriesModel.getReferringComponents('geo3D')[0]; - if (!geo3DModel) { - geo3DModel = ecModel.getComponent('geo3D'); - } - - if (!geo3DModel) { - throw new Error('geo "' + __WEBPACK_IMPORTED_MODULE_4__util_retrieve__["a" /* default */].firstNotNull( - seriesModel.get('geo3DIndex'), - seriesModel.get('geo3DId'), - 0 - ) + '" not found'); - } - - seriesModel.coordinateSystem = geo3DModel.coordinateSystem; - } - }); - - return geo3DList; - }, - - createGeo3D: function (componentModel) { - - var mapData = componentModel.get('map'); - var name; - if (typeof mapData === 'string') { - name = mapData; - mapData = __WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts___default.a.getMap(mapData); - } - else { - if (mapData && mapData.features) { - mapData = { - geoJson: mapData - }; - } - } - if (true) { - if (!mapData) { - mapNotExistsError(mapData); - } - if (!mapData.geoJson.features) { - throw new Error('Invalid GeoJSON for map3D'); - } - } - if (name == null) { - name = 'GEO_ANONYMOUS_' + idStart++; - } - - return new __WEBPACK_IMPORTED_MODULE_0__geo3D_Geo3D__["a" /* default */]( - name + idStart++, name, - mapData && mapData.geoJson, mapData && mapData.specialAreas, - componentModel.get('nameMap') - ); - } -}; - -__WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts___default.a.registerCoordinateSystem('geo3D', geo3DCreator); - -/* harmony default export */ __webpack_exports__["a"] = (geo3DCreator); - -/***/ }), -/* 99 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_claygl_src_dep_glmatrix__ = __webpack_require__(6); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_echarts_lib_coord_geo_fix_textCoord__ = __webpack_require__(205); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_echarts_lib_coord_geo_fix_textCoord___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_echarts_lib_coord_geo_fix_textCoord__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_echarts_lib_coord_geo_fix_geoCoord__ = __webpack_require__(206); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_echarts_lib_coord_geo_fix_geoCoord___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_echarts_lib_coord_geo_fix_geoCoord__); - - -var vec3 = __WEBPACK_IMPORTED_MODULE_1_claygl_src_dep_glmatrix__["a" /* default */].vec3; -var mat4 = __WEBPACK_IMPORTED_MODULE_1_claygl_src_dep_glmatrix__["a" /* default */].mat4; - - - -// Geo fix functions -var geoFixFuncs = [__WEBPACK_IMPORTED_MODULE_2_echarts_lib_coord_geo_fix_textCoord___default.a, __WEBPACK_IMPORTED_MODULE_3_echarts_lib_coord_geo_fix_geoCoord___default.a]; - -function Geo3D(name, map, geoJson, specialAreas, nameMap) { - - this.name = name; - - this.map = map; - - this.regionHeight = 0; - - this.regions = []; - - this._nameCoordMap = {}; - - this.loadGeoJson(geoJson, specialAreas, nameMap); - - this.transform = mat4.identity(new Float64Array(16)); - - this.invTransform = mat4.identity(new Float64Array(16)); - - // Which dimension to extrude. Y or Z - this.extrudeY = true; - - this.altitudeAxis; -} - -Geo3D.prototype = { - - constructor: Geo3D, - - type: 'geo3D', - - dimensions: ['lng', 'lat', 'alt'], - - containPoint: function () {}, - - loadGeoJson: function (geoJson, specialAreas, nameMap) { - var parseGeoJSON = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.parseGeoJSON || __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.parseGeoJson; - try { - this.regions = geoJson ? parseGeoJSON(geoJson) : []; - } - catch (e) { - throw 'Invalid geoJson format\n' + e; - } - specialAreas = specialAreas || {}; - nameMap = nameMap || {}; - var regions = this.regions; - var regionsMap = {}; - for (var i = 0; i < regions.length; i++) { - var regionName = regions[i].name; - // Try use the alias in nameMap - regionName = nameMap[regionName] || regionName; - regions[i].name = regionName; - - regionsMap[regionName] = regions[i]; - // Add geoJson - this.addGeoCoord(regionName, regions[i].center); - - // Some area like Alaska in USA map needs to be tansformed - // to look better - var specialArea = specialAreas[regionName]; - if (specialArea) { - regions[i].transformTo( - specialArea.left, specialArea.top, specialArea.width, specialArea.height - ); - } - } - - this._regionsMap = regionsMap; - - this._geoRect = null; - - geoFixFuncs.forEach(function (fixFunc) { - fixFunc(this); - }, this); - }, - - getGeoBoundingRect: function () { - if (this._geoRect) { - return this._geoRect; - } - var rect; - - var regions = this.regions; - for (var i = 0; i < regions.length; i++) { - var regionRect = regions[i].getBoundingRect(); - rect = rect || regionRect.clone(); - rect.union(regionRect); - } - // FIXME Always return new ? - return (this._geoRect = rect || new __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.graphic.BoundingRect(0, 0, 0, 0)); - }, - - /** - * Add geoCoord for indexing by name - * @param {string} name - * @param {Array.} geoCoord - */ - addGeoCoord: function (name, geoCoord) { - this._nameCoordMap[name] = geoCoord; - }, - - /** - * @param {string} name - * @return {module:echarts/coord/geo/Region} - */ - getRegion: function (name) { - return this._regionsMap[name]; - }, - - getRegionByCoord: function (coord) { - var regions = this.regions; - for (var i = 0; i < regions.length; i++) { - if (regions[i].contain(coord)) { - return regions[i]; - } - } - }, - - setSize: function (width, height, depth) { - this.size = [width, height, depth]; - - var rect = this.getGeoBoundingRect(); - - var scaleX = width / rect.width; - var scaleZ = -depth / rect.height; - var translateX = -width / 2 - rect.x * scaleX; - var translateZ = depth / 2 - rect.y * scaleZ; - - var position = this.extrudeY ? [translateX, 0, translateZ] : [translateX, translateZ, 0]; - var scale = this.extrudeY ? [scaleX, 1, scaleZ] : [scaleX, scaleZ, 1]; - - var m = this.transform; - mat4.identity(m); - mat4.translate(m, m, position); - mat4.scale(m, m, scale); - - mat4.invert(this.invTransform, m); - }, - - dataToPoint: function (data, out) { - out = out || []; - - var extrudeCoordIndex = this.extrudeY ? 1 : 2; - var sideCoordIndex = this.extrudeY ? 2 : 1; - - var altitudeVal = data[2]; - // PENDING. - if (isNaN(altitudeVal)) { - altitudeVal = 0; - } - // lng - out[0] = data[0]; - // lat - out[sideCoordIndex] = data[1]; - - if (this.altitudeAxis) { - out[extrudeCoordIndex] = this.altitudeAxis.dataToCoord(altitudeVal); - } - else { - out[extrudeCoordIndex] = 0; - } - // PENDING different region height. - out[extrudeCoordIndex] += this.regionHeight; - - vec3.transformMat4(out, out, this.transform); - - return out; - }, - - pointToData: function (point, out) { - // TODO - } -}; - -/* harmony default export */ __webpack_exports__["a"] = (Geo3D); - -/***/ }), -/* 100 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_claygl_src_dep_glmatrix__ = __webpack_require__(6); - -var mat4 = __WEBPACK_IMPORTED_MODULE_0_claygl_src_dep_glmatrix__["a" /* default */].mat4; - -var TILE_SIZE = 512; -var FOV = 0.6435011087932844; -var PI = Math.PI; - -var WORLD_SCALE = 1 / 10; - -function MapServiceCoordSys3D() { - /** - * Width of mapbox viewport - */ - this.width = 0; - /** - * Height of mapbox viewport - */ - this.height = 0; - - this.altitudeScale = 1; - - // TODO Change boxHeight won't have animation. - this.boxHeight = 'auto'; - - // Set by mapbox creator - this.altitudeExtent; - - this.bearing = 0; - this.pitch = 0; - this.center = [0, 0]; - - this._origin; - - this.zoom = 0; - this._initialZoom; - - // Some parameters for different map services. - this.maxPitch = 60; - this.zoomOffset = 0; -} - -MapServiceCoordSys3D.prototype = { - - constructor: MapServiceCoordSys3D, - - dimensions: ['lng', 'lat', 'alt'], - - containPoint: function () {}, - - setCameraOption: function (option) { - this.bearing = option.bearing; - this.pitch = option.pitch; - - this.center = option.center; - this.zoom = option.zoom; - - if (!this._origin) { - this._origin = this.projectOnTileWithScale(this.center, TILE_SIZE); - } - if (this._initialZoom == null) { - this._initialZoom = this.zoom; - } - - this.updateTransform(); - }, - - // https://github.com/mapbox/mapbox-gl-js/blob/master/src/geo/transform.js#L479 - updateTransform: function () { - if (!this.height) { return; } - - var cameraToCenterDistance = 0.5 / Math.tan(FOV / 2) * this.height * WORLD_SCALE; - // Convert to radian. - var pitch = Math.max(Math.min(this.pitch, this.maxPitch), 0) / 180 * Math.PI; - - // Find the distance from the center point [width/2, height/2] to the - // center top point [width/2, 0] in Z units, using the law of sines. - // 1 Z unit is equivalent to 1 horizontal px at the center of the map - // (the distance between[width/2, height/2] and [width/2 + 1, height/2]) - var halfFov = FOV / 2; - var groundAngle = Math.PI / 2 + pitch; - var topHalfSurfaceDistance = Math.sin(halfFov) * cameraToCenterDistance / Math.sin(Math.PI - groundAngle - halfFov); - - // Calculate z distance of the farthest fragment that should be rendered. - var furthestDistance = Math.cos(Math.PI / 2 - pitch) * topHalfSurfaceDistance + cameraToCenterDistance; - // Add a bit extra to avoid precision problems when a fragment's distance is exactly `furthestDistance` - var farZ = furthestDistance * 1.1; - // Forced to be 1000 - if (this.pitch > 50) { - farZ = 1000; - } - - // matrix for conversion from location to GL coordinates (-1 .. 1) - var m = []; - mat4.perspective(m, FOV, this.width / this.height, 1, farZ); - this.viewGL.camera.projectionMatrix.setArray(m); - this.viewGL.camera.decomposeProjectionMatrix(); - - var m = mat4.identity([]); - var pt = this.dataToPoint(this.center); - // Inverse - mat4.scale(m, m, [1, -1, 1]); - // Translate to altitude - mat4.translate(m, m, [0, 0, -cameraToCenterDistance]); - mat4.rotateX(m, m, pitch); - mat4.rotateZ(m, m, -this.bearing / 180 * Math.PI); - // Translate to center. - mat4.translate(m, m, [-pt[0] * this.getScale() * WORLD_SCALE, -pt[1] * this.getScale() * WORLD_SCALE, 0]); - - this.viewGL.camera.viewMatrix.array = m; - var invertM = []; - mat4.invert(invertM, m); - this.viewGL.camera.worldTransform.array = invertM; - this.viewGL.camera.decomposeWorldTransform(); - - // scale vertically to meters per pixel (inverse of ground resolution): - // worldSize / (circumferenceOfEarth * cos(lat * π / 180)) - var worldSize = TILE_SIZE * this.getScale(); - var verticalScale; - - if (this.altitudeExtent && !isNaN(this.boxHeight)) { - var range = this.altitudeExtent[1] - this.altitudeExtent[0]; - verticalScale = this.boxHeight / range * this.getScale() / Math.pow(2, this._initialZoom - this.zoomOffset); - } - else { - verticalScale = worldSize / (2 * Math.PI * 6378000 * Math.abs(Math.cos(this.center[1] * (Math.PI / 180)))) - * this.altitudeScale * WORLD_SCALE; - } - // Include scale to avoid relayout when zooming - // FIXME Camera scale may have problem in shadow - this.viewGL.rootNode.scale.set( - this.getScale() * WORLD_SCALE, this.getScale() * WORLD_SCALE, verticalScale - ); - }, - - getScale: function () { - return Math.pow(2, this.zoom - this.zoomOffset); - }, - - projectOnTile: function (data, out) { - return this.projectOnTileWithScale(data, this.getScale() * TILE_SIZE, out); - }, - - projectOnTileWithScale: function (data, scale, out) { - var lng = data[0]; - var lat = data[1]; - var lambda2 = lng * PI / 180; - var phi2 = lat * PI / 180; - var x = scale * (lambda2 + PI) / (2 * PI); - var y = scale * (PI - Math.log(Math.tan(PI / 4 + phi2 * 0.5))) / (2 * PI); - out = out || []; - out[0] = x; - out[1] = y; - return out; - }, - - unprojectFromTile: function (point, out) { - return this.unprojectOnTileWithScale(point, this.getScale() * TILE_SIZE, out); - }, - - unprojectOnTileWithScale: function (point, scale, out) { - var x = point[0]; - var y = point[1]; - var lambda2 = (x / scale) * (2 * PI) - PI; - var phi2 = 2 * (Math.atan(Math.exp(PI - (y / scale) * (2 * PI))) - PI / 4); - out = out || []; - out[0] = lambda2 * 180 / PI; - out[1] = phi2 * 180 / PI; - return out; - }, - - dataToPoint: function (data, out) { - out = this.projectOnTileWithScale(data, TILE_SIZE, out); - // Add a origin to avoid precision issue in WebGL. - out[0] -= this._origin[0]; - out[1] -= this._origin[1]; - // PENDING - out[2] = !isNaN(data[2]) ? data[2] : 0; - if (!isNaN(data[2])) { - out[2] = data[2]; - if (this.altitudeExtent) { - out[2] -= this.altitudeExtent[0]; - } - } - return out; - } -}; - -/* harmony default export */ __webpack_exports__["a"] = (MapServiceCoordSys3D); - -/***/ }), -/* 101 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_retrieve__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__core_ViewGL__ = __webpack_require__(22); - - - - -/* harmony default export */ __webpack_exports__["a"] = (function (serviceComponentType, ServiceCtor, afterCreate) { - - function resizeMapService3D(mapService3DModel, api) { - var width = api.getWidth(); - var height = api.getHeight(); - var dpr = api.getDevicePixelRatio(); - this.viewGL.setViewport(0, 0, width, height, dpr); - - this.width = width; - this.height = height; - - this.altitudeScale = mapService3DModel.get('altitudeScale'); - - this.boxHeight = mapService3DModel.get('boxHeight'); - // this.updateTransform(); - } - - - function updateService3D(ecModel, api) { - - if (this.model.get('boxHeight') === 'auto') { - return; - } - - var altitudeDataExtent = [Infinity, -Infinity] - - ecModel.eachSeries(function (seriesModel) { - if (seriesModel.coordinateSystem !== this) { - return; - } - - // Get altitude data extent. - var data = seriesModel.getData(); - var altDim = seriesModel.coordDimToDataDim('alt')[0]; - if (altDim) { - // TODO altitiude is in coords of lines. - var dataExtent = data.getDataExtent(altDim, true); - altitudeDataExtent[0] = Math.min( - altitudeDataExtent[0], dataExtent[0] - ); - altitudeDataExtent[1] = Math.max( - altitudeDataExtent[1], dataExtent[1] - ); - } - }, this); - if (altitudeDataExtent && isFinite(altitudeDataExtent[1] - altitudeDataExtent[0])) { - this.altitudeExtent = altitudeDataExtent; - } - } - - return { - - - dimensions: ServiceCtor.prototype.dimensions, - - create: function (ecModel, api) { - var mapService3DList = []; - - ecModel.eachComponent(serviceComponentType, function (mapService3DModel) { - var viewGL = mapService3DModel.__viewGL; - if (!viewGL) { - viewGL = mapService3DModel.__viewGL = new __WEBPACK_IMPORTED_MODULE_2__core_ViewGL__["a" /* default */](); - viewGL.setRootNode(new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Node()); - } - - var mapService3DCoordSys = new ServiceCtor(); - mapService3DCoordSys.viewGL = mapService3DModel.__viewGL; - // Inject resize - mapService3DCoordSys.resize = resizeMapService3D; - mapService3DCoordSys.resize(mapService3DModel, api); - - mapService3DList.push(mapService3DCoordSys); - - mapService3DModel.coordinateSystem = mapService3DCoordSys; - mapService3DCoordSys.model = mapService3DModel; - - mapService3DCoordSys.update = updateService3D; - }); - - ecModel.eachSeries(function (seriesModel) { - if (seriesModel.get('coordinateSystem') === serviceComponentType) { - var mapService3DModel = seriesModel.getReferringComponents(serviceComponentType)[0]; - if (!mapService3DModel) { - mapService3DModel = ecModel.getComponent(serviceComponentType); - } - - if (!mapService3DModel) { - throw new Error(serviceComponentType + ' "' + __WEBPACK_IMPORTED_MODULE_0__util_retrieve__["a" /* default */].firstNotNull( - seriesModel.get(serviceComponentType + 'Index'), - seriesModel.get(serviceComponentType + 'Id'), - 0 - ) + '" not found'); - } - - seriesModel.coordinateSystem = mapService3DModel.coordinateSystem; - } - }); - - afterCreate && afterCreate(mapService3DList, ecModel, api); - - return mapService3DList; - } - }; -}); - - -/***/ }), -/* 102 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("\n@export ecgl.displayShadow.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n@import ecgl.common.attributes\n\nvarying vec3 v_WorldPosition;\n\nvarying vec3 v_Normal;\n\nvoid main()\n{\n @import ecgl.common.uv.main\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\n\n v_WorldPosition = (world * vec4(position, 1.0)).xyz;\n gl_Position = worldViewProjection * vec4(position, 1.0);\n}\n\n@end\n\n\n@export ecgl.displayShadow.fragment\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform float roughness: 0.2;\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n@import ecgl.common.ssaoMap.header\n\n@import clay.plugin.compute_shadow_map\n\nvoid main()\n{\n float shadow = 1.0;\n\n @import ecgl.common.ssaoMap.main\n\n#if defined(DIRECTIONAL_LIGHT_COUNT) && defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n for (int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++) {\n shadow = min(shadow, shadowContribsDir[i] * 0.5 + 0.5);\n }\n#endif\n\n shadow *= 0.5 + ao * 0.5;\n shadow = clamp(shadow, 0.0, 1.0);\n\n gl_FragColor = vec4(vec3(0.0), 1.0 - shadow);\n}\n\n@end"); - - -/***/ }), -/* 103 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_zrender_lib_core_matrix__ = __webpack_require__(84); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_zrender_lib_core_matrix___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_zrender_lib_core_matrix__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_zrender_lib_core_vector__ = __webpack_require__(83); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_zrender_lib_core_vector___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_zrender_lib_core_vector__); - - - - -function GLViewHelper(viewGL) { - this.viewGL = viewGL; -} - -GLViewHelper.prototype.reset = function (seriesModel, api) { - this._updateCamera(api.getWidth(), api.getHeight(), api.getDevicePixelRatio()); - this._viewTransform = __WEBPACK_IMPORTED_MODULE_0_zrender_lib_core_matrix___default.a.create(); - this.updateTransform(seriesModel, api); -}; - -GLViewHelper.prototype.updateTransform = function (seriesModel, api) { - var coordinateSystem = seriesModel.coordinateSystem; - - if (coordinateSystem.getRoamTransform) { - - __WEBPACK_IMPORTED_MODULE_0_zrender_lib_core_matrix___default.a.invert(this._viewTransform, coordinateSystem.getRoamTransform()); - - this._setCameraTransform(this._viewTransform); - - api.getZr().refresh(); - } -}; - -// Reimplement the dataToPoint of coordinate system. -// Remove the effect of pan/zoom transform -GLViewHelper.prototype.dataToPoint = function (coordSys, data, pt) { - pt = coordSys.dataToPoint(data, null, pt); - var viewTransform = this._viewTransform; - if (viewTransform) { - __WEBPACK_IMPORTED_MODULE_1_zrender_lib_core_vector___default.a.applyTransform(pt, pt, viewTransform); - } -}; - -/** - * Remove transform info in point. - */ -GLViewHelper.prototype.removeTransformInPoint = function (pt) { - if (this._viewTransform) { - __WEBPACK_IMPORTED_MODULE_1_zrender_lib_core_vector___default.a.applyTransform(pt, pt, this._viewTransform); - } - return pt; -}; - -/** - * Return number - */ -GLViewHelper.prototype.getZoom = function () { - if (this._viewTransform) { - var m = this._viewTransform; - return 1 / Math.max( - Math.sqrt(m[0] * m[0] + m[1] * m[1]), - Math.sqrt(m[2] * m[2] + m[3] * m[3]) - ); - } - return 1; -}; - -GLViewHelper.prototype._setCameraTransform = function (m) { - var camera = this.viewGL.camera; - camera.position.set(m[4], m[5], 0); - camera.scale.set( - Math.sqrt(m[0] * m[0] + m[1] * m[1]), - Math.sqrt(m[2] * m[2] + m[3] * m[3]), - 1 - ); -}; - -GLViewHelper.prototype._updateCamera = function (width, height, dpr) { - // TODO, left, top, right, bottom - this.viewGL.setViewport(0, 0, width, height, dpr); - var camera = this.viewGL.camera; - camera.left = camera.top = 0; - camera.bottom = height; - camera.right = width; - camera.near = 0; - camera.far = 100; -}; - -/* harmony default export */ __webpack_exports__["a"] = (GLViewHelper); - -/***/ }), -/* 104 */ -/***/ (function(module, exports, __webpack_require__) { - -/* WEBPACK VAR INJECTION */(function(global) {/* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -*/ -// (1) The code `if (__DEV__) ...` can be removed by build tool. -// (2) If intend to use `__DEV__`, this module should be imported. Use a global -// variable `__DEV__` may cause that miss the declaration (see #6535), or the -// declaration is behind of the using position (for example in `Model.extent`, -// And tools like rollup can not analysis the dependency if not import). -var dev; // In browser - -if (typeof window !== 'undefined') { - dev = window.__DEV__; -} // In node -else if (typeof global !== 'undefined') { - dev = global.__DEV__; - } - -if (typeof dev === 'undefined') { - dev = true; -} - -var __DEV__ = dev; -exports.__DEV__ = __DEV__; -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(68))) - -/***/ }), -/* 105 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_claygl_src_Geometry__ = __webpack_require__(15); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__dynamicConvertMixin__ = __webpack_require__(38); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_claygl_src_dep_glmatrix__ = __webpack_require__(6); -/** - * Lines geometry - * Use screen space projected lines lineWidth > MAX_LINE_WIDTH - * https://mattdesl.svbtle.com/drawing-lines-is-hard - * @module echarts-gl/util/geometry/LinesGeometry - * @author Yi Shen(http://github.com/pissang) - */ - - - - - -var vec2 = __WEBPACK_IMPORTED_MODULE_3_claygl_src_dep_glmatrix__["a" /* default */].vec2; - -// var CURVE_RECURSION_LIMIT = 8; -// var CURVE_COLLINEAR_EPSILON = 40; - -var sampleLinePoints = [[0, 0], [1, 1]]; -/** - * @constructor - * @alias module:echarts-gl/util/geometry/LinesGeometry - * @extends clay.Geometry - */ - -var LinesGeometry = __WEBPACK_IMPORTED_MODULE_0_claygl_src_Geometry__["a" /* default */].extend(function () { - return { - - segmentScale: 4, - - dynamic: true, - /** - * Need to use mesh to expand lines if lineWidth > MAX_LINE_WIDTH - */ - useNativeLine: true, - - attributes: { - position: new __WEBPACK_IMPORTED_MODULE_0_claygl_src_Geometry__["a" /* default */].Attribute('position', 'float', 2, 'POSITION'), - normal: new __WEBPACK_IMPORTED_MODULE_0_claygl_src_Geometry__["a" /* default */].Attribute('normal', 'float', 2), - offset: new __WEBPACK_IMPORTED_MODULE_0_claygl_src_Geometry__["a" /* default */].Attribute('offset', 'float', 1), - color: new __WEBPACK_IMPORTED_MODULE_0_claygl_src_Geometry__["a" /* default */].Attribute('color', 'float', 4, 'COLOR') - } - }; -}, -/** @lends module: echarts-gl/util/geometry/LinesGeometry.prototype */ -{ - - /** - * Reset offset - */ - resetOffset: function () { - this._vertexOffset = 0; - this._faceOffset = 0; - - this._itemVertexOffsets = []; - }, - - /** - * @param {number} nVertex - */ - setVertexCount: function (nVertex) { - var attributes = this.attributes; - if (this.vertexCount !== nVertex) { - attributes.position.init(nVertex); - attributes.color.init(nVertex); - - if (!this.useNativeLine) { - attributes.offset.init(nVertex); - attributes.normal.init(nVertex); - } - - if (nVertex > 0xffff) { - if (this.indices instanceof Uint16Array) { - this.indices = new Uint32Array(this.indices); - } - } - else { - if (this.indices instanceof Uint32Array) { - this.indices = new Uint16Array(this.indices); - } - } - } - }, - - /** - * @param {number} nTriangle - */ - setTriangleCount: function (nTriangle) { - if (this.triangleCount !== nTriangle) { - if (nTriangle === 0) { - this.indices = null; - } - else { - this.indices = this.vertexCount > 0xffff ? new Uint32Array(nTriangle * 3) : new Uint16Array(nTriangle * 3); - } - } - }, - - _getCubicCurveApproxStep: function (p0, p1, p2, p3) { - var len = vec2.dist(p0, p1) + vec2.dist(p2, p1) + vec2.dist(p3, p2); - var step = 1 / (len + 1) * this.segmentScale; - return step; - }, - - /** - * Get vertex count of cubic curve - * @param {Array.} p0 - * @param {Array.} p1 - * @param {Array.} p2 - * @param {Array.} p3 - * @return number - */ - getCubicCurveVertexCount: function (p0, p1, p2, p3) { - var step = this._getCubicCurveApproxStep(p0, p1, p2, p3); - var segCount = Math.ceil(1 / step); - if (!this.useNativeLine) { - return segCount * 2 + 2; - } - else { - return segCount * 2; - } - }, - - /** - * Get face count of cubic curve - * @param {Array.} p0 - * @param {Array.} p1 - * @param {Array.} p2 - * @param {Array.} p3 - * @return number - */ - getCubicCurveTriangleCount: function (p0, p1, p2, p3) { - var step = this._getCubicCurveApproxStep(p0, p1, p2, p3); - var segCount = Math.ceil(1 / step); - if (!this.useNativeLine) { - return segCount * 2; - } - else { - return 0; - } - }, - - /** - * Get vertex count of line - * @return {number} - */ - getLineVertexCount: function () { - return this.getPolylineVertexCount(sampleLinePoints); - }, - - /** - * Get face count of line - * @return {number} - */ - getLineTriangleCount: function () { - return this.getPolylineTriangleCount(sampleLinePoints); - }, - - /** - * Get how many vertices will polyline take. - * @type {number|Array} points Can be a 1d/2d list of points, or a number of points amount. - * @return {number} - */ - getPolylineVertexCount: function (points) { - var pointsLen; - if (typeof points === 'number') { - pointsLen = points; - } - else { - var is2DArray = typeof points[0] !== 'number'; - pointsLen = is2DArray ? points.length : (points.length / 2); - } - return !this.useNativeLine ? ((pointsLen - 1) * 2 + 2) : (pointsLen - 1) * 2; - }, - - /** - * Get how many triangles will polyline take. - * @type {number|Array} points Can be a 1d/2d list of points, or a number of points amount. - * @return {number} - */ - getPolylineTriangleCount: function (points) { - var pointsLen; - if (typeof points === 'number') { - pointsLen = points; - } - else { - var is2DArray = typeof points[0] !== 'number'; - pointsLen = is2DArray ? points.length : (points.length / 2); - } - return !this.useNativeLine ? (pointsLen - 1) * 2 : 0; - }, - - /** - * Add a cubic curve - * @param {Array.} p0 - * @param {Array.} p1 - * @param {Array.} p2 - * @param {Array.} p3 - * @param {Array.} color - * @param {number} [lineWidth=1] - */ - addCubicCurve: function (p0, p1, p2, p3, color, lineWidth) { - if (lineWidth == null) { - lineWidth = 1; - } - // incremental interpolation - // http://antigrain.com/research/bezier_interpolation/index.html#PAGE_BEZIER_INTERPOLATION - var x0 = p0[0], y0 = p0[1]; - var x1 = p1[0], y1 = p1[1]; - var x2 = p2[0], y2 = p2[1]; - var x3 = p3[0], y3 = p3[1]; - - var step = this._getCubicCurveApproxStep(p0, p1, p2, p3); - - var step2 = step * step; - var step3 = step2 * step; - - var pre1 = 3.0 * step; - var pre2 = 3.0 * step2; - var pre4 = 6.0 * step2; - var pre5 = 6.0 * step3; - - var tmp1x = x0 - x1 * 2.0 + x2; - var tmp1y = y0 - y1 * 2.0 + y2; - - var tmp2x = (x1 - x2) * 3.0 - x0 + x3; - var tmp2y = (y1 - y2) * 3.0 - y0 + y3; - - var fx = x0; - var fy = y0; - - var dfx = (x1 - x0) * pre1 + tmp1x * pre2 + tmp2x * step3; - var dfy = (y1 - y0) * pre1 + tmp1y * pre2 + tmp2y * step3; - - var ddfx = tmp1x * pre4 + tmp2x * pre5; - var ddfy = tmp1y * pre4 + tmp2y * pre5; - - var dddfx = tmp2x * pre5; - var dddfy = tmp2y * pre5; - - var t = 0; - - var k = 0; - var segCount = Math.ceil(1 / step); - - var points = new Float32Array((segCount + 1) * 3); - var points = []; - var offset = 0; - for (var k = 0; k < segCount + 1; k++) { - points[offset++] = fx; - points[offset++] = fy; - - fx += dfx; fy += dfy; - dfx += ddfx; dfy += ddfy; - ddfx += dddfx; ddfy += dddfy; - t += step; - - if (t > 1) { - fx = dfx > 0 ? Math.min(fx, x3) : Math.max(fx, x3); - fy = dfy > 0 ? Math.min(fy, y3) : Math.max(fy, y3); - } - } - - this.addPolyline(points, color, lineWidth); - }, - - /** - * Add a straight line - * @param {Array.} p0 - * @param {Array.} p1 - * @param {Array.} color - * @param {number} [lineWidth=1] - */ - addLine: function (p0, p1, color, lineWidth) { - this.addPolyline([p0, p1], color, lineWidth); - }, - - /** - * Add a straight line - * @param {Array. | Array.} points - * @param {Array. | Array.} color - * @param {number} [lineWidth=1] - * @param {number} [arrayOffset=0] - * @param {number} [pointsCount] Default to be amount of points in the first argument - */ - addPolyline: (function () { - var dirA = vec2.create(); - var dirB = vec2.create(); - var normal = vec2.create(); - var tangent = vec2.create(); - var point = [], nextPoint = [], prevPoint = []; - return function (points, color, lineWidth, arrayOffset, pointsCount) { - if (!points.length) { - return; - } - var is2DArray = typeof points[0] !== 'number'; - if (pointsCount == null) { - pointsCount = is2DArray ? points.length : points.length / 2; - } - if (pointsCount < 2) { - return; - } - if (arrayOffset == null) { - arrayOffset = 0; - } - if (lineWidth == null) { - lineWidth = 1; - } - - this._itemVertexOffsets.push(this._vertexOffset); - - var notSharingColor = is2DArray - ? typeof color[0] !== 'number' - : color.length / 4 === pointsCount; - - var positionAttr = this.attributes.position; - var colorAttr = this.attributes.color; - var offsetAttr = this.attributes.offset; - var normalAttr = this.attributes.normal; - var indices = this.indices; - - var vertexOffset = this._vertexOffset; - var pointColor; - for (var k = 0; k < pointsCount; k++) { - if (is2DArray) { - point = points[k + arrayOffset]; - if (notSharingColor) { - pointColor = color[k + arrayOffset]; - } - else { - pointColor = color; - } - } - else { - var k2 = k * 2 + arrayOffset; - point = point || []; - point[0] = points[k2]; - point[1] = points[k2 + 1]; - - if (notSharingColor) { - var k4 = k * 4 + arrayOffset; - pointColor = pointColor || []; - pointColor[0] = color[k4]; - pointColor[1] = color[k4 + 1]; - pointColor[2] = color[k4 + 2]; - pointColor[3] = color[k4 + 3]; - } - else { - pointColor = color; - } - } - if (!this.useNativeLine) { - var offset; - if (k < pointsCount - 1) { - if (is2DArray) { - vec2.copy(nextPoint, points[k + 1]); - } - else { - var k2 = (k + 1) * 2 + arrayOffset; - nextPoint = nextPoint || []; - nextPoint[0] = points[k2]; - nextPoint[1] = points[k2 + 1]; - } - // TODO In case dir is (0, 0) - // TODO miterLimit - if (k > 0) { - vec2.sub(dirA, point, prevPoint); - vec2.sub(dirB, nextPoint, point); - vec2.normalize(dirA, dirA); - vec2.normalize(dirB, dirB); - vec2.add(tangent, dirA, dirB); - vec2.normalize(tangent, tangent); - var miter = lineWidth / 2 * Math.min(1 / vec2.dot(dirA, tangent), 2); - normal[0] = -tangent[1]; - normal[1] = tangent[0]; - - offset = miter; - } - else { - vec2.sub(dirA, nextPoint, point); - vec2.normalize(dirA, dirA); - - normal[0] = -dirA[1]; - normal[1] = dirA[0]; - - offset = lineWidth / 2; - } - - } - else { - vec2.sub(dirA, point, prevPoint); - vec2.normalize(dirA, dirA); - - normal[0] = -dirA[1]; - normal[1] = dirA[0]; - - offset = lineWidth / 2; - } - normalAttr.set(vertexOffset, normal); - normalAttr.set(vertexOffset + 1, normal); - offsetAttr.set(vertexOffset, offset); - offsetAttr.set(vertexOffset + 1, -offset); - - vec2.copy(prevPoint, point); - - positionAttr.set(vertexOffset, point); - positionAttr.set(vertexOffset + 1, point); - - colorAttr.set(vertexOffset, pointColor); - colorAttr.set(vertexOffset + 1, pointColor); - - vertexOffset += 2; - } - else { - if (k > 1) { - positionAttr.copy(vertexOffset, vertexOffset - 1); - colorAttr.copy(vertexOffset, vertexOffset - 1); - vertexOffset++; - } - } - - if (!this.useNativeLine) { - if (k > 0) { - var idx3 = this._faceOffset * 3; - var indices = this.indices; - // 0-----2 - // 1-----3 - // 0->1->2, 1->3->2 - indices[idx3] = vertexOffset - 4; - indices[idx3 + 1] = vertexOffset - 3; - indices[idx3 + 2] = vertexOffset - 2; - - indices[idx3 + 3] = vertexOffset - 3; - indices[idx3 + 4] = vertexOffset - 1; - indices[idx3 + 5] = vertexOffset - 2; - - this._faceOffset += 2; - } - } - else { - colorAttr.set(vertexOffset, pointColor); - positionAttr.set(vertexOffset, point); - vertexOffset++; - } - } - - this._vertexOffset = vertexOffset; - }; - })(), - - /** - * Set color of single line. - */ - setItemColor: function (idx, color) { - var startOffset = this._itemVertexOffsets[idx]; - var endOffset = idx < this._itemVertexOffsets.length - 1 ? this._itemVertexOffsets[idx + 1] : this._vertexOffset; - - for (var i = startOffset; i < endOffset; i++) { - this.attributes.color.set(i, color); - } - this.dirty('color'); - } -}); - -__WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts___default.a.util.defaults(LinesGeometry.prototype, __WEBPACK_IMPORTED_MODULE_2__dynamicConvertMixin__["a" /* default */]); - -/* harmony default export */ __webpack_exports__["a"] = (LinesGeometry); - -/***/ }), -/* 106 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_echarts_gl__ = __webpack_require__(107); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__src_component_grid3D__ = __webpack_require__(154); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__src_component_geo3D__ = __webpack_require__(201); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__src_component_globe__ = __webpack_require__(207); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__src_component_mapbox3D__ = __webpack_require__(213); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__src_component_maptalks3D__ = __webpack_require__(219); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__src_chart_bar3D__ = __webpack_require__(225); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__src_chart_line3D__ = __webpack_require__(232); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__src_chart_scatter3D__ = __webpack_require__(236); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__src_chart_lines3D__ = __webpack_require__(243); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__src_chart_polygons3D__ = __webpack_require__(249); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__src_chart_surface__ = __webpack_require__(252); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__src_chart_map3D__ = __webpack_require__(256); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__src_chart_scatterGL__ = __webpack_require__(259); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__src_chart_graphGL__ = __webpack_require__(262); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__src_chart_flowGL__ = __webpack_require__(275); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__src_chart_linesGL__ = __webpack_require__(281); - - - - - - - - - - - - - - - - - - - - - -/***/ }), -/* 107 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_claygl_src_version__ = __webpack_require__(108); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__core_LayerGL__ = __webpack_require__(109); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__preprocessor_backwardCompat__ = __webpack_require__(153); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_graphicGL__ = __webpack_require__(1); -/** - * echarts-gl - * Extension pack of ECharts providing 3d plots and globe visualization - * - * Copyright (c) 2014, echarts-gl - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * @module echarts-gl - * @author Yi Shen(http://github.com/pissang) - */ - -// PENDING Use a single canvas as layer or use image element? -var echartsGl = { - version: '1.1.1', - dependencies: { - echarts: '4.1.0', - claygl: '1.2.1' - } -}; - - - - - - -// Version checking -var deps = echartsGl.dependencies; -function versionTooOldMsg(name) { - throw new Error( - name + ' version is too old, needs ' + deps[name] + ' or higher' - ); -} -function checkVersion(version, name) { - if ((version.replace('.', '') - 0) < (deps[name].replace('.', '') - 0)) { - versionTooOldMsg(name); - } - console.log('Loaded ' + name + ', version ' + version); -} -checkVersion(__WEBPACK_IMPORTED_MODULE_1_claygl_src_version__["a" /* default */], 'claygl'); -checkVersion(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.version, 'echarts'); - -function EChartsGL (zr) { - this._layers = {}; - - this._zr = zr; -} - -EChartsGL.prototype.update = function (ecModel, api) { - var self = this; - var zr = api.getZr(); - - if (!zr.getWidth() || !zr.getHeight()) { - console.warn('Dom has no width or height'); - return; - } - - function getLayerGL(model) { - var zlevel; - // Host on coordinate system. - if (model.coordinateSystem && model.coordinateSystem.model) { - zlevel = model.get('zlevel'); - } - else { - zlevel = model.get('zlevel'); - } - - var layers = self._layers; - var layerGL = layers[zlevel]; - if (!layerGL) { - layerGL = layers[zlevel] = new __WEBPACK_IMPORTED_MODULE_2__core_LayerGL__["a" /* default */]('gl-' + zlevel, zr); - - if (zr.painter.isSingleCanvas()) { - layerGL.virtual = true; - // If container is canvas, use image to represent LayerGL - // FIXME Performance - var img = new __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.graphic.Image({ - z: 1e4, - style: { - image: layerGL.renderer.canvas - }, - silent: true - }); - layerGL.__hostImage = img; - - zr.add(img); - } - - zr.painter.insertLayer(zlevel, layerGL); - } - if (layerGL.__hostImage) { - layerGL.__hostImage.setStyle({ - width: layerGL.renderer.getWidth(), - height: layerGL.renderer.getHeight() - }); - } - - return layerGL; - } - - function setSilent(groupGL, silent) { - if (groupGL) { - groupGL.traverse(function (mesh) { - if (mesh.isRenderable && mesh.isRenderable()) { - mesh.ignorePicking = mesh.$ignorePicking != null - ? mesh.$ignorePicking : silent; - } - }); - } - } - - for (var zlevel in this._layers) { - this._layers[zlevel].removeViewsAll(); - } - - ecModel.eachComponent(function (componentType, componentModel) { - if (componentType !== 'series') { - var view = api.getViewOfComponentModel(componentModel); - var coordSys = componentModel.coordinateSystem; - // View with __ecgl__ flag is a echarts-gl component. - if (view.__ecgl__) { - var viewGL; - if (coordSys) { - if (!coordSys.viewGL) { - console.error('Can\'t find viewGL in coordinateSystem of component ' + componentModel.id); - return; - } - viewGL = coordSys.viewGL; - } - else { - if (!componentModel.viewGL) { - console.error('Can\'t find viewGL of component ' + componentModel.id); - return; - } - viewGL = coordSys.viewGL; - } - - var viewGL = coordSys.viewGL; - var layerGL = getLayerGL(componentModel); - - layerGL.addView(viewGL); - - view.afterRender && view.afterRender( - componentModel, ecModel, api, layerGL - ); - - setSilent(view.groupGL, componentModel.get('silent')); - } - } - }); - - ecModel.eachSeries(function (seriesModel) { - var chartView = api.getViewOfSeriesModel(seriesModel); - var coordSys = seriesModel.coordinateSystem; - if (chartView.__ecgl__) { - if ((coordSys && !coordSys.viewGL) && !chartView.viewGL) { - console.error('Can\'t find viewGL of series ' + chartView.id); - return; - } - var viewGL = (coordSys && coordSys.viewGL) || chartView.viewGL; - // TODO Check zlevel not same with component of coordinate system ? - var layerGL = getLayerGL(seriesModel); - layerGL.addView(viewGL); - - chartView.afterRender && chartView.afterRender( - seriesModel, ecModel, api, layerGL - ); - - setSilent(chartView.groupGL, seriesModel.get('silent')); - } - }); -}; - -// Hack original getRenderedCanvas. Will removed after new echarts released -// TODO -var oldInit = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.init; -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.init = function () { - var chart = oldInit.apply(this, arguments); - chart.getZr().painter.getRenderedCanvas = function (opts) { - opts = opts || {}; - if (this._singleCanvas) { - return this._layers[0].dom; - } - - var canvas = document.createElement('canvas'); - var dpr = opts.pixelRatio || this.dpr; - canvas.width = this.getWidth() * dpr; - canvas.height = this.getHeight() * dpr; - var ctx = canvas.getContext('2d'); - ctx.dpr = dpr; - - ctx.clearRect(0, 0, canvas.width, canvas.height); - if (opts.backgroundColor) { - ctx.fillStyle = opts.backgroundColor; - ctx.fillRect(0, 0, canvas.width, canvas.height); - } - - var displayList = this.storage.getDisplayList(true); - - var scope = {}; - var zlevel; - - var self = this; - function findAndDrawOtherLayer(smaller, larger) { - var zlevelList = self._zlevelList; - if (smaller == null) { - smaller = -Infinity; - } - var intermediateLayer; - for (var i = 0; i < zlevelList.length; i++) { - var z = zlevelList[i]; - var layer = self._layers[z]; - if (!layer.__builtin__ && z > smaller && z < larger) { - intermediateLayer = layer; - break; - } - } - if (intermediateLayer && intermediateLayer.renderToCanvas) { - ctx.save(); - intermediateLayer.renderToCanvas(ctx); - ctx.restore(); - } - } - var layer = { - ctx: ctx - }; - for (var i = 0; i < displayList.length; i++) { - var el = displayList[i]; - - if (el.zlevel !== zlevel) { - findAndDrawOtherLayer(zlevel, el.zlevel); - zlevel = el.zlevel; - } - this._doPaintEl(el, layer, true, scope); - } - - findAndDrawOtherLayer(zlevel, Infinity); - - return canvas; - }; - return chart; -}; - - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerPostUpdate(function (ecModel, api) { - var zr = api.getZr(); - - var egl = zr.__egl = zr.__egl || new EChartsGL(zr); - - egl.update(ecModel, api); -}); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerPreprocessor(__WEBPACK_IMPORTED_MODULE_3__preprocessor_backwardCompat__["a" /* default */]); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.graphicGL = __WEBPACK_IMPORTED_MODULE_4__util_graphicGL__["a" /* default */]; - -/* unused harmony default export */ var _unused_webpack_default_export = (EChartsGL); - -/***/ }), -/* 108 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/** - * @name clay.version - */ -/* harmony default export */ __webpack_exports__["a"] = ('1.2.1'); - - -/***/ }), -/* 109 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_claygl_src_Renderer__ = __webpack_require__(52); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_claygl_src_picking_RayPicking__ = __webpack_require__(117); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_claygl_src_Texture__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_graphicGL__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_claygl_src_core_mixin_notifier__ = __webpack_require__(53); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_zrender_lib_animation_requestAnimationFrame__ = __webpack_require__(80); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_zrender_lib_animation_requestAnimationFrame___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_zrender_lib_animation_requestAnimationFrame__); -/** - * Provide WebGL layer to zrender. Which is rendered on top of clay. - * - * - * Relationship between zrender, LayerGL(renderer) and ViewGL(Scene, Camera, Viewport) - * zrender - * / \ - * LayerGL LayerGL - * (renderer) (renderer) - * / \ - * ViewGL ViewGL - * - * @module echarts-gl/core/LayerGL - * @author Yi Shen(http://github.com/pissang) - */ - - - - - - - -// PENDING, clay. notifier is same with zrender Eventful - - - -/** - * @constructor - * @alias module:echarts-gl/core/LayerGL - * @param {string} id Layer ID - * @param {module:zrender/ZRender} zr - */ -var LayerGL = function (id, zr) { - - /** - * Layer ID - * @type {string} - */ - this.id = id; - - /** - * @type {module:zrender/ZRender} - */ - this.zr = zr; - - /** - * @type {clay.Renderer} - */ - try { - this.renderer = new __WEBPACK_IMPORTED_MODULE_1_claygl_src_Renderer__["a" /* default */]({ - clearBit: 0, - devicePixelRatio: zr.painter.dpr, - preserveDrawingBuffer: true, - // PENDING - premultipliedAlpha: true - }); - this.renderer.resize(zr.painter.getWidth(), zr.painter.getHeight()); - } - catch (e) { - this.renderer = null; - this.dom = document.createElement('div'); - this.dom.style.cssText = 'position:absolute; left: 0; top: 0; right: 0; bottom: 0;'; - this.dom.className = 'ecgl-nowebgl'; - this.dom.innerHTML = 'Sorry, your browser does not support WebGL'; - - console.error(e); - return; - } - - this.onglobalout = this.onglobalout.bind(this); - zr.on('globalout', this.onglobalout); - - /** - * Canvas dom for webgl rendering - * @type {HTMLCanvasElement} - */ - this.dom = this.renderer.canvas; - var style = this.dom.style; - style.position = 'absolute'; - style.left = '0'; - style.top = '0'; - - /** - * @type {Array.} - */ - this.views = []; - - this._picking = new __WEBPACK_IMPORTED_MODULE_2_claygl_src_picking_RayPicking__["a" /* default */]({ - renderer: this.renderer - }); - - this._viewsToDispose = []; - - /** - * Current accumulating id. - */ - this._accumulatingId = 0; - - this._zrEventProxy = new __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.graphic.Rect({ - shape: {x: -1, y: -1, width: 2, height: 2}, - // FIXME Better solution. - __isGLToZRProxy: true - }); - - this._backgroundColor = null; -}; - -/** - * @param {module:echarts-gl/core/ViewGL} view - */ -LayerGL.prototype.addView = function (view) { - if (view.layer === this) { - return; - } - // If needs to dispose in this layer. unmark it. - var idx = this._viewsToDispose.indexOf(view); - if (idx >= 0) { - this._viewsToDispose.splice(idx, 1); - } - - this.views.push(view); - - view.layer = this; - - var zr = this.zr; - view.scene.traverse(function (node) { - node.__zr = zr; - if (node.addAnimatorsToZr) { - node.addAnimatorsToZr(zr); - } - }); -}; - -function removeFromZr(node) { - var zr = node.__zr; - node.__zr = null; - if (zr && node.removeAnimatorsFromZr) { - node.removeAnimatorsFromZr(zr); - } -} -/** - * @param {module:echarts-gl/core/ViewGL} view - */ -LayerGL.prototype.removeView = function (view) { - if (view.layer !== this) { - return; - } - - var idx = this.views.indexOf(view); - if (idx >= 0) { - this.views.splice(idx, 1); - view.scene.traverse(removeFromZr, this); - view.layer = null; - - // Mark to dispose in this layer. - this._viewsToDispose.push(view); - } -}; - -/** - * Remove all views - */ -LayerGL.prototype.removeViewsAll = function () { - this.views.forEach(function (view) { - view.scene.traverse(removeFromZr, this); - view.layer = null; - - // Mark to dispose in this layer. - this._viewsToDispose.push(view); - }, this); - - this.views.length = 0; - -}; - -/** - * Resize the canvas and viewport, will be invoked by zrender - * @param {number} width - * @param {number} height - */ -LayerGL.prototype.resize = function (width, height) { - var renderer = this.renderer; - renderer.resize(width, height); -}; - -/** - * Clear color and depth - * @return {[type]} [description] - */ -LayerGL.prototype.clear = function () { - var gl = this.renderer.gl; - var clearColor = this._backgroundColor || [0, 0, 0, 0]; - gl.clearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]); - gl.depthMask(true); - gl.colorMask(true, true, true, true); - gl.clear(gl.DEPTH_BUFFER_BIT | gl.COLOR_BUFFER_BIT); -}; - -/** - * Clear depth - */ -LayerGL.prototype.clearDepth = function () { - var gl = this.renderer.gl; - gl.clear(gl.DEPTH_BUFFER_BIT); -}; - -/** - * Clear color - */ -LayerGL.prototype.clearColor = function () { - var gl = this.renderer.gl; - gl.clearColor(0, 0, 0, 0); - gl.clear(gl.COLOR_BUFFER_BIT); -}; - -/** - * Mark layer to refresh next tick - */ -LayerGL.prototype.needsRefresh = function () { - this.zr.refresh(); -}; - -/** - * Refresh the layer, will be invoked by zrender - */ -LayerGL.prototype.refresh = function (bgColor) { - - this._backgroundColor = bgColor ? __WEBPACK_IMPORTED_MODULE_4__util_graphicGL__["a" /* default */].parseColor(bgColor) : [0, 0, 0, 0]; - this.renderer.clearColor = this._backgroundColor; - - for (var i = 0; i < this.views.length; i++) { - this.views[i].prepareRender(this.renderer); - } - - this._doRender(false); - - // Auto dispose unused resources on GPU, like program(shader), texture, geometry(buffers) - this._trackAndClean(); - - // Dispose trashed views - for (var i = 0; i < this._viewsToDispose.length; i++) { - this._viewsToDispose[i].dispose(this.renderer); - } - this._viewsToDispose.length = 0; - - this._startAccumulating(); -}; - - -LayerGL.prototype.renderToCanvas = function (ctx) { - // PENDING will block the page - this._startAccumulating(true); - ctx.drawImage(this.dom, 0, 0, ctx.canvas.width, ctx.canvas.height); -}; - -LayerGL.prototype._doRender = function (accumulating) { - this.clear(); - this.renderer.saveViewport(); - for (var i = 0; i < this.views.length; i++) { - this.views[i].render(this.renderer, accumulating); - } - this.renderer.restoreViewport(); -}; - -/** - * Stop accumulating - */ -LayerGL.prototype._stopAccumulating = function () { - this._accumulatingId = 0; - clearTimeout(this._accumulatingTimeout); -}; - -var accumulatingId = 1; -/** - * Start accumulating all the views. - * Accumulating is for antialising and have more sampling in SSAO - * @private - */ -LayerGL.prototype._startAccumulating = function (immediate) { - var self = this; - this._stopAccumulating(); - - var needsAccumulate = false; - for (var i = 0; i < this.views.length; i++) { - needsAccumulate = this.views[i].needsAccumulate() || needsAccumulate; - } - if (!needsAccumulate) { - return; - } - - function accumulate(id) { - if (!self._accumulatingId || id !== self._accumulatingId) { - return; - } - - var isFinished = true; - for (var i = 0; i < self.views.length; i++) { - isFinished = self.views[i].isAccumulateFinished() && needsAccumulate; - } - - if (!isFinished) { - self._doRender(true); - - if (immediate) { - accumulate(id); - } - else { - __WEBPACK_IMPORTED_MODULE_6_zrender_lib_animation_requestAnimationFrame___default()(function () { - accumulate(id); - }); - } - } - } - - this._accumulatingId = accumulatingId++; - - if (immediate) { - accumulate(self._accumulatingId); - } - else { - this._accumulatingTimeout = setTimeout(function () { - accumulate(self._accumulatingId); - }, 50); - } -}; - -LayerGL.prototype._trackAndClean = function () { - var textureList = []; - var geometriesList = []; - - // Mark all resources unused; - if (this._textureList) { - markUnused(this._textureList); - markUnused(this._geometriesList); - } - - for (var i = 0; i < this.views.length; i++) { - collectResources(this.views[i].scene, textureList, geometriesList); - } - - // Dispose those unsed resources. - if (this._textureList) { - checkAndDispose(this.renderer, this._textureList); - checkAndDispose(this.renderer, this._geometriesList); - } - - this._textureList = textureList; - this._geometriesList = geometriesList; -}; - -function markUnused(resourceList) { - for (var i = 0; i < resourceList.length; i++) { - resourceList[i].__used__ = 0; - } -} -function checkAndDispose(renderer, resourceList) { - for (var i = 0; i < resourceList.length; i++) { - if (!resourceList[i].__used__) { - resourceList[i].dispose(renderer); - } - } -} -function updateUsed(resource, list) { - resource.__used__ = resource.__used__ || 0; - resource.__used__++; - if (resource.__used__ === 1) { - // Don't push to the list twice. - list.push(resource); - } -} -function collectResources(scene, textureResourceList, geometryResourceList) { - var prevMaterial; - var prevGeometry; - scene.traverse(function (renderable) { - if (renderable.isRenderable()) { - var geometry = renderable.geometry; - var material = renderable.material; - - // TODO optimize!! - if (material !== prevMaterial) { - var textureUniforms = material.getTextureUniforms(); - for (var u = 0; u < textureUniforms.length; u++) { - var uniformName = textureUniforms[u]; - var val = material.uniforms[uniformName].value; - if (!val) { - continue; - } - if (val instanceof __WEBPACK_IMPORTED_MODULE_3_claygl_src_Texture__["a" /* default */]) { - updateUsed(val, textureResourceList); - } - else if (val instanceof Array) { - for (var k = 0; k < val.length; k++) { - if (val[k] instanceof __WEBPACK_IMPORTED_MODULE_3_claygl_src_Texture__["a" /* default */]) { - updateUsed(val[k], textureResourceList); - } - } - } - } - } - if (geometry !== prevGeometry) { - updateUsed(geometry, geometryResourceList); - } - - prevMaterial = material; - prevGeometry = geometry; - } - }); - - for (var k = 0; k < scene.lights.length; k++) { - // Track AmbientCubemap - if (scene.lights[k].cubemap) { - updateUsed(scene.lights[k].cubemap, textureResourceList); - } - } -} -/** - * Dispose the layer - */ -LayerGL.prototype.dispose = function () { - this._stopAccumulating(); - this.renderer.disposeScene(this.scene); - - this.zr.off('globalout', this.onglobalout); -}; - -// Event handlers -LayerGL.prototype.onmousedown = function (e) { - if (e.target && e.target.__isGLToZRProxy) { - return; - } - - e = e.event; - var obj = this.pickObject(e.offsetX, e.offsetY); - if (obj) { - this._dispatchEvent('mousedown', e, obj); - this._dispatchDataEvent('mousedown', e, obj); - } - - this._downX = e.offsetX; - this._downY = e.offsetY; -}; - -LayerGL.prototype.onmousemove = function (e) { - if (e.target && e.target.__isGLToZRProxy) { - return; - } - - e = e.event; - var obj = this.pickObject(e.offsetX, e.offsetY); - - var target = obj && obj.target; - var lastHovered = this._hovered; - this._hovered = obj; - - if (lastHovered && target !== lastHovered.target) { - lastHovered.relatedTarget = target; - this._dispatchEvent('mouseout', e, lastHovered); - // this._dispatchDataEvent('mouseout', e, lastHovered); - - this.zr.setCursorStyle('default'); - } - - this._dispatchEvent('mousemove', e, obj); - - if (obj) { - this.zr.setCursorStyle('pointer'); - - if (!lastHovered || (target !== lastHovered.target)) { - this._dispatchEvent('mouseover', e, obj); - // this._dispatchDataEvent('mouseover', e, obj); - } - } - - this._dispatchDataEvent('mousemove', e, obj); -}; - -LayerGL.prototype.onmouseup = function (e) { - if (e.target && e.target.__isGLToZRProxy) { - return; - } - - e = e.event; - var obj = this.pickObject(e.offsetX, e.offsetY); - - if (obj) { - this._dispatchEvent('mouseup', e, obj); - this._dispatchDataEvent('mouseup', e, obj); - } - - this._upX = e.offsetX; - this._upY = e.offsetY; -}; - -LayerGL.prototype.onclick = LayerGL.prototype.dblclick = function (e) { - if (e.target && e.target.__isGLToZRProxy) { - return; - } - - // Ignore click event if mouse moved - var dx = this._upX - this._downX; - var dy = this._upY - this._downY; - if (Math.sqrt(dx * dx + dy * dy) > 20) { - return; - } - - e = e.event; - var obj = this.pickObject(e.offsetX, e.offsetY); - - if (obj) { - this._dispatchEvent(e.type, e, obj); - this._dispatchDataEvent(e.type, e, obj); - } - - // Try set depth of field onclick - var result = this._clickToSetFocusPoint(e); - if (result) { - var success = result.view.setDOFFocusOnPoint(result.distance); - if (success) { - this.zr.refresh(); - } - } -}; - -LayerGL.prototype._clickToSetFocusPoint = function (e) { - var renderer = this.renderer; - var oldViewport = renderer.viewport; - for (var i = this.views.length - 1; i >= 0; i--) { - var viewGL = this.views[i]; - if (viewGL.hasDOF() && viewGL.containPoint(e.offsetX, e.offsetY)) { - this._picking.scene = viewGL.scene; - this._picking.camera = viewGL.camera; - // Only used for picking, renderer.setViewport will also invoke gl.viewport. - // Set directly, PENDING. - renderer.viewport = viewGL.viewport; - var result = this._picking.pick(e.offsetX, e.offsetY, true); - if (result) { - result.view = viewGL; - return result; - } - } - } - renderer.viewport = oldViewport; -}; - -LayerGL.prototype.onglobalout = function (e) { - var lastHovered = this._hovered; - if (lastHovered) { - this._dispatchEvent('mouseout', e, { - target: lastHovered.target - }); - } -}; - -LayerGL.prototype.pickObject = function (x, y) { - - var output = []; - var renderer = this.renderer; - var oldViewport = renderer.viewport; - for (var i = 0; i < this.views.length; i++) { - var viewGL = this.views[i]; - if (viewGL.containPoint(x, y)) { - this._picking.scene = viewGL.scene; - this._picking.camera = viewGL.camera; - // Only used for picking, renderer.setViewport will also invoke gl.viewport. - // Set directly, PENDING. - renderer.viewport = viewGL.viewport; - this._picking.pickAll(x, y, output); - } - } - renderer.viewport = oldViewport; - output.sort(function (a, b) { - return a.distance - b.distance; - }); - return output[0]; -}; - -LayerGL.prototype._dispatchEvent = function (eveName, originalEvent, newEvent) { - if (!newEvent) { - newEvent = {}; - } - var current = newEvent.target; - - newEvent.cancelBubble = false; - newEvent.event = originalEvent; - newEvent.type = eveName; - newEvent.offsetX = originalEvent.offsetX; - newEvent.offsetY = originalEvent.offsetY; - - while (current) { - current.trigger(eveName, newEvent); - current = current.getParent(); - - if (newEvent.cancelBubble) { - break; - } - } - - this._dispatchToView(eveName, newEvent); -}; - -LayerGL.prototype._dispatchDataEvent = function (eveName, originalEvent, newEvent) { - var mesh = newEvent && newEvent.target; - - var dataIndex = mesh && mesh.dataIndex; - var seriesIndex = mesh && mesh.seriesIndex; - // Custom event data - var eventData = mesh && mesh.eventData; - var elChangedInMouseMove = false; - - var eventProxy = this._zrEventProxy; - eventProxy.position = [originalEvent.offsetX, originalEvent.offsetY]; - eventProxy.update(); - - var targetInfo = { - target: eventProxy - }; - if (eveName === 'mousemove') { - if (dataIndex != null) { - if (dataIndex !== this._lastDataIndex) { - if (parseInt(this._lastDataIndex, 10) >= 0) { - eventProxy.dataIndex = this._lastDataIndex; - eventProxy.seriesIndex = this._lastSeriesIndex; - // FIXME May cause double events. - this.zr.handler.dispatchToElement(targetInfo, 'mouseout', originalEvent); - } - elChangedInMouseMove = true; - } - } - else if (eventData != null) { - if (eventData !== this._lastEventData) { - if (this._lastEventData != null) { - eventProxy.eventData = this._lastEventData; - // FIXME May cause double events. - this.zr.handler.dispatchToElement(targetInfo, 'mouseout', originalEvent); - } - elChangedInMouseMove = true; - } - } - this._lastEventData = eventData; - this._lastDataIndex = dataIndex; - this._lastSeriesIndex = seriesIndex; - } - - eventProxy.eventData = eventData; - eventProxy.dataIndex = dataIndex; - eventProxy.seriesIndex = seriesIndex; - - if (eventData != null || (parseInt(dataIndex, 10) >= 0 && parseInt(seriesIndex, 10) >= 0)) { - this.zr.handler.dispatchToElement(targetInfo, eveName, originalEvent); - - if (elChangedInMouseMove) { - this.zr.handler.dispatchToElement(targetInfo, 'mouseover', originalEvent); - } - } -}; - -LayerGL.prototype._dispatchToView = function (eventName, e) { - for (var i = 0; i < this.views.length; i++) { - if (this.views[i].containPoint(e.offsetX, e.offsetY)) { - this.views[i].trigger(eventName, e); - } - } -}; - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.extend(LayerGL.prototype, __WEBPACK_IMPORTED_MODULE_5_claygl_src_core_mixin_notifier__["a" /* default */]); - -/* harmony default export */ __webpack_exports__["a"] = (LayerGL); - -/***/ }), -/* 110 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/** - * Extend a sub class from base class - * @param {object|Function} makeDefaultOpt default option of this sub class, method of the sub can use this.xxx to access this option - * @param {Function} [initialize] Initialize after the sub class is instantiated - * @param {Object} [proto] Prototype methods/properties of the sub class - * @memberOf clay.core.mixin.extend - * @return {Function} - */ -function derive(makeDefaultOpt, initialize/*optional*/, proto/*optional*/) { - - if (typeof initialize == 'object') { - proto = initialize; - initialize = null; - } - - var _super = this; - - var propList; - if (!(makeDefaultOpt instanceof Function)) { - // Optimize the property iterate if it have been fixed - propList = []; - for (var propName in makeDefaultOpt) { - if (makeDefaultOpt.hasOwnProperty(propName)) { - propList.push(propName); - } - } - } - - var sub = function(options) { - - // call super constructor - _super.apply(this, arguments); - - if (makeDefaultOpt instanceof Function) { - // Invoke makeDefaultOpt each time if it is a function, So we can make sure each - // property in the object will not be shared by mutiple instances - extend(this, makeDefaultOpt.call(this, options)); - } - else { - extendWithPropList(this, makeDefaultOpt, propList); - } - - if (this.constructor === sub) { - // Initialize function will be called in the order of inherit - var initializers = sub.__initializers__; - for (var i = 0; i < initializers.length; i++) { - initializers[i].apply(this, arguments); - } - } - }; - // save super constructor - sub.__super__ = _super; - // Initialize function will be called after all the super constructor is called - if (!_super.__initializers__) { - sub.__initializers__ = []; - } else { - sub.__initializers__ = _super.__initializers__.slice(); - } - if (initialize) { - sub.__initializers__.push(initialize); - } - - var Ctor = function() {}; - Ctor.prototype = _super.prototype; - sub.prototype = new Ctor(); - sub.prototype.constructor = sub; - extend(sub.prototype, proto); - - // extend the derive method as a static method; - sub.extend = _super.extend; - - // DEPCRATED - sub.derive = _super.extend; - - return sub; -} - -function extend(target, source) { - if (!source) { - return; - } - for (var name in source) { - if (source.hasOwnProperty(name)) { - target[name] = source[name]; - } - } -} - -function extendWithPropList(target, source, propList) { - for (var i = 0; i < propList.length; i++) { - var propName = propList[i]; - target[propName] = source[propName]; - } -} - -/** - * @alias clay.core.mixin.extend - * @mixin - */ -/* harmony default export */ __webpack_exports__["a"] = ({ - - extend: derive, - - // DEPCRATED - derive: derive -}); - - -/***/ }), -/* 111 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -var EXTENSION_LIST = [ - 'OES_texture_float', - 'OES_texture_half_float', - 'OES_texture_float_linear', - 'OES_texture_half_float_linear', - 'OES_standard_derivatives', - 'OES_vertex_array_object', - 'OES_element_index_uint', - 'WEBGL_compressed_texture_s3tc', - 'WEBGL_depth_texture', - 'EXT_texture_filter_anisotropic', - 'EXT_shader_texture_lod', - 'WEBGL_draw_buffers', - 'EXT_frag_depth', - 'EXT_sRGB' -]; - -var PARAMETER_NAMES = [ - 'MAX_TEXTURE_SIZE', - 'MAX_CUBE_MAP_TEXTURE_SIZE' -]; - -function GLInfo(_gl) { - var extensions = {}; - var parameters = {}; - - // Get webgl extension - for (var i = 0; i < EXTENSION_LIST.length; i++) { - var extName = EXTENSION_LIST[i]; - createExtension(extName); - } - // Get parameters - for (var i = 0; i < PARAMETER_NAMES.length; i++) { - var name = PARAMETER_NAMES[i]; - parameters[name] = _gl.getParameter(_gl[name]); - } - - this.getExtension = function (name) { - if (!(name in extensions)) { - createExtension(name); - } - return extensions[name]; - }; - - this.getParameter = function (name) { - return parameters[name]; - }; - - this.getMaxJointNumber = function () { - return 15; - }; - - function createExtension(name) { - var ext = _gl.getExtension(name); - if (!ext) { - ext = _gl.getExtension('MOZ_' + name); - } - if (!ext) { - ext = _gl.getExtension('WEBKIT_' + name); - } - extensions[name] = ext; - } -} - -/* harmony default export */ __webpack_exports__["a"] = (GLInfo); - - -/***/ }), -/* 112 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -function get(options) { - - var xhr = new XMLHttpRequest(); - - xhr.open('get', options.url); - // With response type set browser can get and put binary data - // https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest/Sending_and_Receiving_Binary_Data - // Default is text, and it can be set - // arraybuffer, blob, document, json, text - xhr.responseType = options.responseType || 'text'; - - if (options.onprogress) { - //https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest/Using_XMLHttpRequest - xhr.onprogress = function(e) { - if (e.lengthComputable) { - var percent = e.loaded / e.total; - options.onprogress(percent, e.loaded, e.total); - } - else { - options.onprogress(null); - } - }; - } - xhr.onload = function(e) { - if (xhr.status >= 400) { - options.onerror && options.onerror(); - } - else { - options.onload && options.onload(xhr.response); - } - }; - if (options.onerror) { - xhr.onerror = options.onerror; - } - xhr.send(null); -} - -/* harmony default export */ __webpack_exports__["a"] = ({ - get: get -}); - - -/***/ }), -/* 113 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__core_LRU__ = __webpack_require__(69); -/** - * @namespace clay.core.color - */ - - -var colorUtil = {}; - -var kCSSColorTable = { - 'transparent': [0,0,0,0], 'aliceblue': [240,248,255,1], - 'antiquewhite': [250,235,215,1], 'aqua': [0,255,255,1], - 'aquamarine': [127,255,212,1], 'azure': [240,255,255,1], - 'beige': [245,245,220,1], 'bisque': [255,228,196,1], - 'black': [0,0,0,1], 'blanchedalmond': [255,235,205,1], - 'blue': [0,0,255,1], 'blueviolet': [138,43,226,1], - 'brown': [165,42,42,1], 'burlywood': [222,184,135,1], - 'cadetblue': [95,158,160,1], 'chartreuse': [127,255,0,1], - 'chocolate': [210,105,30,1], 'coral': [255,127,80,1], - 'cornflowerblue': [100,149,237,1], 'cornsilk': [255,248,220,1], - 'crimson': [220,20,60,1], 'cyan': [0,255,255,1], - 'darkblue': [0,0,139,1], 'darkcyan': [0,139,139,1], - 'darkgoldenrod': [184,134,11,1], 'darkgray': [169,169,169,1], - 'darkgreen': [0,100,0,1], 'darkgrey': [169,169,169,1], - 'darkkhaki': [189,183,107,1], 'darkmagenta': [139,0,139,1], - 'darkolivegreen': [85,107,47,1], 'darkorange': [255,140,0,1], - 'darkorchid': [153,50,204,1], 'darkred': [139,0,0,1], - 'darksalmon': [233,150,122,1], 'darkseagreen': [143,188,143,1], - 'darkslateblue': [72,61,139,1], 'darkslategray': [47,79,79,1], - 'darkslategrey': [47,79,79,1], 'darkturquoise': [0,206,209,1], - 'darkviolet': [148,0,211,1], 'deeppink': [255,20,147,1], - 'deepskyblue': [0,191,255,1], 'dimgray': [105,105,105,1], - 'dimgrey': [105,105,105,1], 'dodgerblue': [30,144,255,1], - 'firebrick': [178,34,34,1], 'floralwhite': [255,250,240,1], - 'forestgreen': [34,139,34,1], 'fuchsia': [255,0,255,1], - 'gainsboro': [220,220,220,1], 'ghostwhite': [248,248,255,1], - 'gold': [255,215,0,1], 'goldenrod': [218,165,32,1], - 'gray': [128,128,128,1], 'green': [0,128,0,1], - 'greenyellow': [173,255,47,1], 'grey': [128,128,128,1], - 'honeydew': [240,255,240,1], 'hotpink': [255,105,180,1], - 'indianred': [205,92,92,1], 'indigo': [75,0,130,1], - 'ivory': [255,255,240,1], 'khaki': [240,230,140,1], - 'lavender': [230,230,250,1], 'lavenderblush': [255,240,245,1], - 'lawngreen': [124,252,0,1], 'lemonchiffon': [255,250,205,1], - 'lightblue': [173,216,230,1], 'lightcoral': [240,128,128,1], - 'lightcyan': [224,255,255,1], 'lightgoldenrodyellow': [250,250,210,1], - 'lightgray': [211,211,211,1], 'lightgreen': [144,238,144,1], - 'lightgrey': [211,211,211,1], 'lightpink': [255,182,193,1], - 'lightsalmon': [255,160,122,1], 'lightseagreen': [32,178,170,1], - 'lightskyblue': [135,206,250,1], 'lightslategray': [119,136,153,1], - 'lightslategrey': [119,136,153,1], 'lightsteelblue': [176,196,222,1], - 'lightyellow': [255,255,224,1], 'lime': [0,255,0,1], - 'limegreen': [50,205,50,1], 'linen': [250,240,230,1], - 'magenta': [255,0,255,1], 'maroon': [128,0,0,1], - 'mediumaquamarine': [102,205,170,1], 'mediumblue': [0,0,205,1], - 'mediumorchid': [186,85,211,1], 'mediumpurple': [147,112,219,1], - 'mediumseagreen': [60,179,113,1], 'mediumslateblue': [123,104,238,1], - 'mediumspringgreen': [0,250,154,1], 'mediumturquoise': [72,209,204,1], - 'mediumvioletred': [199,21,133,1], 'midnightblue': [25,25,112,1], - 'mintcream': [245,255,250,1], 'mistyrose': [255,228,225,1], - 'moccasin': [255,228,181,1], 'navajowhite': [255,222,173,1], - 'navy': [0,0,128,1], 'oldlace': [253,245,230,1], - 'olive': [128,128,0,1], 'olivedrab': [107,142,35,1], - 'orange': [255,165,0,1], 'orangered': [255,69,0,1], - 'orchid': [218,112,214,1], 'palegoldenrod': [238,232,170,1], - 'palegreen': [152,251,152,1], 'paleturquoise': [175,238,238,1], - 'palevioletred': [219,112,147,1], 'papayawhip': [255,239,213,1], - 'peachpuff': [255,218,185,1], 'peru': [205,133,63,1], - 'pink': [255,192,203,1], 'plum': [221,160,221,1], - 'powderblue': [176,224,230,1], 'purple': [128,0,128,1], - 'red': [255,0,0,1], 'rosybrown': [188,143,143,1], - 'royalblue': [65,105,225,1], 'saddlebrown': [139,69,19,1], - 'salmon': [250,128,114,1], 'sandybrown': [244,164,96,1], - 'seagreen': [46,139,87,1], 'seashell': [255,245,238,1], - 'sienna': [160,82,45,1], 'silver': [192,192,192,1], - 'skyblue': [135,206,235,1], 'slateblue': [106,90,205,1], - 'slategray': [112,128,144,1], 'slategrey': [112,128,144,1], - 'snow': [255,250,250,1], 'springgreen': [0,255,127,1], - 'steelblue': [70,130,180,1], 'tan': [210,180,140,1], - 'teal': [0,128,128,1], 'thistle': [216,191,216,1], - 'tomato': [255,99,71,1], 'turquoise': [64,224,208,1], - 'violet': [238,130,238,1], 'wheat': [245,222,179,1], - 'white': [255,255,255,1], 'whitesmoke': [245,245,245,1], - 'yellow': [255,255,0,1], 'yellowgreen': [154,205,50,1] -}; - -function clampCssByte(i) { // Clamp to integer 0 .. 255. - i = Math.round(i); // Seems to be what Chrome does (vs truncation). - return i < 0 ? 0 : i > 255 ? 255 : i; -} - -function clampCssAngle(i) { // Clamp to integer 0 .. 360. - i = Math.round(i); // Seems to be what Chrome does (vs truncation). - return i < 0 ? 0 : i > 360 ? 360 : i; -} - -function clampCssFloat(f) { // Clamp to float 0.0 .. 1.0. - return f < 0 ? 0 : f > 1 ? 1 : f; -} - -function parseCssInt(str) { // int or percentage. - if (str.length && str.charAt(str.length - 1) === '%') { - return clampCssByte(parseFloat(str) / 100 * 255); - } - return clampCssByte(parseInt(str, 10)); -} - -function parseCssFloat(str) { // float or percentage. - if (str.length && str.charAt(str.length - 1) === '%') { - return clampCssFloat(parseFloat(str) / 100); - } - return clampCssFloat(parseFloat(str)); -} - -function cssHueToRgb(m1, m2, h) { - if (h < 0) { - h += 1; - } - else if (h > 1) { - h -= 1; - } - - if (h * 6 < 1) { - return m1 + (m2 - m1) * h * 6; - } - if (h * 2 < 1) { - return m2; - } - if (h * 3 < 2) { - return m1 + (m2 - m1) * (2/3 - h) * 6; - } - return m1; -} - -function lerpNumber(a, b, p) { - return a + (b - a) * p; -} - -function setRgba(out, r, g, b, a) { - out[0] = r; out[1] = g; out[2] = b; out[3] = a; - return out; -} -function copyRgba(out, a) { - out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; out[3] = a[3]; - return out; -} - -var colorCache = new __WEBPACK_IMPORTED_MODULE_0__core_LRU__["a" /* default */](20); -var lastRemovedArr = null; - -function putToCache(colorStr, rgbaArr) { - // Reuse removed array - if (lastRemovedArr) { - copyRgba(lastRemovedArr, rgbaArr); - } - lastRemovedArr = colorCache.put(colorStr, lastRemovedArr || (rgbaArr.slice())); -} - -/** - * @name clay.core.color.parse - * @param {string} colorStr - * @param {Array.} out - * @return {Array.} - */ -colorUtil.parse = function (colorStr, rgbaArr) { - if (!colorStr) { - return; - } - rgbaArr = rgbaArr || []; - - var cached = colorCache.get(colorStr); - if (cached) { - return copyRgba(rgbaArr, cached); - } - - // colorStr may be not string - colorStr = colorStr + ''; - // Remove all whitespace, not compliant, but should just be more accepting. - var str = colorStr.replace(/ /g, '').toLowerCase(); - - // Color keywords (and transparent) lookup. - if (str in kCSSColorTable) { - copyRgba(rgbaArr, kCSSColorTable[str]); - putToCache(colorStr, rgbaArr); - return rgbaArr; - } - - // #abc and #abc123 syntax. - if (str.charAt(0) === '#') { - if (str.length === 4) { - var iv = parseInt(str.substr(1), 16); // TODO(deanm): Stricter parsing. - if (!(iv >= 0 && iv <= 0xfff)) { - setRgba(rgbaArr, 0, 0, 0, 1); - return; // Covers NaN. - } - setRgba(rgbaArr, - ((iv & 0xf00) >> 4) | ((iv & 0xf00) >> 8), - (iv & 0xf0) | ((iv & 0xf0) >> 4), - (iv & 0xf) | ((iv & 0xf) << 4), - 1 - ); - putToCache(colorStr, rgbaArr); - return rgbaArr; - } - else if (str.length === 7) { - var iv = parseInt(str.substr(1), 16); // TODO(deanm): Stricter parsing. - if (!(iv >= 0 && iv <= 0xffffff)) { - setRgba(rgbaArr, 0, 0, 0, 1); - return; // Covers NaN. - } - setRgba(rgbaArr, - (iv & 0xff0000) >> 16, - (iv & 0xff00) >> 8, - iv & 0xff, - 1 - ); - putToCache(colorStr, rgbaArr); - return rgbaArr; - } - - return; - } - var op = str.indexOf('('), ep = str.indexOf(')'); - if (op !== -1 && ep + 1 === str.length) { - var fname = str.substr(0, op); - var params = str.substr(op + 1, ep - (op + 1)).split(','); - var alpha = 1; // To allow case fallthrough. - switch (fname) { - case 'rgba': - if (params.length !== 4) { - setRgba(rgbaArr, 0, 0, 0, 1); - return; - } - alpha = parseCssFloat(params.pop()); // jshint ignore:line - // Fall through. - case 'rgb': - if (params.length !== 3) { - setRgba(rgbaArr, 0, 0, 0, 1); - return; - } - setRgba(rgbaArr, - parseCssInt(params[0]), - parseCssInt(params[1]), - parseCssInt(params[2]), - alpha - ); - putToCache(colorStr, rgbaArr); - return rgbaArr; - case 'hsla': - if (params.length !== 4) { - setRgba(rgbaArr, 0, 0, 0, 1); - return; - } - params[3] = parseCssFloat(params[3]); - hsla2rgba(params, rgbaArr); - putToCache(colorStr, rgbaArr); - return rgbaArr; - case 'hsl': - if (params.length !== 3) { - setRgba(rgbaArr, 0, 0, 0, 1); - return; - } - hsla2rgba(params, rgbaArr); - putToCache(colorStr, rgbaArr); - return rgbaArr; - default: - return; - } - } - - setRgba(rgbaArr, 0, 0, 0, 1); - return; -}; - -colorUtil.parseToFloat = function (colorStr, rgbaArr) { - rgbaArr = colorUtil.parse(colorStr, rgbaArr); - if (!rgbaArr) { - return; - } - rgbaArr[0] /= 255; - rgbaArr[1] /= 255; - rgbaArr[2] /= 255; - return rgbaArr; -} - -/** - * @name clay.core.color.hsla2rgba - * @param {Array.} hsla - * @param {Array.} rgba - * @return {Array.} rgba - */ -function hsla2rgba(hsla, rgba) { - var h = (((parseFloat(hsla[0]) % 360) + 360) % 360) / 360; // 0 .. 1 - // NOTE(deanm): According to the CSS spec s/l should only be - // percentages, but we don't bother and let float or percentage. - var s = parseCssFloat(hsla[1]); - var l = parseCssFloat(hsla[2]); - var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s; - var m1 = l * 2 - m2; - - rgba = rgba || []; - setRgba(rgba, - clampCssByte(cssHueToRgb(m1, m2, h + 1 / 3) * 255), - clampCssByte(cssHueToRgb(m1, m2, h) * 255), - clampCssByte(cssHueToRgb(m1, m2, h - 1 / 3) * 255), - 1 - ); - - if (hsla.length === 4) { - rgba[3] = hsla[3]; - } - - return rgba; -} - -/** - * @name clay.core.color.rgba2hsla - * @param {Array.} rgba - * @return {Array.} hsla - */ -function rgba2hsla(rgba) { - if (!rgba) { - return; - } - - // RGB from 0 to 255 - var R = rgba[0] / 255; - var G = rgba[1] / 255; - var B = rgba[2] / 255; - - var vMin = Math.min(R, G, B); // Min. value of RGB - var vMax = Math.max(R, G, B); // Max. value of RGB - var delta = vMax - vMin; // Delta RGB value - - var L = (vMax + vMin) / 2; - var H; - var S; - // HSL results from 0 to 1 - if (delta === 0) { - H = 0; - S = 0; - } - else { - if (L < 0.5) { - S = delta / (vMax + vMin); - } - else { - S = delta / (2 - vMax - vMin); - } - - var deltaR = (((vMax - R) / 6) + (delta / 2)) / delta; - var deltaG = (((vMax - G) / 6) + (delta / 2)) / delta; - var deltaB = (((vMax - B) / 6) + (delta / 2)) / delta; - - if (R === vMax) { - H = deltaB - deltaG; - } - else if (G === vMax) { - H = (1 / 3) + deltaR - deltaB; - } - else if (B === vMax) { - H = (2 / 3) + deltaG - deltaR; - } - - if (H < 0) { - H += 1; - } - - if (H > 1) { - H -= 1; - } - } - - var hsla = [H * 360, S, L]; - - if (rgba[3] != null) { - hsla.push(rgba[3]); - } - - return hsla; -} - -/** - * @name clay.core.color.lift - * @param {string} color - * @param {number} level - * @return {string} - */ -colorUtil.lift = function (color, level) { - var colorArr = colorUtil.parse(color); - if (colorArr) { - for (var i = 0; i < 3; i++) { - if (level < 0) { - colorArr[i] = colorArr[i] * (1 - level) | 0; - } - else { - colorArr[i] = ((255 - colorArr[i]) * level + colorArr[i]) | 0; - } - } - return colorUtil.stringify(colorArr, colorArr.length === 4 ? 'rgba' : 'rgb'); - } -} - -/** - * @name clay.core.color.toHex - * @param {string} color - * @return {string} - */ -colorUtil.toHex = function (color) { - var colorArr = colorUtil.parse(color); - if (colorArr) { - return ((1 << 24) + (colorArr[0] << 16) + (colorArr[1] << 8) + (+colorArr[2])).toString(16).slice(1); - } -}; - -/** - * Map value to color. Faster than lerp methods because color is represented by rgba array. - * @name clay.core.color - * @param {number} normalizedValue A float between 0 and 1. - * @param {Array.>} colors List of rgba color array - * @param {Array.} [out] Mapped gba color array - * @return {Array.} will be null/undefined if input illegal. - */ -colorUtil.fastLerp = function (normalizedValue, colors, out) { - if (!(colors && colors.length) - || !(normalizedValue >= 0 && normalizedValue <= 1) - ) { - return; - } - - out = out || []; - - var value = normalizedValue * (colors.length - 1); - var leftIndex = Math.floor(value); - var rightIndex = Math.ceil(value); - var leftColor = colors[leftIndex]; - var rightColor = colors[rightIndex]; - var dv = value - leftIndex; - out[0] = clampCssByte(lerpNumber(leftColor[0], rightColor[0], dv)); - out[1] = clampCssByte(lerpNumber(leftColor[1], rightColor[1], dv)); - out[2] = clampCssByte(lerpNumber(leftColor[2], rightColor[2], dv)); - out[3] = clampCssFloat(lerpNumber(leftColor[3], rightColor[3], dv)); - - return out; -} - -colorUtil.fastMapToColor = colorUtil.fastLerp; - -/** - * @param {number} normalizedValue A float between 0 and 1. - * @param {Array.} colors Color list. - * @param {boolean=} fullOutput Default false. - * @return {(string|Object)} Result color. If fullOutput, - * return {color: ..., leftIndex: ..., rightIndex: ..., value: ...}, - */ -colorUtil.lerp = function (normalizedValue, colors, fullOutput) { - if (!(colors && colors.length) - || !(normalizedValue >= 0 && normalizedValue <= 1) - ) { - return; - } - - var value = normalizedValue * (colors.length - 1); - var leftIndex = Math.floor(value); - var rightIndex = Math.ceil(value); - var leftColor = colorUtil.parse(colors[leftIndex]); - var rightColor = colorUtil.parse(colors[rightIndex]); - var dv = value - leftIndex; - - var color = colorUtil.stringify( - [ - clampCssByte(lerpNumber(leftColor[0], rightColor[0], dv)), - clampCssByte(lerpNumber(leftColor[1], rightColor[1], dv)), - clampCssByte(lerpNumber(leftColor[2], rightColor[2], dv)), - clampCssFloat(lerpNumber(leftColor[3], rightColor[3], dv)) - ], - 'rgba' - ); - - return fullOutput - ? { - color: color, - leftIndex: leftIndex, - rightIndex: rightIndex, - value: value - } - : color; -} - -/** - * @deprecated - */ -colorUtil.mapToColor = colorUtil.lerp; - -/** - * @name clay.core.color - * @param {string} color - * @param {number=} h 0 ~ 360, ignore when null. - * @param {number=} s 0 ~ 1, ignore when null. - * @param {number=} l 0 ~ 1, ignore when null. - * @return {string} Color string in rgba format. - */ -colorUtil.modifyHSL = function (color, h, s, l) { - color = colorUtil.parse(color); - - if (color) { - color = rgba2hsla(color); - h != null && (color[0] = clampCssAngle(h)); - s != null && (color[1] = parseCssFloat(s)); - l != null && (color[2] = parseCssFloat(l)); - - return colorUtil.stringify(hsla2rgba(color), 'rgba'); - } -} - -/** - * @param {string} color - * @param {number=} alpha 0 ~ 1 - * @return {string} Color string in rgba format. - */ -colorUtil.modifyAlpha = function (color, alpha) { - color = colorUtil.parse(color); - - if (color && alpha != null) { - color[3] = clampCssFloat(alpha); - return colorUtil.stringify(color, 'rgba'); - } -} - -/** - * @param {Array.} arrColor like [12,33,44,0.4] - * @param {string} type 'rgba', 'hsva', ... - * @return {string} Result color. (If input illegal, return undefined). - */ -colorUtil.stringify = function (arrColor, type) { - if (!arrColor || !arrColor.length) { - return; - } - var colorStr = arrColor[0] + ',' + arrColor[1] + ',' + arrColor[2]; - if (type === 'rgba' || type === 'hsva' || type === 'hsla') { - colorStr += ',' + arrColor[3]; - } - return type + '(' + colorStr + ')'; -}; - - - -/* harmony default export */ __webpack_exports__["a"] = (colorUtil); - -/***/ }), -/* 114 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/** - * Simple double linked list. Compared with array, it has O(1) remove operation. - * @constructor - * @alias clay.core.LinkedList - */ -var LinkedList = function () { - - /** - * @type {clay.core.LinkedList.Entry} - */ - this.head = null; - - /** - * @type {clay.core.LinkedList.Entry} - */ - this.tail = null; - - this._length = 0; -}; - -/** - * Insert a new value at the tail - * @param {} val - * @return {clay.core.LinkedList.Entry} - */ -LinkedList.prototype.insert = function (val) { - var entry = new LinkedList.Entry(val); - this.insertEntry(entry); - return entry; -}; - -/** - * Insert a new value at idx - * @param {number} idx - * @param {} val - * @return {clay.core.LinkedList.Entry} - */ -LinkedList.prototype.insertAt = function (idx, val) { - if (idx < 0) { - return; - } - var next = this.head; - var cursor = 0; - while (next && cursor != idx) { - next = next.next; - cursor++; - } - if (next) { - var entry = new LinkedList.Entry(val); - var prev = next.prev; - if (!prev) { //next is head - this.head = entry; - } - else { - prev.next = entry; - entry.prev = prev; - } - entry.next = next; - next.prev = entry; - } - else { - this.insert(val); - } -}; - -LinkedList.prototype.insertBeforeEntry = function (val, next) { - var entry = new LinkedList.Entry(val); - var prev = next.prev; - if (!prev) { //next is head - this.head = entry; - } - else { - prev.next = entry; - entry.prev = prev; - } - entry.next = next; - next.prev = entry; - - this._length++; -}; - -/** - * Insert an entry at the tail - * @param {clay.core.LinkedList.Entry} entry - */ -LinkedList.prototype.insertEntry = function (entry) { - if (!this.head) { - this.head = this.tail = entry; - } - else { - this.tail.next = entry; - entry.prev = this.tail; - this.tail = entry; - } - this._length++; -}; - -/** - * Remove entry. - * @param {clay.core.LinkedList.Entry} entry - */ -LinkedList.prototype.remove = function (entry) { - var prev = entry.prev; - var next = entry.next; - if (prev) { - prev.next = next; - } - else { - // Is head - this.head = next; - } - if (next) { - next.prev = prev; - } - else { - // Is tail - this.tail = prev; - } - entry.next = entry.prev = null; - this._length--; -}; - -/** - * Remove entry at index. - * @param {number} idx - * @return {} - */ -LinkedList.prototype.removeAt = function (idx) { - if (idx < 0) { - return; - } - var curr = this.head; - var cursor = 0; - while (curr && cursor != idx) { - curr = curr.next; - cursor++; - } - if (curr) { - this.remove(curr); - return curr.value; - } -}; -/** - * Get head value - * @return {} - */ -LinkedList.prototype.getHead = function () { - if (this.head) { - return this.head.value; - } -}; -/** - * Get tail value - * @return {} - */ -LinkedList.prototype.getTail = function () { - if (this.tail) { - return this.tail.value; - } -}; -/** - * Get value at idx - * @param {number} idx - * @return {} - */ -LinkedList.prototype.getAt = function (idx) { - if (idx < 0) { - return; - } - var curr = this.head; - var cursor = 0; - while (curr && cursor != idx) { - curr = curr.next; - cursor++; - } - return curr.value; -}; - -/** - * @param {} value - * @return {number} - */ -LinkedList.prototype.indexOf = function (value) { - var curr = this.head; - var cursor = 0; - while (curr) { - if (curr.value === value) { - return cursor; - } - curr = curr.next; - cursor++; - } -}; - -/** - * @return {number} - */ -LinkedList.prototype.length = function () { - return this._length; -}; - -/** - * If list is empty - */ -LinkedList.prototype.isEmpty = function () { - return this._length === 0; -}; - -/** - * @param {Function} cb - * @param {} context - */ -LinkedList.prototype.forEach = function (cb, context) { - var curr = this.head; - var idx = 0; - var haveContext = typeof(context) != 'undefined'; - while (curr) { - if (haveContext) { - cb.call(context, curr.value, idx); - } - else { - cb(curr.value, idx); - } - curr = curr.next; - idx++; - } -}; - -/** - * Clear the list - */ -LinkedList.prototype.clear = function () { - this.tail = this.head = null; - this._length = 0; -}; - -/** - * @constructor - * @param {} val - */ -LinkedList.Entry = function (val) { - /** - * @type {} - */ - this.value = val; - - /** - * @type {clay.core.LinkedList.Entry} - */ - this.next = null; - - /** - * @type {clay.core.LinkedList.Entry} - */ - this.prev = null; -}; - -/* harmony default export */ __webpack_exports__["a"] = (LinkedList); - - -/***/ }), -/* 115 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__GLProgram__ = __webpack_require__(116); - - -var loopRegex = /for\s*?\(int\s*?_idx_\s*\=\s*([\w-]+)\;\s*_idx_\s*<\s*([\w-]+);\s*_idx_\s*\+\+\s*\)\s*\{\{([\s\S]+?)(?=\}\})\}\}/g; - -function unrollLoop(shaderStr, defines, lightsNumbers) { - // Loop unroll from three.js, https://github.com/mrdoob/three.js/blob/master/src/renderers/webgl/WebGLProgram.js#L175 - // In some case like shadowMap in loop use 'i' to index value much slower. - - // Loop use _idx_ and increased with _idx_++ will be unrolled - // Use {{ }} to match the pair so the if statement will not be affected - // Write like following - // for (int _idx_ = 0; _idx_ < 4; _idx_++) {{ - // vec3 color = texture2D(textures[_idx_], uv).rgb; - // }} - function replace(match, start, end, snippet) { - var unroll = ''; - // Try to treat as define - if (isNaN(start)) { - if (start in defines) { - start = defines[start]; - } - else { - start = lightNumberDefines[start]; - } - } - if (isNaN(end)) { - if (end in defines) { - end = defines[end]; - } - else { - end = lightNumberDefines[end]; - } - } - // TODO Error checking - - for (var idx = parseInt(start); idx < parseInt(end); idx++) { - // PENDING Add scope? - unroll += '{' - + snippet - .replace(/float\s*\(\s*_idx_\s*\)/g, idx.toFixed(1)) - .replace(/_idx_/g, idx) - + '}'; - } - - return unroll; - } - - var lightNumberDefines = {}; - for (var lightType in lightsNumbers) { - lightNumberDefines[lightType + '_COUNT'] = lightsNumbers[lightType]; - } - return shaderStr.replace(loopRegex, replace); -} - -function getDefineCode(defines, lightsNumbers, enabledTextures) { - var defineStr = []; - if (lightsNumbers) { - for (var lightType in lightsNumbers) { - var count = lightsNumbers[lightType]; - if (count > 0) { - defineStr.push('#define ' + lightType.toUpperCase() + '_COUNT ' + count); - } - } - } - if (enabledTextures) { - for (var i = 0; i < enabledTextures.length; i++) { - var symbol = enabledTextures[i]; - defineStr.push('#define ' + symbol.toUpperCase() + '_ENABLED'); - } - } - // Custom Defines - for (var symbol in defines) { - var value = defines[symbol]; - if (value === null) { - defineStr.push('#define ' + symbol); - } - else{ - defineStr.push('#define ' + symbol + ' ' + value.toString()); - } - } - return defineStr.join('\n'); -} - -function getExtensionCode(exts) { - // Extension declaration must before all non-preprocessor codes - // TODO vertex ? extension enum ? - var extensionStr = []; - for (var i = 0; i < exts.length; i++) { - extensionStr.push('#extension GL_' + exts[i] + ' : enable'); - } - return extensionStr.join('\n'); -} - -function getPrecisionCode(precision) { - return ['precision', precision, 'float'].join(' ') + ';\n' - + ['precision', precision, 'int'].join(' ') + ';\n' - // depth texture may have precision problem on iOS device. - + ['precision', precision, 'sampler2D'].join(' ') + ';\n'; -} - -function ProgramManager(renderer) { - this._renderer = renderer; - this._cache = {}; -} - -ProgramManager.prototype.getProgram = function (renderable, material, scene) { - var cache = this._cache; - - var isSkinnedMesh = renderable.isSkinnedMesh && renderable.isSkinnedMesh(); - var key = 's' + material.shader.shaderID + 'm' + material.getProgramKey(); - if (scene) { - key += 'se' + scene.getProgramKey(renderable.lightGroup); - } - if (isSkinnedMesh) { - key += ',' + renderable.joints.length; - } - var program = cache[key]; - - if (program) { - return program; - } - - var lightsNumbers = scene ? scene.getLightsNumbers(renderable.lightGroup) : {}; - var renderer = this._renderer; - var _gl = renderer.gl; - var enabledTextures = material.getEnabledTextures(); - var skinDefineCode = ''; - if (isSkinnedMesh) { - var skinDefines = { - SKINNING: null, - JOINT_COUNT: renderable.joints.length - }; - if (renderable.joints.length > renderer.getMaxJointNumber()) { - skinDefines.USE_SKIN_MATRICES_TEXTURE = null; - } - // TODO Add skinning code? - skinDefineCode = '\n' + getDefineCode(skinDefines) + '\n'; - } - // TODO Optimize key generation - // VERTEX - var vertexDefineStr = skinDefineCode + getDefineCode(material.vertexDefines, lightsNumbers, enabledTextures); - // FRAGMENT - var fragmentDefineStr = skinDefineCode + getDefineCode(material.fragmentDefines, lightsNumbers, enabledTextures); - - var vertexCode = vertexDefineStr + '\n' + material.shader.vertex; - - var extensions = [ - 'OES_standard_derivatives', - 'EXT_shader_texture_lod' - ].filter(function (ext) { - return renderer.getGLExtension(ext) != null; - }); - - if (extensions.indexOf('EXT_shader_texture_lod') >= 0) { - fragmentDefineStr += '\n#define SUPPORT_TEXTURE_LOD'; - } - if (extensions.indexOf('OES_standard_derivatives') >= 0) { - fragmentDefineStr += '\n#define SUPPORT_STANDARD_DERIVATIVES'; - } - - var fragmentCode = getExtensionCode(extensions) + '\n' - + getPrecisionCode(material.precision) + '\n' - + fragmentDefineStr + '\n' - + material.shader.fragment; - - var finalVertexCode = unrollLoop(vertexCode, material.vertexDefines, lightsNumbers); - var finalFragmentCode = unrollLoop(fragmentCode, material.fragmentDefines, lightsNumbers); - - var program = new __WEBPACK_IMPORTED_MODULE_0__GLProgram__["a" /* default */](); - program.uniformSemantics = material.shader.uniformSemantics; - program.attributes = material.shader.attributes; - var errorMsg = program.buildProgram(_gl, material.shader, finalVertexCode, finalFragmentCode); - program.__error = errorMsg; - - cache[key] = program; - - return program; -}; - -/* harmony default export */ __webpack_exports__["a"] = (ProgramManager); - -/***/ }), -/* 116 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__core_vendor__ = __webpack_require__(14); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__core_Base__ = __webpack_require__(7); - - - -var SHADER_STATE_TO_ENABLE = 1; -var SHADER_STATE_KEEP_ENABLE = 2; -var SHADER_STATE_PENDING = 3; - -// Enable attribute operation is global to all programs -// Here saved the list of all enabled attribute index -// http://www.mjbshaw.com/2013/03/webgl-fixing-invalidoperation.html -var enabledAttributeList = {}; - -// some util functions -function addLineNumbers(string) { - var chunks = string.split('\n'); - for (var i = 0, il = chunks.length; i < il; i ++) { - // Chrome reports shader errors on lines - // starting counting from 1 - chunks[i] = (i + 1) + ': ' + chunks[i]; - } - return chunks.join('\n'); -} - -// Return true or error msg if error happened -function checkShaderErrorMsg(_gl, shader, shaderString) { - if (!_gl.getShaderParameter(shader, _gl.COMPILE_STATUS)) { - return [_gl.getShaderInfoLog(shader), addLineNumbers(shaderString)].join('\n'); - } -} - -var tmpFloat32Array16 = new __WEBPACK_IMPORTED_MODULE_0__core_vendor__["a" /* default */].Float32Array(16); - -var GLProgram = __WEBPACK_IMPORTED_MODULE_1__core_Base__["a" /* default */].extend({ - - uniformSemantics: {}, - attributes: {} - -}, function () { - this._locations = {}; - - this._textureSlot = 0; - - this._program = null; -}, { - - bind: function (renderer) { - this._textureSlot = 0; - renderer.gl.useProgram(this._program); - }, - - hasUniform: function (symbol) { - var location = this._locations[symbol]; - return location !== null && location !== undefined; - }, - - useTextureSlot: function (renderer, texture, slot) { - if (texture) { - renderer.gl.activeTexture(renderer.gl.TEXTURE0 + slot); - // Maybe texture is not loaded yet; - if (texture.isRenderable()) { - texture.bind(renderer); - } - else { - // Bind texture to null - texture.unbind(renderer); - } - } - }, - - currentTextureSlot: function () { - return this._textureSlot; - }, - - resetTextureSlot: function (slot) { - this._textureSlot = slot || 0; - }, - - takeCurrentTextureSlot: function (renderer, texture) { - var textureSlot = this._textureSlot; - - this.useTextureSlot(renderer, texture, textureSlot); - - this._textureSlot++; - - return textureSlot; - }, - - setUniform: function (_gl, type, symbol, value) { - var locationMap = this._locations; - var location = locationMap[symbol]; - // Uniform is not existed in the shader - if (location === null || location === undefined) { - return false; - } - - switch (type) { - case 'm4': - if (!(value instanceof Float32Array)) { - // Use Float32Array is much faster than array when uniformMatrix4fv. - for (var i = 0; i < value.length; i++) { - tmpFloat32Array16[i] = value[i]; - } - value = tmpFloat32Array16; - } - _gl.uniformMatrix4fv(location, false, value); - break; - case '2i': - _gl.uniform2i(location, value[0], value[1]); - break; - case '2f': - _gl.uniform2f(location, value[0], value[1]); - break; - case '3i': - _gl.uniform3i(location, value[0], value[1], value[2]); - break; - case '3f': - _gl.uniform3f(location, value[0], value[1], value[2]); - break; - case '4i': - _gl.uniform4i(location, value[0], value[1], value[2], value[3]); - break; - case '4f': - _gl.uniform4f(location, value[0], value[1], value[2], value[3]); - break; - case '1i': - _gl.uniform1i(location, value); - break; - case '1f': - _gl.uniform1f(location, value); - break; - case '1fv': - _gl.uniform1fv(location, value); - break; - case '1iv': - _gl.uniform1iv(location, value); - break; - case '2iv': - _gl.uniform2iv(location, value); - break; - case '2fv': - _gl.uniform2fv(location, value); - break; - case '3iv': - _gl.uniform3iv(location, value); - break; - case '3fv': - _gl.uniform3fv(location, value); - break; - case '4iv': - _gl.uniform4iv(location, value); - break; - case '4fv': - _gl.uniform4fv(location, value); - break; - case 'm2': - case 'm2v': - _gl.uniformMatrix2fv(location, false, value); - break; - case 'm3': - case 'm3v': - _gl.uniformMatrix3fv(location, false, value); - break; - case 'm4v': - // Raw value - if (Array.isArray(value) && Array.isArray(value[0])) { - var array = new __WEBPACK_IMPORTED_MODULE_0__core_vendor__["a" /* default */].Float32Array(value.length * 16); - var cursor = 0; - for (var i = 0; i < value.length; i++) { - var item = value[i]; - for (var j = 0; j < 16; j++) { - array[cursor++] = item[j]; - } - } - _gl.uniformMatrix4fv(location, false, array); - } - else { // ArrayBufferView - _gl.uniformMatrix4fv(location, false, value); - } - break; - } - return true; - }, - - setUniformOfSemantic: function (_gl, semantic, val) { - var semanticInfo = this.uniformSemantics[semantic]; - if (semanticInfo) { - return this.setUniform(_gl, semanticInfo.type, semanticInfo.symbol, val); - } - return false; - }, - - // Used for creating VAO - // Enable the attributes passed in and disable the rest - // Example Usage: - // enableAttributes(renderer, ["position", "texcoords"]) - enableAttributes: function (renderer, attribList, vao) { - var _gl = renderer.gl; - var program = this._program; - - var locationMap = this._locations; - - var enabledAttributeListInContext; - if (vao) { - enabledAttributeListInContext = vao.__enabledAttributeList; - } - else { - enabledAttributeListInContext = enabledAttributeList[renderer.__uid__]; - } - if (!enabledAttributeListInContext) { - // In vertex array object context - // PENDING Each vao object needs to enable attributes again? - if (vao) { - enabledAttributeListInContext - = vao.__enabledAttributeList - = []; - } - else { - enabledAttributeListInContext - = enabledAttributeList[renderer.__uid__] - = []; - } - } - var locationList = []; - for (var i = 0; i < attribList.length; i++) { - var symbol = attribList[i]; - if (!this.attributes[symbol]) { - locationList[i] = -1; - continue; - } - var location = locationMap[symbol]; - if (location == null) { - location = _gl.getAttribLocation(program, symbol); - // Attrib location is a number from 0 to ... - if (location === -1) { - locationList[i] = -1; - continue; - } - locationMap[symbol] = location; - } - locationList[i] = location; - - if (!enabledAttributeListInContext[location]) { - enabledAttributeListInContext[location] = SHADER_STATE_TO_ENABLE; - } - else { - enabledAttributeListInContext[location] = SHADER_STATE_KEEP_ENABLE; - } - } - - for (var i = 0; i < enabledAttributeListInContext.length; i++) { - switch(enabledAttributeListInContext[i]){ - case SHADER_STATE_TO_ENABLE: - _gl.enableVertexAttribArray(i); - enabledAttributeListInContext[i] = SHADER_STATE_PENDING; - break; - case SHADER_STATE_KEEP_ENABLE: - enabledAttributeListInContext[i] = SHADER_STATE_PENDING; - break; - // Expired - case SHADER_STATE_PENDING: - _gl.disableVertexAttribArray(i); - enabledAttributeListInContext[i] = 0; - break; - } - } - - return locationList; - }, - - buildProgram: function (_gl, shader, vertexShaderCode, fragmentShaderCode) { - var vertexShader = _gl.createShader(_gl.VERTEX_SHADER); - var program = _gl.createProgram(); - - _gl.shaderSource(vertexShader, vertexShaderCode); - _gl.compileShader(vertexShader); - - var fragmentShader = _gl.createShader(_gl.FRAGMENT_SHADER); - _gl.shaderSource(fragmentShader, fragmentShaderCode); - _gl.compileShader(fragmentShader); - - var msg = checkShaderErrorMsg(_gl, vertexShader, vertexShaderCode); - if (msg) { - return msg; - } - msg = checkShaderErrorMsg(_gl, fragmentShader, fragmentShaderCode); - if (msg) { - return msg; - } - - _gl.attachShader(program, vertexShader); - _gl.attachShader(program, fragmentShader); - // Force the position bind to location 0; - if (shader.attributeSemantics['POSITION']) { - _gl.bindAttribLocation(program, 0, shader.attributeSemantics['POSITION'].symbol); - } - else { - // Else choose an attribute and bind to location 0; - var keys = Object.keys(this.attributes); - _gl.bindAttribLocation(program, 0, keys[0]); - } - - _gl.linkProgram(program); - - if (!_gl.getProgramParameter(program, _gl.LINK_STATUS)) { - return 'Could not link program\n' + _gl.getProgramInfoLog(program); - } - - // Cache uniform locations - for (var i = 0; i < shader.uniforms.length; i++) { - var uniformSymbol = shader.uniforms[i]; - this._locations[uniformSymbol] = _gl.getUniformLocation(program, uniformSymbol); - } - - _gl.deleteShader(vertexShader); - _gl.deleteShader(fragmentShader); - - this._program = program; - - // Save code. - this.vertexCode = vertexShaderCode; - this.fragmentCode = fragmentShaderCode; - } -}); - -/* harmony default export */ __webpack_exports__["a"] = (GLProgram); - -/***/ }), -/* 117 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__core_Base__ = __webpack_require__(7); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__math_Ray__ = __webpack_require__(54); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__math_Vector2__ = __webpack_require__(26); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__math_Vector3__ = __webpack_require__(3); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__math_Matrix4__ = __webpack_require__(9); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Renderable__ = __webpack_require__(72); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__core_glenum__ = __webpack_require__(11); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__glmatrix_vec3__ = __webpack_require__(12); - - - - - - - - - -/** - * @constructor clay.picking.RayPicking - * @extends clay.core.Base - */ -var RayPicking = __WEBPACK_IMPORTED_MODULE_0__core_Base__["a" /* default */].extend(/** @lends clay.picking.RayPicking# */{ - /** - * Target scene - * @type {clay.Scene} - */ - scene: null, - /** - * Target camera - * @type {clay.Camera} - */ - camera: null, - /** - * Target renderer - * @type {clay.Renderer} - */ - renderer: null -}, function () { - this._ray = new __WEBPACK_IMPORTED_MODULE_1__math_Ray__["a" /* default */](); - this._ndc = new __WEBPACK_IMPORTED_MODULE_2__math_Vector2__["a" /* default */](); -}, -/** @lends clay.picking.RayPicking.prototype */ -{ - - /** - * Pick the nearest intersection object in the scene - * @param {number} x Mouse position x - * @param {number} y Mouse position y - * @param {boolean} [forcePickAll=false] ignore ignorePicking - * @return {clay.picking.RayPicking~Intersection} - */ - pick: function (x, y, forcePickAll) { - var out = this.pickAll(x, y, [], forcePickAll); - return out[0] || null; - }, - - /** - * Pick all intersection objects, wich will be sorted from near to far - * @param {number} x Mouse position x - * @param {number} y Mouse position y - * @param {Array} [output] - * @param {boolean} [forcePickAll=false] ignore ignorePicking - * @return {Array.} - */ - pickAll: function (x, y, output, forcePickAll) { - this.renderer.screenToNDC(x, y, this._ndc); - this.camera.castRay(this._ndc, this._ray); - - output = output || []; - - this._intersectNode(this.scene, output, forcePickAll || false); - - output.sort(this._intersectionCompareFunc); - - return output; - }, - - _intersectNode: function (node, out, forcePickAll) { - if ((node instanceof __WEBPACK_IMPORTED_MODULE_5__Renderable__["a" /* default */]) && node.isRenderable()) { - if ((!node.ignorePicking || forcePickAll) - && ( - // Only triangle mesh support ray picking - (node.mode === __WEBPACK_IMPORTED_MODULE_6__core_glenum__["a" /* default */].TRIANGLES && node.geometry.isUseIndices()) - // Or if geometry has it's own pickByRay, pick, implementation - || node.geometry.pickByRay - || node.geometry.pick - ) - ) { - this._intersectRenderable(node, out); - } - } - for (var i = 0; i < node._children.length; i++) { - this._intersectNode(node._children[i], out, forcePickAll); - } - }, - - _intersectRenderable: (function () { - - var v1 = new __WEBPACK_IMPORTED_MODULE_3__math_Vector3__["a" /* default */](); - var v2 = new __WEBPACK_IMPORTED_MODULE_3__math_Vector3__["a" /* default */](); - var v3 = new __WEBPACK_IMPORTED_MODULE_3__math_Vector3__["a" /* default */](); - var ray = new __WEBPACK_IMPORTED_MODULE_1__math_Ray__["a" /* default */](); - var worldInverse = new __WEBPACK_IMPORTED_MODULE_4__math_Matrix4__["a" /* default */](); - - return function (renderable, out) { - - var isSkinnedMesh = renderable.isSkinnedMesh(); - ray.copy(this._ray); - __WEBPACK_IMPORTED_MODULE_4__math_Matrix4__["a" /* default */].invert(worldInverse, renderable.worldTransform); - - // Skinned mesh will ignore the world transform. - if (!isSkinnedMesh) { - ray.applyTransform(worldInverse); - } - - var geometry = renderable.geometry; - - var bbox = isSkinnedMesh ? renderable.skeleton.boundingBox : geometry.boundingBox; - - if (bbox && !ray.intersectBoundingBox(bbox)) { - return; - } - // Use user defined picking algorithm - if (geometry.pick) { - geometry.pick( - this._ndc.x, this._ndc.y, - this.renderer, - this.camera, - renderable, out - ); - return; - } - // Use user defined ray picking algorithm - else if (geometry.pickByRay) { - geometry.pickByRay(ray, renderable, out); - return; - } - - var cullBack = (renderable.cullFace === __WEBPACK_IMPORTED_MODULE_6__core_glenum__["a" /* default */].BACK && renderable.frontFace === __WEBPACK_IMPORTED_MODULE_6__core_glenum__["a" /* default */].CCW) - || (renderable.cullFace === __WEBPACK_IMPORTED_MODULE_6__core_glenum__["a" /* default */].FRONT && renderable.frontFace === __WEBPACK_IMPORTED_MODULE_6__core_glenum__["a" /* default */].CW); - - var point; - var indices = geometry.indices; - var positionAttr = geometry.attributes.position; - var weightAttr = geometry.attributes.weight; - var jointAttr = geometry.attributes.joint; - var skinMatricesArray; - var skinMatrices = []; - // Check if valid. - if (!positionAttr || !positionAttr.value || !indices) { - return; - } - if (isSkinnedMesh) { - skinMatricesArray = renderable.skeleton.getSubSkinMatrices(renderable.__uid__, renderable.joints); - for (var i = 0; i < renderable.joints.length; i++) { - skinMatrices[i] = skinMatrices[i] || []; - for (var k = 0; k < 16; k++) { - skinMatrices[i][k] = skinMatricesArray[i * 16 + k]; - } - } - var pos = []; - var weight = []; - var joint = []; - var skinnedPos = []; - var tmp = []; - var skinnedPositionAttr = geometry.attributes.skinnedPosition; - if (!skinnedPositionAttr || !skinnedPositionAttr.value) { - geometry.createAttribute('skinnedPosition', 'f', 3); - skinnedPositionAttr = geometry.attributes.skinnedPosition; - skinnedPositionAttr.init(geometry.vertexCount); - } - for (var i = 0; i < geometry.vertexCount; i++) { - positionAttr.get(i, pos); - weightAttr.get(i, weight); - jointAttr.get(i, joint); - weight[3] = 1 - weight[0] - weight[1] - weight[2]; - __WEBPACK_IMPORTED_MODULE_7__glmatrix_vec3__["a" /* default */].set(skinnedPos, 0, 0, 0); - for (var k = 0; k < 4; k++) { - if (joint[k] >= 0 && weight[k] > 1e-4) { - __WEBPACK_IMPORTED_MODULE_7__glmatrix_vec3__["a" /* default */].transformMat4(tmp, pos, skinMatrices[joint[k]]); - __WEBPACK_IMPORTED_MODULE_7__glmatrix_vec3__["a" /* default */].scaleAndAdd(skinnedPos, skinnedPos, tmp, weight[k]); - } - } - skinnedPositionAttr.set(i, skinnedPos); - } - } - - for (var i = 0; i < indices.length; i += 3) { - var i1 = indices[i]; - var i2 = indices[i + 1]; - var i3 = indices[i + 2]; - var finalPosAttr = isSkinnedMesh - ? geometry.attributes.skinnedPosition - : positionAttr; - finalPosAttr.get(i1, v1.array); - finalPosAttr.get(i2, v2.array); - finalPosAttr.get(i3, v3.array); - - if (cullBack) { - point = ray.intersectTriangle(v1, v2, v3, renderable.culling); - } - else { - point = ray.intersectTriangle(v1, v3, v2, renderable.culling); - } - if (point) { - var pointW = new __WEBPACK_IMPORTED_MODULE_3__math_Vector3__["a" /* default */](); - if (!isSkinnedMesh) { - __WEBPACK_IMPORTED_MODULE_3__math_Vector3__["a" /* default */].transformMat4(pointW, point, renderable.worldTransform); - } - else { - // TODO point maybe not right. - __WEBPACK_IMPORTED_MODULE_3__math_Vector3__["a" /* default */].copy(pointW, point); - } - out.push(new RayPicking.Intersection( - point, pointW, renderable, [i1, i2, i3], i / 3, - __WEBPACK_IMPORTED_MODULE_3__math_Vector3__["a" /* default */].dist(pointW, this._ray.origin) - )); - } - } - }; - })(), - - _intersectionCompareFunc: function (a, b) { - return a.distance - b.distance; - } -}); - -/** - * @constructor clay.picking.RayPicking~Intersection - * @param {clay.Vector3} point - * @param {clay.Vector3} pointWorld - * @param {clay.Node} target - * @param {Array.} triangle - * @param {number} triangleIndex - * @param {number} distance - */ -RayPicking.Intersection = function (point, pointWorld, target, triangle, triangleIndex, distance) { - /** - * Intersection point in local transform coordinates - * @type {clay.Vector3} - */ - this.point = point; - /** - * Intersection point in world transform coordinates - * @type {clay.Vector3} - */ - this.pointWorld = pointWorld; - /** - * Intersection scene node - * @type {clay.Node} - */ - this.target = target; - /** - * Intersection triangle, which is an array of vertex index - * @type {Array.} - */ - this.triangle = triangle; - /** - * Index of intersection triangle. - */ - this.triangleIndex = triangleIndex; - /** - * Distance from intersection point to ray origin - * @type {number} - */ - this.distance = distance; -}; - -/* harmony default export */ __webpack_exports__["a"] = (RayPicking); - - -/***/ }), -/* 118 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__core_Base__ = __webpack_require__(7); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__core_glenum__ = __webpack_require__(11); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__core_Cache__ = __webpack_require__(57); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__core_vendor__ = __webpack_require__(14); - - - - - -function getArrayCtorByType (type) { - return ({ - 'byte': __WEBPACK_IMPORTED_MODULE_3__core_vendor__["a" /* default */].Int8Array, - 'ubyte': __WEBPACK_IMPORTED_MODULE_3__core_vendor__["a" /* default */].Uint8Array, - 'short': __WEBPACK_IMPORTED_MODULE_3__core_vendor__["a" /* default */].Int16Array, - 'ushort': __WEBPACK_IMPORTED_MODULE_3__core_vendor__["a" /* default */].Uint16Array - })[type] || __WEBPACK_IMPORTED_MODULE_3__core_vendor__["a" /* default */].Float32Array; -} - -function makeAttrKey(attrName) { - return 'attr_' + attrName; -} -/** - * GeometryBase attribute - * @alias clay.GeometryBase.Attribute - * @constructor - */ -function Attribute(name, type, size, semantic) { - /** - * Attribute name - * @type {string} - */ - this.name = name; - /** - * Attribute type - * Possible values: - * + `'byte'` - * + `'ubyte'` - * + `'short'` - * + `'ushort'` - * + `'float'` Most commonly used. - * @type {string} - */ - this.type = type; - /** - * Size of attribute component. 1 - 4. - * @type {number} - */ - this.size = size; - /** - * Semantic of this attribute. - * Possible values: - * + `'POSITION'` - * + `'NORMAL'` - * + `'BINORMAL'` - * + `'TANGENT'` - * + `'TEXCOORD'` - * + `'TEXCOORD_0'` - * + `'TEXCOORD_1'` - * + `'COLOR'` - * + `'JOINT'` - * + `'WEIGHT'` - * - * In shader, attribute with same semantic will be automatically mapped. For example: - * ```glsl - * attribute vec3 pos: POSITION - * ``` - * will use the attribute value with semantic POSITION in geometry, no matter what name it used. - * @type {string} - */ - this.semantic = semantic || ''; - - /** - * Value of the attribute. - * @type {TypedArray} - */ - this.value = null; - - // Init getter setter - switch (size) { - case 1: - this.get = function (idx) { - return this.value[idx]; - }; - this.set = function (idx, value) { - this.value[idx] = value; - }; - // Copy from source to target - this.copy = function (target, source) { - this.value[target] = this.value[target]; - }; - break; - case 2: - this.get = function (idx, out) { - var arr = this.value; - out[0] = arr[idx * 2]; - out[1] = arr[idx * 2 + 1]; - return out; - }; - this.set = function (idx, val) { - var arr = this.value; - arr[idx * 2] = val[0]; - arr[idx * 2 + 1] = val[1]; - }; - this.copy = function (target, source) { - var arr = this.value; - source *= 2; - target *= 2; - arr[target] = arr[source]; - arr[target + 1] = arr[source + 1]; - }; - break; - case 3: - this.get = function (idx, out) { - var idx3 = idx * 3; - var arr = this.value; - out[0] = arr[idx3]; - out[1] = arr[idx3 + 1]; - out[2] = arr[idx3 + 2]; - return out; - }; - this.set = function (idx, val) { - var idx3 = idx * 3; - var arr = this.value; - arr[idx3] = val[0]; - arr[idx3 + 1] = val[1]; - arr[idx3 + 2] = val[2]; - }; - this.copy = function (target, source) { - var arr = this.value; - source *= 3; - target *= 3; - arr[target] = arr[source]; - arr[target + 1] = arr[source + 1]; - arr[target + 2] = arr[source + 2]; - }; - break; - case 4: - this.get = function (idx, out) { - var arr = this.value; - var idx4 = idx * 4; - out[0] = arr[idx4]; - out[1] = arr[idx4 + 1]; - out[2] = arr[idx4 + 2]; - out[3] = arr[idx4 + 3]; - return out; - }; - this.set = function (idx, val) { - var arr = this.value; - var idx4 = idx * 4; - arr[idx4] = val[0]; - arr[idx4 + 1] = val[1]; - arr[idx4 + 2] = val[2]; - arr[idx4 + 3] = val[3]; - }; - this.copy = function (target, source) { - var arr = this.value; - source *= 4; - target *= 4; - // copyWithin is extremely slow - arr[target] = arr[source]; - arr[target + 1] = arr[source + 1]; - arr[target + 2] = arr[source + 2]; - arr[target + 3] = arr[source + 3]; - }; - } -} - -/** - * Set item value at give index. Second parameter val is number if size is 1 - * @function - * @name clay.GeometryBase.Attribute#set - * @param {number} idx - * @param {number[]|number} val - * @example - * geometry.getAttribute('position').set(0, [1, 1, 1]); - */ - -/** - * Get item value at give index. Second parameter out is no need if size is 1 - * @function - * @name clay.GeometryBase.Attribute#set - * @param {number} idx - * @param {number[]} [out] - * @example - * geometry.getAttribute('position').get(0, out); - */ - -/** - * Initialize attribute with given vertex count - * @param {number} nVertex - */ -Attribute.prototype.init = function (nVertex) { - if (!this.value || this.value.length != nVertex * this.size) { - var ArrayConstructor = getArrayCtorByType(this.type); - this.value = new ArrayConstructor(nVertex * this.size); - } -}; - -/** - * Initialize attribute with given array. Which can be 1 dimensional or 2 dimensional - * @param {Array} array - * @example - * geometry.getAttribute('position').fromArray( - * [-1, 0, 0, 1, 0, 0, 0, 1, 0] - * ); - * geometry.getAttribute('position').fromArray( - * [ [-1, 0, 0], [1, 0, 0], [0, 1, 0] ] - * ); - */ -Attribute.prototype.fromArray = function (array) { - var ArrayConstructor = getArrayCtorByType(this.type); - var value; - // Convert 2d array to flat - if (array[0] && (array[0].length)) { - var n = 0; - var size = this.size; - value = new ArrayConstructor(array.length * size); - for (var i = 0; i < array.length; i++) { - for (var j = 0; j < size; j++) { - value[n++] = array[i][j]; - } - } - } - else { - value = new ArrayConstructor(array); - } - this.value = value; -}; - -Attribute.prototype.clone = function(copyValue) { - var ret = new Attribute(this.name, this.type, this.size, this.semantic); - // FIXME - if (copyValue) { - console.warn('todo'); - } - return ret; -}; - -function AttributeBuffer(name, type, buffer, size, semantic) { - this.name = name; - this.type = type; - this.buffer = buffer; - this.size = size; - this.semantic = semantic; - - // To be set in mesh - // symbol in the shader - this.symbol = ''; - - // Needs remove flag - this.needsRemove = false; -} - -function IndicesBuffer(buffer) { - this.buffer = buffer; - this.count = 0; -} - -/** - * Base of all geometry. Use {@link clay.Geometry} for common 3D usage. - * @constructor clay.GeometryBase - * @extends clay.core.Base - */ -var GeometryBase = __WEBPACK_IMPORTED_MODULE_0__core_Base__["a" /* default */].extend(function () { - return /** @lends clay.GeometryBase# */ { - /** - * Attributes of geometry. - * @type {Object.} - */ - attributes: {}, - - /** - * Indices of geometry. - * @type {Uint16Array|Uint32Array} - */ - indices: null, - - /** - * Is vertices data dynamically updated. - * Attributes value can't be changed after first render if dyanmic is false. - * @type {boolean} - */ - dynamic: true, - - _enabledAttributes: null, - - // PENDING - // Init it here to avoid deoptimization when it's assigned in application dynamically - __used: 0 - }; -}, function() { - // Use cache - this._cache = new __WEBPACK_IMPORTED_MODULE_2__core_Cache__["a" /* default */](); - - this._attributeList = Object.keys(this.attributes); - - this.__vaoCache = {}; -}, -/** @lends clay.GeometryBase.prototype */ -{ - /** - * Main attribute will be used to count vertex number - * @type {string} - */ - mainAttribute: '', - /** - * User defined picking algorithm instead of default - * triangle ray intersection - * x, y are NDC. - * ```typescript - * (x, y, renderer, camera, renderable, out) => boolean - * ``` - * @type {?Function} - */ - pick: null, - - /** - * User defined ray picking algorithm instead of default - * triangle ray intersection - * ```typescript - * (ray: clay.Ray, renderable: clay.Renderable, out: Array) => boolean - * ``` - * @type {?Function} - */ - pickByRay: null, - - /** - * Mark attributes and indices in geometry needs to update. - * Usually called after you change the data in attributes. - */ - dirty: function () { - var enabledAttributes = this.getEnabledAttributes(); - for (var i = 0; i < enabledAttributes.length; i++) { - this.dirtyAttribute(enabledAttributes[i]); - } - this.dirtyIndices(); - this._enabledAttributes = null; - - this._cache.dirty('any'); - }, - /** - * Mark the indices needs to update. - */ - dirtyIndices: function () { - this._cache.dirtyAll('indices'); - }, - /** - * Mark the attributes needs to update. - * @param {string} [attrName] - */ - dirtyAttribute: function (attrName) { - this._cache.dirtyAll(makeAttrKey(attrName)); - this._cache.dirtyAll('attributes'); - }, - /** - * Get indices of triangle at given index. - * @param {number} idx - * @param {Array.} out - * @return {Array.} - */ - getTriangleIndices: function (idx, out) { - if (idx < this.triangleCount && idx >= 0) { - if (!out) { - out = []; - } - var indices = this.indices; - out[0] = indices[idx * 3]; - out[1] = indices[idx * 3 + 1]; - out[2] = indices[idx * 3 + 2]; - return out; - } - }, - - /** - * Set indices of triangle at given index. - * @param {number} idx - * @param {Array.} arr - */ - setTriangleIndices: function (idx, arr) { - var indices = this.indices; - indices[idx * 3] = arr[0]; - indices[idx * 3 + 1] = arr[1]; - indices[idx * 3 + 2] = arr[2]; - }, - - isUseIndices: function () { - return !!this.indices; - }, - - /** - * Initialize indices from an array. - * @param {Array} array - */ - initIndicesFromArray: function (array) { - var value; - var ArrayConstructor = this.vertexCount > 0xffff - ? __WEBPACK_IMPORTED_MODULE_3__core_vendor__["a" /* default */].Uint32Array : __WEBPACK_IMPORTED_MODULE_3__core_vendor__["a" /* default */].Uint16Array; - // Convert 2d array to flat - if (array[0] && (array[0].length)) { - var n = 0; - var size = 3; - - value = new ArrayConstructor(array.length * size); - for (var i = 0; i < array.length; i++) { - for (var j = 0; j < size; j++) { - value[n++] = array[i][j]; - } - } - } - else { - value = new ArrayConstructor(array); - } - - this.indices = value; - }, - /** - * Create a new attribute - * @param {string} name - * @param {string} type - * @param {number} size - * @param {string} [semantic] - */ - createAttribute: function (name, type, size, semantic) { - var attrib = new Attribute(name, type, size, semantic); - if (this.attributes[name]) { - this.removeAttribute(name); - } - this.attributes[name] = attrib; - this._attributeList.push(name); - return attrib; - }, - /** - * Remove attribute - * @param {string} name - */ - removeAttribute: function (name) { - var attributeList = this._attributeList; - var idx = attributeList.indexOf(name); - if (idx >= 0) { - attributeList.splice(idx, 1); - delete this.attributes[name]; - return true; - } - return false; - }, - - /** - * Get attribute - * @param {string} name - * @return {clay.GeometryBase.Attribute} - */ - getAttribute: function (name) { - return this.attributes[name]; - }, - - /** - * Get enabled attributes name list - * Attribute which has the same vertex number with position is treated as a enabled attribute - * @return {string[]} - */ - getEnabledAttributes: function () { - var enabledAttributes = this._enabledAttributes; - var attributeList = this._attributeList; - // Cache - if (enabledAttributes) { - return enabledAttributes; - } - - var result = []; - var nVertex = this.vertexCount; - - for (var i = 0; i < attributeList.length; i++) { - var name = attributeList[i]; - var attrib = this.attributes[name]; - if (attrib.value) { - if (attrib.value.length === nVertex * attrib.size) { - result.push(name); - } - } - } - - this._enabledAttributes = result; - - return result; - }, - - getBufferChunks: function (renderer) { - var cache = this._cache; - cache.use(renderer.__uid__); - var isAttributesDirty = cache.isDirty('attributes'); - var isIndicesDirty = cache.isDirty('indices'); - if (isAttributesDirty || isIndicesDirty) { - this._updateBuffer(renderer.gl, isAttributesDirty, isIndicesDirty); - var enabledAttributes = this.getEnabledAttributes(); - for (var i = 0; i < enabledAttributes.length; i++) { - cache.fresh(makeAttrKey(enabledAttributes[i])); - } - cache.fresh('attributes'); - cache.fresh('indices'); - } - cache.fresh('any'); - return cache.get('chunks'); - }, - - _updateBuffer: function (_gl, isAttributesDirty, isIndicesDirty) { - var cache = this._cache; - var chunks = cache.get('chunks'); - var firstUpdate = false; - if (!chunks) { - chunks = []; - // Intialize - chunks[0] = { - attributeBuffers: [], - indicesBuffer: null - }; - cache.put('chunks', chunks); - firstUpdate = true; - } - - var chunk = chunks[0]; - var attributeBuffers = chunk.attributeBuffers; - var indicesBuffer = chunk.indicesBuffer; - - if (isAttributesDirty || firstUpdate) { - var attributeList = this.getEnabledAttributes(); - - var attributeBufferMap = {}; - if (!firstUpdate) { - for (var i = 0; i < attributeBuffers.length; i++) { - attributeBufferMap[attributeBuffers[i].name] = attributeBuffers[i]; - } - } - // FIXME If some attributes removed - for (var k = 0; k < attributeList.length; k++) { - var name = attributeList[k]; - var attribute = this.attributes[name]; - - var bufferInfo; - - if (!firstUpdate) { - bufferInfo = attributeBufferMap[name]; - } - var buffer; - if (bufferInfo) { - buffer = bufferInfo.buffer; - } - else { - buffer = _gl.createBuffer(); - } - if (cache.isDirty(makeAttrKey(name))) { - // Only update when they are dirty. - // TODO: Use BufferSubData? - _gl.bindBuffer(_gl.ARRAY_BUFFER, buffer); - _gl.bufferData(_gl.ARRAY_BUFFER, attribute.value, this.dynamic ? __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].DYNAMIC_DRAW : __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].STATIC_DRAW); - } - - attributeBuffers[k] = new AttributeBuffer(name, attribute.type, buffer, attribute.size, attribute.semantic); - } - // Remove unused attributes buffers. - // PENDING - for (var i = k; i < attributeBuffers.length; i++) { - _gl.deleteBuffer(attributeBuffers[i].buffer); - } - attributeBuffers.length = k; - - } - - if (this.isUseIndices() && (isIndicesDirty || firstUpdate)) { - if (!indicesBuffer) { - indicesBuffer = new IndicesBuffer(_gl.createBuffer()); - chunk.indicesBuffer = indicesBuffer; - } - indicesBuffer.count = this.indices.length; - _gl.bindBuffer(_gl.ELEMENT_ARRAY_BUFFER, indicesBuffer.buffer); - _gl.bufferData(_gl.ELEMENT_ARRAY_BUFFER, this.indices, this.dynamic ? __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].DYNAMIC_DRAW : __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].STATIC_DRAW); - } - }, - - /** - * Dispose geometry data in GL context. - * @param {clay.Renderer} renderer - */ - dispose: function (renderer) { - - var cache = this._cache; - - cache.use(renderer.__uid__); - var chunks = cache.get('chunks'); - if (chunks) { - for (var c = 0; c < chunks.length; c++) { - var chunk = chunks[c]; - - for (var k = 0; k < chunk.attributeBuffers.length; k++) { - var attribs = chunk.attributeBuffers[k]; - renderer.gl.deleteBuffer(attribs.buffer); - } - - if (chunk.indicesBuffer) { - renderer.gl.deleteBuffer(chunk.indicesBuffer.buffer); - } - } - } - if (this.__vaoCache) { - var vaoExt = renderer.getGLExtension('OES_vertex_array_object'); - for (var id in this.__vaoCache) { - var vao = this.__vaoCache[id].vao; - if (vao) { - vaoExt.deleteVertexArrayOES(vao); - } - } - } - this.__vaoCache = {}; - cache.deleteContext(renderer.__uid__); - } - -}); - -if (Object.defineProperty) { - /** - * @name clay.GeometryBase#vertexCount - * @type {number} - * @readOnly - */ - Object.defineProperty(GeometryBase.prototype, 'vertexCount', { - - enumerable: false, - - get: function () { - - var mainAttribute = this.attributes[this.mainAttribute]; - - if (!mainAttribute) { - mainAttribute = this.attributes[this._attributeList[0]]; - } - - if (!mainAttribute || !mainAttribute.value) { - return 0; - } - return mainAttribute.value.length / mainAttribute.size; - } - }); - /** - * @name clay.GeometryBase#triangleCount - * @type {number} - * @readOnly - */ - Object.defineProperty(GeometryBase.prototype, 'triangleCount', { - - enumerable: false, - - get: function () { - var indices = this.indices; - if (!indices) { - return 0; - } - else { - return indices.length / 3; - } - } - }); -} - -GeometryBase.STATIC_DRAW = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].STATIC_DRAW; -GeometryBase.DYNAMIC_DRAW = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].DYNAMIC_DRAW; -GeometryBase.STREAM_DRAW = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].STREAM_DRAW; - -GeometryBase.AttributeBuffer = AttributeBuffer; -GeometryBase.IndicesBuffer = IndicesBuffer; - -GeometryBase.Attribute = Attribute; - -/* harmony default export */ __webpack_exports__["a"] = (GeometryBase); - - -/***/ }), -/* 119 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__calcAmbientSHLight_glsl_js__ = __webpack_require__(120); - - -var uniformVec3Prefix = 'uniform vec3 '; -var uniformFloatPrefix = 'uniform float '; -var exportHeaderPrefix = '@export clay.header.'; -var exportEnd = '@end'; -var unconfigurable = ':unconfigurable;'; -/* harmony default export */ __webpack_exports__["a"] = ([ - exportHeaderPrefix + 'directional_light', - uniformVec3Prefix + 'directionalLightDirection[DIRECTIONAL_LIGHT_COUNT]' + unconfigurable, - uniformVec3Prefix + 'directionalLightColor[DIRECTIONAL_LIGHT_COUNT]' + unconfigurable, - exportEnd, - - exportHeaderPrefix + 'ambient_light', - uniformVec3Prefix + 'ambientLightColor[AMBIENT_LIGHT_COUNT]' + unconfigurable, - exportEnd, - - exportHeaderPrefix + 'ambient_sh_light', - uniformVec3Prefix + 'ambientSHLightColor[AMBIENT_SH_LIGHT_COUNT]' + unconfigurable, - uniformVec3Prefix + 'ambientSHLightCoefficients[AMBIENT_SH_LIGHT_COUNT * 9]' + unconfigurable, - __WEBPACK_IMPORTED_MODULE_0__calcAmbientSHLight_glsl_js__["a" /* default */], - exportEnd, - - exportHeaderPrefix + 'ambient_cubemap_light', - uniformVec3Prefix + 'ambientCubemapLightColor[AMBIENT_CUBEMAP_LIGHT_COUNT]' + unconfigurable, - 'uniform samplerCube ambientCubemapLightCubemap[AMBIENT_CUBEMAP_LIGHT_COUNT]' + unconfigurable, - 'uniform sampler2D ambientCubemapLightBRDFLookup[AMBIENT_CUBEMAP_LIGHT_COUNT]' + unconfigurable, - exportEnd, - - exportHeaderPrefix + 'point_light', - uniformVec3Prefix + 'pointLightPosition[POINT_LIGHT_COUNT]' + unconfigurable, - uniformFloatPrefix + 'pointLightRange[POINT_LIGHT_COUNT]' + unconfigurable, - uniformVec3Prefix + 'pointLightColor[POINT_LIGHT_COUNT]' + unconfigurable, - exportEnd, - - exportHeaderPrefix + 'spot_light', - uniformVec3Prefix + 'spotLightPosition[SPOT_LIGHT_COUNT]' + unconfigurable, - uniformVec3Prefix + 'spotLightDirection[SPOT_LIGHT_COUNT]' + unconfigurable, - uniformFloatPrefix + 'spotLightRange[SPOT_LIGHT_COUNT]' + unconfigurable, - uniformFloatPrefix + 'spotLightUmbraAngleCosine[SPOT_LIGHT_COUNT]' + unconfigurable, - uniformFloatPrefix + 'spotLightPenumbraAngleCosine[SPOT_LIGHT_COUNT]' + unconfigurable, - uniformFloatPrefix + 'spotLightFalloffFactor[SPOT_LIGHT_COUNT]' + unconfigurable, - uniformVec3Prefix + 'spotLightColor[SPOT_LIGHT_COUNT]' + unconfigurable, - exportEnd -].join('\n')); - - -/***/ }), -/* 120 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("vec3 calcAmbientSHLight(int idx, vec3 N) {\n int offset = 9 * idx;\n return ambientSHLightCoefficients[0]\n + ambientSHLightCoefficients[1] * N.x\n + ambientSHLightCoefficients[2] * N.y\n + ambientSHLightCoefficients[3] * N.z\n + ambientSHLightCoefficients[4] * N.x * N.z\n + ambientSHLightCoefficients[5] * N.z * N.y\n + ambientSHLightCoefficients[6] * N.y * N.x\n + ambientSHLightCoefficients[7] * (3.0 * N.z * N.z - 1.0)\n + ambientSHLightCoefficients[8] * (N.x * N.x - N.y * N.y);\n}"); - - -/***/ }), -/* 121 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export clay.skybox.vertex\n#define SHADER_NAME skybox\nuniform mat4 world : WORLD;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nattribute vec3 position : POSITION;\nvarying vec3 v_WorldPosition;\nvoid main()\n{\n v_WorldPosition = (world * vec4(position, 1.0)).xyz;\n gl_Position = worldViewProjection * vec4(position, 1.0);\n}\n@end\n@export clay.skybox.fragment\n#define PI 3.1415926\nuniform mat4 viewInverse : VIEWINVERSE;\n#ifdef EQUIRECTANGULAR\nuniform sampler2D environmentMap;\n#else\nuniform samplerCube environmentMap;\n#endif\nuniform float lod: 0.0;\nvarying vec3 v_WorldPosition;\n@import clay.util.rgbm\n@import clay.util.srgb\n@import clay.util.ACES\nvoid main()\n{\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(v_WorldPosition - eyePos);\n#ifdef EQUIRECTANGULAR\n float phi = acos(V.y);\n float theta = atan(-V.x, V.z) + PI * 0.5;\n vec2 uv = vec2(theta / 2.0 / PI, phi / PI);\n vec4 texel = decodeHDR(texture2D(environmentMap, fract(uv)));\n#else\n #if defined(LOD) || defined(SUPPORT_TEXTURE_LOD)\n vec4 texel = decodeHDR(textureCubeLodEXT(environmentMap, V, lod));\n #else\n vec4 texel = decodeHDR(textureCube(environmentMap, V));\n #endif\n#endif\n#ifdef SRGB_DECODE\n texel = sRGBToLinear(texel);\n#endif\n#ifdef TONEMAPPING\n texel.rgb = ACESToneMapping(texel.rgb);\n#endif\n#ifdef SRGB_ENCODE\n texel = linearTosRGB(texel);\n#endif\n gl_FragColor = encodeHDR(vec4(texel.rgb, 1.0));\n}\n@end"); - - -/***/ }), -/* 122 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Texture__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Texture2D__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__TextureCube__ = __webpack_require__(27); - - - - -// http://msdn.microsoft.com/en-us/library/windows/desktop/bb943991(v=vs.85).aspx -// https://github.com/toji/webgl-texture-utils/blob/master/texture-util/dds.js -var DDS_MAGIC = 0x20534444; - -var DDSD_CAPS = 0x1; -var DDSD_HEIGHT = 0x2; -var DDSD_WIDTH = 0x4; -var DDSD_PITCH = 0x8; -var DDSD_PIXELFORMAT = 0x1000; -var DDSD_MIPMAPCOUNT = 0x20000; -var DDSD_LINEARSIZE = 0x80000; -var DDSD_DEPTH = 0x800000; - -var DDSCAPS_COMPLEX = 0x8; -var DDSCAPS_MIPMAP = 0x400000; -var DDSCAPS_TEXTURE = 0x1000; - -var DDSCAPS2_CUBEMAP = 0x200; -var DDSCAPS2_CUBEMAP_POSITIVEX = 0x400; -var DDSCAPS2_CUBEMAP_NEGATIVEX = 0x800; -var DDSCAPS2_CUBEMAP_POSITIVEY = 0x1000; -var DDSCAPS2_CUBEMAP_NEGATIVEY = 0x2000; -var DDSCAPS2_CUBEMAP_POSITIVEZ = 0x4000; -var DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x8000; -var DDSCAPS2_VOLUME = 0x200000; - -var DDPF_ALPHAPIXELS = 0x1; -var DDPF_ALPHA = 0x2; -var DDPF_FOURCC = 0x4; -var DDPF_RGB = 0x40; -var DDPF_YUV = 0x200; -var DDPF_LUMINANCE = 0x20000; - -function fourCCToInt32(value) { - return value.charCodeAt(0) + - (value.charCodeAt(1) << 8) + - (value.charCodeAt(2) << 16) + - (value.charCodeAt(3) << 24); -} - -function int32ToFourCC(value) { - return String.fromCharCode( - value & 0xff, - (value >> 8) & 0xff, - (value >> 16) & 0xff, - (value >> 24) & 0xff - ); -} - -var headerLengthInt = 31; // The header length in 32 bit ints - -var FOURCC_DXT1 = fourCCToInt32('DXT1'); -var FOURCC_DXT3 = fourCCToInt32('DXT3'); -var FOURCC_DXT5 = fourCCToInt32('DXT5'); -// Offsets into the header array -var off_magic = 0; - -var off_size = 1; -var off_flags = 2; -var off_height = 3; -var off_width = 4; - -var off_mipmapCount = 7; - -var off_pfFlags = 20; -var off_pfFourCC = 21; - -var off_caps = 27; -var off_caps2 = 28; -var off_caps3 = 29; -var off_caps4 = 30; - -var ret = { - parse: function(arrayBuffer, out) { - var header = new Int32Array(arrayBuffer, 0, headerLengthInt); - if (header[off_magic] !== DDS_MAGIC) { - return null; - } - if (!header(off_pfFlags) & DDPF_FOURCC) { - return null; - } - - var fourCC = header(off_pfFourCC); - var width = header[off_width]; - var height = header[off_height]; - var isCubeMap = header[off_caps2] & DDSCAPS2_CUBEMAP; - var hasMipmap = header[off_flags] & DDSD_MIPMAPCOUNT; - var blockBytes, internalFormat; - switch(fourCC) { - case FOURCC_DXT1: - blockBytes = 8; - internalFormat = __WEBPACK_IMPORTED_MODULE_0__Texture__["a" /* default */].COMPRESSED_RGB_S3TC_DXT1_EXT; - break; - case FOURCC_DXT3: - blockBytes = 16; - internalFormat = __WEBPACK_IMPORTED_MODULE_0__Texture__["a" /* default */].COMPRESSED_RGBA_S3TC_DXT3_EXT; - break; - case FOURCC_DXT5: - blockBytes = 16; - internalFormat = __WEBPACK_IMPORTED_MODULE_0__Texture__["a" /* default */].COMPRESSED_RGBA_S3TC_DXT5_EXT; - break; - default: - return null; - } - var dataOffset = header[off_size] + 4; - // TODO: Suppose all face are existed - var faceNumber = isCubeMap ? 6 : 1; - var mipmapCount = 1; - if (hasMipmap) { - mipmapCount = Math.max(1, header[off_mipmapCount]); - } - - var textures = []; - for (var f = 0; f < faceNumber; f++) { - var _width = width; - var _height = height; - textures[f] = new __WEBPACK_IMPORTED_MODULE_1__Texture2D__["a" /* default */]({ - width: _width, - height: _height, - format: internalFormat - }); - var mipmaps = []; - for (var i = 0; i < mipmapCount; i++) { - var dataLength = Math.max(4, _width) / 4 * Math.max(4, _height) / 4 * blockBytes; - var byteArray = new Uint8Array(arrayBuffer, dataOffset, dataLength); - - dataOffset += dataLength; - _width *= 0.5; - _height *= 0.5; - mipmaps[i] = byteArray; - } - textures[f].pixels = mipmaps[0]; - if (hasMipmap) { - textures[f].mipmaps = mipmaps; - } - } - // TODO - // return isCubeMap ? textures : textures[0]; - if (out) { - out.width = textures[0].width; - out.height = textures[0].height; - out.format = textures[0].format; - out.pixels = textures[0].pixels; - out.mipmaps = textures[0].mipmaps; - } - else { - return textures[0]; - } - } -}; - -/* harmony default export */ __webpack_exports__["a"] = (ret); - - -/***/ }), -/* 123 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Texture__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Texture2D__ = __webpack_require__(5); - - -var toChar = String.fromCharCode; - -var MINELEN = 8; -var MAXELEN = 0x7fff; -function rgbe2float(rgbe, buffer, offset, exposure) { - if (rgbe[3] > 0) { - var f = Math.pow(2.0, rgbe[3] - 128 - 8 + exposure); - buffer[offset + 0] = rgbe[0] * f; - buffer[offset + 1] = rgbe[1] * f; - buffer[offset + 2] = rgbe[2] * f; - } - else { - buffer[offset + 0] = 0; - buffer[offset + 1] = 0; - buffer[offset + 2] = 0; - } - buffer[offset + 3] = 1.0; - return buffer; -} - -function uint82string(array, offset, size) { - var str = ''; - for (var i = offset; i < size; i++) { - str += toChar(array[i]); - } - return str; -} - -function copyrgbe(s, t) { - t[0] = s[0]; - t[1] = s[1]; - t[2] = s[2]; - t[3] = s[3]; -} - -// TODO : check -function oldReadColors(scan, buffer, offset, xmax) { - var rshift = 0, x = 0, len = xmax; - while (len > 0) { - scan[x][0] = buffer[offset++]; - scan[x][1] = buffer[offset++]; - scan[x][2] = buffer[offset++]; - scan[x][3] = buffer[offset++]; - if (scan[x][0] === 1 && scan[x][1] === 1 && scan[x][2] === 1) { - // exp is count of repeated pixels - for (var i = (scan[x][3] << rshift) >>> 0; i > 0; i--) { - copyrgbe(scan[x-1], scan[x]); - x++; - len--; - } - rshift += 8; - } else { - x++; - len--; - rshift = 0; - } - } - return offset; -} - -function readColors(scan, buffer, offset, xmax) { - if ((xmax < MINELEN) | (xmax > MAXELEN)) { - return oldReadColors(scan, buffer, offset, xmax); - } - var i = buffer[offset++]; - if (i != 2) { - return oldReadColors(scan, buffer, offset - 1, xmax); - } - scan[0][1] = buffer[offset++]; - scan[0][2] = buffer[offset++]; - - i = buffer[offset++]; - if ((((scan[0][2] << 8) >>> 0) | i) >>> 0 !== xmax) { - return null; - } - for (var i = 0; i < 4; i++) { - for (var x = 0; x < xmax;) { - var code = buffer[offset++]; - if (code > 128) { - code = (code & 127) >>> 0; - var val = buffer[offset++]; - while (code--) { - scan[x++][i] = val; - } - } else { - while (code--) { - scan[x++][i] = buffer[offset++]; - } - } - } - } - return offset; -} - - -var ret = { - // http://www.graphics.cornell.edu/~bjw/rgbe.html - // Blender source - // http://radsite.lbl.gov/radiance/refer/Notes/picture_format.html - parseRGBE: function(arrayBuffer, texture, exposure) { - if (exposure == null) { - exposure = 0; - } - var data = new Uint8Array(arrayBuffer); - var size = data.length; - if (uint82string(data, 0, 2) !== '#?') { - return; - } - // find empty line, next line is resolution info - for (var i = 2; i < size; i++) { - if (toChar(data[i]) === '\n' && toChar(data[i+1]) === '\n') { - break; - } - } - if (i >= size) { // not found - return; - } - // find resolution info line - i += 2; - var str = ''; - for (; i < size; i++) { - var _char = toChar(data[i]); - if (_char === '\n') { - break; - } - str += _char; - } - // -Y M +X N - var tmp = str.split(' '); - var height = parseInt(tmp[1]); - var width = parseInt(tmp[3]); - if (!width || !height) { - return; - } - - // read and decode actual data - var offset = i+1; - var scanline = []; - // memzero - for (var x = 0; x < width; x++) { - scanline[x] = []; - for (var j = 0; j < 4; j++) { - scanline[x][j] = 0; - } - } - var pixels = new Float32Array(width * height * 4); - var offset2 = 0; - for (var y = 0; y < height; y++) { - var offset = readColors(scanline, data, offset, width); - if (!offset) { - return null; - } - for (var x = 0; x < width; x++) { - rgbe2float(scanline[x], pixels, offset2, exposure); - offset2 += 4; - } - } - - if (!texture) { - texture = new __WEBPACK_IMPORTED_MODULE_1__Texture2D__["a" /* default */](); - } - texture.width = width; - texture.height = height; - texture.pixels = pixels; - // HALF_FLOAT can't use Float32Array - texture.type = __WEBPACK_IMPORTED_MODULE_0__Texture__["a" /* default */].FLOAT; - return texture; - }, - - parseRGBEFromPNG: function(png) { - - } -}; - -/* harmony default export */ __webpack_exports__["a"] = (ret); - - -/***/ }), -/* 124 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_claygl_src_Texture2D__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_claygl_src_math_Vector3__ = __webpack_require__(3); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_claygl_src_math_Vector2__ = __webpack_require__(26); -/** - * Surface texture in the 3D scene. - * Provide management and rendering of zrender shapes and groups - * - * @module echarts-gl/util/EChartsSurface - * @author Yi Shen(http://github.com/pissang) - */ - - - - - -var events = ['mousedown', 'mouseup', 'mousemove', 'mouseover', 'mouseout', 'click', 'dblclick', 'contextmenu']; - -function makeHandlerName(eventName) { - return '_on' + eventName; -} -/** - * @constructor - * @alias echarts-gl/util/EChartsSurface - * @param {module:echarts~ECharts} chart - */ -var EChartsSurface = function (chart) { - var self = this; - this._texture = new __WEBPACK_IMPORTED_MODULE_0_claygl_src_Texture2D__["a" /* default */]({ - anisotropic: 32, - flipY: false, - - surface: this, - - dispose: function (renderer) { - self.dispose(); - __WEBPACK_IMPORTED_MODULE_0_claygl_src_Texture2D__["a" /* default */].prototype.dispose.call(this, renderer); - } - }); - - events.forEach(function (eventName) { - this[makeHandlerName(eventName)] = function (eveObj) { - if (!eveObj.triangle) { - return; - } - this._meshes.forEach(function (mesh) { - this.dispatchEvent(eventName, mesh, eveObj.triangle, eveObj.point); - }, this); - }; - }, this); - - this._meshes = []; - - if (chart) { - this.setECharts(chart); - } - - // Texture updated callback; - this.onupdate = null; -}; - -EChartsSurface.prototype = { - - constructor: EChartsSurface, - - getTexture: function () { - return this._texture; - }, - - setECharts: function (chart) { - this._chart = chart; - - var canvas = chart.getDom(); - if (!(canvas instanceof HTMLCanvasElement)) { - console.error('ECharts must init on canvas if it is used as texture.'); - // Use an empty canvas - canvas = document.createElement('canvas'); - } - else { - var self = this; - // Wrap refreshImmediately - var zr = chart.getZr(); - var oldRefreshImmediately = zr.__oldRefreshImmediately || zr.refreshImmediately; - zr.refreshImmediately = function () { - oldRefreshImmediately.call(this); - self._texture.dirty(); - - self.onupdate && self.onupdate(); - }; - zr.__oldRefreshImmediately = oldRefreshImmediately; - } - - this._texture.image = canvas; - this._texture.dirty(); - this.onupdate && this.onupdate(); - }, - - /** - * @method - * @param {clay.Mesh} attachedMesh - * @param {Array.} triangle Triangle indices - * @param {clay.math.Vector3} point - */ - dispatchEvent: (function () { - - var p0 = new __WEBPACK_IMPORTED_MODULE_1_claygl_src_math_Vector3__["a" /* default */](); - var p1 = new __WEBPACK_IMPORTED_MODULE_1_claygl_src_math_Vector3__["a" /* default */](); - var p2 = new __WEBPACK_IMPORTED_MODULE_1_claygl_src_math_Vector3__["a" /* default */](); - var uv0 = new __WEBPACK_IMPORTED_MODULE_2_claygl_src_math_Vector2__["a" /* default */](); - var uv1 = new __WEBPACK_IMPORTED_MODULE_2_claygl_src_math_Vector2__["a" /* default */](); - var uv2 = new __WEBPACK_IMPORTED_MODULE_2_claygl_src_math_Vector2__["a" /* default */](); - var uv = new __WEBPACK_IMPORTED_MODULE_2_claygl_src_math_Vector2__["a" /* default */](); - - var vCross = new __WEBPACK_IMPORTED_MODULE_1_claygl_src_math_Vector3__["a" /* default */](); - - return function (eventName, attachedMesh, triangle, point) { - var geo = attachedMesh.geometry; - var position = geo.attributes.position; - var texcoord = geo.attributes.texcoord0; - var dot = __WEBPACK_IMPORTED_MODULE_1_claygl_src_math_Vector3__["a" /* default */].dot; - var cross = __WEBPACK_IMPORTED_MODULE_1_claygl_src_math_Vector3__["a" /* default */].cross; - - position.get(triangle[0], p0.array); - position.get(triangle[1], p1.array); - position.get(triangle[2], p2.array); - texcoord.get(triangle[0], uv0.array); - texcoord.get(triangle[1], uv1.array); - texcoord.get(triangle[2], uv2.array); - - cross(vCross, p1, p2); - var det = dot(p0, vCross); - var t = dot(point, vCross) / det; - cross(vCross, p2, p0); - var u = dot(point, vCross) / det; - cross(vCross, p0, p1); - var v = dot(point, vCross) / det; - - __WEBPACK_IMPORTED_MODULE_2_claygl_src_math_Vector2__["a" /* default */].scale(uv, uv0, t); - __WEBPACK_IMPORTED_MODULE_2_claygl_src_math_Vector2__["a" /* default */].scaleAndAdd(uv, uv, uv1, u); - __WEBPACK_IMPORTED_MODULE_2_claygl_src_math_Vector2__["a" /* default */].scaleAndAdd(uv, uv, uv2, v); - - var x = uv.x * this._chart.getWidth(); - var y = uv.y * this._chart.getHeight(); - this._chart.getZr().handler.dispatch(eventName, { - zrX: x, - zrY: y - }); - }; - })(), - - attachToMesh: function (mesh) { - if (this._meshes.indexOf(mesh) >= 0) { - return; - } - - events.forEach(function (eventName) { - mesh.on(eventName, this[makeHandlerName(eventName)], this); - }, this); - - this._meshes.push(mesh); - }, - - detachFromMesh: function (mesh) { - var idx = this._meshes.indexOf(mesh); - if (idx >= 0) { - this._meshes.splice(idx, 1); - } - - events.forEach(function (eventName) { - mesh.off(eventName, this[makeHandlerName(eventName)]); - }, this); - }, - - dispose: function () { - this._meshes.forEach(function (mesh) { - this.detachFromMesh(mesh); - }, this); - } -}; - -/* harmony default export */ __webpack_exports__["a"] = (EChartsSurface); - -/***/ }), -/* 125 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Light__ = __webpack_require__(24); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_cubemap__ = __webpack_require__(77); -// https://docs.unrealengine.com/latest/INT/Engine/Rendering/LightingAndShadows/AmbientCubemap/ - - - -/** - * Ambient cubemap light provides specular parts of Image Based Lighting. - * Which is a basic requirement for Physically Based Rendering - * @constructor clay.light.AmbientCubemap - * @extends clay.Light - */ -var AmbientCubemapLight = __WEBPACK_IMPORTED_MODULE_0__Light__["a" /* default */].extend({ - - /** - * @type {clay.TextureCube} - * @memberOf clay.light.AmbientCubemap# - */ - cubemap: null, - - // TODO - // range: 100, - - castShadow: false, - - _normalDistribution: null, - _brdfLookup: null - -}, /** @lends clay.light.AmbientCubemap# */ { - - type: 'AMBIENT_CUBEMAP_LIGHT', - - /** - * Do prefitering the cubemap - * @param {clay.Renderer} renderer - * @param {number} [size=32] - */ - prefilter: function (renderer, size) { - if (!renderer.getGLExtension('EXT_shader_texture_lod')) { - console.warn('Device not support textureCubeLodEXT'); - return; - } - if (!this._brdfLookup) { - this._normalDistribution = __WEBPACK_IMPORTED_MODULE_1__util_cubemap__["a" /* default */].generateNormalDistribution(); - this._brdfLookup = __WEBPACK_IMPORTED_MODULE_1__util_cubemap__["a" /* default */].integrateBRDF(renderer, this._normalDistribution); - } - var cubemap = this.cubemap; - if (cubemap.__prefiltered) { - return; - } - - var result = __WEBPACK_IMPORTED_MODULE_1__util_cubemap__["a" /* default */].prefilterEnvironmentMap( - renderer, cubemap, { - encodeRGBM: true, - width: size, - height: size - }, this._normalDistribution, this._brdfLookup - ); - this.cubemap = result.environmentMap; - this.cubemap.__prefiltered = true; - - cubemap.dispose(renderer); - }, - - getBRDFLookup: function () { - return this._brdfLookup; - }, - - uniformTemplates: { - ambientCubemapLightColor: { - type: '3f', - value: function (instance) { - var color = instance.color; - var intensity = instance.intensity; - return [color[0]*intensity, color[1]*intensity, color[2]*intensity]; - } - }, - - ambientCubemapLightCubemap: { - type: 't', - value: function (instance) { - return instance.cubemap; - } - }, - - ambientCubemapLightBRDFLookup: { - type: 't', - value: function (instance) { - return instance._brdfLookup; - } - } - } - /** - * @function - * @name clone - * @return {clay.light.AmbientCubemap} - * @memberOf clay.light.AmbientCubemap.prototype - */ -}); - -/* harmony default export */ __webpack_exports__["a"] = (AmbientCubemapLight); - - -/***/ }), -/* 126 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("\n@export clay.compositor.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\nvarying vec2 v_Texcoord;\nvoid main()\n{\n v_Texcoord = texcoord;\n gl_Position = worldViewProjection * vec4(position, 1.0);\n}\n@end"); - - -/***/ }), -/* 127 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("#define SAMPLE_NUMBER 1024\n#define PI 3.14159265358979\nuniform sampler2D normalDistribution;\nuniform vec2 viewportSize : [512, 256];\nconst vec3 N = vec3(0.0, 0.0, 1.0);\nconst float fSampleNumber = float(SAMPLE_NUMBER);\nvec3 importanceSampleNormal(float i, float roughness, vec3 N) {\n vec3 H = texture2D(normalDistribution, vec2(roughness, i)).rgb;\n vec3 upVector = abs(N.y) > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nfloat G_Smith(float roughness, float NoV, float NoL) {\n float k = roughness * roughness / 2.0;\n float G1V = NoV / (NoV * (1.0 - k) + k);\n float G1L = NoL / (NoL * (1.0 - k) + k);\n return G1L * G1V;\n}\nvoid main() {\n vec2 uv = gl_FragCoord.xy / viewportSize;\n float NoV = uv.x;\n float roughness = uv.y;\n vec3 V;\n V.x = sqrt(1.0 - NoV * NoV);\n V.y = 0.0;\n V.z = NoV;\n float A = 0.0;\n float B = 0.0;\n for (int i = 0; i < SAMPLE_NUMBER; i++) {\n vec3 H = importanceSampleNormal(float(i) / fSampleNumber, roughness, N);\n vec3 L = reflect(-V, H);\n float NoL = clamp(L.z, 0.0, 1.0);\n float NoH = clamp(H.z, 0.0, 1.0);\n float VoH = clamp(dot(V, H), 0.0, 1.0);\n if (NoL > 0.0) {\n float G = G_Smith(roughness, NoV, NoL);\n float G_Vis = G * VoH / (NoH * NoV);\n float Fc = pow(1.0 - VoH, 5.0);\n A += (1.0 - Fc) * G_Vis;\n B += Fc * G_Vis;\n }\n }\n gl_FragColor = vec4(vec2(A, B) / fSampleNumber, 0.0, 1.0);\n}\n"); - - -/***/ }), -/* 128 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("#define SHADER_NAME prefilter\n#define SAMPLE_NUMBER 1024\n#define PI 3.14159265358979\nuniform mat4 viewInverse : VIEWINVERSE;\nuniform samplerCube environmentMap;\nuniform sampler2D normalDistribution;\nuniform float roughness : 0.5;\nvarying vec2 v_Texcoord;\nvarying vec3 v_WorldPosition;\n@import clay.util.rgbm\nvec3 importanceSampleNormal(float i, float roughness, vec3 N) {\n vec3 H = texture2D(normalDistribution, vec2(roughness, i)).rgb;\n vec3 upVector = abs(N.y) > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nvoid main() {\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(v_WorldPosition - eyePos);\n vec3 N = V;\n vec3 prefilteredColor = vec3(0.0);\n float totalWeight = 0.0;\n float fMaxSampleNumber = float(SAMPLE_NUMBER);\n for (int i = 0; i < SAMPLE_NUMBER; i++) {\n vec3 H = importanceSampleNormal(float(i) / fMaxSampleNumber, roughness, N);\n vec3 L = reflect(-V, H);\n float NoL = clamp(dot(N, L), 0.0, 1.0);\n if (NoL > 0.0) {\n prefilteredColor += decodeHDR(textureCube(environmentMap, L)).rgb * NoL;\n totalWeight += NoL;\n }\n }\n gl_FragColor = encodeHDR(vec4(prefilteredColor / totalWeight, 1.0));\n}\n"); - - -/***/ }), -/* 129 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Light__ = __webpack_require__(24); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__core_vendor__ = __webpack_require__(14); - - - -/** - * Spherical Harmonic Ambient Light - * @constructor clay.light.AmbientSH - * @extends clay.Light - */ -var AmbientSHLight = __WEBPACK_IMPORTED_MODULE_0__Light__["a" /* default */].extend({ - - castShadow: false, - - /** - * Spherical Harmonic Coefficients - * @type {Array.} - * @memberOf clay.light.AmbientSH# - */ - coefficients: [], - -}, function () { - this._coefficientsTmpArr = new __WEBPACK_IMPORTED_MODULE_1__core_vendor__["a" /* default */].Float32Array(9 * 3); -}, { - - type: 'AMBIENT_SH_LIGHT', - - uniformTemplates: { - ambientSHLightColor: { - type: '3f', - value: function (instance) { - var color = instance.color; - var intensity = instance.intensity; - return [color[0] * intensity, color[1] * intensity, color[2] * intensity]; - } - }, - - ambientSHLightCoefficients: { - type: '3f', - value: function (instance) { - var coefficientsTmpArr = instance._coefficientsTmpArr; - for (var i = 0; i < instance.coefficients.length; i++) { - coefficientsTmpArr[i] = instance.coefficients[i]; - } - return coefficientsTmpArr; - } - } - } - /** - * @function - * @name clone - * @return {clay.light.Ambient} - * @memberOf clay.light.Ambient.prototype - */ -}); - -/* harmony default export */ __webpack_exports__["a"] = (AmbientSHLight); - - -/***/ }), -/* 130 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Texture__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__FrameBuffer__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__Texture2D__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__compositor_Pass__ = __webpack_require__(16); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__core_vendor__ = __webpack_require__(14); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__plugin_Skybox__ = __webpack_require__(42); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__plugin_Skydome__ = __webpack_require__(75); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__prePass_EnvironmentMap__ = __webpack_require__(62); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Scene__ = __webpack_require__(36); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__glmatrix_vec3__ = __webpack_require__(12); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__shader_projectEnvMap_glsl_js__ = __webpack_require__(131); -// Spherical Harmonic Helpers - - - - - - - - - - -var sh = {}; - - - -var targets = ['px', 'nx', 'py', 'ny', 'pz', 'nz']; - -// Project on gpu, but needs browser to support readPixels as Float32Array. -function projectEnvironmentMapGPU(renderer, envMap) { - var shTexture = new __WEBPACK_IMPORTED_MODULE_2__Texture2D__["a" /* default */]({ - width: 9, - height: 1, - type: __WEBPACK_IMPORTED_MODULE_0__Texture__["a" /* default */].FLOAT - }); - var pass = new __WEBPACK_IMPORTED_MODULE_3__compositor_Pass__["a" /* default */]({ - fragment: __WEBPACK_IMPORTED_MODULE_10__shader_projectEnvMap_glsl_js__["a" /* default */] - }); - pass.material.define('fragment', 'TEXTURE_SIZE', envMap.width); - pass.setUniform('environmentMap', envMap); - - var framebuffer = new __WEBPACK_IMPORTED_MODULE_1__FrameBuffer__["a" /* default */](); - framebuffer.attach(shTexture); - pass.render(renderer, framebuffer); - - framebuffer.bind(renderer); - // TODO Only chrome and firefox support Float32Array - var pixels = new __WEBPACK_IMPORTED_MODULE_4__core_vendor__["a" /* default */].Float32Array(9 * 4); - renderer.gl.readPixels(0, 0, 9, 1, __WEBPACK_IMPORTED_MODULE_0__Texture__["a" /* default */].RGBA, __WEBPACK_IMPORTED_MODULE_0__Texture__["a" /* default */].FLOAT, pixels); - - var coeff = new __WEBPACK_IMPORTED_MODULE_4__core_vendor__["a" /* default */].Float32Array(9 * 3); - for (var i = 0; i < 9; i++) { - coeff[i * 3] = pixels[i * 4]; - coeff[i * 3 + 1] = pixels[i * 4 + 1]; - coeff[i * 3 + 2] = pixels[i * 4 + 2]; - } - framebuffer.unbind(renderer); - - framebuffer.dispose(renderer); - pass.dispose(renderer); - return coeff; -} - -function harmonics(normal, index){ - var x = normal[0]; - var y = normal[1]; - var z = normal[2]; - - if (index === 0) { - return 1.0; - } - else if (index === 1) { - return x; - } - else if (index === 2) { - return y; - } - else if (index === 3) { - return z; - } - else if (index === 4) { - return x * z; - } - else if (index === 5) { - return y * z; - } - else if (index === 6) { - return x * y; - } - else if (index === 7) { - return 3.0 * z * z - 1.0; - } - else { - return x * x - y * y; - } -} - -var normalTransform = { - px: [2, 1, 0, -1, -1, 1], - nx: [2, 1, 0, 1, -1, -1], - py: [0, 2, 1, 1, -1, -1], - ny: [0, 2, 1, 1, 1, 1], - pz: [0, 1, 2, -1, -1, -1], - nz: [0, 1, 2, 1, -1, 1] -}; - -// Project on cpu. -function projectEnvironmentMapCPU(renderer, cubePixels, width, height) { - var coeff = new __WEBPACK_IMPORTED_MODULE_4__core_vendor__["a" /* default */].Float32Array(9 * 3); - var normal = __WEBPACK_IMPORTED_MODULE_9__glmatrix_vec3__["a" /* default */].create(); - var texel = __WEBPACK_IMPORTED_MODULE_9__glmatrix_vec3__["a" /* default */].create(); - var fetchNormal = __WEBPACK_IMPORTED_MODULE_9__glmatrix_vec3__["a" /* default */].create(); - for (var m = 0; m < 9; m++) { - var result = __WEBPACK_IMPORTED_MODULE_9__glmatrix_vec3__["a" /* default */].create(); - for (var k = 0; k < targets.length; k++) { - var pixels = cubePixels[targets[k]]; - - var sideResult = __WEBPACK_IMPORTED_MODULE_9__glmatrix_vec3__["a" /* default */].create(); - var divider = 0; - var i = 0; - var transform = normalTransform[targets[k]]; - for (var y = 0; y < height; y++) { - for (var x = 0; x < width; x++) { - - normal[0] = x / (width - 1.0) * 2.0 - 1.0; - // TODO Flip y? - normal[1] = y / (height - 1.0) * 2.0 - 1.0; - normal[2] = -1.0; - __WEBPACK_IMPORTED_MODULE_9__glmatrix_vec3__["a" /* default */].normalize(normal, normal); - - fetchNormal[0] = normal[transform[0]] * transform[3]; - fetchNormal[1] = normal[transform[1]] * transform[4]; - fetchNormal[2] = normal[transform[2]] * transform[5]; - - texel[0] = pixels[i++] / 255; - texel[1] = pixels[i++] / 255; - texel[2] = pixels[i++] / 255; - // RGBM Decode - var scale = pixels[i++] / 255 * 8.12; - texel[0] *= scale; - texel[1] *= scale; - texel[2] *= scale; - - __WEBPACK_IMPORTED_MODULE_9__glmatrix_vec3__["a" /* default */].scaleAndAdd(sideResult, sideResult, texel, harmonics(fetchNormal, m) * -normal[2]); - // -normal.z equals cos(theta) of Lambertian - divider += -normal[2]; - } - } - __WEBPACK_IMPORTED_MODULE_9__glmatrix_vec3__["a" /* default */].scaleAndAdd(result, result, sideResult, 1 / divider); - } - - coeff[m * 3] = result[0] / 6.0; - coeff[m * 3 + 1] = result[1] / 6.0; - coeff[m * 3 + 2] = result[2] / 6.0; - } - return coeff; -} - -/** - * @param {clay.Renderer} renderer - * @param {clay.Texture} envMap - * @param {Object} [textureOpts] - * @param {Object} [textureOpts.lod] - * @param {boolean} [textureOpts.decodeRGBM] - */ -sh.projectEnvironmentMap = function (renderer, envMap, opts) { - - // TODO sRGB - - opts = opts || {}; - opts.lod = opts.lod || 0; - - var skybox; - var dummyScene = new __WEBPACK_IMPORTED_MODULE_8__Scene__["a" /* default */](); - var size = 64; - if (envMap.textureType === 'texture2D') { - skybox = new __WEBPACK_IMPORTED_MODULE_6__plugin_Skydome__["a" /* default */]({ - scene: dummyScene, - environmentMap: envMap - }); - } - else { - size = (envMap.image && envMap.image.px) ? envMap.image.px.width : envMap.width; - skybox = new __WEBPACK_IMPORTED_MODULE_5__plugin_Skybox__["a" /* default */]({ - scene: dummyScene, - environmentMap: envMap - }); - } - // Convert to rgbm - var width = Math.ceil(size / Math.pow(2, opts.lod)); - var height = Math.ceil(size / Math.pow(2, opts.lod)); - var rgbmTexture = new __WEBPACK_IMPORTED_MODULE_2__Texture2D__["a" /* default */]({ - width: width, - height: height - }); - var framebuffer = new __WEBPACK_IMPORTED_MODULE_1__FrameBuffer__["a" /* default */](); - skybox.material.define('fragment', 'RGBM_ENCODE'); - if (opts.decodeRGBM) { - skybox.material.define('fragment', 'RGBM_DECODE'); - } - skybox.material.set('lod', opts.lod); - var envMapPass = new __WEBPACK_IMPORTED_MODULE_7__prePass_EnvironmentMap__["a" /* default */]({ - texture: rgbmTexture - }); - var cubePixels = {}; - for (var i = 0; i < targets.length; i++) { - cubePixels[targets[i]] = new Uint8Array(width * height * 4); - var camera = envMapPass.getCamera(targets[i]); - camera.fov = 90; - framebuffer.attach(rgbmTexture); - framebuffer.bind(renderer); - renderer.render(dummyScene, camera); - renderer.gl.readPixels( - 0, 0, width, height, - __WEBPACK_IMPORTED_MODULE_0__Texture__["a" /* default */].RGBA, __WEBPACK_IMPORTED_MODULE_0__Texture__["a" /* default */].UNSIGNED_BYTE, cubePixels[targets[i]] - ); - framebuffer.unbind(renderer); - } - - skybox.dispose(renderer); - framebuffer.dispose(renderer); - rgbmTexture.dispose(renderer); - - return projectEnvironmentMapCPU(renderer, cubePixels, width, height); -}; - -/* harmony default export */ __webpack_exports__["a"] = (sh); - - -/***/ }), -/* 131 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("uniform samplerCube environmentMap;\nvarying vec2 v_Texcoord;\n#define TEXTURE_SIZE 16\nmat3 front = mat3(\n 1.0, 0.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 0.0, 1.0\n);\nmat3 back = mat3(\n -1.0, 0.0, 0.0,\n 0.0, 1.0, 0.0,\n 0.0, 0.0, -1.0\n);\nmat3 left = mat3(\n 0.0, 0.0, -1.0,\n 0.0, 1.0, 0.0,\n 1.0, 0.0, 0.0\n);\nmat3 right = mat3(\n 0.0, 0.0, 1.0,\n 0.0, 1.0, 0.0,\n -1.0, 0.0, 0.0\n);\nmat3 up = mat3(\n 1.0, 0.0, 0.0,\n 0.0, 0.0, 1.0,\n 0.0, -1.0, 0.0\n);\nmat3 down = mat3(\n 1.0, 0.0, 0.0,\n 0.0, 0.0, -1.0,\n 0.0, 1.0, 0.0\n);\nfloat harmonics(vec3 normal){\n int index = int(gl_FragCoord.x);\n float x = normal.x;\n float y = normal.y;\n float z = normal.z;\n if(index==0){\n return 1.0;\n }\n else if(index==1){\n return x;\n }\n else if(index==2){\n return y;\n }\n else if(index==3){\n return z;\n }\n else if(index==4){\n return x*z;\n }\n else if(index==5){\n return y*z;\n }\n else if(index==6){\n return x*y;\n }\n else if(index==7){\n return 3.0*z*z - 1.0;\n }\n else{\n return x*x - y*y;\n }\n}\nvec3 sampleSide(mat3 rot)\n{\n vec3 result = vec3(0.0);\n float divider = 0.0;\n for (int i = 0; i < TEXTURE_SIZE * TEXTURE_SIZE; i++) {\n float x = mod(float(i), float(TEXTURE_SIZE));\n float y = float(i / TEXTURE_SIZE);\n vec2 sidecoord = ((vec2(x, y) + vec2(0.5, 0.5)) / vec2(TEXTURE_SIZE)) * 2.0 - 1.0;\n vec3 normal = normalize(vec3(sidecoord, -1.0));\n vec3 fetchNormal = rot * normal;\n vec3 texel = textureCube(environmentMap, fetchNormal).rgb;\n result += harmonics(fetchNormal) * texel * -normal.z;\n divider += -normal.z;\n }\n return result / divider;\n}\nvoid main()\n{\n vec3 result = (\n sampleSide(front) +\n sampleSide(back) +\n sampleSide(left) +\n sampleSide(right) +\n sampleSide(up) +\n sampleSide(down)\n ) / 6.0;\n gl_FragColor = vec4(result, 1.0);\n}"); - - -/***/ }), -/* 132 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Geometry__ = __webpack_require__(15); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__math_BoundingBox__ = __webpack_require__(18); - - - -/** - * @constructor clay.geometry.Sphere - * @extends clay.Geometry - * @param {Object} [opt] - * @param {number} [widthSegments] - * @param {number} [heightSegments] - * @param {number} [phiStart] - * @param {number} [phiLength] - * @param {number} [thetaStart] - * @param {number} [thetaLength] - * @param {number} [radius] - */ -var Sphere = __WEBPACK_IMPORTED_MODULE_0__Geometry__["a" /* default */].extend(/** @lends clay.geometry.Sphere# */ { - dynamic: false, - /** - * @type {number} - */ - widthSegments: 40, - /** - * @type {number} - */ - heightSegments: 20, - - /** - * @type {number} - */ - phiStart: 0, - /** - * @type {number} - */ - phiLength: Math.PI * 2, - - /** - * @type {number} - */ - thetaStart: 0, - /** - * @type {number} - */ - thetaLength: Math.PI, - - /** - * @type {number} - */ - radius: 1 - -}, function() { - this.build(); -}, -/** @lends clay.geometry.Sphere.prototype */ -{ - /** - * Build sphere geometry - */ - build: function() { - var heightSegments = this.heightSegments; - var widthSegments = this.widthSegments; - - var positionAttr = this.attributes.position; - var texcoordAttr = this.attributes.texcoord0; - var normalAttr = this.attributes.normal; - - var vertexCount = (widthSegments + 1) * (heightSegments + 1); - positionAttr.init(vertexCount); - texcoordAttr.init(vertexCount); - normalAttr.init(vertexCount); - - var IndicesCtor = vertexCount > 0xffff ? Uint32Array : Uint16Array; - var indices = this.indices = new IndicesCtor(widthSegments * heightSegments * 6); - - var x, y, z, - u, v, - i, j; - - var radius = this.radius; - var phiStart = this.phiStart; - var phiLength = this.phiLength; - var thetaStart = this.thetaStart; - var thetaLength = this.thetaLength; - var radius = this.radius; - - var pos = []; - var uv = []; - var offset = 0; - var divider = 1 / radius; - for (j = 0; j <= heightSegments; j ++) { - for (i = 0; i <= widthSegments; i ++) { - u = i / widthSegments; - v = j / heightSegments; - - // X axis is inverted so texture can be mapped from left to right - x = -radius * Math.cos(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength); - y = radius * Math.cos(thetaStart + v * thetaLength); - z = radius * Math.sin(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength); - - pos[0] = x; pos[1] = y; pos[2] = z; - uv[0] = u; uv[1] = v; - positionAttr.set(offset, pos); - texcoordAttr.set(offset, uv); - pos[0] *= divider; - pos[1] *= divider; - pos[2] *= divider; - normalAttr.set(offset, pos); - offset++; - } - } - - var i1, i2, i3, i4; - - var len = widthSegments + 1; - - var n = 0; - for (j = 0; j < heightSegments; j ++) { - for (i = 0; i < widthSegments; i ++) { - i2 = j * len + i; - i1 = (j * len + i + 1); - i4 = (j + 1) * len + i + 1; - i3 = (j + 1) * len + i; - - indices[n++] = i1; - indices[n++] = i2; - indices[n++] = i4; - - indices[n++] = i2; - indices[n++] = i3; - indices[n++] = i4; - } - } - - this.boundingBox = new __WEBPACK_IMPORTED_MODULE_1__math_BoundingBox__["a" /* default */](); - this.boundingBox.max.set(radius, radius, radius); - this.boundingBox.min.set(-radius, -radius, -radius); - } -}); - -/* harmony default export */ __webpack_exports__["a"] = (Sphere); - - -/***/ }), -/* 133 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Light__ = __webpack_require__(24); - - -/** - * @constructor clay.light.Ambient - * @extends clay.Light - */ -var AmbientLight = __WEBPACK_IMPORTED_MODULE_0__Light__["a" /* default */].extend({ - - castShadow: false - -}, { - - type: 'AMBIENT_LIGHT', - - uniformTemplates: { - ambientLightColor: { - type: '3f', - value: function(instance) { - var color = instance.color; - var intensity = instance.intensity; - return [color[0]*intensity, color[1]*intensity, color[2]*intensity]; - } - } - } - /** - * @function - * @name clone - * @return {clay.light.Ambient} - * @memberOf clay.light.Ambient.prototype - */ -}); - -/* harmony default export */ __webpack_exports__["a"] = (AmbientLight); - - -/***/ }), -/* 134 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Light__ = __webpack_require__(24); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__math_Vector3__ = __webpack_require__(3); - - - -/** - * @constructor clay.light.Directional - * @extends clay.Light - * - * @example - * var light = new clay.light.Directional({ - * intensity: 0.5, - * color: [1.0, 0.0, 0.0] - * }); - * light.position.set(10, 10, 10); - * light.lookAt(clay.Vector3.ZERO); - * scene.add(light); - */ -var DirectionalLight = __WEBPACK_IMPORTED_MODULE_0__Light__["a" /* default */].extend(/** @lends clay.light.Directional# */ { - /** - * @type {number} - */ - shadowBias: 0.001, - /** - * @type {number} - */ - shadowSlopeScale: 2.0, - /** - * Shadow cascade. - * Use PSSM technique when it is larger than 1 and have a unique directional light in scene. - * @type {number} - */ - shadowCascade: 1, - - /** - * Available when shadowCascade is larger than 1 and have a unique directional light in scene. - * @type {number} - */ - cascadeSplitLogFactor: 0.2 -}, { - - type: 'DIRECTIONAL_LIGHT', - - uniformTemplates: { - directionalLightDirection: { - type: '3f', - value: function (instance) { - instance.__dir = instance.__dir || new __WEBPACK_IMPORTED_MODULE_1__math_Vector3__["a" /* default */](); - // Direction is target to eye - return instance.__dir.copy(instance.worldTransform.z).normalize().negate().array; - } - }, - directionalLightColor: { - type: '3f', - value: function (instance) { - var color = instance.color; - var intensity = instance.intensity; - return [color[0] * intensity, color[1] * intensity, color[2] * intensity]; - } - } - }, - /** - * @return {clay.light.Directional} - * @memberOf clay.light.Directional.prototype - */ - clone: function () { - var light = __WEBPACK_IMPORTED_MODULE_0__Light__["a" /* default */].prototype.clone.call(this); - light.shadowBias = this.shadowBias; - light.shadowSlopeScale = this.shadowSlopeScale; - return light; - } -}); - -/* harmony default export */ __webpack_exports__["a"] = (DirectionalLight); - - -/***/ }), -/* 135 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Light__ = __webpack_require__(24); - - -/** - * @constructor clay.light.Point - * @extends clay.Light - */ -var PointLight = __WEBPACK_IMPORTED_MODULE_0__Light__["a" /* default */].extend(/** @lends clay.light.Point# */ { - /** - * @type {number} - */ - range: 100, - - /** - * @type {number} - */ - castShadow: false -}, { - - type: 'POINT_LIGHT', - - uniformTemplates: { - pointLightPosition: { - type: '3f', - value: function(instance) { - return instance.getWorldPosition().array; - } - }, - pointLightRange: { - type: '1f', - value: function(instance) { - return instance.range; - } - }, - pointLightColor: { - type: '3f', - value: function(instance) { - var color = instance.color; - var intensity = instance.intensity; - return [color[0] * intensity, color[1] * intensity, color[2] * intensity]; - } - } - }, - /** - * @return {clay.light.Point} - * @memberOf clay.light.Point.prototype - */ - clone: function() { - var light = __WEBPACK_IMPORTED_MODULE_0__Light__["a" /* default */].prototype.clone.call(this); - light.range = this.range; - return light; - } -}); - -/* harmony default export */ __webpack_exports__["a"] = (PointLight); - - -/***/ }), -/* 136 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Light__ = __webpack_require__(24); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__math_Vector3__ = __webpack_require__(3); - - - -/** - * @constructor clay.light.Spot - * @extends clay.Light - */ -var SpotLight = __WEBPACK_IMPORTED_MODULE_0__Light__["a" /* default */].extend(/**@lends clay.light.Spot */ { - /** - * @type {number} - */ - range: 20, - /** - * @type {number} - */ - umbraAngle: 30, - /** - * @type {number} - */ - penumbraAngle: 45, - /** - * @type {number} - */ - falloffFactor: 2.0, - /** - * @type {number} - */ - shadowBias: 0.001, - /** - * @type {number} - */ - shadowSlopeScale: 2.0 -}, { - - type: 'SPOT_LIGHT', - - uniformTemplates: { - spotLightPosition: { - type: '3f', - value: function (instance) { - return instance.getWorldPosition().array; - } - }, - spotLightRange: { - type: '1f', - value: function (instance) { - return instance.range; - } - }, - spotLightUmbraAngleCosine: { - type: '1f', - value: function (instance) { - return Math.cos(instance.umbraAngle * Math.PI / 180); - } - }, - spotLightPenumbraAngleCosine: { - type: '1f', - value: function (instance) { - return Math.cos(instance.penumbraAngle * Math.PI / 180); - } - }, - spotLightFalloffFactor: { - type: '1f', - value: function (instance) { - return instance.falloffFactor; - } - }, - spotLightDirection: { - type: '3f', - value: function (instance) { - instance.__dir = instance.__dir || new __WEBPACK_IMPORTED_MODULE_1__math_Vector3__["a" /* default */](); - // Direction is target to eye - return instance.__dir.copy(instance.worldTransform.z).negate().array; - } - }, - spotLightColor: { - type: '3f', - value: function (instance) { - var color = instance.color; - var intensity = instance.intensity; - return [color[0] * intensity, color[1] * intensity, color[2] * intensity]; - } - } - }, - /** - * @return {clay.light.Spot} - * @memberOf clay.light.Spot.prototype - */ - clone: function () { - var light = __WEBPACK_IMPORTED_MODULE_0__Light__["a" /* default */].prototype.clone.call(this); - light.range = this.range; - light.umbraAngle = this.umbraAngle; - light.penumbraAngle = this.penumbraAngle; - light.falloffFactor = this.falloffFactor; - light.shadowBias = this.shadowBias; - light.shadowSlopeScale = this.shadowSlopeScale; - return light; - } -}); - -/* harmony default export */ __webpack_exports__["a"] = (SpotLight); - - -/***/ }), -/* 137 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__ = __webpack_require__(33); - - -/** - * @constructor - * @alias clay.Vector4 - * @param {number} x - * @param {number} y - * @param {number} z - * @param {number} w - */ -var Vector4 = function(x, y, z, w) { - - x = x || 0; - y = y || 0; - z = z || 0; - w = w || 0; - - /** - * Storage of Vector4, read and write of x, y, z, w will change the values in array - * All methods also operate on the array instead of x, y, z, w components - * @name array - * @type {Float32Array} - * @memberOf clay.Vector4# - */ - this.array = __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].fromValues(x, y, z, w); - - /** - * Dirty flag is used by the Node to determine - * if the matrix is updated to latest - * @name _dirty - * @type {boolean} - * @memberOf clay.Vector4# - */ - this._dirty = true; -}; - -Vector4.prototype = { - - constructor: Vector4, - - /** - * Add b to self - * @param {clay.Vector4} b - * @return {clay.Vector4} - */ - add: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].add(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Set x, y and z components - * @param {number} x - * @param {number} y - * @param {number} z - * @param {number} w - * @return {clay.Vector4} - */ - set: function(x, y, z, w) { - this.array[0] = x; - this.array[1] = y; - this.array[2] = z; - this.array[3] = w; - this._dirty = true; - return this; - }, - - /** - * Set x, y, z and w components from array - * @param {Float32Array|number[]} arr - * @return {clay.Vector4} - */ - setArray: function(arr) { - this.array[0] = arr[0]; - this.array[1] = arr[1]; - this.array[2] = arr[2]; - this.array[3] = arr[3]; - - this._dirty = true; - return this; - }, - - /** - * Clone a new Vector4 - * @return {clay.Vector4} - */ - clone: function() { - return new Vector4(this.x, this.y, this.z, this.w); - }, - - /** - * Copy from b - * @param {clay.Vector4} b - * @return {clay.Vector4} - */ - copy: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].copy(this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Alias for distance - * @param {clay.Vector4} b - * @return {number} - */ - dist: function(b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].dist(this.array, b.array); - }, - - /** - * Distance between self and b - * @param {clay.Vector4} b - * @return {number} - */ - distance: function(b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].distance(this.array, b.array); - }, - - /** - * Alias for divide - * @param {clay.Vector4} b - * @return {clay.Vector4} - */ - div: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].div(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Divide self by b - * @param {clay.Vector4} b - * @return {clay.Vector4} - */ - divide: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].divide(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Dot product of self and b - * @param {clay.Vector4} b - * @return {number} - */ - dot: function(b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].dot(this.array, b.array); - }, - - /** - * Alias of length - * @return {number} - */ - len: function() { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].len(this.array); - }, - - /** - * Calculate the length - * @return {number} - */ - length: function() { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].length(this.array); - }, - /** - * Linear interpolation between a and b - * @param {clay.Vector4} a - * @param {clay.Vector4} b - * @param {number} t - * @return {clay.Vector4} - */ - lerp: function(a, b, t) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].lerp(this.array, a.array, b.array, t); - this._dirty = true; - return this; - }, - - /** - * Minimum of self and b - * @param {clay.Vector4} b - * @return {clay.Vector4} - */ - min: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].min(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Maximum of self and b - * @param {clay.Vector4} b - * @return {clay.Vector4} - */ - max: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].max(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Alias for multiply - * @param {clay.Vector4} b - * @return {clay.Vector4} - */ - mul: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].mul(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Mutiply self and b - * @param {clay.Vector4} b - * @return {clay.Vector4} - */ - multiply: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].multiply(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Negate self - * @return {clay.Vector4} - */ - negate: function() { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].negate(this.array, this.array); - this._dirty = true; - return this; - }, - - /** - * Normalize self - * @return {clay.Vector4} - */ - normalize: function() { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].normalize(this.array, this.array); - this._dirty = true; - return this; - }, - - /** - * Generate random x, y, z, w components with a given scale - * @param {number} scale - * @return {clay.Vector4} - */ - random: function(scale) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].random(this.array, scale); - this._dirty = true; - return this; - }, - - /** - * Scale self - * @param {number} scale - * @return {clay.Vector4} - */ - scale: function(s) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].scale(this.array, this.array, s); - this._dirty = true; - return this; - }, - /** - * Scale b and add to self - * @param {clay.Vector4} b - * @param {number} scale - * @return {clay.Vector4} - */ - scaleAndAdd: function(b, s) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].scaleAndAdd(this.array, this.array, b.array, s); - this._dirty = true; - return this; - }, - - /** - * Alias for squaredDistance - * @param {clay.Vector4} b - * @return {number} - */ - sqrDist: function(b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].sqrDist(this.array, b.array); - }, - - /** - * Squared distance between self and b - * @param {clay.Vector4} b - * @return {number} - */ - squaredDistance: function(b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].squaredDistance(this.array, b.array); - }, - - /** - * Alias for squaredLength - * @return {number} - */ - sqrLen: function() { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].sqrLen(this.array); - }, - - /** - * Squared length of self - * @return {number} - */ - squaredLength: function() { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].squaredLength(this.array); - }, - - /** - * Alias for subtract - * @param {clay.Vector4} b - * @return {clay.Vector4} - */ - sub: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].sub(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Subtract b from self - * @param {clay.Vector4} b - * @return {clay.Vector4} - */ - subtract: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].subtract(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Transform self with a Matrix4 m - * @param {clay.Matrix4} m - * @return {clay.Vector4} - */ - transformMat4: function(m) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].transformMat4(this.array, this.array, m.array); - this._dirty = true; - return this; - }, - - /** - * Transform self with a Quaternion q - * @param {clay.Quaternion} q - * @return {clay.Vector4} - */ - transformQuat: function(q) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].transformQuat(this.array, this.array, q.array); - this._dirty = true; - return this; - }, - - toString: function() { - return '[' + Array.prototype.join.call(this.array, ',') + ']'; - }, - - toArray: function () { - return Array.prototype.slice.call(this.array); - } -}; - -var defineProperty = Object.defineProperty; -// Getter and Setter -if (defineProperty) { - - var proto = Vector4.prototype; - /** - * @name x - * @type {number} - * @memberOf clay.Vector4 - * @instance - */ - defineProperty(proto, 'x', { - get: function () { - return this.array[0]; - }, - set: function (value) { - this.array[0] = value; - this._dirty = true; - } - }); - - /** - * @name y - * @type {number} - * @memberOf clay.Vector4 - * @instance - */ - defineProperty(proto, 'y', { - get: function () { - return this.array[1]; - }, - set: function (value) { - this.array[1] = value; - this._dirty = true; - } - }); - - /** - * @name z - * @type {number} - * @memberOf clay.Vector4 - * @instance - */ - defineProperty(proto, 'z', { - get: function () { - return this.array[2]; - }, - set: function (value) { - this.array[2] = value; - this._dirty = true; - } - }); - - /** - * @name w - * @type {number} - * @memberOf clay.Vector4 - * @instance - */ - defineProperty(proto, 'w', { - get: function () { - return this.array[3]; - }, - set: function (value) { - this.array[3] = value; - this._dirty = true; - } - }); -} - -// Supply methods that are not in place - -/** - * @param {clay.Vector4} out - * @param {clay.Vector4} a - * @param {clay.Vector4} b - * @return {clay.Vector4} - */ -Vector4.add = function(out, a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].add(out.array, a.array, b.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Vector4} out - * @param {number} x - * @param {number} y - * @param {number} z - * @return {clay.Vector4} - */ -Vector4.set = function(out, x, y, z, w) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].set(out.array, x, y, z, w); - out._dirty = true; -}; - -/** - * @param {clay.Vector4} out - * @param {clay.Vector4} b - * @return {clay.Vector4} - */ -Vector4.copy = function(out, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].copy(out.array, b.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Vector4} a - * @param {clay.Vector4} b - * @return {number} - */ -Vector4.dist = function(a, b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].distance(a.array, b.array); -}; - -/** - * @function - * @param {clay.Vector4} a - * @param {clay.Vector4} b - * @return {number} - */ -Vector4.distance = Vector4.dist; - -/** - * @param {clay.Vector4} out - * @param {clay.Vector4} a - * @param {clay.Vector4} b - * @return {clay.Vector4} - */ -Vector4.div = function(out, a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].divide(out.array, a.array, b.array); - out._dirty = true; - return out; -}; - -/** - * @function - * @param {clay.Vector4} out - * @param {clay.Vector4} a - * @param {clay.Vector4} b - * @return {clay.Vector4} - */ -Vector4.divide = Vector4.div; - -/** - * @param {clay.Vector4} a - * @param {clay.Vector4} b - * @return {number} - */ -Vector4.dot = function(a, b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].dot(a.array, b.array); -}; - -/** - * @param {clay.Vector4} a - * @return {number} - */ -Vector4.len = function(b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].length(b.array); -}; - -// Vector4.length = Vector4.len; - -/** - * @param {clay.Vector4} out - * @param {clay.Vector4} a - * @param {clay.Vector4} b - * @param {number} t - * @return {clay.Vector4} - */ -Vector4.lerp = function(out, a, b, t) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].lerp(out.array, a.array, b.array, t); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Vector4} out - * @param {clay.Vector4} a - * @param {clay.Vector4} b - * @return {clay.Vector4} - */ -Vector4.min = function(out, a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].min(out.array, a.array, b.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Vector4} out - * @param {clay.Vector4} a - * @param {clay.Vector4} b - * @return {clay.Vector4} - */ -Vector4.max = function(out, a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].max(out.array, a.array, b.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Vector4} out - * @param {clay.Vector4} a - * @param {clay.Vector4} b - * @return {clay.Vector4} - */ -Vector4.mul = function(out, a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].multiply(out.array, a.array, b.array); - out._dirty = true; - return out; -}; - -/** - * @function - * @param {clay.Vector4} out - * @param {clay.Vector4} a - * @param {clay.Vector4} b - * @return {clay.Vector4} - */ -Vector4.multiply = Vector4.mul; - -/** - * @param {clay.Vector4} out - * @param {clay.Vector4} a - * @return {clay.Vector4} - */ -Vector4.negate = function(out, a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].negate(out.array, a.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Vector4} out - * @param {clay.Vector4} a - * @return {clay.Vector4} - */ -Vector4.normalize = function(out, a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].normalize(out.array, a.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Vector4} out - * @param {number} scale - * @return {clay.Vector4} - */ -Vector4.random = function(out, scale) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].random(out.array, scale); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Vector4} out - * @param {clay.Vector4} a - * @param {number} scale - * @return {clay.Vector4} - */ -Vector4.scale = function(out, a, scale) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].scale(out.array, a.array, scale); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Vector4} out - * @param {clay.Vector4} a - * @param {clay.Vector4} b - * @param {number} scale - * @return {clay.Vector4} - */ -Vector4.scaleAndAdd = function(out, a, b, scale) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].scaleAndAdd(out.array, a.array, b.array, scale); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Vector4} a - * @param {clay.Vector4} b - * @return {number} - */ -Vector4.sqrDist = function(a, b) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].sqrDist(a.array, b.array); -}; - -/** - * @function - * @param {clay.Vector4} a - * @param {clay.Vector4} b - * @return {number} - */ -Vector4.squaredDistance = Vector4.sqrDist; - -/** - * @param {clay.Vector4} a - * @return {number} - */ -Vector4.sqrLen = function(a) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].sqrLen(a.array); -}; -/** - * @function - * @param {clay.Vector4} a - * @return {number} - */ -Vector4.squaredLength = Vector4.sqrLen; - -/** - * @param {clay.Vector4} out - * @param {clay.Vector4} a - * @param {clay.Vector4} b - * @return {clay.Vector4} - */ -Vector4.sub = function(out, a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].subtract(out.array, a.array, b.array); - out._dirty = true; - return out; -}; -/** - * @function - * @param {clay.Vector4} out - * @param {clay.Vector4} a - * @param {clay.Vector4} b - * @return {clay.Vector4} - */ -Vector4.subtract = Vector4.sub; - -/** - * @param {clay.Vector4} out - * @param {clay.Vector4} a - * @param {clay.Matrix4} m - * @return {clay.Vector4} - */ -Vector4.transformMat4 = function(out, a, m) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].transformMat4(out.array, a.array, m.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Vector4} out - * @param {clay.Vector4} a - * @param {clay.Quaternion} q - * @return {clay.Vector4} - */ -Vector4.transformQuat = function(out, a, q) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec4__["a" /* default */].transformQuat(out.array, a.array, q.array); - out._dirty = true; - return out; -}; - -/* harmony default export */ __webpack_exports__["a"] = (Vector4); - - -/***/ }), -/* 138 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2__ = __webpack_require__(78); - - -/** - * @constructor - * @alias clay.Matrix2 - */ -var Matrix2 = function() { - - /** - * Storage of Matrix2 - * @name array - * @type {Float32Array} - * @memberOf clay.Matrix2# - */ - this.array = __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2__["a" /* default */].create(); - - /** - * @name _dirty - * @type {boolean} - * @memberOf clay.Matrix2# - */ - this._dirty = true; -}; - -Matrix2.prototype = { - - constructor: Matrix2, - - /** - * Set components from array - * @param {Float32Array|number[]} arr - */ - setArray: function (arr) { - for (var i = 0; i < this.array.length; i++) { - this.array[i] = arr[i]; - } - this._dirty = true; - return this; - }, - /** - * Clone a new Matrix2 - * @return {clay.Matrix2} - */ - clone: function() { - return (new Matrix2()).copy(this); - }, - - /** - * Copy from b - * @param {clay.Matrix2} b - * @return {clay.Matrix2} - */ - copy: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2__["a" /* default */].copy(this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Calculate the adjugate of self, in-place - * @return {clay.Matrix2} - */ - adjoint: function() { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2__["a" /* default */].adjoint(this.array, this.array); - this._dirty = true; - return this; - }, - - /** - * Calculate matrix determinant - * @return {number} - */ - determinant: function() { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2__["a" /* default */].determinant(this.array); - }, - - /** - * Set to a identity matrix - * @return {clay.Matrix2} - */ - identity: function() { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2__["a" /* default */].identity(this.array); - this._dirty = true; - return this; - }, - - /** - * Invert self - * @return {clay.Matrix2} - */ - invert: function() { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2__["a" /* default */].invert(this.array, this.array); - this._dirty = true; - return this; - }, - - /** - * Alias for mutiply - * @param {clay.Matrix2} b - * @return {clay.Matrix2} - */ - mul: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2__["a" /* default */].mul(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Alias for multiplyLeft - * @param {clay.Matrix2} a - * @return {clay.Matrix2} - */ - mulLeft: function(a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2__["a" /* default */].mul(this.array, a.array, this.array); - this._dirty = true; - return this; - }, - - /** - * Multiply self and b - * @param {clay.Matrix2} b - * @return {clay.Matrix2} - */ - multiply: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2__["a" /* default */].multiply(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Multiply a and self, a is on the left - * @param {clay.Matrix2} a - * @return {clay.Matrix2} - */ - multiplyLeft: function(a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2__["a" /* default */].multiply(this.array, a.array, this.array); - this._dirty = true; - return this; - }, - - /** - * Rotate self by a given radian - * @param {number} rad - * @return {clay.Matrix2} - */ - rotate: function(rad) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2__["a" /* default */].rotate(this.array, this.array, rad); - this._dirty = true; - return this; - }, - - /** - * Scale self by s - * @param {clay.Vector2} s - * @return {clay.Matrix2} - */ - scale: function(v) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2__["a" /* default */].scale(this.array, this.array, v.array); - this._dirty = true; - return this; - }, - /** - * Transpose self, in-place. - * @return {clay.Matrix2} - */ - transpose: function() { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2__["a" /* default */].transpose(this.array, this.array); - this._dirty = true; - return this; - }, - - toString: function() { - return '[' + Array.prototype.join.call(this.array, ',') + ']'; - }, - - toArray: function () { - return Array.prototype.slice.call(this.array); - } -}; - -/** - * @param {Matrix2} out - * @param {Matrix2} a - * @return {Matrix2} - */ -Matrix2.adjoint = function(out, a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2__["a" /* default */].adjoint(out.array, a.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix2} out - * @param {clay.Matrix2} a - * @return {clay.Matrix2} - */ -Matrix2.copy = function(out, a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2__["a" /* default */].copy(out.array, a.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix2} a - * @return {number} - */ -Matrix2.determinant = function(a) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2__["a" /* default */].determinant(a.array); -}; - -/** - * @param {clay.Matrix2} out - * @return {clay.Matrix2} - */ -Matrix2.identity = function(out) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2__["a" /* default */].identity(out.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix2} out - * @param {clay.Matrix2} a - * @return {clay.Matrix2} - */ -Matrix2.invert = function(out, a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2__["a" /* default */].invert(out.array, a.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix2} out - * @param {clay.Matrix2} a - * @param {clay.Matrix2} b - * @return {clay.Matrix2} - */ -Matrix2.mul = function(out, a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2__["a" /* default */].mul(out.array, a.array, b.array); - out._dirty = true; - return out; -}; - -/** - * @function - * @param {clay.Matrix2} out - * @param {clay.Matrix2} a - * @param {clay.Matrix2} b - * @return {clay.Matrix2} - */ -Matrix2.multiply = Matrix2.mul; - -/** - * @param {clay.Matrix2} out - * @param {clay.Matrix2} a - * @param {number} rad - * @return {clay.Matrix2} - */ -Matrix2.rotate = function(out, a, rad) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2__["a" /* default */].rotate(out.array, a.array, rad); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix2} out - * @param {clay.Matrix2} a - * @param {clay.Vector2} v - * @return {clay.Matrix2} - */ -Matrix2.scale = function(out, a, v) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2__["a" /* default */].scale(out.array, a.array, v.array); - out._dirty = true; - return out; -}; -/** - * @param {Matrix2} out - * @param {Matrix2} a - * @return {Matrix2} - */ -Matrix2.transpose = function(out, a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2__["a" /* default */].transpose(out.array, a.array); - out._dirty = true; - return out; -}; - -/* harmony default export */ __webpack_exports__["a"] = (Matrix2); - - -/***/ }), -/* 139 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2d__ = __webpack_require__(79); - - -/** - * @constructor - * @alias clay.Matrix2d - */ -var Matrix2d = function() { - /** - * Storage of Matrix2d - * @name array - * @type {Float32Array} - * @memberOf clay.Matrix2d# - */ - this.array = __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2d__["a" /* default */].create(); - - /** - * @name _dirty - * @type {boolean} - * @memberOf clay.Matrix2d# - */ - this._dirty = true; -}; - -Matrix2d.prototype = { - - constructor: Matrix2d, - - /** - * Set components from array - * @param {Float32Array|number[]} arr - */ - setArray: function (arr) { - for (var i = 0; i < this.array.length; i++) { - this.array[i] = arr[i]; - } - this._dirty = true; - return this; - }, - /** - * Clone a new Matrix2d - * @return {clay.Matrix2d} - */ - clone: function() { - return (new Matrix2d()).copy(this); - }, - - /** - * Copy from b - * @param {clay.Matrix2d} b - * @return {clay.Matrix2d} - */ - copy: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2d__["a" /* default */].copy(this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Calculate matrix determinant - * @return {number} - */ - determinant: function() { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2d__["a" /* default */].determinant(this.array); - }, - - /** - * Set to a identity matrix - * @return {clay.Matrix2d} - */ - identity: function() { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2d__["a" /* default */].identity(this.array); - this._dirty = true; - return this; - }, - - /** - * Invert self - * @return {clay.Matrix2d} - */ - invert: function() { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2d__["a" /* default */].invert(this.array, this.array); - this._dirty = true; - return this; - }, - - /** - * Alias for mutiply - * @param {clay.Matrix2d} b - * @return {clay.Matrix2d} - */ - mul: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2d__["a" /* default */].mul(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Alias for multiplyLeft - * @param {clay.Matrix2d} a - * @return {clay.Matrix2d} - */ - mulLeft: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2d__["a" /* default */].mul(this.array, b.array, this.array); - this._dirty = true; - return this; - }, - - /** - * Multiply self and b - * @param {clay.Matrix2d} b - * @return {clay.Matrix2d} - */ - multiply: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2d__["a" /* default */].multiply(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Multiply a and self, a is on the left - * @param {clay.Matrix2d} a - * @return {clay.Matrix2d} - */ - multiplyLeft: function(b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2d__["a" /* default */].multiply(this.array, b.array, this.array); - this._dirty = true; - return this; - }, - - /** - * Rotate self by a given radian - * @param {number} rad - * @return {clay.Matrix2d} - */ - rotate: function(rad) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2d__["a" /* default */].rotate(this.array, this.array, rad); - this._dirty = true; - return this; - }, - - /** - * Scale self by s - * @param {clay.Vector2} s - * @return {clay.Matrix2d} - */ - scale: function(s) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2d__["a" /* default */].scale(this.array, this.array, s.array); - this._dirty = true; - return this; - }, - - /** - * Translate self by v - * @param {clay.Vector2} v - * @return {clay.Matrix2d} - */ - translate: function(v) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2d__["a" /* default */].translate(this.array, this.array, v.array); - this._dirty = true; - return this; - }, - - toString: function() { - return '[' + Array.prototype.join.call(this.array, ',') + ']'; - }, - - toArray: function () { - return Array.prototype.slice.call(this.array); - } -}; - -/** - * @param {clay.Matrix2d} out - * @param {clay.Matrix2d} a - * @return {clay.Matrix2d} - */ -Matrix2d.copy = function(out, a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2d__["a" /* default */].copy(out.array, a.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix2d} a - * @return {number} - */ -Matrix2d.determinant = function(a) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2d__["a" /* default */].determinant(a.array); -}; - -/** - * @param {clay.Matrix2d} out - * @return {clay.Matrix2d} - */ -Matrix2d.identity = function(out) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2d__["a" /* default */].identity(out.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix2d} out - * @param {clay.Matrix2d} a - * @return {clay.Matrix2d} - */ -Matrix2d.invert = function(out, a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2d__["a" /* default */].invert(out.array, a.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix2d} out - * @param {clay.Matrix2d} a - * @param {clay.Matrix2d} b - * @return {clay.Matrix2d} - */ -Matrix2d.mul = function(out, a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2d__["a" /* default */].mul(out.array, a.array, b.array); - out._dirty = true; - return out; -}; - -/** - * @function - * @param {clay.Matrix2d} out - * @param {clay.Matrix2d} a - * @param {clay.Matrix2d} b - * @return {clay.Matrix2d} - */ -Matrix2d.multiply = Matrix2d.mul; - -/** - * @param {clay.Matrix2d} out - * @param {clay.Matrix2d} a - * @param {number} rad - * @return {clay.Matrix2d} - */ -Matrix2d.rotate = function(out, a, rad) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2d__["a" /* default */].rotate(out.array, a.array, rad); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix2d} out - * @param {clay.Matrix2d} a - * @param {clay.Vector2} v - * @return {clay.Matrix2d} - */ -Matrix2d.scale = function(out, a, v) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2d__["a" /* default */].scale(out.array, a.array, v.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix2d} out - * @param {clay.Matrix2d} a - * @param {clay.Vector2} v - * @return {clay.Matrix2d} - */ -Matrix2d.translate = function(out, a, v) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat2d__["a" /* default */].translate(out.array, a.array, v.array); - out._dirty = true; - return out; -}; - -/* harmony default export */ __webpack_exports__["a"] = (Matrix2d); - - -/***/ }), -/* 140 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__ = __webpack_require__(34); - - -/** - * @constructor - * @alias clay.Matrix3 - */ -var Matrix3 = function () { - - /** - * Storage of Matrix3 - * @name array - * @type {Float32Array} - * @memberOf clay.Matrix3# - */ - this.array = __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].create(); - - /** - * @name _dirty - * @type {boolean} - * @memberOf clay.Matrix3# - */ - this._dirty = true; -}; - -Matrix3.prototype = { - - constructor: Matrix3, - - /** - * Set components from array - * @param {Float32Array|number[]} arr - */ - setArray: function (arr) { - for (var i = 0; i < this.array.length; i++) { - this.array[i] = arr[i]; - } - this._dirty = true; - return this; - }, - /** - * Calculate the adjugate of self, in-place - * @return {clay.Matrix3} - */ - adjoint: function () { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].adjoint(this.array, this.array); - this._dirty = true; - return this; - }, - - /** - * Clone a new Matrix3 - * @return {clay.Matrix3} - */ - clone: function () { - return (new Matrix3()).copy(this); - }, - - /** - * Copy from b - * @param {clay.Matrix3} b - * @return {clay.Matrix3} - */ - copy: function (b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].copy(this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Calculate matrix determinant - * @return {number} - */ - determinant: function () { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].determinant(this.array); - }, - - /** - * Copy the values from Matrix2d a - * @param {clay.Matrix2d} a - * @return {clay.Matrix3} - */ - fromMat2d: function (a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].fromMat2d(this.array, a.array); - this._dirty = true; - return this; - }, - - /** - * Copies the upper-left 3x3 values of Matrix4 - * @param {clay.Matrix4} a - * @return {clay.Matrix3} - */ - fromMat4: function (a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].fromMat4(this.array, a.array); - this._dirty = true; - return this; - }, - - /** - * Calculates a rotation matrix from the given quaternion - * @param {clay.Quaternion} q - * @return {clay.Matrix3} - */ - fromQuat: function (q) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].fromQuat(this.array, q.array); - this._dirty = true; - return this; - }, - - /** - * Set to a identity matrix - * @return {clay.Matrix3} - */ - identity: function () { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].identity(this.array); - this._dirty = true; - return this; - }, - - /** - * Invert self - * @return {clay.Matrix3} - */ - invert: function () { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].invert(this.array, this.array); - this._dirty = true; - return this; - }, - - /** - * Alias for mutiply - * @param {clay.Matrix3} b - * @return {clay.Matrix3} - */ - mul: function (b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].mul(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Alias for multiplyLeft - * @param {clay.Matrix3} a - * @return {clay.Matrix3} - */ - mulLeft: function (a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].mul(this.array, a.array, this.array); - this._dirty = true; - return this; - }, - - /** - * Multiply self and b - * @param {clay.Matrix3} b - * @return {clay.Matrix3} - */ - multiply: function (b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].multiply(this.array, this.array, b.array); - this._dirty = true; - return this; - }, - - /** - * Multiply a and self, a is on the left - * @param {clay.Matrix3} a - * @return {clay.Matrix3} - */ - multiplyLeft: function (a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].multiply(this.array, a.array, this.array); - this._dirty = true; - return this; - }, - - /** - * Rotate self by a given radian - * @param {number} rad - * @return {clay.Matrix3} - */ - rotate: function (rad) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].rotate(this.array, this.array, rad); - this._dirty = true; - return this; - }, - - /** - * Scale self by s - * @param {clay.Vector2} s - * @return {clay.Matrix3} - */ - scale: function (v) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].scale(this.array, this.array, v.array); - this._dirty = true; - return this; - }, - - /** - * Translate self by v - * @param {clay.Vector2} v - * @return {clay.Matrix3} - */ - translate: function (v) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].translate(this.array, this.array, v.array); - this._dirty = true; - return this; - }, - /** - * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix - * @param {clay.Matrix4} a - */ - normalFromMat4: function (a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].normalFromMat4(this.array, a.array); - this._dirty = true; - return this; - }, - - /** - * Transpose self, in-place. - * @return {clay.Matrix2} - */ - transpose: function () { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].transpose(this.array, this.array); - this._dirty = true; - return this; - }, - - toString: function () { - return '[' + Array.prototype.join.call(this.array, ',') + ']'; - }, - - toArray: function () { - return Array.prototype.slice.call(this.array); - } -}; -/** - * @param {clay.Matrix3} out - * @param {clay.Matrix3} a - * @return {clay.Matrix3} - */ -Matrix3.adjoint = function (out, a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].adjoint(out.array, a.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix3} out - * @param {clay.Matrix3} a - * @return {clay.Matrix3} - */ -Matrix3.copy = function (out, a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].copy(out.array, a.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix3} a - * @return {number} - */ -Matrix3.determinant = function (a) { - return __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].determinant(a.array); -}; - -/** - * @param {clay.Matrix3} out - * @return {clay.Matrix3} - */ -Matrix3.identity = function (out) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].identity(out.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix3} out - * @param {clay.Matrix3} a - * @return {clay.Matrix3} - */ -Matrix3.invert = function (out, a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].invert(out.array, a.array); - return out; -}; - -/** - * @param {clay.Matrix3} out - * @param {clay.Matrix3} a - * @param {clay.Matrix3} b - * @return {clay.Matrix3} - */ -Matrix3.mul = function (out, a, b) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].mul(out.array, a.array, b.array); - out._dirty = true; - return out; -}; - -/** - * @function - * @param {clay.Matrix3} out - * @param {clay.Matrix3} a - * @param {clay.Matrix3} b - * @return {clay.Matrix3} - */ -Matrix3.multiply = Matrix3.mul; - -/** - * @param {clay.Matrix3} out - * @param {clay.Matrix2d} a - * @return {clay.Matrix3} - */ -Matrix3.fromMat2d = function (out, a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].fromMat2d(out.array, a.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix3} out - * @param {clay.Matrix4} a - * @return {clay.Matrix3} - */ -Matrix3.fromMat4 = function (out, a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].fromMat4(out.array, a.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix3} out - * @param {clay.Quaternion} a - * @return {clay.Matrix3} - */ -Matrix3.fromQuat = function (out, q) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].fromQuat(out.array, q.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix3} out - * @param {clay.Matrix4} a - * @return {clay.Matrix3} - */ -Matrix3.normalFromMat4 = function (out, a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].normalFromMat4(out.array, a.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix3} out - * @param {clay.Matrix3} a - * @param {number} rad - * @return {clay.Matrix3} - */ -Matrix3.rotate = function (out, a, rad) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].rotate(out.array, a.array, rad); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix3} out - * @param {clay.Matrix3} a - * @param {clay.Vector2} v - * @return {clay.Matrix3} - */ -Matrix3.scale = function (out, a, v) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].scale(out.array, a.array, v.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix3} out - * @param {clay.Matrix3} a - * @return {clay.Matrix3} - */ -Matrix3.transpose = function (out, a) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].transpose(out.array, a.array); - out._dirty = true; - return out; -}; - -/** - * @param {clay.Matrix3} out - * @param {clay.Matrix3} a - * @param {clay.Vector2} v - * @return {clay.Matrix3} - */ -Matrix3.translate = function (out, a, v) { - __WEBPACK_IMPORTED_MODULE_0__glmatrix_mat3__["a" /* default */].translate(out.array, a.array, v.array); - out._dirty = true; - return out; -}; - -/* harmony default export */ __webpack_exports__["a"] = (Matrix3); - - -/***/ }), -/* 141 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_zrender_lib_animation_Animator__ = __webpack_require__(142); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_zrender_lib_animation_Animator___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_zrender_lib_animation_Animator__); - - -var animatableMixin = { - - _animators: null, - - getAnimators: function () { - this._animators = this._animators || []; - - return this._animators; - }, - - animate: function (path, opts) { - this._animators = this._animators || []; - - var el = this; - - var target; - - if (path) { - var pathSplitted = path.split('.'); - var prop = el; - for (var i = 0, l = pathSplitted.length; i < l; i++) { - if (!prop) { - continue; - } - prop = prop[pathSplitted[i]]; - } - if (prop) { - target = prop; - } - } - else { - target = el; - } - if (target == null) { - throw new Error('Target ' + path + ' not exists'); - } - - var animators = this._animators; - - var animator = new __WEBPACK_IMPORTED_MODULE_0_zrender_lib_animation_Animator___default.a(target, opts); - var self = this; - animator.during(function () { - if (self.__zr) { - self.__zr.refresh(); - } - }).done(function () { - var idx = animators.indexOf(animator); - if (idx >= 0) { - animators.splice(idx, 1); - } - }); - animators.push(animator); - - if (this.__zr) { - this.__zr.animation.addAnimator(animator); - } - - return animator; - }, - - stopAnimation: function (forwardToLast) { - this._animators = this._animators || []; - - var animators = this._animators; - var len = animators.length; - for (var i = 0; i < len; i++) { - animators[i].stop(forwardToLast); - } - animators.length = 0; - - return this; - }, - - addAnimatorsToZr: function (zr) { - if (this._animators) { - for (var i = 0; i < this._animators.length; i++) { - zr.animation.addAnimator(this._animators[i]); - } - } - }, - - removeAnimatorsFromZr: function (zr) { - if (this._animators) { - for (var i = 0; i < this._animators.length; i++) { - zr.animation.removeAnimator(this._animators[i]); - } - } - } -}; - -/* harmony default export */ __webpack_exports__["a"] = (animatableMixin); - -/***/ }), -/* 142 */ -/***/ (function(module, exports, __webpack_require__) { - -var Clip = __webpack_require__(143); - -var color = __webpack_require__(145); - -var _util = __webpack_require__(13); - -var isArrayLike = _util.isArrayLike; - -/** - * @module echarts/animation/Animator - */ -var arraySlice = Array.prototype.slice; - -function defaultGetter(target, key) { - return target[key]; -} - -function defaultSetter(target, key, value) { - target[key] = value; -} -/** - * @param {number} p0 - * @param {number} p1 - * @param {number} percent - * @return {number} - */ - - -function interpolateNumber(p0, p1, percent) { - return (p1 - p0) * percent + p0; -} -/** - * @param {string} p0 - * @param {string} p1 - * @param {number} percent - * @return {string} - */ - - -function interpolateString(p0, p1, percent) { - return percent > 0.5 ? p1 : p0; -} -/** - * @param {Array} p0 - * @param {Array} p1 - * @param {number} percent - * @param {Array} out - * @param {number} arrDim - */ - - -function interpolateArray(p0, p1, percent, out, arrDim) { - var len = p0.length; - - if (arrDim == 1) { - for (var i = 0; i < len; i++) { - out[i] = interpolateNumber(p0[i], p1[i], percent); - } - } else { - var len2 = len && p0[0].length; - - for (var i = 0; i < len; i++) { - for (var j = 0; j < len2; j++) { - out[i][j] = interpolateNumber(p0[i][j], p1[i][j], percent); - } - } - } -} // arr0 is source array, arr1 is target array. -// Do some preprocess to avoid error happened when interpolating from arr0 to arr1 - - -function fillArr(arr0, arr1, arrDim) { - var arr0Len = arr0.length; - var arr1Len = arr1.length; - - if (arr0Len !== arr1Len) { - // FIXME Not work for TypedArray - var isPreviousLarger = arr0Len > arr1Len; - - if (isPreviousLarger) { - // Cut the previous - arr0.length = arr1Len; - } else { - // Fill the previous - for (var i = arr0Len; i < arr1Len; i++) { - arr0.push(arrDim === 1 ? arr1[i] : arraySlice.call(arr1[i])); - } - } - } // Handling NaN value - - - var len2 = arr0[0] && arr0[0].length; - - for (var i = 0; i < arr0.length; i++) { - if (arrDim === 1) { - if (isNaN(arr0[i])) { - arr0[i] = arr1[i]; - } - } else { - for (var j = 0; j < len2; j++) { - if (isNaN(arr0[i][j])) { - arr0[i][j] = arr1[i][j]; - } - } - } - } -} -/** - * @param {Array} arr0 - * @param {Array} arr1 - * @param {number} arrDim - * @return {boolean} - */ - - -function isArraySame(arr0, arr1, arrDim) { - if (arr0 === arr1) { - return true; - } - - var len = arr0.length; - - if (len !== arr1.length) { - return false; - } - - if (arrDim === 1) { - for (var i = 0; i < len; i++) { - if (arr0[i] !== arr1[i]) { - return false; - } - } - } else { - var len2 = arr0[0].length; - - for (var i = 0; i < len; i++) { - for (var j = 0; j < len2; j++) { - if (arr0[i][j] !== arr1[i][j]) { - return false; - } - } - } - } - - return true; -} -/** - * Catmull Rom interpolate array - * @param {Array} p0 - * @param {Array} p1 - * @param {Array} p2 - * @param {Array} p3 - * @param {number} t - * @param {number} t2 - * @param {number} t3 - * @param {Array} out - * @param {number} arrDim - */ - - -function catmullRomInterpolateArray(p0, p1, p2, p3, t, t2, t3, out, arrDim) { - var len = p0.length; - - if (arrDim == 1) { - for (var i = 0; i < len; i++) { - out[i] = catmullRomInterpolate(p0[i], p1[i], p2[i], p3[i], t, t2, t3); - } - } else { - var len2 = p0[0].length; - - for (var i = 0; i < len; i++) { - for (var j = 0; j < len2; j++) { - out[i][j] = catmullRomInterpolate(p0[i][j], p1[i][j], p2[i][j], p3[i][j], t, t2, t3); - } - } - } -} -/** - * Catmull Rom interpolate number - * @param {number} p0 - * @param {number} p1 - * @param {number} p2 - * @param {number} p3 - * @param {number} t - * @param {number} t2 - * @param {number} t3 - * @return {number} - */ - - -function catmullRomInterpolate(p0, p1, p2, p3, t, t2, t3) { - var v0 = (p2 - p0) * 0.5; - var v1 = (p3 - p1) * 0.5; - return (2 * (p1 - p2) + v0 + v1) * t3 + (-3 * (p1 - p2) - 2 * v0 - v1) * t2 + v0 * t + p1; -} - -function cloneValue(value) { - if (isArrayLike(value)) { - var len = value.length; - - if (isArrayLike(value[0])) { - var ret = []; - - for (var i = 0; i < len; i++) { - ret.push(arraySlice.call(value[i])); - } - - return ret; - } - - return arraySlice.call(value); - } - - return value; -} - -function rgba2String(rgba) { - rgba[0] = Math.floor(rgba[0]); - rgba[1] = Math.floor(rgba[1]); - rgba[2] = Math.floor(rgba[2]); - return 'rgba(' + rgba.join(',') + ')'; -} - -function getArrayDim(keyframes) { - var lastValue = keyframes[keyframes.length - 1].value; - return isArrayLike(lastValue && lastValue[0]) ? 2 : 1; -} - -function createTrackClip(animator, easing, oneTrackDone, keyframes, propName, forceAnimate) { - var getter = animator._getter; - var setter = animator._setter; - var useSpline = easing === 'spline'; - var trackLen = keyframes.length; - - if (!trackLen) { - return; - } // Guess data type - - - var firstVal = keyframes[0].value; - var isValueArray = isArrayLike(firstVal); - var isValueColor = false; - var isValueString = false; // For vertices morphing - - var arrDim = isValueArray ? getArrayDim(keyframes) : 0; - var trackMaxTime; // Sort keyframe as ascending - - keyframes.sort(function (a, b) { - return a.time - b.time; - }); - trackMaxTime = keyframes[trackLen - 1].time; // Percents of each keyframe - - var kfPercents = []; // Value of each keyframe - - var kfValues = []; - var prevValue = keyframes[0].value; - var isAllValueEqual = true; - - for (var i = 0; i < trackLen; i++) { - kfPercents.push(keyframes[i].time / trackMaxTime); // Assume value is a color when it is a string - - var value = keyframes[i].value; // Check if value is equal, deep check if value is array - - if (!(isValueArray && isArraySame(value, prevValue, arrDim) || !isValueArray && value === prevValue)) { - isAllValueEqual = false; - } - - prevValue = value; // Try converting a string to a color array - - if (typeof value == 'string') { - var colorArray = color.parse(value); - - if (colorArray) { - value = colorArray; - isValueColor = true; - } else { - isValueString = true; - } - } - - kfValues.push(value); - } - - if (!forceAnimate && isAllValueEqual) { - return; - } - - var lastValue = kfValues[trackLen - 1]; // Polyfill array and NaN value - - for (var i = 0; i < trackLen - 1; i++) { - if (isValueArray) { - fillArr(kfValues[i], lastValue, arrDim); - } else { - if (isNaN(kfValues[i]) && !isNaN(lastValue) && !isValueString && !isValueColor) { - kfValues[i] = lastValue; - } - } - } - - isValueArray && fillArr(getter(animator._target, propName), lastValue, arrDim); // Cache the key of last frame to speed up when - // animation playback is sequency - - var lastFrame = 0; - var lastFramePercent = 0; - var start; - var w; - var p0; - var p1; - var p2; - var p3; - - if (isValueColor) { - var rgba = [0, 0, 0, 0]; - } - - var onframe = function (target, percent) { - // Find the range keyframes - // kf1-----kf2---------current--------kf3 - // find kf2 and kf3 and do interpolation - var frame; // In the easing function like elasticOut, percent may less than 0 - - if (percent < 0) { - frame = 0; - } else if (percent < lastFramePercent) { - // Start from next key - // PENDING start from lastFrame ? - start = Math.min(lastFrame + 1, trackLen - 1); - - for (frame = start; frame >= 0; frame--) { - if (kfPercents[frame] <= percent) { - break; - } - } // PENDING really need to do this ? - - - frame = Math.min(frame, trackLen - 2); - } else { - for (frame = lastFrame; frame < trackLen; frame++) { - if (kfPercents[frame] > percent) { - break; - } - } - - frame = Math.min(frame - 1, trackLen - 2); - } - - lastFrame = frame; - lastFramePercent = percent; - var range = kfPercents[frame + 1] - kfPercents[frame]; - - if (range === 0) { - return; - } else { - w = (percent - kfPercents[frame]) / range; - } - - if (useSpline) { - p1 = kfValues[frame]; - p0 = kfValues[frame === 0 ? frame : frame - 1]; - p2 = kfValues[frame > trackLen - 2 ? trackLen - 1 : frame + 1]; - p3 = kfValues[frame > trackLen - 3 ? trackLen - 1 : frame + 2]; - - if (isValueArray) { - catmullRomInterpolateArray(p0, p1, p2, p3, w, w * w, w * w * w, getter(target, propName), arrDim); - } else { - var value; - - if (isValueColor) { - value = catmullRomInterpolateArray(p0, p1, p2, p3, w, w * w, w * w * w, rgba, 1); - value = rgba2String(rgba); - } else if (isValueString) { - // String is step(0.5) - return interpolateString(p1, p2, w); - } else { - value = catmullRomInterpolate(p0, p1, p2, p3, w, w * w, w * w * w); - } - - setter(target, propName, value); - } - } else { - if (isValueArray) { - interpolateArray(kfValues[frame], kfValues[frame + 1], w, getter(target, propName), arrDim); - } else { - var value; - - if (isValueColor) { - interpolateArray(kfValues[frame], kfValues[frame + 1], w, rgba, 1); - value = rgba2String(rgba); - } else if (isValueString) { - // String is step(0.5) - return interpolateString(kfValues[frame], kfValues[frame + 1], w); - } else { - value = interpolateNumber(kfValues[frame], kfValues[frame + 1], w); - } - - setter(target, propName, value); - } - } - }; - - var clip = new Clip({ - target: animator._target, - life: trackMaxTime, - loop: animator._loop, - delay: animator._delay, - onframe: onframe, - ondestroy: oneTrackDone - }); - - if (easing && easing !== 'spline') { - clip.easing = easing; - } - - return clip; -} -/** - * @alias module:zrender/animation/Animator - * @constructor - * @param {Object} target - * @param {boolean} loop - * @param {Function} getter - * @param {Function} setter - */ - - -var Animator = function (target, loop, getter, setter) { - this._tracks = {}; - this._target = target; - this._loop = loop || false; - this._getter = getter || defaultGetter; - this._setter = setter || defaultSetter; - this._clipCount = 0; - this._delay = 0; - this._doneList = []; - this._onframeList = []; - this._clipList = []; -}; - -Animator.prototype = { - /** - * 设置动画关键帧 - * @param {number} time 关键帧时间,单位是ms - * @param {Object} props 关键帧的属性值,key-value表示 - * @return {module:zrender/animation/Animator} - */ - when: function (time - /* ms */ - , props) { - var tracks = this._tracks; - - for (var propName in props) { - if (!props.hasOwnProperty(propName)) { - continue; - } - - if (!tracks[propName]) { - tracks[propName] = []; // Invalid value - - var value = this._getter(this._target, propName); - - if (value == null) { - // zrLog('Invalid property ' + propName); - continue; - } // If time is 0 - // Then props is given initialize value - // Else - // Initialize value from current prop value - - - if (time !== 0) { - tracks[propName].push({ - time: 0, - value: cloneValue(value) - }); - } - } - - tracks[propName].push({ - time: time, - value: props[propName] - }); - } - - return this; - }, - - /** - * 添加动画每一帧的回调函数 - * @param {Function} callback - * @return {module:zrender/animation/Animator} - */ - during: function (callback) { - this._onframeList.push(callback); - - return this; - }, - pause: function () { - for (var i = 0; i < this._clipList.length; i++) { - this._clipList[i].pause(); - } - - this._paused = true; - }, - resume: function () { - for (var i = 0; i < this._clipList.length; i++) { - this._clipList[i].resume(); - } - - this._paused = false; - }, - isPaused: function () { - return !!this._paused; - }, - _doneCallback: function () { - // Clear all tracks - this._tracks = {}; // Clear all clips - - this._clipList.length = 0; - var doneList = this._doneList; - var len = doneList.length; - - for (var i = 0; i < len; i++) { - doneList[i].call(this); - } - }, - - /** - * 开始执行动画 - * @param {string|Function} [easing] - * 动画缓动函数,详见{@link module:zrender/animation/easing} - * @param {boolean} forceAnimate - * @return {module:zrender/animation/Animator} - */ - start: function (easing, forceAnimate) { - var self = this; - var clipCount = 0; - - var oneTrackDone = function () { - clipCount--; - - if (!clipCount) { - self._doneCallback(); - } - }; - - var lastClip; - - for (var propName in this._tracks) { - if (!this._tracks.hasOwnProperty(propName)) { - continue; - } - - var clip = createTrackClip(this, easing, oneTrackDone, this._tracks[propName], propName, forceAnimate); - - if (clip) { - this._clipList.push(clip); - - clipCount++; // If start after added to animation - - if (this.animation) { - this.animation.addClip(clip); - } - - lastClip = clip; - } - } // Add during callback on the last clip - - - if (lastClip) { - var oldOnFrame = lastClip.onframe; - - lastClip.onframe = function (target, percent) { - oldOnFrame(target, percent); - - for (var i = 0; i < self._onframeList.length; i++) { - self._onframeList[i](target, percent); - } - }; - } // This optimization will help the case that in the upper application - // the view may be refreshed frequently, where animation will be - // called repeatly but nothing changed. - - - if (!clipCount) { - this._doneCallback(); - } - - return this; - }, - - /** - * 停止动画 - * @param {boolean} forwardToLast If move to last frame before stop - */ - stop: function (forwardToLast) { - var clipList = this._clipList; - var animation = this.animation; - - for (var i = 0; i < clipList.length; i++) { - var clip = clipList[i]; - - if (forwardToLast) { - // Move to last frame before stop - clip.onframe(this._target, 1); - } - - animation && animation.removeClip(clip); - } - - clipList.length = 0; - }, - - /** - * 设置动画延迟开始的时间 - * @param {number} time 单位ms - * @return {module:zrender/animation/Animator} - */ - delay: function (time) { - this._delay = time; - return this; - }, - - /** - * 添加动画结束的回调 - * @param {Function} cb - * @return {module:zrender/animation/Animator} - */ - done: function (cb) { - if (cb) { - this._doneList.push(cb); - } - - return this; - }, - - /** - * @return {Array.} - */ - getClips: function () { - return this._clipList; - } -}; -var _default = Animator; -module.exports = _default; - -/***/ }), -/* 143 */ -/***/ (function(module, exports, __webpack_require__) { - -var easingFuncs = __webpack_require__(144); - -/** - * 动画主控制器 - * @config target 动画对象,可以是数组,如果是数组的话会批量分发onframe等事件 - * @config life(1000) 动画时长 - * @config delay(0) 动画延迟时间 - * @config loop(true) - * @config gap(0) 循环的间隔时间 - * @config onframe - * @config easing(optional) - * @config ondestroy(optional) - * @config onrestart(optional) - * - * TODO pause - */ -function Clip(options) { - this._target = options.target; // 生命周期 - - this._life = options.life || 1000; // 延时 - - this._delay = options.delay || 0; // 开始时间 - // this._startTime = new Date().getTime() + this._delay;// 单位毫秒 - - this._initialized = false; // 是否循环 - - this.loop = options.loop == null ? false : options.loop; - this.gap = options.gap || 0; - this.easing = options.easing || 'Linear'; - this.onframe = options.onframe; - this.ondestroy = options.ondestroy; - this.onrestart = options.onrestart; - this._pausedTime = 0; - this._paused = false; -} - -Clip.prototype = { - constructor: Clip, - step: function (globalTime, deltaTime) { - // Set startTime on first step, or _startTime may has milleseconds different between clips - // PENDING - if (!this._initialized) { - this._startTime = globalTime + this._delay; - this._initialized = true; - } - - if (this._paused) { - this._pausedTime += deltaTime; - return; - } - - var percent = (globalTime - this._startTime - this._pausedTime) / this._life; // 还没开始 - - if (percent < 0) { - return; - } - - percent = Math.min(percent, 1); - var easing = this.easing; - var easingFunc = typeof easing == 'string' ? easingFuncs[easing] : easing; - var schedule = typeof easingFunc === 'function' ? easingFunc(percent) : percent; - this.fire('frame', schedule); // 结束 - - if (percent == 1) { - if (this.loop) { - this.restart(globalTime); // 重新开始周期 - // 抛出而不是直接调用事件直到 stage.update 后再统一调用这些事件 - - return 'restart'; - } // 动画完成将这个控制器标识为待删除 - // 在Animation.update中进行批量删除 - - - this._needsRemove = true; - return 'destroy'; - } - - return null; - }, - restart: function (globalTime) { - var remainder = (globalTime - this._startTime - this._pausedTime) % this._life; - this._startTime = globalTime - remainder + this.gap; - this._pausedTime = 0; - this._needsRemove = false; - }, - fire: function (eventType, arg) { - eventType = 'on' + eventType; - - if (this[eventType]) { - this[eventType](this._target, arg); - } - }, - pause: function () { - this._paused = true; - }, - resume: function () { - this._paused = false; - } -}; -var _default = Clip; -module.exports = _default; - -/***/ }), -/* 144 */ -/***/ (function(module, exports) { - -/** - * 缓动代码来自 https://github.com/sole/tween.js/blob/master/src/Tween.js - * @see http://sole.github.io/tween.js/examples/03_graphs.html - * @exports zrender/animation/easing - */ -var easing = { - /** - * @param {number} k - * @return {number} - */ - linear: function (k) { - return k; - }, - - /** - * @param {number} k - * @return {number} - */ - quadraticIn: function (k) { - return k * k; - }, - - /** - * @param {number} k - * @return {number} - */ - quadraticOut: function (k) { - return k * (2 - k); - }, - - /** - * @param {number} k - * @return {number} - */ - quadraticInOut: function (k) { - if ((k *= 2) < 1) { - return 0.5 * k * k; - } - - return -0.5 * (--k * (k - 2) - 1); - }, - // 三次方的缓动(t^3) - - /** - * @param {number} k - * @return {number} - */ - cubicIn: function (k) { - return k * k * k; - }, - - /** - * @param {number} k - * @return {number} - */ - cubicOut: function (k) { - return --k * k * k + 1; - }, - - /** - * @param {number} k - * @return {number} - */ - cubicInOut: function (k) { - if ((k *= 2) < 1) { - return 0.5 * k * k * k; - } - - return 0.5 * ((k -= 2) * k * k + 2); - }, - // 四次方的缓动(t^4) - - /** - * @param {number} k - * @return {number} - */ - quarticIn: function (k) { - return k * k * k * k; - }, - - /** - * @param {number} k - * @return {number} - */ - quarticOut: function (k) { - return 1 - --k * k * k * k; - }, - - /** - * @param {number} k - * @return {number} - */ - quarticInOut: function (k) { - if ((k *= 2) < 1) { - return 0.5 * k * k * k * k; - } - - return -0.5 * ((k -= 2) * k * k * k - 2); - }, - // 五次方的缓动(t^5) - - /** - * @param {number} k - * @return {number} - */ - quinticIn: function (k) { - return k * k * k * k * k; - }, - - /** - * @param {number} k - * @return {number} - */ - quinticOut: function (k) { - return --k * k * k * k * k + 1; - }, - - /** - * @param {number} k - * @return {number} - */ - quinticInOut: function (k) { - if ((k *= 2) < 1) { - return 0.5 * k * k * k * k * k; - } - - return 0.5 * ((k -= 2) * k * k * k * k + 2); - }, - // 正弦曲线的缓动(sin(t)) - - /** - * @param {number} k - * @return {number} - */ - sinusoidalIn: function (k) { - return 1 - Math.cos(k * Math.PI / 2); - }, - - /** - * @param {number} k - * @return {number} - */ - sinusoidalOut: function (k) { - return Math.sin(k * Math.PI / 2); - }, - - /** - * @param {number} k - * @return {number} - */ - sinusoidalInOut: function (k) { - return 0.5 * (1 - Math.cos(Math.PI * k)); - }, - // 指数曲线的缓动(2^t) - - /** - * @param {number} k - * @return {number} - */ - exponentialIn: function (k) { - return k === 0 ? 0 : Math.pow(1024, k - 1); - }, - - /** - * @param {number} k - * @return {number} - */ - exponentialOut: function (k) { - return k === 1 ? 1 : 1 - Math.pow(2, -10 * k); - }, - - /** - * @param {number} k - * @return {number} - */ - exponentialInOut: function (k) { - if (k === 0) { - return 0; - } - - if (k === 1) { - return 1; - } - - if ((k *= 2) < 1) { - return 0.5 * Math.pow(1024, k - 1); - } - - return 0.5 * (-Math.pow(2, -10 * (k - 1)) + 2); - }, - // 圆形曲线的缓动(sqrt(1-t^2)) - - /** - * @param {number} k - * @return {number} - */ - circularIn: function (k) { - return 1 - Math.sqrt(1 - k * k); - }, - - /** - * @param {number} k - * @return {number} - */ - circularOut: function (k) { - return Math.sqrt(1 - --k * k); - }, - - /** - * @param {number} k - * @return {number} - */ - circularInOut: function (k) { - if ((k *= 2) < 1) { - return -0.5 * (Math.sqrt(1 - k * k) - 1); - } - - return 0.5 * (Math.sqrt(1 - (k -= 2) * k) + 1); - }, - // 创建类似于弹簧在停止前来回振荡的动画 - - /** - * @param {number} k - * @return {number} - */ - elasticIn: function (k) { - var s; - var a = 0.1; - var p = 0.4; - - if (k === 0) { - return 0; - } - - if (k === 1) { - return 1; - } - - if (!a || a < 1) { - a = 1; - s = p / 4; - } else { - s = p * Math.asin(1 / a) / (2 * Math.PI); - } - - return -(a * Math.pow(2, 10 * (k -= 1)) * Math.sin((k - s) * (2 * Math.PI) / p)); - }, - - /** - * @param {number} k - * @return {number} - */ - elasticOut: function (k) { - var s; - var a = 0.1; - var p = 0.4; - - if (k === 0) { - return 0; - } - - if (k === 1) { - return 1; - } - - if (!a || a < 1) { - a = 1; - s = p / 4; - } else { - s = p * Math.asin(1 / a) / (2 * Math.PI); - } - - return a * Math.pow(2, -10 * k) * Math.sin((k - s) * (2 * Math.PI) / p) + 1; - }, - - /** - * @param {number} k - * @return {number} - */ - elasticInOut: function (k) { - var s; - var a = 0.1; - var p = 0.4; - - if (k === 0) { - return 0; - } - - if (k === 1) { - return 1; - } - - if (!a || a < 1) { - a = 1; - s = p / 4; - } else { - s = p * Math.asin(1 / a) / (2 * Math.PI); - } - - if ((k *= 2) < 1) { - return -0.5 * (a * Math.pow(2, 10 * (k -= 1)) * Math.sin((k - s) * (2 * Math.PI) / p)); - } - - return a * Math.pow(2, -10 * (k -= 1)) * Math.sin((k - s) * (2 * Math.PI) / p) * 0.5 + 1; - }, - // 在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动 - - /** - * @param {number} k - * @return {number} - */ - backIn: function (k) { - var s = 1.70158; - return k * k * ((s + 1) * k - s); - }, - - /** - * @param {number} k - * @return {number} - */ - backOut: function (k) { - var s = 1.70158; - return --k * k * ((s + 1) * k + s) + 1; - }, - - /** - * @param {number} k - * @return {number} - */ - backInOut: function (k) { - var s = 1.70158 * 1.525; - - if ((k *= 2) < 1) { - return 0.5 * (k * k * ((s + 1) * k - s)); - } - - return 0.5 * ((k -= 2) * k * ((s + 1) * k + s) + 2); - }, - // 创建弹跳效果 - - /** - * @param {number} k - * @return {number} - */ - bounceIn: function (k) { - return 1 - easing.bounceOut(1 - k); - }, - - /** - * @param {number} k - * @return {number} - */ - bounceOut: function (k) { - if (k < 1 / 2.75) { - return 7.5625 * k * k; - } else if (k < 2 / 2.75) { - return 7.5625 * (k -= 1.5 / 2.75) * k + 0.75; - } else if (k < 2.5 / 2.75) { - return 7.5625 * (k -= 2.25 / 2.75) * k + 0.9375; - } else { - return 7.5625 * (k -= 2.625 / 2.75) * k + 0.984375; - } - }, - - /** - * @param {number} k - * @return {number} - */ - bounceInOut: function (k) { - if (k < 0.5) { - return easing.bounceIn(k * 2) * 0.5; - } - - return easing.bounceOut(k * 2 - 1) * 0.5 + 0.5; - } -}; -var _default = easing; -module.exports = _default; - -/***/ }), -/* 145 */ -/***/ (function(module, exports, __webpack_require__) { - -var LRU = __webpack_require__(60); - -var kCSSColorTable = { - 'transparent': [0, 0, 0, 0], - 'aliceblue': [240, 248, 255, 1], - 'antiquewhite': [250, 235, 215, 1], - 'aqua': [0, 255, 255, 1], - 'aquamarine': [127, 255, 212, 1], - 'azure': [240, 255, 255, 1], - 'beige': [245, 245, 220, 1], - 'bisque': [255, 228, 196, 1], - 'black': [0, 0, 0, 1], - 'blanchedalmond': [255, 235, 205, 1], - 'blue': [0, 0, 255, 1], - 'blueviolet': [138, 43, 226, 1], - 'brown': [165, 42, 42, 1], - 'burlywood': [222, 184, 135, 1], - 'cadetblue': [95, 158, 160, 1], - 'chartreuse': [127, 255, 0, 1], - 'chocolate': [210, 105, 30, 1], - 'coral': [255, 127, 80, 1], - 'cornflowerblue': [100, 149, 237, 1], - 'cornsilk': [255, 248, 220, 1], - 'crimson': [220, 20, 60, 1], - 'cyan': [0, 255, 255, 1], - 'darkblue': [0, 0, 139, 1], - 'darkcyan': [0, 139, 139, 1], - 'darkgoldenrod': [184, 134, 11, 1], - 'darkgray': [169, 169, 169, 1], - 'darkgreen': [0, 100, 0, 1], - 'darkgrey': [169, 169, 169, 1], - 'darkkhaki': [189, 183, 107, 1], - 'darkmagenta': [139, 0, 139, 1], - 'darkolivegreen': [85, 107, 47, 1], - 'darkorange': [255, 140, 0, 1], - 'darkorchid': [153, 50, 204, 1], - 'darkred': [139, 0, 0, 1], - 'darksalmon': [233, 150, 122, 1], - 'darkseagreen': [143, 188, 143, 1], - 'darkslateblue': [72, 61, 139, 1], - 'darkslategray': [47, 79, 79, 1], - 'darkslategrey': [47, 79, 79, 1], - 'darkturquoise': [0, 206, 209, 1], - 'darkviolet': [148, 0, 211, 1], - 'deeppink': [255, 20, 147, 1], - 'deepskyblue': [0, 191, 255, 1], - 'dimgray': [105, 105, 105, 1], - 'dimgrey': [105, 105, 105, 1], - 'dodgerblue': [30, 144, 255, 1], - 'firebrick': [178, 34, 34, 1], - 'floralwhite': [255, 250, 240, 1], - 'forestgreen': [34, 139, 34, 1], - 'fuchsia': [255, 0, 255, 1], - 'gainsboro': [220, 220, 220, 1], - 'ghostwhite': [248, 248, 255, 1], - 'gold': [255, 215, 0, 1], - 'goldenrod': [218, 165, 32, 1], - 'gray': [128, 128, 128, 1], - 'green': [0, 128, 0, 1], - 'greenyellow': [173, 255, 47, 1], - 'grey': [128, 128, 128, 1], - 'honeydew': [240, 255, 240, 1], - 'hotpink': [255, 105, 180, 1], - 'indianred': [205, 92, 92, 1], - 'indigo': [75, 0, 130, 1], - 'ivory': [255, 255, 240, 1], - 'khaki': [240, 230, 140, 1], - 'lavender': [230, 230, 250, 1], - 'lavenderblush': [255, 240, 245, 1], - 'lawngreen': [124, 252, 0, 1], - 'lemonchiffon': [255, 250, 205, 1], - 'lightblue': [173, 216, 230, 1], - 'lightcoral': [240, 128, 128, 1], - 'lightcyan': [224, 255, 255, 1], - 'lightgoldenrodyellow': [250, 250, 210, 1], - 'lightgray': [211, 211, 211, 1], - 'lightgreen': [144, 238, 144, 1], - 'lightgrey': [211, 211, 211, 1], - 'lightpink': [255, 182, 193, 1], - 'lightsalmon': [255, 160, 122, 1], - 'lightseagreen': [32, 178, 170, 1], - 'lightskyblue': [135, 206, 250, 1], - 'lightslategray': [119, 136, 153, 1], - 'lightslategrey': [119, 136, 153, 1], - 'lightsteelblue': [176, 196, 222, 1], - 'lightyellow': [255, 255, 224, 1], - 'lime': [0, 255, 0, 1], - 'limegreen': [50, 205, 50, 1], - 'linen': [250, 240, 230, 1], - 'magenta': [255, 0, 255, 1], - 'maroon': [128, 0, 0, 1], - 'mediumaquamarine': [102, 205, 170, 1], - 'mediumblue': [0, 0, 205, 1], - 'mediumorchid': [186, 85, 211, 1], - 'mediumpurple': [147, 112, 219, 1], - 'mediumseagreen': [60, 179, 113, 1], - 'mediumslateblue': [123, 104, 238, 1], - 'mediumspringgreen': [0, 250, 154, 1], - 'mediumturquoise': [72, 209, 204, 1], - 'mediumvioletred': [199, 21, 133, 1], - 'midnightblue': [25, 25, 112, 1], - 'mintcream': [245, 255, 250, 1], - 'mistyrose': [255, 228, 225, 1], - 'moccasin': [255, 228, 181, 1], - 'navajowhite': [255, 222, 173, 1], - 'navy': [0, 0, 128, 1], - 'oldlace': [253, 245, 230, 1], - 'olive': [128, 128, 0, 1], - 'olivedrab': [107, 142, 35, 1], - 'orange': [255, 165, 0, 1], - 'orangered': [255, 69, 0, 1], - 'orchid': [218, 112, 214, 1], - 'palegoldenrod': [238, 232, 170, 1], - 'palegreen': [152, 251, 152, 1], - 'paleturquoise': [175, 238, 238, 1], - 'palevioletred': [219, 112, 147, 1], - 'papayawhip': [255, 239, 213, 1], - 'peachpuff': [255, 218, 185, 1], - 'peru': [205, 133, 63, 1], - 'pink': [255, 192, 203, 1], - 'plum': [221, 160, 221, 1], - 'powderblue': [176, 224, 230, 1], - 'purple': [128, 0, 128, 1], - 'red': [255, 0, 0, 1], - 'rosybrown': [188, 143, 143, 1], - 'royalblue': [65, 105, 225, 1], - 'saddlebrown': [139, 69, 19, 1], - 'salmon': [250, 128, 114, 1], - 'sandybrown': [244, 164, 96, 1], - 'seagreen': [46, 139, 87, 1], - 'seashell': [255, 245, 238, 1], - 'sienna': [160, 82, 45, 1], - 'silver': [192, 192, 192, 1], - 'skyblue': [135, 206, 235, 1], - 'slateblue': [106, 90, 205, 1], - 'slategray': [112, 128, 144, 1], - 'slategrey': [112, 128, 144, 1], - 'snow': [255, 250, 250, 1], - 'springgreen': [0, 255, 127, 1], - 'steelblue': [70, 130, 180, 1], - 'tan': [210, 180, 140, 1], - 'teal': [0, 128, 128, 1], - 'thistle': [216, 191, 216, 1], - 'tomato': [255, 99, 71, 1], - 'turquoise': [64, 224, 208, 1], - 'violet': [238, 130, 238, 1], - 'wheat': [245, 222, 179, 1], - 'white': [255, 255, 255, 1], - 'whitesmoke': [245, 245, 245, 1], - 'yellow': [255, 255, 0, 1], - 'yellowgreen': [154, 205, 50, 1] -}; - -function clampCssByte(i) { - // Clamp to integer 0 .. 255. - i = Math.round(i); // Seems to be what Chrome does (vs truncation). - - return i < 0 ? 0 : i > 255 ? 255 : i; -} - -function clampCssAngle(i) { - // Clamp to integer 0 .. 360. - i = Math.round(i); // Seems to be what Chrome does (vs truncation). - - return i < 0 ? 0 : i > 360 ? 360 : i; -} - -function clampCssFloat(f) { - // Clamp to float 0.0 .. 1.0. - return f < 0 ? 0 : f > 1 ? 1 : f; -} - -function parseCssInt(str) { - // int or percentage. - if (str.length && str.charAt(str.length - 1) === '%') { - return clampCssByte(parseFloat(str) / 100 * 255); - } - - return clampCssByte(parseInt(str, 10)); -} - -function parseCssFloat(str) { - // float or percentage. - if (str.length && str.charAt(str.length - 1) === '%') { - return clampCssFloat(parseFloat(str) / 100); - } - - return clampCssFloat(parseFloat(str)); -} - -function cssHueToRgb(m1, m2, h) { - if (h < 0) { - h += 1; - } else if (h > 1) { - h -= 1; - } - - if (h * 6 < 1) { - return m1 + (m2 - m1) * h * 6; - } - - if (h * 2 < 1) { - return m2; - } - - if (h * 3 < 2) { - return m1 + (m2 - m1) * (2 / 3 - h) * 6; - } - - return m1; -} - -function lerpNumber(a, b, p) { - return a + (b - a) * p; -} - -function setRgba(out, r, g, b, a) { - out[0] = r; - out[1] = g; - out[2] = b; - out[3] = a; - return out; -} - -function copyRgba(out, a) { - out[0] = a[0]; - out[1] = a[1]; - out[2] = a[2]; - out[3] = a[3]; - return out; -} - -var colorCache = new LRU(20); -var lastRemovedArr = null; - -function putToCache(colorStr, rgbaArr) { - // Reuse removed array - if (lastRemovedArr) { - copyRgba(lastRemovedArr, rgbaArr); - } - - lastRemovedArr = colorCache.put(colorStr, lastRemovedArr || rgbaArr.slice()); -} -/** - * @param {string} colorStr - * @param {Array.} out - * @return {Array.} - * @memberOf module:zrender/util/color - */ - - -function parse(colorStr, rgbaArr) { - if (!colorStr) { - return; - } - - rgbaArr = rgbaArr || []; - var cached = colorCache.get(colorStr); - - if (cached) { - return copyRgba(rgbaArr, cached); - } // colorStr may be not string - - - colorStr = colorStr + ''; // Remove all whitespace, not compliant, but should just be more accepting. - - var str = colorStr.replace(/ /g, '').toLowerCase(); // Color keywords (and transparent) lookup. - - if (str in kCSSColorTable) { - copyRgba(rgbaArr, kCSSColorTable[str]); - putToCache(colorStr, rgbaArr); - return rgbaArr; - } // #abc and #abc123 syntax. - - - if (str.charAt(0) === '#') { - if (str.length === 4) { - var iv = parseInt(str.substr(1), 16); // TODO(deanm): Stricter parsing. - - if (!(iv >= 0 && iv <= 0xfff)) { - setRgba(rgbaArr, 0, 0, 0, 1); - return; // Covers NaN. - } - - setRgba(rgbaArr, (iv & 0xf00) >> 4 | (iv & 0xf00) >> 8, iv & 0xf0 | (iv & 0xf0) >> 4, iv & 0xf | (iv & 0xf) << 4, 1); - putToCache(colorStr, rgbaArr); - return rgbaArr; - } else if (str.length === 7) { - var iv = parseInt(str.substr(1), 16); // TODO(deanm): Stricter parsing. - - if (!(iv >= 0 && iv <= 0xffffff)) { - setRgba(rgbaArr, 0, 0, 0, 1); - return; // Covers NaN. - } - - setRgba(rgbaArr, (iv & 0xff0000) >> 16, (iv & 0xff00) >> 8, iv & 0xff, 1); - putToCache(colorStr, rgbaArr); - return rgbaArr; - } - - return; - } - - var op = str.indexOf('('), - ep = str.indexOf(')'); - - if (op !== -1 && ep + 1 === str.length) { - var fname = str.substr(0, op); - var params = str.substr(op + 1, ep - (op + 1)).split(','); - var alpha = 1; // To allow case fallthrough. - - switch (fname) { - case 'rgba': - if (params.length !== 4) { - setRgba(rgbaArr, 0, 0, 0, 1); - return; - } - - alpha = parseCssFloat(params.pop()); - // jshint ignore:line - // Fall through. - - case 'rgb': - if (params.length !== 3) { - setRgba(rgbaArr, 0, 0, 0, 1); - return; - } - - setRgba(rgbaArr, parseCssInt(params[0]), parseCssInt(params[1]), parseCssInt(params[2]), alpha); - putToCache(colorStr, rgbaArr); - return rgbaArr; - - case 'hsla': - if (params.length !== 4) { - setRgba(rgbaArr, 0, 0, 0, 1); - return; - } - - params[3] = parseCssFloat(params[3]); - hsla2rgba(params, rgbaArr); - putToCache(colorStr, rgbaArr); - return rgbaArr; - - case 'hsl': - if (params.length !== 3) { - setRgba(rgbaArr, 0, 0, 0, 1); - return; - } - - hsla2rgba(params, rgbaArr); - putToCache(colorStr, rgbaArr); - return rgbaArr; - - default: - return; - } - } - - setRgba(rgbaArr, 0, 0, 0, 1); - return; -} -/** - * @param {Array.} hsla - * @param {Array.} rgba - * @return {Array.} rgba - */ - - -function hsla2rgba(hsla, rgba) { - var h = (parseFloat(hsla[0]) % 360 + 360) % 360 / 360; // 0 .. 1 - // NOTE(deanm): According to the CSS spec s/l should only be - // percentages, but we don't bother and let float or percentage. - - var s = parseCssFloat(hsla[1]); - var l = parseCssFloat(hsla[2]); - var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s; - var m1 = l * 2 - m2; - rgba = rgba || []; - setRgba(rgba, clampCssByte(cssHueToRgb(m1, m2, h + 1 / 3) * 255), clampCssByte(cssHueToRgb(m1, m2, h) * 255), clampCssByte(cssHueToRgb(m1, m2, h - 1 / 3) * 255), 1); - - if (hsla.length === 4) { - rgba[3] = hsla[3]; - } - - return rgba; -} -/** - * @param {Array.} rgba - * @return {Array.} hsla - */ - - -function rgba2hsla(rgba) { - if (!rgba) { - return; - } // RGB from 0 to 255 - - - var R = rgba[0] / 255; - var G = rgba[1] / 255; - var B = rgba[2] / 255; - var vMin = Math.min(R, G, B); // Min. value of RGB - - var vMax = Math.max(R, G, B); // Max. value of RGB - - var delta = vMax - vMin; // Delta RGB value - - var L = (vMax + vMin) / 2; - var H; - var S; // HSL results from 0 to 1 - - if (delta === 0) { - H = 0; - S = 0; - } else { - if (L < 0.5) { - S = delta / (vMax + vMin); - } else { - S = delta / (2 - vMax - vMin); - } - - var deltaR = ((vMax - R) / 6 + delta / 2) / delta; - var deltaG = ((vMax - G) / 6 + delta / 2) / delta; - var deltaB = ((vMax - B) / 6 + delta / 2) / delta; - - if (R === vMax) { - H = deltaB - deltaG; - } else if (G === vMax) { - H = 1 / 3 + deltaR - deltaB; - } else if (B === vMax) { - H = 2 / 3 + deltaG - deltaR; - } - - if (H < 0) { - H += 1; - } - - if (H > 1) { - H -= 1; - } - } - - var hsla = [H * 360, S, L]; - - if (rgba[3] != null) { - hsla.push(rgba[3]); - } - - return hsla; -} -/** - * @param {string} color - * @param {number} level - * @return {string} - * @memberOf module:zrender/util/color - */ - - -function lift(color, level) { - var colorArr = parse(color); - - if (colorArr) { - for (var i = 0; i < 3; i++) { - if (level < 0) { - colorArr[i] = colorArr[i] * (1 - level) | 0; - } else { - colorArr[i] = (255 - colorArr[i]) * level + colorArr[i] | 0; - } - - if (colorArr[i] > 255) { - colorArr[i] = 255; - } else if (color[i] < 0) { - colorArr[i] = 0; - } - } - - return stringify(colorArr, colorArr.length === 4 ? 'rgba' : 'rgb'); - } -} -/** - * @param {string} color - * @return {string} - * @memberOf module:zrender/util/color - */ - - -function toHex(color) { - var colorArr = parse(color); - - if (colorArr) { - return ((1 << 24) + (colorArr[0] << 16) + (colorArr[1] << 8) + +colorArr[2]).toString(16).slice(1); - } -} -/** - * Map value to color. Faster than lerp methods because color is represented by rgba array. - * @param {number} normalizedValue A float between 0 and 1. - * @param {Array.>} colors List of rgba color array - * @param {Array.} [out] Mapped gba color array - * @return {Array.} will be null/undefined if input illegal. - */ - - -function fastLerp(normalizedValue, colors, out) { - if (!(colors && colors.length) || !(normalizedValue >= 0 && normalizedValue <= 1)) { - return; - } - - out = out || []; - var value = normalizedValue * (colors.length - 1); - var leftIndex = Math.floor(value); - var rightIndex = Math.ceil(value); - var leftColor = colors[leftIndex]; - var rightColor = colors[rightIndex]; - var dv = value - leftIndex; - out[0] = clampCssByte(lerpNumber(leftColor[0], rightColor[0], dv)); - out[1] = clampCssByte(lerpNumber(leftColor[1], rightColor[1], dv)); - out[2] = clampCssByte(lerpNumber(leftColor[2], rightColor[2], dv)); - out[3] = clampCssFloat(lerpNumber(leftColor[3], rightColor[3], dv)); - return out; -} -/** - * @deprecated - */ - - -var fastMapToColor = fastLerp; -/** - * @param {number} normalizedValue A float between 0 and 1. - * @param {Array.} colors Color list. - * @param {boolean=} fullOutput Default false. - * @return {(string|Object)} Result color. If fullOutput, - * return {color: ..., leftIndex: ..., rightIndex: ..., value: ...}, - * @memberOf module:zrender/util/color - */ - -function lerp(normalizedValue, colors, fullOutput) { - if (!(colors && colors.length) || !(normalizedValue >= 0 && normalizedValue <= 1)) { - return; - } - - var value = normalizedValue * (colors.length - 1); - var leftIndex = Math.floor(value); - var rightIndex = Math.ceil(value); - var leftColor = parse(colors[leftIndex]); - var rightColor = parse(colors[rightIndex]); - var dv = value - leftIndex; - var color = stringify([clampCssByte(lerpNumber(leftColor[0], rightColor[0], dv)), clampCssByte(lerpNumber(leftColor[1], rightColor[1], dv)), clampCssByte(lerpNumber(leftColor[2], rightColor[2], dv)), clampCssFloat(lerpNumber(leftColor[3], rightColor[3], dv))], 'rgba'); - return fullOutput ? { - color: color, - leftIndex: leftIndex, - rightIndex: rightIndex, - value: value - } : color; -} -/** - * @deprecated - */ - - -var mapToColor = lerp; -/** - * @param {string} color - * @param {number=} h 0 ~ 360, ignore when null. - * @param {number=} s 0 ~ 1, ignore when null. - * @param {number=} l 0 ~ 1, ignore when null. - * @return {string} Color string in rgba format. - * @memberOf module:zrender/util/color - */ - -function modifyHSL(color, h, s, l) { - color = parse(color); - - if (color) { - color = rgba2hsla(color); - h != null && (color[0] = clampCssAngle(h)); - s != null && (color[1] = parseCssFloat(s)); - l != null && (color[2] = parseCssFloat(l)); - return stringify(hsla2rgba(color), 'rgba'); - } -} -/** - * @param {string} color - * @param {number=} alpha 0 ~ 1 - * @return {string} Color string in rgba format. - * @memberOf module:zrender/util/color - */ - - -function modifyAlpha(color, alpha) { - color = parse(color); - - if (color && alpha != null) { - color[3] = clampCssFloat(alpha); - return stringify(color, 'rgba'); - } -} -/** - * @param {Array.} arrColor like [12,33,44,0.4] - * @param {string} type 'rgba', 'hsva', ... - * @return {string} Result color. (If input illegal, return undefined). - */ - - -function stringify(arrColor, type) { - if (!arrColor || !arrColor.length) { - return; - } - - var colorStr = arrColor[0] + ',' + arrColor[1] + ',' + arrColor[2]; - - if (type === 'rgba' || type === 'hsva' || type === 'hsla') { - colorStr += ',' + arrColor[3]; - } - - return type + '(' + colorStr + ')'; -} - -exports.parse = parse; -exports.lift = lift; -exports.toHex = toHex; -exports.fastLerp = fastLerp; -exports.fastMapToColor = fastMapToColor; -exports.lerp = lerp; -exports.mapToColor = mapToColor; -exports.modifyHSL = modifyHSL; -exports.modifyAlpha = modifyAlpha; -exports.stringify = stringify; - -/***/ }), -/* 146 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("\n@export clay.util.rand\nhighp float rand(vec2 uv) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot(uv.xy, vec2(a,b)), sn = mod(dt, 3.141592653589793);\n return fract(sin(sn) * c);\n}\n@end\n@export clay.util.calculate_attenuation\nuniform float attenuationFactor : 5.0;\nfloat lightAttenuation(float dist, float range)\n{\n float attenuation = 1.0;\n attenuation = dist*dist/(range*range+1.0);\n float att_s = attenuationFactor;\n attenuation = 1.0/(attenuation*att_s+1.0);\n att_s = 1.0/(att_s+1.0);\n attenuation = attenuation - att_s;\n attenuation /= 1.0 - att_s;\n return clamp(attenuation, 0.0, 1.0);\n}\n@end\n@export clay.util.edge_factor\n#ifdef SUPPORT_STANDARD_DERIVATIVES\nfloat edgeFactor(float width)\n{\n vec3 d = fwidth(v_Barycentric);\n vec3 a3 = smoothstep(vec3(0.0), d * width, v_Barycentric);\n return min(min(a3.x, a3.y), a3.z);\n}\n#else\nfloat edgeFactor(float width)\n{\n return 1.0;\n}\n#endif\n@end\n@export clay.util.encode_float\nvec4 encodeFloat(const in float depth)\n{\n const vec4 bitShifts = vec4(256.0*256.0*256.0, 256.0*256.0, 256.0, 1.0);\n const vec4 bit_mask = vec4(0.0, 1.0/256.0, 1.0/256.0, 1.0/256.0);\n vec4 res = fract(depth * bitShifts);\n res -= res.xxyz * bit_mask;\n return res;\n}\n@end\n@export clay.util.decode_float\nfloat decodeFloat(const in vec4 color)\n{\n const vec4 bitShifts = vec4(1.0/(256.0*256.0*256.0), 1.0/(256.0*256.0), 1.0/256.0, 1.0);\n return dot(color, bitShifts);\n}\n@end\n@export clay.util.float\n@import clay.util.encode_float\n@import clay.util.decode_float\n@end\n@export clay.util.rgbm_decode\nvec3 RGBMDecode(vec4 rgbm, float range) {\n return range * rgbm.rgb * rgbm.a;\n}\n@end\n@export clay.util.rgbm_encode\nvec4 RGBMEncode(vec3 color, float range) {\n if (dot(color, color) == 0.0) {\n return vec4(0.0);\n }\n vec4 rgbm;\n color /= range;\n rgbm.a = clamp(max(max(color.r, color.g), max(color.b, 1e-6)), 0.0, 1.0);\n rgbm.a = ceil(rgbm.a * 255.0) / 255.0;\n rgbm.rgb = color / rgbm.a;\n return rgbm;\n}\n@end\n@export clay.util.rgbm\n@import clay.util.rgbm_decode\n@import clay.util.rgbm_encode\nvec4 decodeHDR(vec4 color)\n{\n#if defined(RGBM_DECODE) || defined(RGBM)\n return vec4(RGBMDecode(color, 8.12), 1.0);\n#else\n return color;\n#endif\n}\nvec4 encodeHDR(vec4 color)\n{\n#if defined(RGBM_ENCODE) || defined(RGBM)\n return RGBMEncode(color.xyz, 8.12);\n#else\n return color;\n#endif\n}\n@end\n@export clay.util.srgb\nvec4 sRGBToLinear(in vec4 value) {\n return vec4(mix(pow(value.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)), value.rgb * 0.0773993808, vec3(lessThanEqual(value.rgb, vec3(0.04045)))), value.w);\n}\nvec4 linearTosRGB(in vec4 value) {\n return vec4(mix(pow(value.rgb, vec3(0.41666)) * 1.055 - vec3(0.055), value.rgb * 12.92, vec3(lessThanEqual(value.rgb, vec3(0.0031308)))), value.w);\n}\n@end\n@export clay.chunk.skinning_header\n#ifdef SKINNING\nattribute vec3 weight : WEIGHT;\nattribute vec4 joint : JOINT;\n#ifdef USE_SKIN_MATRICES_TEXTURE\nuniform sampler2D skinMatricesTexture : ignore;\nuniform float skinMatricesTextureSize: ignore;\nmat4 getSkinMatrix(sampler2D tex, float idx) {\n float j = idx * 4.0;\n float x = mod(j, skinMatricesTextureSize);\n float y = floor(j / skinMatricesTextureSize) + 0.5;\n vec2 scale = vec2(skinMatricesTextureSize);\n return mat4(\n texture2D(tex, vec2(x + 0.5, y) / scale),\n texture2D(tex, vec2(x + 1.5, y) / scale),\n texture2D(tex, vec2(x + 2.5, y) / scale),\n texture2D(tex, vec2(x + 3.5, y) / scale)\n );\n}\nmat4 getSkinMatrix(float idx) {\n return getSkinMatrix(skinMatricesTexture, idx);\n}\n#else\nuniform mat4 skinMatrix[JOINT_COUNT] : SKIN_MATRIX;\nmat4 getSkinMatrix(float idx) {\n return skinMatrix[int(idx)];\n}\n#endif\n#endif\n@end\n@export clay.chunk.skin_matrix\nmat4 skinMatrixWS = getSkinMatrix(joint.x) * weight.x;\nif (weight.y > 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.y) * weight.y;\n}\nif (weight.z > 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.z) * weight.z;\n}\nfloat weightW = 1.0-weight.x-weight.y-weight.z;\nif (weightW > 1e-4)\n{\n skinMatrixWS += getSkinMatrix(joint.w) * weightW;\n}\n@end\n@export clay.util.parallax_correct\nvec3 parallaxCorrect(in vec3 dir, in vec3 pos, in vec3 boxMin, in vec3 boxMax) {\n vec3 first = (boxMax - pos) / dir;\n vec3 second = (boxMin - pos) / dir;\n vec3 further = max(first, second);\n float dist = min(further.x, min(further.y, further.z));\n vec3 fixedPos = pos + dir * dist;\n vec3 boxCenter = (boxMax + boxMin) * 0.5;\n return normalize(fixedPos - boxCenter);\n}\n@end\n@export clay.util.clamp_sample\nvec4 clampSample(const in sampler2D texture, const in vec2 coord)\n{\n#ifdef STEREO\n float eye = step(0.5, coord.x) * 0.5;\n vec2 coordClamped = clamp(coord, vec2(eye, 0.0), vec2(0.5 + eye, 1.0));\n#else\n vec2 coordClamped = clamp(coord, vec2(0.0), vec2(1.0));\n#endif\n return texture2D(texture, coordClamped);\n}\n@end\n@export clay.util.ACES\nvec3 ACESToneMapping(vec3 color)\n{\n const float A = 2.51;\n const float B = 0.03;\n const float C = 2.43;\n const float D = 0.59;\n const float E = 0.14;\n return (color * (A * color + B)) / (color * (C * color + D) + E);\n}\n@end"); - - -/***/ }), -/* 147 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("\n@export ecgl.common.transformUniforms\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 worldInverseTranspose : WORLDINVERSETRANSPOSE;\nuniform mat4 world : WORLD;\n@end\n\n@export ecgl.common.attributes\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\nattribute vec3 normal : NORMAL;\n@end\n\n@export ecgl.common.uv.header\nuniform vec2 uvRepeat : [1.0, 1.0];\nuniform vec2 uvOffset : [0.0, 0.0];\nuniform vec2 detailUvRepeat : [1.0, 1.0];\nuniform vec2 detailUvOffset : [0.0, 0.0];\n\nvarying vec2 v_Texcoord;\nvarying vec2 v_DetailTexcoord;\n@end\n\n@export ecgl.common.uv.main\nv_Texcoord = texcoord * uvRepeat + uvOffset;\nv_DetailTexcoord = texcoord * detailUvRepeat + detailUvOffset;\n@end\n\n@export ecgl.common.uv.fragmentHeader\nvarying vec2 v_Texcoord;\nvarying vec2 v_DetailTexcoord;\n@end\n\n\n@export ecgl.common.albedo.main\n\n vec4 albedoTexel = vec4(1.0);\n#ifdef DIFFUSEMAP_ENABLED\n albedoTexel = texture2D(diffuseMap, v_Texcoord);\n #ifdef SRGB_DECODE\n albedoTexel = sRGBToLinear(albedoTexel);\n #endif\n#endif\n\n#ifdef DETAILMAP_ENABLED\n vec4 detailTexel = texture2D(detailMap, v_DetailTexcoord);\n #ifdef SRGB_DECODE\n detailTexel = sRGBToLinear(detailTexel);\n #endif\n albedoTexel.rgb = mix(albedoTexel.rgb, detailTexel.rgb, detailTexel.a);\n albedoTexel.a = detailTexel.a + (1.0 - detailTexel.a) * albedoTexel.a;\n#endif\n\n@end\n\n@export ecgl.common.wireframe.vertexHeader\n\n#ifdef WIREFRAME_QUAD\nattribute vec4 barycentric;\nvarying vec4 v_Barycentric;\n#elif defined(WIREFRAME_TRIANGLE)\nattribute vec3 barycentric;\nvarying vec3 v_Barycentric;\n#endif\n\n@end\n\n@export ecgl.common.wireframe.vertexMain\n\n#if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE)\n v_Barycentric = barycentric;\n#endif\n\n@end\n\n\n@export ecgl.common.wireframe.fragmentHeader\n\nuniform float wireframeLineWidth : 1;\nuniform vec4 wireframeLineColor: [0, 0, 0, 0.5];\n\n#ifdef WIREFRAME_QUAD\nvarying vec4 v_Barycentric;\nfloat edgeFactor () {\n vec4 d = fwidth(v_Barycentric);\n vec4 a4 = smoothstep(vec4(0.0), d * wireframeLineWidth, v_Barycentric);\n return min(min(min(a4.x, a4.y), a4.z), a4.w);\n}\n#elif defined(WIREFRAME_TRIANGLE)\nvarying vec3 v_Barycentric;\nfloat edgeFactor () {\n vec3 d = fwidth(v_Barycentric);\n vec3 a3 = smoothstep(vec3(0.0), d * wireframeLineWidth, v_Barycentric);\n return min(min(a3.x, a3.y), a3.z);\n}\n#endif\n\n@end\n\n\n@export ecgl.common.wireframe.fragmentMain\n\n#if defined(WIREFRAME_QUAD) || defined(WIREFRAME_TRIANGLE)\n if (wireframeLineWidth > 0.) {\n vec4 lineColor = wireframeLineColor;\n#ifdef SRGB_DECODE\n lineColor = sRGBToLinear(lineColor);\n#endif\n\n gl_FragColor.rgb = mix(gl_FragColor.rgb, lineColor.rgb, (1.0 - edgeFactor()) * lineColor.a);\n }\n#endif\n@end\n\n\n\n\n@export ecgl.common.bumpMap.header\n\n#ifdef BUMPMAP_ENABLED\nuniform sampler2D bumpMap;\nuniform float bumpScale : 1.0;\n\n\nvec3 bumpNormal(vec3 surfPos, vec3 surfNormal, vec3 baseNormal)\n{\n vec2 dSTdx = dFdx(v_Texcoord);\n vec2 dSTdy = dFdy(v_Texcoord);\n\n float Hll = bumpScale * texture2D(bumpMap, v_Texcoord).x;\n float dHx = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdx).x - Hll;\n float dHy = bumpScale * texture2D(bumpMap, v_Texcoord + dSTdy).x - Hll;\n\n vec3 vSigmaX = dFdx(surfPos);\n vec3 vSigmaY = dFdy(surfPos);\n vec3 vN = surfNormal;\n\n vec3 R1 = cross(vSigmaY, vN);\n vec3 R2 = cross(vN, vSigmaX);\n\n float fDet = dot(vSigmaX, R1);\n\n vec3 vGrad = sign(fDet) * (dHx * R1 + dHy * R2);\n return normalize(abs(fDet) * baseNormal - vGrad);\n\n}\n#endif\n\n@end\n\n@export ecgl.common.normalMap.vertexHeader\n\n#ifdef NORMALMAP_ENABLED\nattribute vec4 tangent : TANGENT;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@end\n\n@export ecgl.common.normalMap.vertexMain\n\n#ifdef NORMALMAP_ENABLED\n if (dot(tangent, tangent) > 0.0) {\n v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz);\n v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w);\n }\n#endif\n\n@end\n\n\n@export ecgl.common.normalMap.fragmentHeader\n\n#ifdef NORMALMAP_ENABLED\nuniform sampler2D normalMap;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@end\n\n@export ecgl.common.normalMap.fragmentMain\n#ifdef NORMALMAP_ENABLED\n if (dot(v_Tangent, v_Tangent) > 0.0) {\n vec3 normalTexel = texture2D(normalMap, v_DetailTexcoord).xyz;\n if (dot(normalTexel, normalTexel) > 0.0) { N = normalTexel * 2.0 - 1.0;\n mat3 tbn = mat3(v_Tangent, v_Bitangent, v_Normal);\n N = normalize(tbn * N);\n }\n }\n#endif\n@end\n\n\n\n@export ecgl.common.vertexAnimation.header\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute vec3 prevNormal;\nuniform float percent;\n#endif\n\n@end\n\n@export ecgl.common.vertexAnimation.main\n\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n vec3 norm = mix(prevNormal, normal, percent);\n#else\n vec3 pos = position;\n vec3 norm = normal;\n#endif\n\n@end\n\n\n@export ecgl.common.ssaoMap.header\n#ifdef SSAOMAP_ENABLED\nuniform sampler2D ssaoMap;\nuniform vec4 viewport : VIEWPORT;\n#endif\n@end\n\n@export ecgl.common.ssaoMap.main\n float ao = 1.0;\n#ifdef SSAOMAP_ENABLED\n ao = texture2D(ssaoMap, (gl_FragCoord.xy - viewport.xy) / viewport.zw).r;\n#endif\n@end\n\n\n\n\n@export ecgl.common.diffuseLayer.header\n\n#if (LAYER_DIFFUSEMAP_COUNT > 0)\nuniform float layerDiffuseIntensity[LAYER_DIFFUSEMAP_COUNT];\nuniform sampler2D layerDiffuseMap[LAYER_DIFFUSEMAP_COUNT];\n#endif\n\n@end\n\n@export ecgl.common.emissiveLayer.header\n\n#if (LAYER_EMISSIVEMAP_COUNT > 0)\nuniform float layerEmissionIntensity[LAYER_EMISSIVEMAP_COUNT];\nuniform sampler2D layerEmissiveMap[LAYER_EMISSIVEMAP_COUNT];\n#endif\n\n@end\n\n@export ecgl.common.layers.header\n@import ecgl.common.diffuseLayer.header\n@import ecgl.common.emissiveLayer.header\n@end\n\n@export ecgl.common.diffuseLayer.main\n\n#if (LAYER_DIFFUSEMAP_COUNT > 0)\n for (int _idx_ = 0; _idx_ < LAYER_DIFFUSEMAP_COUNT; _idx_++) {{\n float intensity = layerDiffuseIntensity[_idx_];\n vec4 texel2 = texture2D(layerDiffuseMap[_idx_], v_Texcoord);\n #ifdef SRGB_DECODE\n texel2 = sRGBToLinear(texel2);\n #endif\n albedoTexel.rgb = mix(albedoTexel.rgb, texel2.rgb * intensity, texel2.a);\n albedoTexel.a = texel2.a + (1.0 - texel2.a) * albedoTexel.a;\n }}\n#endif\n\n@end\n\n@export ecgl.common.emissiveLayer.main\n\n#if (LAYER_EMISSIVEMAP_COUNT > 0)\n for (int _idx_ = 0; _idx_ < LAYER_EMISSIVEMAP_COUNT; _idx_++)\n {{\n vec4 texel2 = texture2D(layerEmissiveMap[_idx_], v_Texcoord) * layerEmissionIntensity[_idx_];\n #ifdef SRGB_DECODE\n texel2 = sRGBToLinear(texel2);\n #endif\n float intensity = layerEmissionIntensity[_idx_];\n gl_FragColor.rgb += texel2.rgb * texel2.a * intensity;\n }}\n#endif\n\n@end\n"); - - -/***/ }), -/* 148 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export ecgl.color.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\n@import ecgl.common.uv.header\n\nattribute vec2 texcoord : TEXCOORD_0;\nattribute vec3 position: POSITION;\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nuniform float percent : 1.0;\n#endif\n\nvoid main()\n{\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n#else\n vec3 pos = position;\n#endif\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n @import ecgl.common.uv.main\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n\n}\n\n@end\n\n@export ecgl.color.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n\nuniform sampler2D diffuseMap;\nuniform sampler2D detailMap;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n@import ecgl.common.layers.header\n\n@import ecgl.common.uv.fragmentHeader\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.util.srgb\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color);\n#else\n gl_FragColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n gl_FragColor *= v_Color;\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n gl_FragColor *= albedoTexel;\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n\n}\n@end"); - - -/***/ }), -/* 149 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("/**\n * http: */\n\n@export ecgl.lambert.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n\n@import ecgl.common.attributes\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.vertexAnimation.header\n\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nvoid main()\n{\n @import ecgl.common.uv.main\n\n @import ecgl.common.vertexAnimation.main\n\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n}\n\n@end\n\n\n@export ecgl.lambert.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform sampler2D diffuseMap;\nuniform sampler2D detailMap;\n\n@import ecgl.common.layers.header\n\nuniform float emissionIntensity: 1.0;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color);\n#else\n gl_FragColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n gl_FragColor *= sRGBToLinear(v_Color);\n #else\n gl_FragColor *= v_Color;\n #endif\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n gl_FragColor *= albedoTexel;\n\n vec3 N = v_Normal;\n#ifdef DOUBLE_SIDED\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n vec3 diffuseColor = vec3(0.0, 0.0, 0.0);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++)\n {\n diffuseColor += ambientLightColor[i] * ambientFactor * ao;\n }\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n diffuseColor += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao;\n }}\n#endif\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++)\n {\n vec3 lightDirection = -directionalLightDirection[i];\n vec3 lightColor = directionalLightColor[i];\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[i];\n }\n#endif\n\n float ndl = dot(N, normalize(lightDirection)) * shadowContrib;\n\n diffuseColor += lightColor * clamp(ndl, 0.0, 1.0);\n }\n#endif\n\n gl_FragColor.rgb *= diffuseColor;\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end"); - - -/***/ }), -/* 150 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export ecgl.realistic.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n@import ecgl.common.attributes\n\n\n@import ecgl.common.wireframe.vertexHeader\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef NORMALMAP_ENABLED\nattribute vec4 tangent : TANGENT;\nvarying vec3 v_Tangent;\nvarying vec3 v_Bitangent;\n#endif\n\n@import ecgl.common.vertexAnimation.header\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nvoid main()\n{\n\n @import ecgl.common.uv.main\n\n @import ecgl.common.vertexAnimation.main\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n v_Normal = normalize((worldInverseTranspose * vec4(norm, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n\n#ifdef NORMALMAP_ENABLED\n v_Tangent = normalize((worldInverseTranspose * vec4(tangent.xyz, 0.0)).xyz);\n v_Bitangent = normalize(cross(v_Normal, v_Tangent) * tangent.w);\n#endif\n\n @import ecgl.common.wireframe.vertexMain\n\n}\n\n@end\n\n\n\n@export ecgl.realistic.fragment\n\n#define LAYER_DIFFUSEMAP_COUNT 0\n#define LAYER_EMISSIVEMAP_COUNT 0\n#define PI 3.14159265358979\n#define ROUGHNESS_CHANEL 0\n#define METALNESS_CHANEL 1\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform sampler2D diffuseMap;\n\nuniform sampler2D detailMap;\nuniform sampler2D metalnessMap;\nuniform sampler2D roughnessMap;\n\n@import ecgl.common.layers.header\n\nuniform float emissionIntensity: 1.0;\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nuniform float metalness : 0.0;\nuniform float roughness : 0.5;\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef AMBIENT_CUBEMAP_LIGHT_COUNT\n@import clay.header.ambient_cubemap_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n@import ecgl.common.normalMap.fragmentHeader\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import clay.util.rgbm\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nvec3 F_Schlick(float ndv, vec3 spec) {\n return spec + (1.0 - spec) * pow(1.0 - ndv, 5.0);\n}\n\nfloat D_Phong(float g, float ndh) {\n float a = pow(8192.0, g);\n return (a + 2.0) / 8.0 * pow(ndh, a);\n}\n\nvoid main()\n{\n vec4 albedoColor = color;\n\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n albedoColor *= sRGBToLinear(v_Color);\n #else\n albedoColor *= v_Color;\n #endif\n#endif\n\n @import ecgl.common.albedo.main\n\n @import ecgl.common.diffuseLayer.main\n\n albedoColor *= albedoTexel;\n\n float m = metalness;\n\n#ifdef METALNESSMAP_ENABLED\n float m2 = texture2D(metalnessMap, v_DetailTexcoord)[METALNESS_CHANEL];\n m = clamp(m2 + (m - 0.5) * 2.0, 0.0, 1.0);\n#endif\n\n vec3 baseColor = albedoColor.rgb;\n albedoColor.rgb = baseColor * (1.0 - m);\n vec3 specFactor = mix(vec3(0.04), baseColor, m);\n\n float g = 1.0 - roughness;\n\n#ifdef ROUGHNESSMAP_ENABLED\n float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL];\n g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0);\n#endif\n\n vec3 N = v_Normal;\n\n#ifdef DOUBLE_SIDED\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n@import ecgl.common.normalMap.fragmentMain\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n vec3 diffuseTerm = vec3(0.0);\n vec3 specularTerm = vec3(0.0);\n\n float ndv = clamp(dot(N, V), 0.0, 1.0);\n vec3 fresnelTerm = F_Schlick(ndv, specFactor);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_LIGHT_COUNT; _idx_++)\n {{\n diffuseTerm += ambientLightColor[_idx_] * ambientFactor * ao;\n }}\n#endif\n\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n diffuseTerm += calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_] * ao;\n }}\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int _idx_ = 0; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++)\n {{\n vec3 L = -directionalLightDirection[_idx_];\n vec3 lc = directionalLightColor[_idx_];\n\n vec3 H = normalize(L + V);\n float ndl = clamp(dot(N, normalize(L)), 0.0, 1.0);\n float ndh = clamp(dot(N, H), 0.0, 1.0);\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[_idx_];\n }\n#endif\n\n vec3 li = lc * ndl * shadowContrib;\n\n diffuseTerm += li;\n specularTerm += li * fresnelTerm * D_Phong(g, ndh);\n }}\n#endif\n\n\n#ifdef AMBIENT_CUBEMAP_LIGHT_COUNT\n vec3 L = reflect(-V, N);\n L = vec3(L.x, L[NORMAL_UP_AXIS], L[NORMAL_FRONT_AXIS]);\n float rough2 = clamp(1.0 - g, 0.0, 1.0);\n float bias2 = rough2 * 5.0;\n vec2 brdfParam2 = texture2D(ambientCubemapLightBRDFLookup[0], vec2(rough2, ndv)).xy;\n vec3 envWeight2 = specFactor * brdfParam2.x + brdfParam2.y;\n vec3 envTexel2;\n for(int _idx_ = 0; _idx_ < AMBIENT_CUBEMAP_LIGHT_COUNT; _idx_++)\n {{\n envTexel2 = RGBMDecode(textureCubeLodEXT(ambientCubemapLightCubemap[_idx_], L, bias2), 8.12);\n specularTerm += ambientCubemapLightColor[_idx_] * envTexel2 * envWeight2 * ao;\n }}\n#endif\n\n gl_FragColor.rgb = albedoColor.rgb * diffuseTerm + specularTerm;\n gl_FragColor.a = albedoColor.a;\n\n#ifdef SRGB_ENCODE\n gl_FragColor = linearTosRGB(gl_FragColor);\n#endif\n\n @import ecgl.common.emissiveLayer.main\n\n @import ecgl.common.wireframe.fragmentMain\n}\n\n@end"); - - -/***/ }), -/* 151 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export ecgl.hatching.vertex\n\n@import ecgl.realistic.vertex\n\n@end\n\n\n@export ecgl.hatching.fragment\n\n#define NORMAL_UP_AXIS 1\n#define NORMAL_FRONT_AXIS 2\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform vec4 color : [0.0, 0.0, 0.0, 1.0];\nuniform vec4 paperColor : [1.0, 1.0, 1.0, 1.0];\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n#ifdef AMBIENT_LIGHT_COUNT\n@import clay.header.ambient_light\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n@import clay.header.ambient_sh_light\n#endif\n\n#ifdef DIRECTIONAL_LIGHT_COUNT\n@import clay.header.directional_light\n#endif\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\n\n@import ecgl.common.ssaoMap.header\n\n@import ecgl.common.bumpMap.header\n\n@import clay.util.srgb\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.plugin.compute_shadow_map\n\nuniform sampler2D hatch1;\nuniform sampler2D hatch2;\nuniform sampler2D hatch3;\nuniform sampler2D hatch4;\nuniform sampler2D hatch5;\nuniform sampler2D hatch6;\n\nfloat shade(in float tone) {\n vec4 c = vec4(1. ,1., 1., 1.);\n float step = 1. / 6.;\n vec2 uv = v_DetailTexcoord;\n if (tone <= step / 2.0) {\n c = mix(vec4(0.), texture2D(hatch6, uv), 12. * tone);\n }\n else if (tone <= step) {\n c = mix(texture2D(hatch6, uv), texture2D(hatch5, uv), 6. * tone);\n }\n if(tone > step && tone <= 2. * step){\n c = mix(texture2D(hatch5, uv), texture2D(hatch4, uv) , 6. * (tone - step));\n }\n if(tone > 2. * step && tone <= 3. * step){\n c = mix(texture2D(hatch4, uv), texture2D(hatch3, uv), 6. * (tone - 2. * step));\n }\n if(tone > 3. * step && tone <= 4. * step){\n c = mix(texture2D(hatch3, uv), texture2D(hatch2, uv), 6. * (tone - 3. * step));\n }\n if(tone > 4. * step && tone <= 5. * step){\n c = mix(texture2D(hatch2, uv), texture2D(hatch1, uv), 6. * (tone - 4. * step));\n }\n if(tone > 5. * step){\n c = mix(texture2D(hatch1, uv), vec4(1.), 6. * (tone - 5. * step));\n }\n\n return c.r;\n}\n\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\n\nvoid main()\n{\n#ifdef SRGB_DECODE\n vec4 inkColor = sRGBToLinear(color);\n#else\n vec4 inkColor = color;\n#endif\n\n#ifdef VERTEX_COLOR\n #ifdef SRGB_DECODE\n inkColor *= sRGBToLinear(v_Color);\n #else\n inkColor *= v_Color;\n #endif\n#endif\n\n vec3 N = v_Normal;\n#ifdef DOUBLE_SIDED\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n N = -N;\n }\n#endif\n\n float tone = 0.0;\n\n float ambientFactor = 1.0;\n\n#ifdef BUMPMAP_ENABLED\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n ambientFactor = dot(v_Normal, N);\n#endif\n\n vec3 N2 = vec3(N.x, N[NORMAL_UP_AXIS], N[NORMAL_FRONT_AXIS]);\n\n @import ecgl.common.ssaoMap.main\n\n#ifdef AMBIENT_LIGHT_COUNT\n for(int i = 0; i < AMBIENT_LIGHT_COUNT; i++)\n {\n tone += dot(ambientLightColor[i], w) * ambientFactor * ao;\n }\n#endif\n#ifdef AMBIENT_SH_LIGHT_COUNT\n for(int _idx_ = 0; _idx_ < AMBIENT_SH_LIGHT_COUNT; _idx_++)\n {{\n tone += dot(calcAmbientSHLight(_idx_, N2) * ambientSHLightColor[_idx_], w) * ao;\n }}\n#endif\n#ifdef DIRECTIONAL_LIGHT_COUNT\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n float shadowContribsDir[DIRECTIONAL_LIGHT_COUNT];\n if(shadowEnabled)\n {\n computeShadowOfDirectionalLights(v_WorldPosition, shadowContribsDir);\n }\n#endif\n for(int i = 0; i < DIRECTIONAL_LIGHT_COUNT; i++)\n {\n vec3 lightDirection = -directionalLightDirection[i];\n float lightTone = dot(directionalLightColor[i], w);\n\n float shadowContrib = 1.0;\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n if (shadowEnabled)\n {\n shadowContrib = shadowContribsDir[i];\n }\n#endif\n\n float ndl = dot(N, normalize(lightDirection)) * shadowContrib;\n\n tone += lightTone * clamp(ndl, 0.0, 1.0);\n }\n#endif\n\n gl_FragColor = mix(inkColor, paperColor, shade(clamp(tone, 0.0, 1.0)));\n }\n@end\n"); - - -/***/ }), -/* 152 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export ecgl.sm.depth.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nuniform float percent : 1.0;\n#endif\n\nvarying vec4 v_ViewPosition;\nvarying vec2 v_Texcoord;\n\nvoid main(){\n\n#ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n#else\n vec3 pos = position;\n#endif\n\n v_ViewPosition = worldViewProjection * vec4(pos, 1.0);\n gl_Position = v_ViewPosition;\n\n v_Texcoord = texcoord;\n\n}\n@end\n\n\n\n@export ecgl.sm.depth.fragment\n\n@import clay.sm.depth.fragment\n\n@end"); - - -/***/ }), -/* 153 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); - - -var GL_SERIES = ['bar3D', 'line3D', 'map3D', 'scatter3D', 'surface', 'lines3D', 'scatterGL', 'scatter3D']; - -function convertNormalEmphasis(option, optType) { - if (option && option[optType] && (option[optType].normal || option[optType].emphasis)) { - var normalOpt = option[optType].normal; - var emphasisOpt = option[optType].emphasis; - - if (normalOpt) { - option[optType] = normalOpt; - } - if (emphasisOpt) { - option.emphasis = option.emphasis || {}; - option.emphasis[optType] = emphasisOpt; - } - } -} - -function convertNormalEmphasisForEach(option) { - convertNormalEmphasis(option, 'itemStyle'); - convertNormalEmphasis(option, 'lineStyle'); - convertNormalEmphasis(option, 'areaStyle'); - convertNormalEmphasis(option, 'label'); -} - -function removeTextStyleInAxis(axesOpt) { - if (!axesOpt) { - return; - } - if (!(axesOpt instanceof Array)) { - axesOpt = [axesOpt]; - } - __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.each(axesOpt, function (axisOpt) { - if (axisOpt.axisLabel) { - var labelOpt = axisOpt.axisLabel; - __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.extend(labelOpt, labelOpt.textStyle); - labelOpt.textStyle = null; - } - }); -} - -/* harmony default export */ __webpack_exports__["a"] = (function (option) { - __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.each(option.series, function (series) { - if (__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.indexOf(GL_SERIES, series.type) >= 0) { - convertNormalEmphasisForEach(series); - - // Compatitable with original mapbox - if (series.coordinateSystem === 'mapbox') { - series.coordinateSystem = 'mapbox3D'; - option.mapbox3D = option.mapbox; - } - } - }); - - removeTextStyleInAxis(option.xAxis3D); - removeTextStyleInAxis(option.yAxis3D); - removeTextStyleInAxis(option.zAxis3D); - removeTextStyleInAxis(option.grid3D); - - convertNormalEmphasis(option.geo3D); -});; - -/***/ }), -/* 154 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__grid3D_Axis3DModel__ = __webpack_require__(155); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__grid3D_Grid3DModel__ = __webpack_require__(159); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__grid3D_Grid3DView__ = __webpack_require__(160); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__coord_grid3DCreator__ = __webpack_require__(167); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_echarts_lib_echarts__); - - - - - - - -__WEBPACK_IMPORTED_MODULE_4_echarts_lib_echarts___default.a.registerAction({ - type: 'grid3DChangeCamera', - event: 'grid3dcamerachanged', - update: 'series:updateCamera' -}, function (payload, ecModel) { - ecModel.eachComponent({ - mainType: 'grid3D', query: payload - }, function (componentModel) { - componentModel.setView(payload); - }); -}); - -__WEBPACK_IMPORTED_MODULE_4_echarts_lib_echarts___default.a.registerAction({ - type: 'grid3DShowAxisPointer', - event: 'grid3dshowaxispointer', - update: 'grid3D:showAxisPointer' -}, function (payload, ecModel) { -}); - -__WEBPACK_IMPORTED_MODULE_4_echarts_lib_echarts___default.a.registerAction({ - type: 'grid3DHideAxisPointer', - event: 'grid3dhideaxispointer', - update: 'grid3D:hideAxisPointer' -}, function (payload, ecModel) { -}); - -/***/ }), -/* 155 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__createAxis3DModel__ = __webpack_require__(156); - - - -var Axis3DModel = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendComponentModel({ - - type: 'cartesian3DAxis', - - axis: null, - - /** - * @override - */ - getCoordSysModel: function () { - return this.ecModel.queryComponents({ - mainType: 'grid3D', - index: this.option.gridIndex, - id: this.option.gridId - })[0]; - } -}); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.helper.mixinAxisModelCommonMethods(Axis3DModel); - -function getAxisType(axisDim, option) { - // Default axis with data is category axis - return option.type || (option.data ? 'category' : 'value'); -} - -Object(__WEBPACK_IMPORTED_MODULE_1__createAxis3DModel__["a" /* default */])('x', Axis3DModel, getAxisType, { - name: 'X' -}); -Object(__WEBPACK_IMPORTED_MODULE_1__createAxis3DModel__["a" /* default */])('y', Axis3DModel, getAxisType, { - name: 'Y' -}); -Object(__WEBPACK_IMPORTED_MODULE_1__createAxis3DModel__["a" /* default */])('z', Axis3DModel, getAxisType, { - name: 'Z' -}); - -/***/ }), -/* 156 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__axis3DDefault__ = __webpack_require__(157); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_echarts_lib_data_OrdinalMeta__ = __webpack_require__(158); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_echarts_lib_data_OrdinalMeta___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_echarts_lib_data_OrdinalMeta__); - - - - - -var AXIS_TYPES = ['value', 'category', 'time', 'log']; -/** - * Generate sub axis model class - * @param {string} dim 'x' 'y' 'radius' 'angle' 'parallel' - * @param {module:echarts/model/Component} BaseAxisModelClass - * @param {Function} axisTypeDefaulter - * @param {Object} [extraDefaultOption] - */ -/* harmony default export */ __webpack_exports__["a"] = (function (dim, BaseAxisModelClass, axisTypeDefaulter, extraDefaultOption) { - - __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.each(AXIS_TYPES, function (axisType) { - - BaseAxisModelClass.extend({ - - type: dim + 'Axis3D.' + axisType, - - /** - * @type readOnly - */ - __ordinalMeta: null, - - mergeDefaultAndTheme: function (option, ecModel) { - - var themeModel = ecModel.getTheme(); - __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(option, themeModel.get(axisType + 'Axis3D')); - __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(option, this.getDefaultOption()); - - option.type = axisTypeDefaulter(dim, option); - }, - - /** - * @override - */ - optionUpdated: function () { - var thisOption = this.option; - - if (thisOption.type === 'category') { - this.__ordinalMeta = __WEBPACK_IMPORTED_MODULE_2_echarts_lib_data_OrdinalMeta___default.a.createByAxisModel(this); - } - }, - - getCategories: function () { - if (this.option.type === 'category') { - return this.__ordinalMeta.categories; - } - }, - - getOrdinalMeta: function () { - return this.__ordinalMeta; - }, - - defaultOption: __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge( - __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.clone(__WEBPACK_IMPORTED_MODULE_1__axis3DDefault__["a" /* default */][axisType + 'Axis3D']), - extraDefaultOption || {}, - true - ) - }); - }); - - // TODO - BaseAxisModelClass.superClass.registerSubTypeDefaulter( - dim + 'Axis3D', - __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.curry(axisTypeDefaulter, dim) - ); -});; - -/***/ }), -/* 157 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); - - -var defaultOption = { - show: true, - - grid3DIndex: 0, - // 反向坐标轴 - inverse: false, - - // 坐标轴名字 - name: '', - // 坐标轴名字位置 - nameLocation: 'middle', - - nameTextStyle: { - fontSize: 16 - }, - // 文字与轴线距离 - nameGap: 20, - - axisPointer: {}, - - axisLine: {}, - // 坐标轴小标记 - axisTick: {}, - axisLabel: {}, - // 分隔区域 - splitArea: {} -}; - -var categoryAxis = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge({ - // 类目起始和结束两端空白策略 - boundaryGap: true, - // splitArea: { - // show: false - // }, - // 坐标轴小标记 - axisTick: { - // If tick is align with label when boundaryGap is true - // Default with axisTick - alignWithLabel: false, - interval: 'auto' - }, - // 坐标轴文本标签,详见axis.axisLabel - axisLabel: { - interval: 'auto' - }, - axisPointer: { - label: { - show: false - } - } -}, defaultOption); - -var valueAxis = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge({ - // 数值起始和结束两端空白策略 - boundaryGap: [0, 0], - // 最小值, 设置成 'dataMin' 则从数据中计算最小值 - // min: null, - // 最大值,设置成 'dataMax' 则从数据中计算最大值 - // max: null, - // 脱离0值比例,放大聚焦到最终_min,_max区间 - // scale: false, - // 分割段数,默认为5 - splitNumber: 5, - // Minimum interval - // minInterval: null - - axisPointer: { - label: { - } - } -}, defaultOption); - -// FIXME -var timeAxis = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.defaults({ - scale: true, - min: 'dataMin', - max: 'dataMax' -}, valueAxis); -var logAxis = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.defaults({ - logBase: 10 -}, valueAxis); -logAxis.scale = true; - -/* harmony default export */ __webpack_exports__["a"] = ({ - categoryAxis3D: categoryAxis, - valueAxis3D: valueAxis, - timeAxis3D: timeAxis, - logAxis3D: logAxis -}); - -/***/ }), -/* 158 */ -/***/ (function(module, exports, __webpack_require__) { - -var _util = __webpack_require__(13); - -var createHashMap = _util.createHashMap; -var isObject = _util.isObject; -var map = _util.map; - -/* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -*/ - -/** - * @constructor - * @param {Object} [opt] - * @param {Object} [opt.categories=[]] - * @param {Object} [opt.needCollect=false] - * @param {Object} [opt.deduplication=false] - */ -function OrdinalMeta(opt) { - /** - * @readOnly - * @type {Array.} - */ - this.categories = opt.categories || []; - /** - * @private - * @type {boolean} - */ - - this._needCollect = opt.needCollect; - /** - * @private - * @type {boolean} - */ - - this._deduplication = opt.deduplication; - /** - * @private - * @type {boolean} - */ - - this._map; -} -/** - * @param {module:echarts/model/Model} axisModel - * @return {module:echarts/data/OrdinalMeta} - */ - - -OrdinalMeta.createByAxisModel = function (axisModel) { - var option = axisModel.option; - var data = option.data; - var categories = data && map(data, getName); - return new OrdinalMeta({ - categories: categories, - needCollect: !categories, - // deduplication is default in axis. - deduplication: option.dedplication !== false - }); -}; - -var proto = OrdinalMeta.prototype; -/** - * @param {string} category - * @return {number} ordinal - */ - -proto.getOrdinal = function (category) { - return getOrCreateMap(this).get(category); -}; -/** - * @param {*} category - * @return {number} The ordinal. If not found, return NaN. - */ - - -proto.parseAndCollect = function (category) { - var index; - var needCollect = this._needCollect; // The value of category dim can be the index of the given category set. - // This feature is only supported when !needCollect, because we should - // consider a common case: a value is 2017, which is a number but is - // expected to be tread as a category. This case usually happen in dataset, - // where it happent to be no need of the index feature. - - if (typeof category !== 'string' && !needCollect) { - return category; - } // Optimize for the scenario: - // category is ['2012-01-01', '2012-01-02', ...], where the input - // data has been ensured not duplicate and is large data. - // Notice, if a dataset dimension provide categroies, usually echarts - // should remove duplication except user tell echarts dont do that - // (set axis.deduplication = false), because echarts do not know whether - // the values in the category dimension has duplication (consider the - // parallel-aqi example) - - - if (needCollect && !this._deduplication) { - index = this.categories.length; - this.categories[index] = category; - return index; - } - - var map = getOrCreateMap(this); - index = map.get(category); - - if (index == null) { - if (needCollect) { - index = this.categories.length; - this.categories[index] = category; - map.set(category, index); - } else { - index = NaN; - } - } - - return index; -}; // Consider big data, do not create map until needed. - - -function getOrCreateMap(ordinalMeta) { - return ordinalMeta._map || (ordinalMeta._map = createHashMap(ordinalMeta.categories)); -} - -function getName(obj) { - if (isObject(obj) && obj.value != null) { - return obj.value; - } else { - return obj + ''; - } -} - -var _default = OrdinalMeta; -module.exports = _default; - -/***/ }), -/* 159 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__common_componentViewControlMixin__ = __webpack_require__(44); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_componentPostEffectMixin__ = __webpack_require__(28); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_componentLightMixin__ = __webpack_require__(29); - - - - - -var Grid3DModel = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendComponentModel({ - - type: 'grid3D', - - dependencies: ['xAxis3D', 'yAxis3D', 'zAxis3D'], - - defaultOption: { - - show: true, - - zlevel: -10, - - // Layout used for viewport - left: 0, - top: 0, - width: '100%', - height: '100%', - - environment: 'auto', - - // Dimension of grid3D - boxWidth: 100, - boxHeight: 100, - boxDepth: 100, - - // Common axis options. - axisPointer: { - show: true, - lineStyle: { - color: 'rgba(0, 0, 0, 0.8)', - width: 1 - }, - - label: { - show: true, - // (dimValue: number, value: Array) => string - formatter: null, - - // TODO, Consider boxWidth - margin: 8, - // backgroundColor: '#ffbd67', - // borderColor: '#000', - // borderWidth: 0, - - textStyle: { - fontSize: 14, - color: '#fff', - backgroundColor: 'rgba(0,0,0,0.5)', - padding: 3, - borderRadius: 3 - } - } - }, - - axisLine: { - show: true, - lineStyle: { - color: '#333', - width: 2, - type: 'solid' - } - }, - - axisTick: { - show: true, - inside: false, - length: 3, - lineStyle: { - width: 1 - } - }, - axisLabel: { - show: true, - inside: false, - rotate: 0, - margin: 8, - textStyle: { - fontSize: 12 - } - }, - splitLine: { - show: true, - lineStyle: { - color: ['#ccc'], - width: 1, - type: 'solid' - } - }, - splitArea: { - show: false, - areaStyle: { - color: ['rgba(250,250,250,0.3)','rgba(200,200,200,0.3)'] - } - }, - - // Light options - light: { - main: { - // Alpha angle for top-down rotation - // Positive to rotate to top. - alpha: 30, - // beta angle for left-right rotation - // Positive to rotate to right. - beta: 40 - }, - ambient: { - intensity: 0.4 - } - }, - - viewControl: { - // Small damping for precise control. - // damping: 0.1, - - // Alpha angle for top-down rotation - // Positive to rotate to top. - alpha: 20, - // beta angle for left-right rotation - // Positive to rotate to right. - beta: 40, - - autoRotate: false, - - // Distance to the surface of grid3D. - distance: 200, - - // Min distance to the surface of grid3D - minDistance: 40, - // Max distance to the surface of grid3D - maxDistance: 400 - } - } -}); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(Grid3DModel.prototype, __WEBPACK_IMPORTED_MODULE_1__common_componentViewControlMixin__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(Grid3DModel.prototype, __WEBPACK_IMPORTED_MODULE_2__common_componentPostEffectMixin__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(Grid3DModel.prototype, __WEBPACK_IMPORTED_MODULE_3__common_componentLightMixin__["a" /* default */]); - -/* unused harmony default export */ var _unused_webpack_default_export = (Grid3DModel); - - - -/***/ }), -/* 160 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_OrbitControl__ = __webpack_require__(45); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_geometry_Lines3D__ = __webpack_require__(25); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_retrieve__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__util_ZRTextureAtlasSurface__ = __webpack_require__(81); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__common_SceneHelper__ = __webpack_require__(30); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Grid3DFace__ = __webpack_require__(162); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Grid3DAxis__ = __webpack_require__(164); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__util_mesh_LabelsMesh__ = __webpack_require__(63); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__util_shader_lines3D_glsl_js__ = __webpack_require__(46); -// TODO orthographic camera - - - - - - -var firstNotNull = __WEBPACK_IMPORTED_MODULE_4__util_retrieve__["a" /* default */].firstNotNull; - - - - - - - -__WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Shader.import(__WEBPACK_IMPORTED_MODULE_10__util_shader_lines3D_glsl_js__["a" /* default */]); - -['x', 'y', 'z'].forEach(function (dim) { - __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendComponentView({ - type: dim + 'Axis3D' - }); -}); - -var dimIndicesMap = { - // Left to right - x: 0, - // Far to near - y: 2, - // Bottom to up - z: 1 -}; - -/* unused harmony default export */ var _unused_webpack_default_export = (__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendComponentView({ - - type: 'grid3D', - - __ecgl__: true, - - init: function (ecModel, api) { - - var FACES = [ - // planeDim0, planeDim1, offsetDim, dir on dim3 axis(gl), plane. - ['y', 'z', 'x', -1, 'left'], - ['y', 'z', 'x', 1, 'right'], - ['x', 'y', 'z', -1, 'bottom'], - ['x', 'y','z', 1, 'top'], - ['x', 'z', 'y', -1, 'far'], - ['x', 'z','y', 1, 'near'] - ]; - - var DIMS = ['x', 'y', 'z']; - - var quadsMaterial = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Material({ - // transparent: true, - shader: __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].createShader('ecgl.color'), - depthMask: false, - transparent: true - }); - var linesMaterial = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Material({ - // transparent: true, - shader: __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].createShader('ecgl.meshLines3D'), - depthMask: false, - transparent: true - }); - quadsMaterial.define('fragment', 'DOUBLE_SIDED'); - quadsMaterial.define('both', 'VERTEX_COLOR'); - - this.groupGL = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Node(); - - this._control = new __WEBPACK_IMPORTED_MODULE_2__util_OrbitControl__["a" /* default */]({ - zr: api.getZr() - }); - this._control.init(); - - // Save mesh and other infos for each face. - this._faces = FACES.map(function (faceInfo) { - var face = new __WEBPACK_IMPORTED_MODULE_7__Grid3DFace__["a" /* default */](faceInfo, linesMaterial, quadsMaterial); - this.groupGL.add(face.rootNode); - return face; - }, this); - - // Save mesh and other infos for each axis. - this._axes = DIMS.map(function (dim) { - var axis = new __WEBPACK_IMPORTED_MODULE_8__Grid3DAxis__["a" /* default */](dim, linesMaterial); - this.groupGL.add(axis.rootNode); - return axis; - }, this); - - var dpr = api.getDevicePixelRatio(); - // Texture surface for label. - this._axisLabelSurface = new __WEBPACK_IMPORTED_MODULE_5__util_ZRTextureAtlasSurface__["a" /* default */]({ - width: 256, height: 256, - devicePixelRatio: dpr - }); - this._axisLabelSurface.onupdate = function () { - api.getZr().refresh(); - }; - - this._axisPointerLineMesh = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Mesh({ - geometry: new __WEBPACK_IMPORTED_MODULE_3__util_geometry_Lines3D__["a" /* default */]({ useNativeLine: false }), - material: linesMaterial, - castShadow: false, - // PENDING - ignorePicking: true, - renderOrder: 3 - }); - this.groupGL.add(this._axisPointerLineMesh); - - this._axisPointerLabelsSurface = new __WEBPACK_IMPORTED_MODULE_5__util_ZRTextureAtlasSurface__["a" /* default */]({ - width: 128, height: 128, - devicePixelRatio: dpr - }); - this._axisPointerLabelsMesh = new __WEBPACK_IMPORTED_MODULE_9__util_mesh_LabelsMesh__["a" /* default */]({ - ignorePicking: true, renderOrder: 4, - castShadow: false - }); - this._axisPointerLabelsMesh.material.set('textureAtlas', this._axisPointerLabelsSurface.getTexture()); - this.groupGL.add(this._axisPointerLabelsMesh); - - this._lightRoot = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Node(); - this._sceneHelper = new __WEBPACK_IMPORTED_MODULE_6__common_SceneHelper__["a" /* default */](); - this._sceneHelper.initLight(this._lightRoot); - }, - - render: function (grid3DModel, ecModel, api) { - - this._model = grid3DModel; - this._api = api; - - var cartesian = grid3DModel.coordinateSystem; - - // Always have light. - cartesian.viewGL.add(this._lightRoot); - - if (grid3DModel.get('show')) { - cartesian.viewGL.add(this.groupGL); - } - else { - cartesian.viewGL.remove(this.groupGL); - } - - // cartesian.viewGL.setCameraType(grid3DModel.get('viewControl.projection')); - - var control = this._control; - control.setViewGL(cartesian.viewGL); - - var viewControlModel = grid3DModel.getModel('viewControl'); - control.setFromViewControlModel(viewControlModel, 0); - - this._axisLabelSurface.clear(); - - control.off('update'); - if (grid3DModel.get('show')) { - this._faces.forEach(function (face) { - face.update(grid3DModel, ecModel, api); - }, this); - this._axes.forEach(function (axis) { - axis.update(grid3DModel, this._axisLabelSurface, api); - }, this); - } - - control.on('update', this._onCameraChange.bind(this, grid3DModel, api), this); - - this._sceneHelper.setScene(cartesian.viewGL.scene); - this._sceneHelper.updateLight(grid3DModel); - - // Set post effect - cartesian.viewGL.setPostEffect(grid3DModel.getModel('postEffect'), api); - cartesian.viewGL.setTemporalSuperSampling(grid3DModel.getModel('temporalSuperSampling')); - - this._initMouseHandler(grid3DModel); - }, - - afterRender: function (grid3DModel, ecModel, api, layerGL) { - // Create ambient cubemap after render because we need to know the renderer. - // TODO - var renderer = layerGL.renderer; - - this._sceneHelper.updateAmbientCubemap(renderer, grid3DModel, api); - - this._sceneHelper.updateSkybox(renderer, grid3DModel, api); - }, - - /** - * showAxisPointer will be triggered by action. - */ - showAxisPointer: function (grid3dModel, ecModel, api, payload) { - this._doShowAxisPointer(); - this._updateAxisPointer(payload.value); - }, - - /** - * hideAxisPointer will be triggered by action. - */ - hideAxisPointer: function (grid3dModel, ecModel, api, payload) { - this._doHideAxisPointer(); - }, - - _initMouseHandler: function (grid3DModel) { - var cartesian = grid3DModel.coordinateSystem; - var viewGL = cartesian.viewGL; - - // TODO xAxis3D.axisPointer.show ? - if (grid3DModel.get('show') && grid3DModel.get('axisPointer.show')) { - viewGL.on('mousemove', this._updateAxisPointerOnMousePosition, this); - } - else { - viewGL.off('mousemove', this._updateAxisPointerOnMousePosition); - } - }, - - /** - * Try find and show axisPointer on the intersect point - * of mouse ray with grid plane. - */ - _updateAxisPointerOnMousePosition: function (e) { - // Ignore if mouse is on the element. - if (e.target) { - return; - } - var grid3DModel = this._model; - var cartesian = grid3DModel.coordinateSystem; - var viewGL = cartesian.viewGL; - - var ray = viewGL.castRay(e.offsetX, e.offsetY, new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Ray()); - - var nearestIntersectPoint; - for (var i = 0; i < this._faces.length; i++) { - var face = this._faces[i]; - if (face.rootNode.invisible) { - continue; - } - - // Plane is not face the camera. flip it - if (face.plane.normal.dot(viewGL.camera.worldTransform.z) < 0) { - face.plane.normal.negate(); - } - - var point = ray.intersectPlane(face.plane); - if (!point) { - continue; - } - var axis0 = cartesian.getAxis(face.faceInfo[0]); - var axis1 = cartesian.getAxis(face.faceInfo[1]); - var idx0 = dimIndicesMap[face.faceInfo[0]]; - var idx1 = dimIndicesMap[face.faceInfo[1]]; - if (axis0.contain(point.array[idx0]) && axis1.contain(point.array[idx1])) { - nearestIntersectPoint = point; - } - } - - if (nearestIntersectPoint) { - var data = cartesian.pointToData(nearestIntersectPoint.array, [], true); - this._updateAxisPointer(data); - - this._doShowAxisPointer(); - } - else { - this._doHideAxisPointer(); - } - }, - - _onCameraChange: function (grid3DModel, api) { - - if (grid3DModel.get('show')) { - this._updateFaceVisibility(); - this._updateAxisLinePosition(); - } - - var control = this._control; - - api.dispatchAction({ - type: 'grid3DChangeCamera', - alpha: control.getAlpha(), - beta: control.getBeta(), - distance: control.getDistance(), - center: control.getCenter(), - from: this.uid, - grid3DId: grid3DModel.id - }); - }, - - /** - * Update visibility of each face when camera view changed, front face will be invisible. - * @private - */ - _updateFaceVisibility: function () { - var camera = this._control.getCamera(); - var viewSpacePos = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Vector3(); - camera.update(); - for (var idx = 0; idx < this._faces.length / 2; idx++) { - var depths = []; - for (var k = 0; k < 2; k++) { - var face = this._faces[idx * 2 + k]; - face.rootNode.getWorldPosition(viewSpacePos); - viewSpacePos.transformMat4(camera.viewMatrix); - depths[k] = viewSpacePos.z; - } - // Set the front face invisible - var frontIndex = depths[0] > depths[1] ? 0 : 1; - var frontFace = this._faces[idx * 2 + frontIndex]; - var backFace = this._faces[idx * 2 + 1 - frontIndex]; - // Update rotation. - frontFace.rootNode.invisible = true; - backFace.rootNode.invisible = false; - } - }, - - /** - * Update axis line position when camera view changed. - * @private - */ - _updateAxisLinePosition: function () { - // Put xAxis, yAxis on x, y visible plane. - // Put zAxis on the left. - // TODO - var cartesian = this._model.coordinateSystem; - var xAxis = cartesian.getAxis('x'); - var yAxis = cartesian.getAxis('y'); - var zAxis = cartesian.getAxis('z'); - var top = zAxis.getExtentMax(); - var bottom = zAxis.getExtentMin(); - var left = xAxis.getExtentMin(); - var right = xAxis.getExtentMax(); - var near = yAxis.getExtentMax(); - var far = yAxis.getExtentMin(); - - var xAxisNode = this._axes[0].rootNode; - var yAxisNode = this._axes[1].rootNode; - var zAxisNode = this._axes[2].rootNode; - - var faces = this._faces; - // Notice: in cartesian up axis is z, but in webgl up axis is y. - var xAxisZOffset = (faces[4].rootNode.invisible ? far : near); - var xAxisYOffset = (faces[2].rootNode.invisible ? top : bottom); - var yAxisXOffset = (faces[0].rootNode.invisible ? left : right); - var yAxisYOffset = (faces[2].rootNode.invisible ? top : bottom); - var zAxisXOffset = (faces[0].rootNode.invisible ? right : left); - var zAxisZOffset = (faces[4].rootNode.invisible ? far : near); - - xAxisNode.rotation.identity(); - yAxisNode.rotation.identity(); - zAxisNode.rotation.identity(); - if (faces[4].rootNode.invisible) { - this._axes[0].flipped = true; - xAxisNode.rotation.rotateX(Math.PI); - } - if (faces[0].rootNode.invisible) { - this._axes[1].flipped = true; - yAxisNode.rotation.rotateZ(Math.PI); - } - if (faces[4].rootNode.invisible) { - this._axes[2].flipped = true; - zAxisNode.rotation.rotateY(Math.PI); - } - - xAxisNode.position.set(0, xAxisYOffset, xAxisZOffset); - yAxisNode.position.set(yAxisXOffset, yAxisYOffset, 0); // Actually z - zAxisNode.position.set(zAxisXOffset, 0, zAxisZOffset); // Actually y - - xAxisNode.update(); - yAxisNode.update(); - zAxisNode.update(); - - this._updateAxisLabelAlign(); - }, - - /** - * Update label align on axis when axisLine position changed. - * @private - */ - _updateAxisLabelAlign: function () { - // var cartesian = this._model.coordinateSystem; - var camera = this._control.getCamera(); - var coords = [new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Vector4(), new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Vector4()]; - var center = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Vector4(); - this.groupGL.getWorldPosition(center); - center.w = 1.0; - center.transformMat4(camera.viewMatrix) - .transformMat4(camera.projectionMatrix); - center.x /= center.w; - center.y /= center.w; - this._axes.forEach(function (axisInfo) { - var lineCoords = axisInfo.axisLineCoords; - var labelGeo = axisInfo.labelsMesh.geometry; - for (var i = 0; i < coords.length; i++) { - coords[i].setArray(lineCoords[i]); - coords[i].w = 1.0; - coords[i].transformMat4(axisInfo.rootNode.worldTransform) - .transformMat4(camera.viewMatrix) - .transformMat4(camera.projectionMatrix); - coords[i].x /= coords[i].w; - coords[i].y /= coords[i].w; - } - var dx = coords[1].x - coords[0].x; - var dy = coords[1].y - coords[0].y; - var cx = (coords[1].x + coords[0].x) / 2; - var cy = (coords[1].y + coords[0].y) / 2; - var textAlign; - var verticalAlign; - if (Math.abs(dy / dx) < 0.5) { - textAlign = 'center'; - verticalAlign = cy > center.y ? 'bottom' : 'top'; - } - else { - verticalAlign = 'middle'; - textAlign = cx > center.x ? 'left' : 'right'; - } - - // axis labels - axisInfo.setSpriteAlign(textAlign, verticalAlign, this._api); - }, this); - }, - - _doShowAxisPointer: function () { - if (!this._axisPointerLineMesh.invisible) { - return; - } - - this._axisPointerLineMesh.invisible = false; - this._axisPointerLabelsMesh.invisible = false; - this._api.getZr().refresh(); - }, - - _doHideAxisPointer: function () { - if (this._axisPointerLineMesh.invisible) { - return; - } - - this._axisPointerLineMesh.invisible = true; - this._axisPointerLabelsMesh.invisible = true; - this._api.getZr().refresh(); - }, - /** - * @private updateAxisPointer. - */ - _updateAxisPointer: function (data) { - var cartesian = this._model.coordinateSystem; - var point = cartesian.dataToPoint(data); - - var axisPointerLineMesh = this._axisPointerLineMesh; - var linesGeo = axisPointerLineMesh.geometry; - - var axisPointerParentModel = this._model.getModel('axisPointer'); - - var dpr = this._api.getDevicePixelRatio(); - linesGeo.convertToDynamicArray(true); - - - function ifShowAxisPointer(axis) { - return __WEBPACK_IMPORTED_MODULE_4__util_retrieve__["a" /* default */].firstNotNull( - axis.model.get('axisPointer.show'), - axisPointerParentModel.get('show') - ); - } - function getAxisColorAndLineWidth(axis) { - var axisPointerModel = axis.model.getModel('axisPointer', axisPointerParentModel); - var lineStyleModel = axisPointerModel.getModel('lineStyle'); - - var color = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor(lineStyleModel.get('color')); - var lineWidth = firstNotNull(lineStyleModel.get('width'), 1); - var opacity = firstNotNull(lineStyleModel.get('opacity'), 1); - color[3] *= opacity; - - return { - color: color, - lineWidth: lineWidth - }; - } - for (var k = 0; k < this._faces.length; k++) { - var face = this._faces[k]; - if (face.rootNode.invisible) { - continue; - } - - var faceInfo = face.faceInfo; - var otherCoord = faceInfo[3] < 0 - ? cartesian.getAxis(faceInfo[2]).getExtentMin() - : cartesian.getAxis(faceInfo[2]).getExtentMax(); - var otherDimIdx = dimIndicesMap[faceInfo[2]]; - - // Line on face. - for (var i = 0; i < 2; i++) { - var dim = faceInfo[i]; - var faceOtherDim = faceInfo[1 - i]; - var axis = cartesian.getAxis(dim); - var faceOtherAxis = cartesian.getAxis(faceOtherDim); - - if (!ifShowAxisPointer(axis)) { - continue; - } - - var p0 = [0, 0, 0]; var p1 = [0, 0, 0]; - var dimIdx = dimIndicesMap[dim]; - var faceOtherDimIdx = dimIndicesMap[faceOtherDim]; - p0[dimIdx] = p1[dimIdx] = point[dimIdx]; - - p0[otherDimIdx] = p1[otherDimIdx] = otherCoord; - p0[faceOtherDimIdx] = faceOtherAxis.getExtentMin(); - p1[faceOtherDimIdx] = faceOtherAxis.getExtentMax(); - - var colorAndLineWidth = getAxisColorAndLineWidth(axis); - linesGeo.addLine(p0, p1, colorAndLineWidth.color, colorAndLineWidth.lineWidth * dpr); - } - - // Project line. - if (ifShowAxisPointer(cartesian.getAxis(faceInfo[2]))) { - var p0 = point.slice(); - var p1 = point.slice(); - p1[otherDimIdx] = otherCoord; - var colorAndLineWidth = getAxisColorAndLineWidth(cartesian.getAxis(faceInfo[2])); - linesGeo.addLine(p0, p1, colorAndLineWidth.color, colorAndLineWidth.lineWidth * dpr); - } - } - linesGeo.convertToTypedArray(); - - this._updateAxisPointerLabelsMesh(data); - - this._api.getZr().refresh(); - }, - - _updateAxisPointerLabelsMesh: function (data) { - var grid3dModel = this._model; - var axisPointerLabelsMesh = this._axisPointerLabelsMesh; - var axisPointerLabelsSurface = this._axisPointerLabelsSurface; - var cartesian = grid3dModel.coordinateSystem; - - var axisPointerParentModel = grid3dModel.getModel('axisPointer'); - - axisPointerLabelsMesh.geometry.convertToDynamicArray(true); - axisPointerLabelsSurface.clear(); - - var otherDim = { - x: 'y', y: 'x', z: 'y' - }; - this._axes.forEach(function (axisInfo, idx) { - var axis = cartesian.getAxis(axisInfo.dim); - var axisModel = axis.model; - var axisPointerModel = axisModel.getModel('axisPointer', axisPointerParentModel); - var labelModel = axisPointerModel.getModel('label'); - var lineColor = axisPointerModel.get('lineStyle.color'); - if (!labelModel.get('show') || !axisPointerModel.get('show')) { - return; - } - var val = data[idx]; - var formatter = labelModel.get('formatter'); - var text = axis.scale.getLabel(val); - if (formatter != null) { - text = formatter(text, data); - } - else { - if (axis.scale.type === 'interval' || axis.scale.type === 'log') { - var precision = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.number.getPrecisionSafe(axis.scale.getTicks()[0]); - text = val.toFixed(precision + 2); - } - } - - var textStyleModel = labelModel.getModel('textStyle'); - var labelColor = textStyleModel.get('color'); - var textEl = new __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.graphic.Text(); - __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.graphic.setTextStyle(textEl.style, textStyleModel, { - text: text, - textFill: labelColor || lineColor, - textAlign: 'left', - textVerticalAlign: 'top' - }); - var coords = axisPointerLabelsSurface.add(textEl); - var rect = textEl.getBoundingRect(); - var dpr = this._api.getDevicePixelRatio(); - var pos = axisInfo.rootNode.position.toArray(); - var otherIdx = dimIndicesMap[otherDim[axisInfo.dim]]; - pos[otherIdx] += (axisInfo.flipped ? -1 : 1) * labelModel.get('margin'); - pos[dimIndicesMap[axisInfo.dim]] = axis.dataToCoord(data[idx]); - - axisPointerLabelsMesh.geometry.addSprite( - pos, [rect.width * dpr, rect.height * dpr], coords, - axisInfo.textAlign, axisInfo.textVerticalAlign - ); - }, this); - axisPointerLabelsSurface.getZr().refreshImmediately(); - axisPointerLabelsMesh.material.set('uvScale', axisPointerLabelsSurface.getCoordsScale()); - axisPointerLabelsMesh.geometry.convertToTypedArray(); - }, - - dispose: function () { - this.groupGL.removeAll(); - this._control.dispose(); - } -})); - -/***/ }), -/* 161 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__vec2__ = __webpack_require__(70); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__vec3__ = __webpack_require__(12); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__vec4__ = __webpack_require__(33); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__mat2__ = __webpack_require__(78); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__mat2d__ = __webpack_require__(79); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__mat3__ = __webpack_require__(34); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__mat4__ = __webpack_require__(21); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__quat__ = __webpack_require__(55); -/** - * @fileoverview gl-matrix - High performance matrix and vector operations - * @author Brandon Jones - * @author Colin MacKenzie IV - * @version 2.2.2 - */ - -/* Copyright (c) 2013, Brandon Jones, Colin MacKenzie IV. All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - - - - - - - - - - -/* harmony default export */ __webpack_exports__["a"] = ({ - vec2: __WEBPACK_IMPORTED_MODULE_0__vec2__["a" /* default */], - vec3: __WEBPACK_IMPORTED_MODULE_1__vec3__["a" /* default */], - vec4: __WEBPACK_IMPORTED_MODULE_2__vec4__["a" /* default */], - mat2: __WEBPACK_IMPORTED_MODULE_3__mat2__["a" /* default */], - mat2d: __WEBPACK_IMPORTED_MODULE_4__mat2d__["a" /* default */], - mat3: __WEBPACK_IMPORTED_MODULE_5__mat3__["a" /* default */], - mat4: __WEBPACK_IMPORTED_MODULE_6__mat4__["a" /* default */], - quat: __WEBPACK_IMPORTED_MODULE_7__quat__["a" /* default */] -}); - - -/***/ }), -/* 162 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_retrieve__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_geometry_Lines3D__ = __webpack_require__(25); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_geometry_Quads__ = __webpack_require__(163); - - - - - -var firstNotNull = __WEBPACK_IMPORTED_MODULE_2__util_retrieve__["a" /* default */].firstNotNull; - -var dimIndicesMap = { - // Left to right - x: 0, - // Far to near - y: 2, - // Bottom to up - z: 1 -}; - -function updateFacePlane(node, plane, otherAxis, dir) { - var coord = [0, 0, 0]; - var distance = dir < 0 ? otherAxis.getExtentMin() : otherAxis.getExtentMax(); - coord[dimIndicesMap[otherAxis.dim]] = distance; - node.position.setArray(coord); - node.rotation.identity(); - - // Negative distance because on the opposite of normal direction. - plane.distance = -Math.abs(distance); - plane.normal.set(0, 0, 0); - if (otherAxis.dim === 'x') { - node.rotation.rotateY(dir * Math.PI / 2); - plane.normal.x = -dir; - } - else if (otherAxis.dim === 'z') { - node.rotation.rotateX(-dir * Math.PI / 2); - plane.normal.y = -dir; - } - else { - if (dir > 0) { - node.rotation.rotateY(Math.PI); - } - plane.normal.z = -dir; - } -} - - -function Grid3DFace(faceInfo, linesMaterial, quadsMaterial) { - this.rootNode = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Node(); - - var linesMesh = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Mesh({ - geometry: new __WEBPACK_IMPORTED_MODULE_3__util_geometry_Lines3D__["a" /* default */]({ useNativeLine: false }), - material: linesMaterial, - castShadow: false, - ignorePicking: true, - $ignorePicking: true, - renderOrder: 1 - }); - var quadsMesh = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Mesh({ - geometry: new __WEBPACK_IMPORTED_MODULE_4__util_geometry_Quads__["a" /* default */](), - material: quadsMaterial, - castShadow: false, - culling: false, - ignorePicking: true, - $ignorePicking: true, - renderOrder: 0 - }); - // Quads are behind lines. - this.rootNode.add(quadsMesh); - this.rootNode.add(linesMesh); - - this.faceInfo = faceInfo; - this.plane =new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Plane(); - this.linesMesh =linesMesh; - this.quadsMesh =quadsMesh; -} - -Grid3DFace.prototype.update = function (grid3DModel, ecModel, api) { - var cartesian = grid3DModel.coordinateSystem; - var axes = [ - cartesian.getAxis(this.faceInfo[0]), - cartesian.getAxis(this.faceInfo[1]) - ]; - var lineGeometry = this.linesMesh.geometry; - var quadsGeometry = this.quadsMesh.geometry; - - lineGeometry.convertToDynamicArray(true); - quadsGeometry.convertToDynamicArray(true); - this._updateSplitLines(lineGeometry, axes, grid3DModel, api); - this._udpateSplitAreas(quadsGeometry, axes, grid3DModel, api); - lineGeometry.convertToTypedArray(); - quadsGeometry.convertToTypedArray(); - - - var otherAxis = cartesian.getAxis(this.faceInfo[2]); - updateFacePlane(this.rootNode, this.plane, otherAxis, this.faceInfo[3]); -}; - -Grid3DFace.prototype._updateSplitLines = function (geometry, axes, grid3DModel, api) { - var dpr = api.getDevicePixelRatio(); - axes.forEach(function (axis, idx) { - var axisModel = axis.model; - var otherExtent = axes[1 - idx].getExtent(); - - if (axis.scale.isBlank()) { - return; - } - - var splitLineModel = axisModel.getModel('splitLine', grid3DModel.getModel('splitLine')); - // Render splitLines - if (splitLineModel.get('show')) { - var lineStyleModel = splitLineModel.getModel('lineStyle'); - var lineColors = lineStyleModel.get('color'); - var opacity = firstNotNull(lineStyleModel.get('opacity'), 1.0); - var lineWidth = firstNotNull(lineStyleModel.get('width'), 1.0); - - lineColors = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.isArray(lineColors) ? lineColors : [lineColors]; - - var ticksCoords = axis.getTicksCoords({ - tickModel: splitLineModel - }); - - var count = 0; - for (var i = 0; i < ticksCoords.length; i++) { - var tickCoord = ticksCoords[i].coord; - var lineColor = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor(lineColors[count % lineColors.length]); - lineColor[3] *= opacity; - - var p0 = [0, 0, 0]; var p1 = [0, 0, 0]; - // 0 - x, 1 - y - p0[idx] = p1[idx] = tickCoord; - p0[1 - idx] = otherExtent[0]; - p1[1 - idx] = otherExtent[1]; - - geometry.addLine(p0, p1, lineColor, lineWidth * dpr); - - count++; - } - } - }); -}; - -Grid3DFace.prototype._udpateSplitAreas = function (geometry, axes, grid3DModel, api) { - axes.forEach(function (axis, idx) { - var axisModel = axis.model; - var otherExtent = axes[1 - idx].getExtent(); - - if (axis.scale.isBlank()) { - return; - } - - var splitAreaModel = axisModel.getModel('splitArea', grid3DModel.getModel('splitArea')); - // Render splitAreas - if (splitAreaModel.get('show')) { - var areaStyleModel = splitAreaModel.getModel('areaStyle'); - var colors = areaStyleModel.get('color'); - var opacity = firstNotNull(areaStyleModel.get('opacity'), 1.0); - - colors = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.isArray(colors) ? colors : [colors]; - - var ticksCoords = axis.getTicksCoords({ - tickModel: splitAreaModel, - clamp: true - }); - - var count = 0; - var prevP0 = [0, 0, 0]; - var prevP1 = [0, 0, 0]; - // 0 - x, 1 - y - for (var i = 0; i < ticksCoords.length; i++) { - var tickCoord = ticksCoords[i].coord; - - var p0 = [0, 0, 0]; var p1 = [0, 0, 0]; - // 0 - x, 1 - y - p0[idx] = p1[idx] = tickCoord; - p0[1 - idx] = otherExtent[0]; - p1[1 - idx] = otherExtent[1]; - - if (i === 0) { - prevP0 = p0; - prevP1 = p1; - continue; - } - - var color = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor(colors[count % colors.length]); - color[3] *= opacity; - geometry.addQuad([prevP0, p0, p1, prevP1], color); - - prevP0 = p0; - prevP1 = p1; - - count++; - } - } - }); -}; - -/* harmony default export */ __webpack_exports__["a"] = (Grid3DFace); - -/***/ }), -/* 163 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_claygl_src_Geometry__ = __webpack_require__(15); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__dynamicConvertMixin__ = __webpack_require__(38); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_claygl_src_dep_glmatrix__ = __webpack_require__(6); -/** - * @module echarts-gl/util/geometry/QuadsGeometry - * @author Yi Shen(http://github.com/pissang) - */ - - - - - -var vec3 = __WEBPACK_IMPORTED_MODULE_3_claygl_src_dep_glmatrix__["a" /* default */].vec3; - -/** - * @constructor - * @alias module:echarts-gl/util/geometry/QuadsGeometry - * @extends clay.Geometry - */ - -var QuadsGeometry = __WEBPACK_IMPORTED_MODULE_0_claygl_src_Geometry__["a" /* default */].extend(function () { - return { - - segmentScale: 1, - - /** - * Need to use mesh to expand lines if lineWidth > MAX_LINE_WIDTH - */ - useNativeLine: true, - - attributes: { - position: new __WEBPACK_IMPORTED_MODULE_0_claygl_src_Geometry__["a" /* default */].Attribute('position', 'float', 3, 'POSITION'), - normal: new __WEBPACK_IMPORTED_MODULE_0_claygl_src_Geometry__["a" /* default */].Attribute('normal', 'float', 3, 'NORMAL'), - color: new __WEBPACK_IMPORTED_MODULE_0_claygl_src_Geometry__["a" /* default */].Attribute('color', 'float', 4, 'COLOR') - } - }; -}, -/** @lends module: echarts-gl/util/geometry/QuadsGeometry.prototype */ -{ - - /** - * Reset offset - */ - resetOffset: function () { - this._vertexOffset = 0; - this._faceOffset = 0; - }, - - /** - * @param {number} nQuad - */ - setQuadCount: function (nQuad) { - var attributes = this.attributes; - var vertexCount = this.getQuadVertexCount() * nQuad; - var triangleCount = this.getQuadTriangleCount() * nQuad; - if (this.vertexCount !== vertexCount) { - attributes.position.init(vertexCount); - attributes.normal.init(vertexCount); - attributes.color.init(vertexCount); - } - if (this.triangleCount !== triangleCount) { - this.indices = vertexCount > 0xffff ? new Uint32Array(triangleCount * 3) : new Uint16Array(triangleCount * 3); - } - }, - - getQuadVertexCount: function () { - return 4; - }, - - getQuadTriangleCount: function () { - return 2; - }, - - /** - * Add a quad, which in following order: - * 0-----1 - * 3-----2 - */ - addQuad: (function () { - var a = vec3.create(); - var b = vec3.create(); - var normal = vec3.create(); - var indices = [0, 3, 1, 3, 2, 1]; - return function (coords, color) { - var positionAttr = this.attributes.position; - var normalAttr = this.attributes.normal; - var colorAttr = this.attributes.color; - - vec3.sub(a, coords[1], coords[0]); - vec3.sub(b, coords[2], coords[1]); - vec3.cross(normal, a, b); - vec3.normalize(normal, normal); - - for (var i = 0; i < 4; i++) { - positionAttr.set(this._vertexOffset + i, coords[i]); - colorAttr.set(this._vertexOffset + i, color); - normalAttr.set(this._vertexOffset + i, normal); - } - var idx = this._faceOffset * 3; - for (var i = 0; i < 6; i++) { - this.indices[idx + i] = indices[i] + this._vertexOffset; - } - this._vertexOffset += 4; - this._faceOffset += 2; - }; - })() -}); - -__WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts___default.a.util.defaults(QuadsGeometry.prototype, __WEBPACK_IMPORTED_MODULE_2__dynamicConvertMixin__["a" /* default */]); - -/* harmony default export */ __webpack_exports__["a"] = (QuadsGeometry); - -/***/ }), -/* 164 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_geometry_Lines3D__ = __webpack_require__(25); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_retrieve__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_mesh_LabelsMesh__ = __webpack_require__(63); - - - - - -var firstNotNull = __WEBPACK_IMPORTED_MODULE_3__util_retrieve__["a" /* default */].firstNotNull; - -var dimIndicesMap = { - // Left to right - x: 0, - // Far to near - y: 2, - // Bottom to up - z: 1 -}; - -function Grid3DAxis(dim, linesMaterial) { - var linesMesh = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Mesh({ - geometry: new __WEBPACK_IMPORTED_MODULE_2__util_geometry_Lines3D__["a" /* default */]({ useNativeLine: false }), - material: linesMaterial, - castShadow: false, - ignorePicking: true, renderOrder: 2 - }); - var axisLabelsMesh = new __WEBPACK_IMPORTED_MODULE_4__util_mesh_LabelsMesh__["a" /* default */](); - axisLabelsMesh.material.depthMask = false; - - var rootNode = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Node(); - rootNode.add(linesMesh); - rootNode.add(axisLabelsMesh); - - this.rootNode = rootNode; - this.dim = dim; - - this.linesMesh = linesMesh; - this.labelsMesh = axisLabelsMesh; - this.axisLineCoords = null; - this.labelElements = []; -} - -var otherDim = { - x: 'y', y: 'x', z: 'y' -}; -Grid3DAxis.prototype.update = function ( - grid3DModel, axisLabelSurface, api -) { - var cartesian = grid3DModel.coordinateSystem; - var axis = cartesian.getAxis(this.dim); - - var linesGeo = this.linesMesh.geometry; - var labelsGeo = this.labelsMesh.geometry; - linesGeo.convertToDynamicArray(true); - labelsGeo.convertToDynamicArray(true); - var axisModel = axis.model; - var extent = axis.getExtent(); - - var dpr = api.getDevicePixelRatio(); - var axisLineModel = axisModel.getModel('axisLine', grid3DModel.getModel('axisLine')); - var axisTickModel = axisModel.getModel('axisTick', grid3DModel.getModel('axisTick')); - var axisLabelModel = axisModel.getModel('axisLabel', grid3DModel.getModel('axisLabel')); - var axisLineColor = axisLineModel.get('lineStyle.color'); - // Render axisLine - if (axisLineModel.get('show')) { - var axisLineStyleModel = axisLineModel.getModel('lineStyle'); - var p0 = [0, 0, 0]; var p1 = [0, 0, 0]; - var idx = dimIndicesMap[axis.dim]; - p0[idx] = extent[0]; - p1[idx] = extent[1]; - - // Save some useful info. - this.axisLineCoords =[p0, p1]; - - var color = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor(axisLineColor); - var lineWidth = firstNotNull(axisLineStyleModel.get('width'), 1.0); - var opacity = firstNotNull(axisLineStyleModel.get('opacity'), 1.0); - color[3] *= opacity; - linesGeo.addLine(p0, p1, color, lineWidth * dpr); - } - // Render axis ticksCoords - if (axisTickModel.get('show')) { - var lineStyleModel = axisTickModel.getModel('lineStyle'); - var lineColor = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor( - firstNotNull(lineStyleModel.get('color'), axisLineColor) - ); - var lineWidth = firstNotNull(lineStyleModel.get('width'), 1.0); - lineColor[3] *= firstNotNull(lineStyleModel.get('opacity'), 1.0); - var ticksCoords = axis.getTicksCoords(); - var tickLength = axisTickModel.get('length'); - - for (var i = 0; i < ticksCoords.length; i++) { - var tickCoord = ticksCoords[i].coord; - - var p0 = [0, 0, 0]; var p1 = [0, 0, 0]; - var idx = dimIndicesMap[axis.dim]; - var otherIdx = dimIndicesMap[otherDim[axis.dim]]; - // 0 : x, 1 : y - p0[idx] = p1[idx] = tickCoord; - p1[otherIdx] = tickLength; - - linesGeo.addLine(p0, p1, lineColor, lineWidth * dpr); - } - } - - this.labelElements = []; - var dpr = api.getDevicePixelRatio(); - if (axisLabelModel.get('show')) { - var ticksCoords = axis.getTicksCoords(); - var categoryData = axisModel.get('data'); - - var labelMargin = axisLabelModel.get('margin'); - var labels = axis.getViewLabels(); - - for (var i = 0; i < labels.length; i++) { - var tickValue = labels[i].tickValue; - var formattedLabel = labels[i].formattedLabel; - var rawLabel = labels[i].rawLabel; - - var tickCoord = axis.dataToCoord(tickValue); - - var p = [0, 0, 0]; - var idx = dimIndicesMap[axis.dim]; - var otherIdx = dimIndicesMap[otherDim[axis.dim]]; - // 0 : x, 1 : y - p[idx] = p[idx] = tickCoord; - p[otherIdx] = labelMargin; - - var itemTextStyleModel = axisLabelModel; - if (categoryData && categoryData[tickValue] && categoryData[tickValue].textStyle) { - itemTextStyleModel = new __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.Model( - categoryData[tickValue].textStyle, axisLabelModel, axisModel.ecModel - ); - } - var textColor = firstNotNull(itemTextStyleModel.get('color'), axisLineColor); - - var textEl = new __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.graphic.Text(); - __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.graphic.setTextStyle(textEl.style, itemTextStyleModel, { - text: formattedLabel, - textFill: typeof textColor === 'function' - ? textColor( - // (1) In category axis with data zoom, tick is not the original - // index of axis.data. So tick should not be exposed to user - // in category axis. - // (2) Compatible with previous version, which always returns labelStr. - // But in interval scale labelStr is like '223,445', which maked - // user repalce ','. So we modify it to return original val but remain - // it as 'string' to avoid error in replacing. - axis.type === 'category' ? rawLabel : axis.type === 'value' ? tickValue + '' : tickValue, - i - ) - : textColor, - textVerticalAlign: 'top', - textAlign: 'left' - }); - var coords = axisLabelSurface.add(textEl); - var rect = textEl.getBoundingRect(); - labelsGeo.addSprite(p, [rect.width * dpr, rect.height * dpr], coords); - - this.labelElements.push(textEl); - } - } - - if (axisModel.get('name')) { - var nameTextStyleModel = axisModel.getModel('nameTextStyle'); - var p = [0, 0, 0]; - var idx = dimIndicesMap[axis.dim]; - var otherIdx = dimIndicesMap[otherDim[axis.dim]]; - var labelColor = firstNotNull(nameTextStyleModel.get('color'), axisLineColor); - var strokeColor = nameTextStyleModel.get('borderColor'); - var lineWidth = nameTextStyleModel.get('borderWidth'); - // TODO start and end - p[idx] = p[idx] = (extent[0] + extent[1]) / 2; - p[otherIdx] = axisModel.get('nameGap'); - - var textEl = new __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.graphic.Text(); - __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.graphic.setTextStyle(textEl.style, nameTextStyleModel, { - text: axisModel.get('name'), - textFill: labelColor, - textStroke: strokeColor, - lineWidth: lineWidth - }); - var coords = axisLabelSurface.add(textEl); - var rect = textEl.getBoundingRect(); - labelsGeo.addSprite(p, [rect.width * dpr, rect.height * dpr], coords); - - textEl.__idx = this.labelElements.length; - this.nameLabelElement = textEl; - } - - this.labelsMesh.material.set('textureAtlas', axisLabelSurface.getTexture()); - this.labelsMesh.material.set('uvScale', axisLabelSurface.getCoordsScale()); - - linesGeo.convertToTypedArray(); - labelsGeo.convertToTypedArray(); -}; - -Grid3DAxis.prototype.setSpriteAlign = function (textAlign, textVerticalAlign, api) { - var dpr = api.getDevicePixelRatio(); - var labelGeo = this.labelsMesh.geometry; - for (var i = 0; i < this.labelElements.length; i++) { - var labelEl = this.labelElements[i]; - var rect = labelEl.getBoundingRect(); - - labelGeo.setSpriteAlign(i, [rect.width * dpr, rect.height * dpr], textAlign, textVerticalAlign); - } - // name label - var nameLabelEl = this.nameLabelElement; - if (nameLabelEl) { - var rect = nameLabelEl.getBoundingRect(); - labelGeo.setSpriteAlign(nameLabelEl.__idx, [rect.width * dpr, rect.height * dpr], textAlign, textVerticalAlign); - labelGeo.dirty(); - } - - this.textAlign = textAlign; - this.textVerticalAlign = textVerticalAlign; -}; - -/* harmony default export */ __webpack_exports__["a"] = (Grid3DAxis); - -/***/ }), -/* 165 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_claygl_src_Geometry__ = __webpack_require__(15); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__dynamicConvertMixin__ = __webpack_require__(38); -/** - * Geometry collecting sprites - * - * @module echarts-gl/util/geometry/Sprites - * @author Yi Shen(https://github.com/pissang) - */ - - - - -var squareTriangles = [ - 0, 1, 2, 0, 2, 3 -]; - -var SpritesGeometry = __WEBPACK_IMPORTED_MODULE_1_claygl_src_Geometry__["a" /* default */].extend(function () { - return { - attributes: { - position: new __WEBPACK_IMPORTED_MODULE_1_claygl_src_Geometry__["a" /* default */].Attribute('position', 'float', 3, 'POSITION'), - texcoord: new __WEBPACK_IMPORTED_MODULE_1_claygl_src_Geometry__["a" /* default */].Attribute('texcoord', 'float', 2, 'TEXCOORD_0'), - offset: new __WEBPACK_IMPORTED_MODULE_1_claygl_src_Geometry__["a" /* default */].Attribute('offset', 'float', 2), - color: new __WEBPACK_IMPORTED_MODULE_1_claygl_src_Geometry__["a" /* default */].Attribute('color', 'float', 4, 'COLOR') - } - }; -}, { - resetOffset: function () { - this._vertexOffset = 0; - this._faceOffset = 0; - }, - setSpriteCount: function (spriteCount) { - this._spriteCount = spriteCount; - - var vertexCount = spriteCount * 4; - var triangleCount = spriteCount * 2; - - if (this.vertexCount !== vertexCount) { - this.attributes.position.init(vertexCount); - this.attributes.offset.init(vertexCount); - this.attributes.color.init(vertexCount); - } - if (this.triangleCount !== triangleCount) { - this.indices = vertexCount > 0xffff ? new Uint32Array(triangleCount * 3) : new Uint16Array(triangleCount * 3); - } - }, - - setSpriteAlign: function (spriteOffset, size, align, verticalAlign, margin) { - if (align == null) { - align = 'left'; - } - if (verticalAlign == null) { - verticalAlign = 'top'; - } - - var leftOffset, topOffset, rightOffset, bottomOffset; - margin = margin || 0; - switch (align) { - case 'left': - leftOffset = margin; - rightOffset = size[0] + margin; - break; - case 'center': - case 'middle': - leftOffset = -size[0] / 2; - rightOffset = size[0] / 2; - break; - case 'right': - leftOffset = -size[0] - margin; - rightOffset = -margin; - break; - } - switch (verticalAlign) { - case 'bottom': - topOffset = margin; - bottomOffset = size[1] + margin; - break; - case 'middle': - topOffset = -size[1] / 2; - bottomOffset = size[1] / 2; - break; - case 'top': - topOffset = -size[1] - margin; - bottomOffset = -margin; - break; - } - // 3----2 - // 0----1 - var vertexOffset = spriteOffset * 4; - var offsetAttr = this.attributes.offset; - offsetAttr.set(vertexOffset, [leftOffset, bottomOffset]); - offsetAttr.set(vertexOffset + 1, [rightOffset, bottomOffset]); - offsetAttr.set(vertexOffset + 2, [rightOffset, topOffset]); - offsetAttr.set(vertexOffset + 3, [leftOffset, topOffset]); - }, - /** - * Add sprite - * @param {Array.} position - * @param {Array.} size [width, height] - * @param {Array.} coords [leftBottom, rightTop] - * @param {string} [align='left'] 'left' 'center' 'right' - * @param {string} [verticalAlign='top'] 'top' 'middle' 'bottom' - * @param {number} [screenMargin=0] - */ - addSprite: function (position, size, coords, align, verticalAlign, screenMargin) { - var vertexOffset = this._vertexOffset; - this.setSprite( - this._vertexOffset / 4, position, size, coords, align, verticalAlign, screenMargin - ) - for (var i = 0; i < squareTriangles.length; i++) { - this.indices[this._faceOffset * 3 + i] = squareTriangles[i] + vertexOffset; - } - this._faceOffset += 2; - this._vertexOffset += 4; - - return vertexOffset / 4; - }, - - setSprite: function (spriteOffset, position, size, coords, align, verticalAlign, screenMargin) { - var vertexOffset = spriteOffset * 4; - - var attributes = this.attributes; - for (var i = 0; i < 4; i++) { - attributes.position.set(vertexOffset + i, position); - } - // 3----2 - // 0----1 - var texcoordAttr = attributes.texcoord; - - texcoordAttr.set(vertexOffset, [coords[0][0], coords[0][1]]); - texcoordAttr.set(vertexOffset + 1, [coords[1][0], coords[0][1]]); - texcoordAttr.set(vertexOffset + 2, [coords[1][0], coords[1][1]]); - texcoordAttr.set(vertexOffset + 3, [coords[0][0], coords[1][1]]); - - this.setSpriteAlign(spriteOffset, size, align, verticalAlign, screenMargin); - } -}); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.defaults(SpritesGeometry.prototype, __WEBPACK_IMPORTED_MODULE_2__dynamicConvertMixin__["a" /* default */]); - -/* harmony default export */ __webpack_exports__["a"] = (SpritesGeometry); - -/***/ }), -/* 166 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export ecgl.labels.vertex\n\nattribute vec3 position: POSITION;\nattribute vec2 texcoord: TEXCOORD_0;\nattribute vec2 offset;\n#ifdef VERTEX_COLOR\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n#endif\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform vec4 viewport : VIEWPORT;\n\nvarying vec2 v_Texcoord;\n\nvoid main()\n{\n vec4 proj = worldViewProjection * vec4(position, 1.0);\n\n vec2 screen = (proj.xy / abs(proj.w) + 1.0) * 0.5 * viewport.zw;\n\n screen += offset;\n\n proj.xy = (screen / viewport.zw - 0.5) * 2.0 * abs(proj.w);\n gl_Position = proj;\n#ifdef VERTEX_COLOR\n v_Color = a_Color;\n#endif\n v_Texcoord = texcoord;\n}\n@end\n\n\n@export ecgl.labels.fragment\n\nuniform vec3 color : [1.0, 1.0, 1.0];\nuniform float alpha : 1.0;\nuniform sampler2D textureAtlas;\nuniform vec2 uvScale: [1.0, 1.0];\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\nvarying float v_Miter;\n\nvarying vec2 v_Texcoord;\n\nvoid main()\n{\n gl_FragColor = vec4(color, alpha) * texture2D(textureAtlas, v_Texcoord * uvScale);\n#ifdef VERTEX_COLOR\n gl_FragColor *= v_Color;\n#endif\n}\n\n@end"); - - -/***/ }), -/* 167 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__grid3D_Cartesian3D__ = __webpack_require__(168); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__grid3D_Axis3D__ = __webpack_require__(170); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_echarts_lib_util_layout__ = __webpack_require__(47); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_echarts_lib_util_layout___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_echarts_lib_util_layout__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__core_ViewGL__ = __webpack_require__(22); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__util_retrieve__ = __webpack_require__(2); - - - - - - - -function resizeCartesian3D(grid3DModel, api) { - // Use left/top/width/height - var boxLayoutOption = grid3DModel.getBoxLayoutParams(); - - var viewport = __WEBPACK_IMPORTED_MODULE_3_echarts_lib_util_layout___default.a.getLayoutRect(boxLayoutOption, { - width: api.getWidth(), - height: api.getHeight() - }); - - // Flip Y - viewport.y = api.getHeight() - viewport.y - viewport.height; - - this.viewGL.setViewport(viewport.x, viewport.y, viewport.width, viewport.height, api.getDevicePixelRatio()); - - var boxWidth = grid3DModel.get('boxWidth'); - var boxHeight = grid3DModel.get('boxHeight'); - var boxDepth = grid3DModel.get('boxDepth'); - - if (true) { - ['x', 'y', 'z'].forEach(function (dim) { - if (!this.getAxis(dim)) { - throw new Error('Grid' + grid3DModel.id + ' don\'t have ' + dim + 'Axis'); - } - }, this); - } - this.getAxis('x').setExtent(-boxWidth / 2, boxWidth / 2); - // From near to far - this.getAxis('y').setExtent(boxDepth / 2, -boxDepth / 2); - this.getAxis('z').setExtent(-boxHeight / 2, boxHeight / 2); - - this.size = [boxWidth, boxHeight, boxDepth]; -} - -function updateCartesian3D(ecModel, api) { - var dataExtents = {}; - function unionDataExtents(dim, extent) { - dataExtents[dim] = dataExtents[dim] || [Infinity, -Infinity]; - dataExtents[dim][0] = Math.min(extent[0], dataExtents[dim][0]); - dataExtents[dim][1] = Math.max(extent[1], dataExtents[dim][1]); - } - // Get data extents for scale. - ecModel.eachSeries(function (seriesModel) { - if (seriesModel.coordinateSystem !== this) { - return; - } - var data = seriesModel.getData(); - ['x', 'y', 'z'].forEach(function (coordDim) { - data.mapDimension(coordDim, true).forEach(function (dataDim) { - unionDataExtents( - coordDim, data.getDataExtent(dataDim, true) - ); - }); - }); - }, this); - - ['xAxis3D', 'yAxis3D', 'zAxis3D'].forEach(function (axisType) { - ecModel.eachComponent(axisType, function (axisModel) { - var dim = axisType.charAt(0); - var grid3DModel = axisModel.getReferringComponents('grid3D')[0]; - - var cartesian3D = grid3DModel.coordinateSystem; - if (cartesian3D !== this) { - return; - } - - var axis = cartesian3D.getAxis(dim); - if (axis) { - if (true) { - console.warn('Can\'t have two %s in one grid3D', axisType); - } - return; - } - var scale = __WEBPACK_IMPORTED_MODULE_2_echarts_lib_echarts___default.a.helper.createScale( - dataExtents[dim] || [Infinity, -Infinity], axisModel - ); - axis = new __WEBPACK_IMPORTED_MODULE_1__grid3D_Axis3D__["a" /* default */](dim, scale); - axis.type = axisModel.get('type'); - var isCategory = axis.type === 'category'; - axis.onBand = isCategory && axisModel.get('boundaryGap'); - axis.inverse = axisModel.get('inverse'); - - axisModel.axis = axis; - axis.model = axisModel; - - // override `echarts/coord/Axis#getLabelModel` - axis.getLabelModel = function () { - return axisModel.getModel('axisLabel', grid3DModel.getModel('axisLabel')); - }; - // override `echarts/coord/Axis#getTickModel` - axis.getTickModel = function () { - return axisModel.getModel('axisTick', grid3DModel.getModel('axisTick')); - }; - - cartesian3D.addAxis(axis); - }, this); - }, this); - - this.resize(this.model, api); -} - -var grid3DCreator = { - - dimensions: __WEBPACK_IMPORTED_MODULE_0__grid3D_Cartesian3D__["a" /* default */].prototype.dimensions, - - create: function (ecModel, api) { - - var cartesian3DList = []; - - ecModel.eachComponent('grid3D', function (grid3DModel) { - // FIXME - grid3DModel.__viewGL = grid3DModel.__viewGL || new __WEBPACK_IMPORTED_MODULE_4__core_ViewGL__["a" /* default */](); - - var cartesian3D = new __WEBPACK_IMPORTED_MODULE_0__grid3D_Cartesian3D__["a" /* default */](); - cartesian3D.model = grid3DModel; - cartesian3D.viewGL = grid3DModel.__viewGL; - - grid3DModel.coordinateSystem = cartesian3D; - cartesian3DList.push(cartesian3D); - - // Inject resize and update - cartesian3D.resize = resizeCartesian3D; - - cartesian3D.update = updateCartesian3D; - }); - - var axesTypes = ['xAxis3D', 'yAxis3D', 'zAxis3D']; - function findAxesModels(seriesModel, ecModel) { - return axesTypes.map(function (axisType) { - var axisModel = seriesModel.getReferringComponents(axisType)[0]; - if (axisModel == null) { - axisModel = ecModel.getComponent(axisType); - } - if (true) { - if (!axisModel) { - throw new Error(axisType + ' "' + __WEBPACK_IMPORTED_MODULE_5__util_retrieve__["a" /* default */].firstNotNull( - seriesModel.get(axisType + 'Index'), - seriesModel.get(axisType + 'Id'), - 0 - ) + '" not found'); - } - } - return axisModel; - }); - } - - ecModel.eachSeries(function (seriesModel) { - if (seriesModel.get('coordinateSystem') !== 'cartesian3D') { - return; - } - var firstGridModel = seriesModel.getReferringComponents('grid3D')[0]; - - if (firstGridModel == null) { - var axesModels = findAxesModels(seriesModel, ecModel); - var firstGridModel = axesModels[0].getCoordSysModel(); - axesModels.forEach(function (axisModel) { - var grid3DModel = axisModel.getCoordSysModel(); - if (true) { - if (!grid3DModel) { - throw new Error( - 'grid3D "' + __WEBPACK_IMPORTED_MODULE_5__util_retrieve__["a" /* default */].firstNotNull( - axisModel.get('gridIndex'), - axisModel.get('gridId'), - 0 - ) + '" not found' - ); - } - if (grid3DModel !== firstGridModel) { - throw new Error('xAxis3D, yAxis3D, zAxis3D must use the same grid'); - } - } - }); - } - - var coordSys = firstGridModel.coordinateSystem; - seriesModel.coordinateSystem = coordSys; - }); - - return cartesian3DList; - } -}; - -__WEBPACK_IMPORTED_MODULE_2_echarts_lib_echarts___default.a.registerCoordinateSystem('grid3D', grid3DCreator); - -/* unused harmony default export */ var _unused_webpack_default_export = (grid3DCreator); - -/***/ }), -/* 168 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_echarts_lib_coord_cartesian_Cartesian__ = __webpack_require__(169); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_echarts_lib_coord_cartesian_Cartesian___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_echarts_lib_coord_cartesian_Cartesian__); - - - -function Cartesian3D(name) { - - __WEBPACK_IMPORTED_MODULE_1_echarts_lib_coord_cartesian_Cartesian___default.a.call(this, name); - - this.size = [0, 0, 0]; -} - -Cartesian3D.prototype = { - - constructor: Cartesian3D, - - type: 'cartesian3D', - - dimensions: ['x', 'y', 'z'], - - model: null, - - containPoint: function (point) { - return this.getAxis('x').contain(point[0]) - && this.getAxis('y').contain(point[2]) - && this.getAxis('z').contain(point[1]); - }, - - containData: function (data) { - return this.getAxis('x').containData(data[0]) - && this.getAxis('y').containData(data[1]) - && this.getAxis('z').containData(data[2]); - }, - - dataToPoint: function (data, out, clamp) { - out = out || []; - out[0] = this.getAxis('x').dataToCoord(data[0], clamp); - out[2] = this.getAxis('y').dataToCoord(data[1], clamp); - out[1] = this.getAxis('z').dataToCoord(data[2], clamp); - return out; - }, - - pointToData: function (point, out, clamp) { - out = out || []; - out[0] = this.getAxis('x').coordToData(point[0], clamp); - out[1] = this.getAxis('y').coordToData(point[2], clamp); - out[2] = this.getAxis('z').coordToData(point[1], clamp); - return out; - } -}; - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.inherits(Cartesian3D, __WEBPACK_IMPORTED_MODULE_1_echarts_lib_coord_cartesian_Cartesian___default.a); - -/* harmony default export */ __webpack_exports__["a"] = (Cartesian3D); - -/***/ }), -/* 169 */ -/***/ (function(module, exports, __webpack_require__) { - -var zrUtil = __webpack_require__(13); - -/* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -*/ - -/** - * Cartesian coordinate system - * @module echarts/coord/Cartesian - * - */ -function dimAxisMapper(dim) { - return this._axes[dim]; -} -/** - * @alias module:echarts/coord/Cartesian - * @constructor - */ - - -var Cartesian = function (name) { - this._axes = {}; - this._dimList = []; - /** - * @type {string} - */ - - this.name = name || ''; -}; - -Cartesian.prototype = { - constructor: Cartesian, - type: 'cartesian', - - /** - * Get axis - * @param {number|string} dim - * @return {module:echarts/coord/Cartesian~Axis} - */ - getAxis: function (dim) { - return this._axes[dim]; - }, - - /** - * Get axes list - * @return {Array.} - */ - getAxes: function () { - return zrUtil.map(this._dimList, dimAxisMapper, this); - }, - - /** - * Get axes list by given scale type - */ - getAxesByScale: function (scaleType) { - scaleType = scaleType.toLowerCase(); - return zrUtil.filter(this.getAxes(), function (axis) { - return axis.scale.type === scaleType; - }); - }, - - /** - * Add axis - * @param {module:echarts/coord/Cartesian.Axis} - */ - addAxis: function (axis) { - var dim = axis.dim; - this._axes[dim] = axis; - - this._dimList.push(dim); - }, - - /** - * Convert data to coord in nd space - * @param {Array.|Object.} val - * @return {Array.|Object.} - */ - dataToCoord: function (val) { - return this._dataCoordConvert(val, 'dataToCoord'); - }, - - /** - * Convert coord in nd space to data - * @param {Array.|Object.} val - * @return {Array.|Object.} - */ - coordToData: function (val) { - return this._dataCoordConvert(val, 'coordToData'); - }, - _dataCoordConvert: function (input, method) { - var dimList = this._dimList; - var output = input instanceof Array ? [] : {}; - - for (var i = 0; i < dimList.length; i++) { - var dim = dimList[i]; - var axis = this._axes[dim]; - output[dim] = axis[method](input[dim]); - } - - return output; - } -}; -var _default = Cartesian; -module.exports = _default; - -/***/ }), -/* 170 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); - - -function Axis3D(dim, scale, extent) { - - __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.Axis.call(this, dim, scale, extent); -} - -Axis3D.prototype = { - constructor: Axis3D, - - getExtentMin: function () { - var extent = this._extent; - return Math.min(extent[0], extent[1]); - }, - - getExtentMax: function () { - var extent = this._extent; - return Math.max(extent[0], extent[1]); - }, - - calculateCategoryInterval: function () { - // TODO consider label length - return Math.floor(this.scale.count() / 8); - } -}; - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.inherits(Axis3D, __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.Axis); - -/* harmony default export */ __webpack_exports__["a"] = (Axis3D); - -/***/ }), -/* 171 */ -/***/ (function(module, exports, __webpack_require__) { - -var zrUtil = __webpack_require__(13); - -var textContain = __webpack_require__(172); - -var numberUtil = __webpack_require__(85); - -/* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -*/ - -/** - * 每三位默认加,格式化 - * @param {string|number} x - * @return {string} - */ -function addCommas(x) { - if (isNaN(x)) { - return '-'; - } - - x = (x + '').split('.'); - return x[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g, '$1,') + (x.length > 1 ? '.' + x[1] : ''); -} -/** - * @param {string} str - * @param {boolean} [upperCaseFirst=false] - * @return {string} str - */ - - -function toCamelCase(str, upperCaseFirst) { - str = (str || '').toLowerCase().replace(/-(.)/g, function (match, group1) { - return group1.toUpperCase(); - }); - - if (upperCaseFirst && str) { - str = str.charAt(0).toUpperCase() + str.slice(1); - } - - return str; -} - -var normalizeCssArray = zrUtil.normalizeCssArray; -var replaceReg = /([&<>"'])/g; -var replaceMap = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - '\'': ''' -}; - -function encodeHTML(source) { - return source == null ? '' : (source + '').replace(replaceReg, function (str, c) { - return replaceMap[c]; - }); -} - -var TPL_VAR_ALIAS = ['a', 'b', 'c', 'd', 'e', 'f', 'g']; - -var wrapVar = function (varName, seriesIdx) { - return '{' + varName + (seriesIdx == null ? '' : seriesIdx) + '}'; -}; -/** - * Template formatter - * @param {string} tpl - * @param {Array.|Object} paramsList - * @param {boolean} [encode=false] - * @return {string} - */ - - -function formatTpl(tpl, paramsList, encode) { - if (!zrUtil.isArray(paramsList)) { - paramsList = [paramsList]; - } - - var seriesLen = paramsList.length; - - if (!seriesLen) { - return ''; - } - - var $vars = paramsList[0].$vars || []; - - for (var i = 0; i < $vars.length; i++) { - var alias = TPL_VAR_ALIAS[i]; - tpl = tpl.replace(wrapVar(alias), wrapVar(alias, 0)); - } - - for (var seriesIdx = 0; seriesIdx < seriesLen; seriesIdx++) { - for (var k = 0; k < $vars.length; k++) { - var val = paramsList[seriesIdx][$vars[k]]; - tpl = tpl.replace(wrapVar(TPL_VAR_ALIAS[k], seriesIdx), encode ? encodeHTML(val) : val); - } - } - - return tpl; -} -/** - * simple Template formatter - * - * @param {string} tpl - * @param {Object} param - * @param {boolean} [encode=false] - * @return {string} - */ - - -function formatTplSimple(tpl, param, encode) { - zrUtil.each(param, function (value, key) { - tpl = tpl.replace('{' + key + '}', encode ? encodeHTML(value) : value); - }); - return tpl; -} -/** - * @param {Object|string} [opt] If string, means color. - * @param {string} [opt.color] - * @param {string} [opt.extraCssText] - * @param {string} [opt.type='item'] 'item' or 'subItem' - * @return {string} - */ - - -function getTooltipMarker(opt, extraCssText) { - opt = zrUtil.isString(opt) ? { - color: opt, - extraCssText: extraCssText - } : opt || {}; - var color = opt.color; - var type = opt.type; - var extraCssText = opt.extraCssText; - - if (!color) { - return ''; - } - - return type === 'subItem' ? '' : ''; -} - -function pad(str, len) { - str += ''; - return '0000'.substr(0, len - str.length) + str; -} -/** - * ISO Date format - * @param {string} tpl - * @param {number} value - * @param {boolean} [isUTC=false] Default in local time. - * see `module:echarts/scale/Time` - * and `module:echarts/util/number#parseDate`. - * @inner - */ - - -function formatTime(tpl, value, isUTC) { - if (tpl === 'week' || tpl === 'month' || tpl === 'quarter' || tpl === 'half-year' || tpl === 'year') { - tpl = 'MM-dd\nyyyy'; - } - - var date = numberUtil.parseDate(value); - var utc = isUTC ? 'UTC' : ''; - var y = date['get' + utc + 'FullYear'](); - var M = date['get' + utc + 'Month']() + 1; - var d = date['get' + utc + 'Date'](); - var h = date['get' + utc + 'Hours'](); - var m = date['get' + utc + 'Minutes'](); - var s = date['get' + utc + 'Seconds'](); - var S = date['get' + utc + 'Milliseconds'](); - tpl = tpl.replace('MM', pad(M, 2)).replace('M', M).replace('yyyy', y).replace('yy', y % 100).replace('dd', pad(d, 2)).replace('d', d).replace('hh', pad(h, 2)).replace('h', h).replace('mm', pad(m, 2)).replace('m', m).replace('ss', pad(s, 2)).replace('s', s).replace('SSS', pad(S, 3)); - return tpl; -} -/** - * Capital first - * @param {string} str - * @return {string} - */ - - -function capitalFirst(str) { - return str ? str.charAt(0).toUpperCase() + str.substr(1) : str; -} - -var truncateText = textContain.truncateText; -var getTextRect = textContain.getBoundingRect; -exports.addCommas = addCommas; -exports.toCamelCase = toCamelCase; -exports.normalizeCssArray = normalizeCssArray; -exports.encodeHTML = encodeHTML; -exports.formatTpl = formatTpl; -exports.formatTplSimple = formatTplSimple; -exports.getTooltipMarker = getTooltipMarker; -exports.formatTime = formatTime; -exports.capitalFirst = capitalFirst; -exports.truncateText = truncateText; -exports.getTextRect = getTextRect; - -/***/ }), -/* 172 */ -/***/ (function(module, exports, __webpack_require__) { - -var BoundingRect = __webpack_require__(82); - -var imageHelper = __webpack_require__(173); - -var _util = __webpack_require__(13); - -var getContext = _util.getContext; -var extend = _util.extend; -var retrieve2 = _util.retrieve2; -var retrieve3 = _util.retrieve3; -var trim = _util.trim; -var textWidthCache = {}; -var textWidthCacheCounter = 0; -var TEXT_CACHE_MAX = 5000; -var STYLE_REG = /\{([a-zA-Z0-9_]+)\|([^}]*)\}/g; -var DEFAULT_FONT = '12px sans-serif'; // Avoid assign to an exported variable, for transforming to cjs. - -var methods = {}; - -function $override(name, fn) { - methods[name] = fn; -} -/** - * @public - * @param {string} text - * @param {string} font - * @return {number} width - */ - - -function getWidth(text, font) { - font = font || DEFAULT_FONT; - var key = text + ':' + font; - - if (textWidthCache[key]) { - return textWidthCache[key]; - } - - var textLines = (text + '').split('\n'); - var width = 0; - - for (var i = 0, l = textLines.length; i < l; i++) { - // textContain.measureText may be overrided in SVG or VML - width = Math.max(measureText(textLines[i], font).width, width); - } - - if (textWidthCacheCounter > TEXT_CACHE_MAX) { - textWidthCacheCounter = 0; - textWidthCache = {}; - } - - textWidthCacheCounter++; - textWidthCache[key] = width; - return width; -} -/** - * @public - * @param {string} text - * @param {string} font - * @param {string} [textAlign='left'] - * @param {string} [textVerticalAlign='top'] - * @param {Array.} [textPadding] - * @param {Object} [rich] - * @param {Object} [truncate] - * @return {Object} {x, y, width, height, lineHeight} - */ - - -function getBoundingRect(text, font, textAlign, textVerticalAlign, textPadding, rich, truncate) { - return rich ? getRichTextRect(text, font, textAlign, textVerticalAlign, textPadding, rich, truncate) : getPlainTextRect(text, font, textAlign, textVerticalAlign, textPadding, truncate); -} - -function getPlainTextRect(text, font, textAlign, textVerticalAlign, textPadding, truncate) { - var contentBlock = parsePlainText(text, font, textPadding, truncate); - var outerWidth = getWidth(text, font); - - if (textPadding) { - outerWidth += textPadding[1] + textPadding[3]; - } - - var outerHeight = contentBlock.outerHeight; - var x = adjustTextX(0, outerWidth, textAlign); - var y = adjustTextY(0, outerHeight, textVerticalAlign); - var rect = new BoundingRect(x, y, outerWidth, outerHeight); - rect.lineHeight = contentBlock.lineHeight; - return rect; -} - -function getRichTextRect(text, font, textAlign, textVerticalAlign, textPadding, rich, truncate) { - var contentBlock = parseRichText(text, { - rich: rich, - truncate: truncate, - font: font, - textAlign: textAlign, - textPadding: textPadding - }); - var outerWidth = contentBlock.outerWidth; - var outerHeight = contentBlock.outerHeight; - var x = adjustTextX(0, outerWidth, textAlign); - var y = adjustTextY(0, outerHeight, textVerticalAlign); - return new BoundingRect(x, y, outerWidth, outerHeight); -} -/** - * @public - * @param {number} x - * @param {number} width - * @param {string} [textAlign='left'] - * @return {number} Adjusted x. - */ - - -function adjustTextX(x, width, textAlign) { - // FIXME Right to left language - if (textAlign === 'right') { - x -= width; - } else if (textAlign === 'center') { - x -= width / 2; - } - - return x; -} -/** - * @public - * @param {number} y - * @param {number} height - * @param {string} [textVerticalAlign='top'] - * @return {number} Adjusted y. - */ - - -function adjustTextY(y, height, textVerticalAlign) { - if (textVerticalAlign === 'middle') { - y -= height / 2; - } else if (textVerticalAlign === 'bottom') { - y -= height; - } - - return y; -} -/** - * @public - * @param {stirng} textPosition - * @param {Object} rect {x, y, width, height} - * @param {number} distance - * @return {Object} {x, y, textAlign, textVerticalAlign} - */ - - -function adjustTextPositionOnRect(textPosition, rect, distance) { - var x = rect.x; - var y = rect.y; - var height = rect.height; - var width = rect.width; - var halfHeight = height / 2; - var textAlign = 'left'; - var textVerticalAlign = 'top'; - - switch (textPosition) { - case 'left': - x -= distance; - y += halfHeight; - textAlign = 'right'; - textVerticalAlign = 'middle'; - break; - - case 'right': - x += distance + width; - y += halfHeight; - textVerticalAlign = 'middle'; - break; - - case 'top': - x += width / 2; - y -= distance; - textAlign = 'center'; - textVerticalAlign = 'bottom'; - break; - - case 'bottom': - x += width / 2; - y += height + distance; - textAlign = 'center'; - break; - - case 'inside': - x += width / 2; - y += halfHeight; - textAlign = 'center'; - textVerticalAlign = 'middle'; - break; - - case 'insideLeft': - x += distance; - y += halfHeight; - textVerticalAlign = 'middle'; - break; - - case 'insideRight': - x += width - distance; - y += halfHeight; - textAlign = 'right'; - textVerticalAlign = 'middle'; - break; - - case 'insideTop': - x += width / 2; - y += distance; - textAlign = 'center'; - break; - - case 'insideBottom': - x += width / 2; - y += height - distance; - textAlign = 'center'; - textVerticalAlign = 'bottom'; - break; - - case 'insideTopLeft': - x += distance; - y += distance; - break; - - case 'insideTopRight': - x += width - distance; - y += distance; - textAlign = 'right'; - break; - - case 'insideBottomLeft': - x += distance; - y += height - distance; - textVerticalAlign = 'bottom'; - break; - - case 'insideBottomRight': - x += width - distance; - y += height - distance; - textAlign = 'right'; - textVerticalAlign = 'bottom'; - break; - } - - return { - x: x, - y: y, - textAlign: textAlign, - textVerticalAlign: textVerticalAlign - }; -} -/** - * Show ellipsis if overflow. - * - * @public - * @param {string} text - * @param {string} containerWidth - * @param {string} font - * @param {number} [ellipsis='...'] - * @param {Object} [options] - * @param {number} [options.maxIterations=3] - * @param {number} [options.minChar=0] If truncate result are less - * then minChar, ellipsis will not show, which is - * better for user hint in some cases. - * @param {number} [options.placeholder=''] When all truncated, use the placeholder. - * @return {string} - */ - - -function truncateText(text, containerWidth, font, ellipsis, options) { - if (!containerWidth) { - return ''; - } - - var textLines = (text + '').split('\n'); - options = prepareTruncateOptions(containerWidth, font, ellipsis, options); // FIXME - // It is not appropriate that every line has '...' when truncate multiple lines. - - for (var i = 0, len = textLines.length; i < len; i++) { - textLines[i] = truncateSingleLine(textLines[i], options); - } - - return textLines.join('\n'); -} - -function prepareTruncateOptions(containerWidth, font, ellipsis, options) { - options = extend({}, options); - options.font = font; - var ellipsis = retrieve2(ellipsis, '...'); - options.maxIterations = retrieve2(options.maxIterations, 2); - var minChar = options.minChar = retrieve2(options.minChar, 0); // FIXME - // Other languages? - - options.cnCharWidth = getWidth('国', font); // FIXME - // Consider proportional font? - - var ascCharWidth = options.ascCharWidth = getWidth('a', font); - options.placeholder = retrieve2(options.placeholder, ''); // Example 1: minChar: 3, text: 'asdfzxcv', truncate result: 'asdf', but not: 'a...'. - // Example 2: minChar: 3, text: '维度', truncate result: '维', but not: '...'. - - var contentWidth = containerWidth = Math.max(0, containerWidth - 1); // Reserve some gap. - - for (var i = 0; i < minChar && contentWidth >= ascCharWidth; i++) { - contentWidth -= ascCharWidth; - } - - var ellipsisWidth = getWidth(ellipsis); - - if (ellipsisWidth > contentWidth) { - ellipsis = ''; - ellipsisWidth = 0; - } - - contentWidth = containerWidth - ellipsisWidth; - options.ellipsis = ellipsis; - options.ellipsisWidth = ellipsisWidth; - options.contentWidth = contentWidth; - options.containerWidth = containerWidth; - return options; -} - -function truncateSingleLine(textLine, options) { - var containerWidth = options.containerWidth; - var font = options.font; - var contentWidth = options.contentWidth; - - if (!containerWidth) { - return ''; - } - - var lineWidth = getWidth(textLine, font); - - if (lineWidth <= containerWidth) { - return textLine; - } - - for (var j = 0;; j++) { - if (lineWidth <= contentWidth || j >= options.maxIterations) { - textLine += options.ellipsis; - break; - } - - var subLength = j === 0 ? estimateLength(textLine, contentWidth, options.ascCharWidth, options.cnCharWidth) : lineWidth > 0 ? Math.floor(textLine.length * contentWidth / lineWidth) : 0; - textLine = textLine.substr(0, subLength); - lineWidth = getWidth(textLine, font); - } - - if (textLine === '') { - textLine = options.placeholder; - } - - return textLine; -} - -function estimateLength(text, contentWidth, ascCharWidth, cnCharWidth) { - var width = 0; - var i = 0; - - for (var len = text.length; i < len && width < contentWidth; i++) { - var charCode = text.charCodeAt(i); - width += 0 <= charCode && charCode <= 127 ? ascCharWidth : cnCharWidth; - } - - return i; -} -/** - * @public - * @param {string} font - * @return {number} line height - */ - - -function getLineHeight(font) { - // FIXME A rough approach. - return getWidth('国', font); -} -/** - * @public - * @param {string} text - * @param {string} font - * @return {Object} width - */ - - -function measureText(text, font) { - return methods.measureText(text, font); -} // Avoid assign to an exported variable, for transforming to cjs. - - -methods.measureText = function (text, font) { - var ctx = getContext(); - ctx.font = font || DEFAULT_FONT; - return ctx.measureText(text); -}; -/** - * @public - * @param {string} text - * @param {string} font - * @param {Object} [truncate] - * @return {Object} block: {lineHeight, lines, height, outerHeight} - * Notice: for performance, do not calculate outerWidth util needed. - */ - - -function parsePlainText(text, font, padding, truncate) { - text != null && (text += ''); - var lineHeight = getLineHeight(font); - var lines = text ? text.split('\n') : []; - var height = lines.length * lineHeight; - var outerHeight = height; - - if (padding) { - outerHeight += padding[0] + padding[2]; - } - - if (text && truncate) { - var truncOuterHeight = truncate.outerHeight; - var truncOuterWidth = truncate.outerWidth; - - if (truncOuterHeight != null && outerHeight > truncOuterHeight) { - text = ''; - lines = []; - } else if (truncOuterWidth != null) { - var options = prepareTruncateOptions(truncOuterWidth - (padding ? padding[1] + padding[3] : 0), font, truncate.ellipsis, { - minChar: truncate.minChar, - placeholder: truncate.placeholder - }); // FIXME - // It is not appropriate that every line has '...' when truncate multiple lines. - - for (var i = 0, len = lines.length; i < len; i++) { - lines[i] = truncateSingleLine(lines[i], options); - } - } - } - - return { - lines: lines, - height: height, - outerHeight: outerHeight, - lineHeight: lineHeight - }; -} -/** - * For example: 'some text {a|some text}other text{b|some text}xxx{c|}xxx' - * Also consider 'bbbb{a|xxx\nzzz}xxxx\naaaa'. - * - * @public - * @param {string} text - * @param {Object} style - * @return {Object} block - * { - * width, - * height, - * lines: [{ - * lineHeight, - * width, - * tokens: [[{ - * styleName, - * text, - * width, // include textPadding - * height, // include textPadding - * textWidth, // pure text width - * textHeight, // pure text height - * lineHeihgt, - * font, - * textAlign, - * textVerticalAlign - * }], [...], ...] - * }, ...] - * } - * If styleName is undefined, it is plain text. - */ - - -function parseRichText(text, style) { - var contentBlock = { - lines: [], - width: 0, - height: 0 - }; - text != null && (text += ''); - - if (!text) { - return contentBlock; - } - - var lastIndex = STYLE_REG.lastIndex = 0; - var result; - - while ((result = STYLE_REG.exec(text)) != null) { - var matchedIndex = result.index; - - if (matchedIndex > lastIndex) { - pushTokens(contentBlock, text.substring(lastIndex, matchedIndex)); - } - - pushTokens(contentBlock, result[2], result[1]); - lastIndex = STYLE_REG.lastIndex; - } - - if (lastIndex < text.length) { - pushTokens(contentBlock, text.substring(lastIndex, text.length)); - } - - var lines = contentBlock.lines; - var contentHeight = 0; - var contentWidth = 0; // For `textWidth: 100%` - - var pendingList = []; - var stlPadding = style.textPadding; - var truncate = style.truncate; - var truncateWidth = truncate && truncate.outerWidth; - var truncateHeight = truncate && truncate.outerHeight; - - if (stlPadding) { - truncateWidth != null && (truncateWidth -= stlPadding[1] + stlPadding[3]); - truncateHeight != null && (truncateHeight -= stlPadding[0] + stlPadding[2]); - } // Calculate layout info of tokens. - - - for (var i = 0; i < lines.length; i++) { - var line = lines[i]; - var lineHeight = 0; - var lineWidth = 0; - - for (var j = 0; j < line.tokens.length; j++) { - var token = line.tokens[j]; - var tokenStyle = token.styleName && style.rich[token.styleName] || {}; // textPadding should not inherit from style. - - var textPadding = token.textPadding = tokenStyle.textPadding; // textFont has been asigned to font by `normalizeStyle`. - - var font = token.font = tokenStyle.font || style.font; // textHeight can be used when textVerticalAlign is specified in token. - - var tokenHeight = token.textHeight = retrieve2( // textHeight should not be inherited, consider it can be specified - // as box height of the block. - tokenStyle.textHeight, getLineHeight(font)); - textPadding && (tokenHeight += textPadding[0] + textPadding[2]); - token.height = tokenHeight; - token.lineHeight = retrieve3(tokenStyle.textLineHeight, style.textLineHeight, tokenHeight); - token.textAlign = tokenStyle && tokenStyle.textAlign || style.textAlign; - token.textVerticalAlign = tokenStyle && tokenStyle.textVerticalAlign || 'middle'; - - if (truncateHeight != null && contentHeight + token.lineHeight > truncateHeight) { - return { - lines: [], - width: 0, - height: 0 - }; - } - - token.textWidth = getWidth(token.text, font); - var tokenWidth = tokenStyle.textWidth; - var tokenWidthNotSpecified = tokenWidth == null || tokenWidth === 'auto'; // Percent width, can be `100%`, can be used in drawing separate - // line when box width is needed to be auto. - - if (typeof tokenWidth === 'string' && tokenWidth.charAt(tokenWidth.length - 1) === '%') { - token.percentWidth = tokenWidth; - pendingList.push(token); - tokenWidth = 0; // Do not truncate in this case, because there is no user case - // and it is too complicated. - } else { - if (tokenWidthNotSpecified) { - tokenWidth = token.textWidth; // FIXME: If image is not loaded and textWidth is not specified, calling - // `getBoundingRect()` will not get correct result. - - var textBackgroundColor = tokenStyle.textBackgroundColor; - var bgImg = textBackgroundColor && textBackgroundColor.image; // Use cases: - // (1) If image is not loaded, it will be loaded at render phase and call - // `dirty()` and `textBackgroundColor.image` will be replaced with the loaded - // image, and then the right size will be calculated here at the next tick. - // See `graphic/helper/text.js`. - // (2) If image loaded, and `textBackgroundColor.image` is image src string, - // use `imageHelper.findExistImage` to find cached image. - // `imageHelper.findExistImage` will always be called here before - // `imageHelper.createOrUpdateImage` in `graphic/helper/text.js#renderRichText` - // which ensures that image will not be rendered before correct size calcualted. - - if (bgImg) { - bgImg = imageHelper.findExistImage(bgImg); - - if (imageHelper.isImageReady(bgImg)) { - tokenWidth = Math.max(tokenWidth, bgImg.width * tokenHeight / bgImg.height); - } - } - } - - var paddingW = textPadding ? textPadding[1] + textPadding[3] : 0; - tokenWidth += paddingW; - var remianTruncWidth = truncateWidth != null ? truncateWidth - lineWidth : null; - - if (remianTruncWidth != null && remianTruncWidth < tokenWidth) { - if (!tokenWidthNotSpecified || remianTruncWidth < paddingW) { - token.text = ''; - token.textWidth = tokenWidth = 0; - } else { - token.text = truncateText(token.text, remianTruncWidth - paddingW, font, truncate.ellipsis, { - minChar: truncate.minChar - }); - token.textWidth = getWidth(token.text, font); - tokenWidth = token.textWidth + paddingW; - } - } - } - - lineWidth += token.width = tokenWidth; - tokenStyle && (lineHeight = Math.max(lineHeight, token.lineHeight)); - } - - line.width = lineWidth; - line.lineHeight = lineHeight; - contentHeight += lineHeight; - contentWidth = Math.max(contentWidth, lineWidth); - } - - contentBlock.outerWidth = contentBlock.width = retrieve2(style.textWidth, contentWidth); - contentBlock.outerHeight = contentBlock.height = retrieve2(style.textHeight, contentHeight); - - if (stlPadding) { - contentBlock.outerWidth += stlPadding[1] + stlPadding[3]; - contentBlock.outerHeight += stlPadding[0] + stlPadding[2]; - } - - for (var i = 0; i < pendingList.length; i++) { - var token = pendingList[i]; - var percentWidth = token.percentWidth; // Should not base on outerWidth, because token can not be placed out of padding. - - token.width = parseInt(percentWidth, 10) / 100 * contentWidth; - } - - return contentBlock; -} - -function pushTokens(block, str, styleName) { - var isEmptyStr = str === ''; - var strs = str.split('\n'); - var lines = block.lines; - - for (var i = 0; i < strs.length; i++) { - var text = strs[i]; - var token = { - styleName: styleName, - text: text, - isLineHolder: !text && !isEmptyStr - }; // The first token should be appended to the last line. - - if (!i) { - var tokens = (lines[lines.length - 1] || (lines[0] = { - tokens: [] - })).tokens; // Consider cases: - // (1) ''.split('\n') => ['', '\n', ''], the '' at the first item - // (which is a placeholder) should be replaced by new token. - // (2) A image backage, where token likes {a|}. - // (3) A redundant '' will affect textAlign in line. - // (4) tokens with the same tplName should not be merged, because - // they should be displayed in different box (with border and padding). - - var tokensLen = tokens.length; - tokensLen === 1 && tokens[0].isLineHolder ? tokens[0] = token : // Consider text is '', only insert when it is the "lineHolder" or - // "emptyStr". Otherwise a redundant '' will affect textAlign in line. - (text || !tokensLen || isEmptyStr) && tokens.push(token); - } // Other tokens always start a new line. - else { - // If there is '', insert it as a placeholder. - lines.push({ - tokens: [token] - }); - } - } -} - -function makeFont(style) { - // FIXME in node-canvas fontWeight is before fontStyle - // Use `fontSize` `fontFamily` to check whether font properties are defined. - var font = (style.fontSize || style.fontFamily) && [style.fontStyle, style.fontWeight, (style.fontSize || 12) + 'px', // If font properties are defined, `fontFamily` should not be ignored. - style.fontFamily || 'sans-serif'].join(' '); - return font && trim(font) || style.textFont || style.font; -} - -exports.DEFAULT_FONT = DEFAULT_FONT; -exports.$override = $override; -exports.getWidth = getWidth; -exports.getBoundingRect = getBoundingRect; -exports.adjustTextX = adjustTextX; -exports.adjustTextY = adjustTextY; -exports.adjustTextPositionOnRect = adjustTextPositionOnRect; -exports.truncateText = truncateText; -exports.getLineHeight = getLineHeight; -exports.measureText = measureText; -exports.parsePlainText = parsePlainText; -exports.parseRichText = parseRichText; -exports.makeFont = makeFont; - -/***/ }), -/* 173 */ -/***/ (function(module, exports, __webpack_require__) { - -var LRU = __webpack_require__(60); - -var globalImageCache = new LRU(50); -/** - * @param {string|HTMLImageElement|HTMLCanvasElement|Canvas} newImageOrSrc - * @return {HTMLImageElement|HTMLCanvasElement|Canvas} image - */ - -function findExistImage(newImageOrSrc) { - if (typeof newImageOrSrc === 'string') { - var cachedImgObj = globalImageCache.get(newImageOrSrc); - return cachedImgObj && cachedImgObj.image; - } else { - return newImageOrSrc; - } -} -/** - * Caution: User should cache loaded images, but not just count on LRU. - * Consider if required images more than LRU size, will dead loop occur? - * - * @param {string|HTMLImageElement|HTMLCanvasElement|Canvas} newImageOrSrc - * @param {HTMLImageElement|HTMLCanvasElement|Canvas} image Existent image. - * @param {module:zrender/Element} [hostEl] For calling `dirty`. - * @param {Function} [cb] params: (image, cbPayload) - * @param {Object} [cbPayload] Payload on cb calling. - * @return {HTMLImageElement|HTMLCanvasElement|Canvas} image - */ - - -function createOrUpdateImage(newImageOrSrc, image, hostEl, cb, cbPayload) { - if (!newImageOrSrc) { - return image; - } else if (typeof newImageOrSrc === 'string') { - // Image should not be loaded repeatly. - if (image && image.__zrImageSrc === newImageOrSrc || !hostEl) { - return image; - } // Only when there is no existent image or existent image src - // is different, this method is responsible for load. - - - var cachedImgObj = globalImageCache.get(newImageOrSrc); - var pendingWrap = { - hostEl: hostEl, - cb: cb, - cbPayload: cbPayload - }; - - if (cachedImgObj) { - image = cachedImgObj.image; - !isImageReady(image) && cachedImgObj.pending.push(pendingWrap); - } else { - !image && (image = new Image()); - image.onload = imageOnLoad; - globalImageCache.put(newImageOrSrc, image.__cachedImgObj = { - image: image, - pending: [pendingWrap] - }); - image.src = image.__zrImageSrc = newImageOrSrc; - } - - return image; - } // newImageOrSrc is an HTMLImageElement or HTMLCanvasElement or Canvas - else { - return newImageOrSrc; - } -} - -function imageOnLoad() { - var cachedImgObj = this.__cachedImgObj; - this.onload = this.__cachedImgObj = null; - - for (var i = 0; i < cachedImgObj.pending.length; i++) { - var pendingWrap = cachedImgObj.pending[i]; - var cb = pendingWrap.cb; - cb && cb(this, pendingWrap.cbPayload); - pendingWrap.hostEl.dirty(); - } - - cachedImgObj.pending.length = 0; -} - -function isImageReady(image) { - return image && image.width && image.height; -} - -exports.findExistImage = findExistImage; -exports.createOrUpdateImage = createOrUpdateImage; -exports.isImageReady = isImageReady; - -/***/ }), -/* 174 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__core_Base__ = __webpack_require__(7); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__core_glenum__ = __webpack_require__(11); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__math_Vector3__ = __webpack_require__(3); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__math_BoundingBox__ = __webpack_require__(18); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__math_Frustum__ = __webpack_require__(59); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__math_Matrix4__ = __webpack_require__(9); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Renderer__ = __webpack_require__(52); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Shader__ = __webpack_require__(8); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__Material__ = __webpack_require__(19); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__FrameBuffer__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__Texture__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__Texture2D__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__TextureCube__ = __webpack_require__(27); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__camera_Perspective__ = __webpack_require__(41); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__camera_Orthographic__ = __webpack_require__(37); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__compositor_Pass__ = __webpack_require__(16); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__compositor_TexturePool__ = __webpack_require__(86); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__glmatrix_mat4__ = __webpack_require__(21); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__shader_source_shadowmap_glsl_js__ = __webpack_require__(175); - - - - - - - - - - - - - - - - - - - - - -var targets = ['px', 'nx', 'py', 'ny', 'pz', 'nz']; - - -__WEBPACK_IMPORTED_MODULE_7__Shader__["a" /* default */]['import'](__WEBPACK_IMPORTED_MODULE_18__shader_source_shadowmap_glsl_js__["a" /* default */]); - -function getDepthMaterialUniform(renderable, depthMaterial, symbol) { - if (symbol === 'alphaMap') { - return renderable.material.get('diffuseMap'); - } - else if (symbol === 'alphaCutoff') { - if (renderable.material.isDefined('fragment', 'ALPHA_TEST') - && renderable.material.get('diffuseMap') - ) { - var alphaCutoff = renderable.material.get('alphaCutoff'); - return alphaCutoff || 0; - } - return 0; - } - else { - return depthMaterial.get(symbol); - } -} - -function isDepthMaterialChanged(renderable, prevRenderable) { - var matA = renderable.material; - var matB = prevRenderable.material; - return matA.get('diffuseMap') !== matB.get('diffuseMap') - || (matA.get('alphaCutoff') || 0) !== (matB.get('alphaCutoff') || 0); -} - -/** - * Pass rendering shadow map. - * - * @constructor clay.prePass.ShadowMap - * @extends clay.core.Base - * @example - * var shadowMapPass = new clay.prePass.ShadowMap({ - * softShadow: clay.prePass.ShadowMap.VSM - * }); - * ... - * animation.on('frame', function (frameTime) { - * shadowMapPass.render(renderer, scene, camera); - * renderer.render(scene, camera); - * }); - */ -var ShadowMapPass = __WEBPACK_IMPORTED_MODULE_0__core_Base__["a" /* default */].extend(function () { - return /** @lends clay.prePass.ShadowMap# */ { - /** - * Soft shadow technique. - * Can be {@link clay.prePass.ShadowMap.PCF} or {@link clay.prePass.ShadowMap.VSM} - * @type {number} - */ - softShadow: ShadowMapPass.PCF, - - /** - * Soft shadow blur size - * @type {number} - */ - shadowBlur: 1.0, - - lightFrustumBias: 'auto', - - kernelPCF: new Float32Array([ - 1, 0, - 1, 1, - -1, 1, - 0, 1, - -1, 0, - -1, -1, - 1, -1, - 0, -1 - ]), - - precision: 'highp', - - _lastRenderNotCastShadow: false, - - _frameBuffer: new __WEBPACK_IMPORTED_MODULE_9__FrameBuffer__["a" /* default */](), - - _textures: {}, - _shadowMapNumber: { - 'POINT_LIGHT': 0, - 'DIRECTIONAL_LIGHT': 0, - 'SPOT_LIGHT': 0 - }, - - _depthMaterials: {}, - _distanceMaterials: {}, - - _receivers: [], - _lightsCastShadow: [], - - _lightCameras: {}, - _lightMaterials: {}, - - _texturePool: new __WEBPACK_IMPORTED_MODULE_16__compositor_TexturePool__["a" /* default */]() - }; -}, function () { - // Gaussian filter pass for VSM - this._gaussianPassH = new __WEBPACK_IMPORTED_MODULE_15__compositor_Pass__["a" /* default */]({ - fragment: __WEBPACK_IMPORTED_MODULE_7__Shader__["a" /* default */].source('clay.compositor.gaussian_blur') - }); - this._gaussianPassV = new __WEBPACK_IMPORTED_MODULE_15__compositor_Pass__["a" /* default */]({ - fragment: __WEBPACK_IMPORTED_MODULE_7__Shader__["a" /* default */].source('clay.compositor.gaussian_blur') - }); - this._gaussianPassH.setUniform('blurSize', this.shadowBlur); - this._gaussianPassH.setUniform('blurDir', 0.0); - this._gaussianPassV.setUniform('blurSize', this.shadowBlur); - this._gaussianPassV.setUniform('blurDir', 1.0); - - this._outputDepthPass = new __WEBPACK_IMPORTED_MODULE_15__compositor_Pass__["a" /* default */]({ - fragment: __WEBPACK_IMPORTED_MODULE_7__Shader__["a" /* default */].source('clay.sm.debug_depth') - }); -}, { - /** - * Render scene to shadow textures - * @param {clay.Renderer} renderer - * @param {clay.Scene} scene - * @param {clay.Camera} sceneCamera - * @param {boolean} [notUpdateScene=false] - * @memberOf clay.prePass.ShadowMap.prototype - */ - render: function (renderer, scene, sceneCamera, notUpdateScene) { - if (!sceneCamera) { - sceneCamera = scene.getMainCamera(); - } - this.trigger('beforerender', this, renderer, scene, sceneCamera); - this._renderShadowPass(renderer, scene, sceneCamera, notUpdateScene); - this.trigger('afterrender', this, renderer, scene, sceneCamera); - }, - - /** - * Debug rendering of shadow textures - * @param {clay.Renderer} renderer - * @param {number} size - * @memberOf clay.prePass.ShadowMap.prototype - */ - renderDebug: function (renderer, size) { - renderer.saveClear(); - var viewport = renderer.viewport; - var x = 0, y = 0; - var width = size || viewport.width / 4; - var height = width; - if (this.softShadow === ShadowMapPass.VSM) { - this._outputDepthPass.material.define('fragment', 'USE_VSM'); - } - else { - this._outputDepthPass.material.undefine('fragment', 'USE_VSM'); - } - for (var name in this._textures) { - var texture = this._textures[name]; - renderer.setViewport(x, y, width * texture.width / texture.height, height); - this._outputDepthPass.setUniform('depthMap', texture); - this._outputDepthPass.render(renderer); - x += width * texture.width / texture.height; - } - renderer.setViewport(viewport); - renderer.restoreClear(); - }, - - _updateReceivers: function (renderer, mesh) { - if (mesh.receiveShadow) { - this._receivers.push(mesh); - mesh.material.set('shadowEnabled', 1); - - mesh.material.set('pcfKernel', this.kernelPCF); - } - else { - mesh.material.set('shadowEnabled', 0); - } - - if (this.softShadow === ShadowMapPass.VSM) { - mesh.material.define('fragment', 'USE_VSM'); - mesh.material.undefine('fragment', 'PCF_KERNEL_SIZE'); - } - else { - mesh.material.undefine('fragment', 'USE_VSM'); - var kernelPCF = this.kernelPCF; - if (kernelPCF && kernelPCF.length) { - mesh.material.define('fragment', 'PCF_KERNEL_SIZE', kernelPCF.length / 2); - } - else { - mesh.material.undefine('fragment', 'PCF_KERNEL_SIZE'); - } - } - }, - - _update: function (renderer, scene) { - var self = this; - scene.traverse(function (renderable) { - if (renderable.isRenderable()) { - self._updateReceivers(renderer, renderable); - } - }); - - for (var i = 0; i < scene.lights.length; i++) { - var light = scene.lights[i]; - if (light.castShadow && !light.invisible) { - this._lightsCastShadow.push(light); - } - } - }, - - _renderShadowPass: function (renderer, scene, sceneCamera, notUpdateScene) { - // reset - for (var name in this._shadowMapNumber) { - this._shadowMapNumber[name] = 0; - } - this._lightsCastShadow.length = 0; - this._receivers.length = 0; - - var _gl = renderer.gl; - - if (!notUpdateScene) { - scene.update(); - } - if (sceneCamera) { - sceneCamera.update(); - } - - scene.updateLights(); - this._update(renderer, scene); - - // Needs to update the receivers again if shadows come from 1 to 0. - if (!this._lightsCastShadow.length && this._lastRenderNotCastShadow) { - return; - } - - this._lastRenderNotCastShadow = this._lightsCastShadow === 0; - - _gl.enable(_gl.DEPTH_TEST); - _gl.depthMask(true); - _gl.disable(_gl.BLEND); - - // Clear with high-z, so the part not rendered will not been shadowed - // TODO - // TODO restore - _gl.clearColor(1.0, 1.0, 1.0, 1.0); - - // Shadow uniforms - var spotLightShadowMaps = []; - var spotLightMatrices = []; - var directionalLightShadowMaps = []; - var directionalLightMatrices = []; - var shadowCascadeClips = []; - var pointLightShadowMaps = []; - - var dirLightHasCascade; - // Create textures for shadow map - for (var i = 0; i < this._lightsCastShadow.length; i++) { - var light = this._lightsCastShadow[i]; - if (light.type === 'DIRECTIONAL_LIGHT') { - - if (dirLightHasCascade) { - console.warn('Only one direectional light supported with shadow cascade'); - continue; - } - if (light.shadowCascade > 4) { - console.warn('Support at most 4 cascade'); - continue; - } - if (light.shadowCascade > 1) { - dirLightHasCascade = light; - } - - this.renderDirectionalLightShadow( - renderer, - scene, - sceneCamera, - light, - shadowCascadeClips, - directionalLightMatrices, - directionalLightShadowMaps - ); - } - else if (light.type === 'SPOT_LIGHT') { - this.renderSpotLightShadow( - renderer, - scene, - light, - spotLightMatrices, - spotLightShadowMaps - ); - } - else if (light.type === 'POINT_LIGHT') { - this.renderPointLightShadow( - renderer, - scene, - light, - pointLightShadowMaps - ); - } - - this._shadowMapNumber[light.type]++; - } - - for (var lightType in this._shadowMapNumber) { - var number = this._shadowMapNumber[lightType]; - var key = lightType + '_SHADOWMAP_COUNT'; - for (var i = 0; i < this._receivers.length; i++) { - var mesh = this._receivers[i]; - var material = mesh.material; - if (material.fragmentDefines[key] !== number) { - if (number > 0) { - material.define('fragment', key, number); - } - else if (material.isDefined('fragment', key)) { - material.undefine('fragment', key); - } - } - } - } - for (var i = 0; i < this._receivers.length; i++) { - var mesh = this._receivers[i]; - var material = mesh.material; - if (dirLightHasCascade) { - material.define('fragment', 'SHADOW_CASCADE', dirLightHasCascade.shadowCascade); - } - else { - material.undefine('fragment', 'SHADOW_CASCADE'); - } - } - - var shadowUniforms = scene.shadowUniforms; - - function getSize(texture) { - return texture.height; - } - if (directionalLightShadowMaps.length > 0) { - var directionalLightShadowMapSizes = directionalLightShadowMaps.map(getSize); - shadowUniforms.directionalLightShadowMaps = { value: directionalLightShadowMaps, type: 'tv' }; - shadowUniforms.directionalLightMatrices = { value: directionalLightMatrices, type: 'm4v' }; - shadowUniforms.directionalLightShadowMapSizes = { value: directionalLightShadowMapSizes, type: '1fv' }; - if (dirLightHasCascade) { - var shadowCascadeClipsNear = shadowCascadeClips.slice(); - var shadowCascadeClipsFar = shadowCascadeClips.slice(); - shadowCascadeClipsNear.pop(); - shadowCascadeClipsFar.shift(); - - // Iterate from far to near - shadowCascadeClipsNear.reverse(); - shadowCascadeClipsFar.reverse(); - // directionalLightShadowMaps.reverse(); - directionalLightMatrices.reverse(); - shadowUniforms.shadowCascadeClipsNear = { value: shadowCascadeClipsNear, type: '1fv' }; - shadowUniforms.shadowCascadeClipsFar = { value: shadowCascadeClipsFar, type: '1fv' }; - } - } - - if (spotLightShadowMaps.length > 0) { - var spotLightShadowMapSizes = spotLightShadowMaps.map(getSize); - var shadowUniforms = scene.shadowUniforms; - shadowUniforms.spotLightShadowMaps = { value: spotLightShadowMaps, type: 'tv' }; - shadowUniforms.spotLightMatrices = { value: spotLightMatrices, type: 'm4v' }; - shadowUniforms.spotLightShadowMapSizes = { value: spotLightShadowMapSizes, type: '1fv' }; - } - - if (pointLightShadowMaps.length > 0) { - shadowUniforms.pointLightShadowMaps = { value: pointLightShadowMaps, type: 'tv' }; - } - }, - - renderDirectionalLightShadow: (function () { - - var splitFrustum = new __WEBPACK_IMPORTED_MODULE_4__math_Frustum__["a" /* default */](); - var splitProjMatrix = new __WEBPACK_IMPORTED_MODULE_5__math_Matrix4__["a" /* default */](); - var cropBBox = new __WEBPACK_IMPORTED_MODULE_3__math_BoundingBox__["a" /* default */](); - var cropMatrix = new __WEBPACK_IMPORTED_MODULE_5__math_Matrix4__["a" /* default */](); - var lightViewMatrix = new __WEBPACK_IMPORTED_MODULE_5__math_Matrix4__["a" /* default */](); - var lightViewProjMatrix = new __WEBPACK_IMPORTED_MODULE_5__math_Matrix4__["a" /* default */](); - var lightProjMatrix = new __WEBPACK_IMPORTED_MODULE_5__math_Matrix4__["a" /* default */](); - - return function (renderer, scene, sceneCamera, light, shadowCascadeClips, directionalLightMatrices, directionalLightShadowMaps) { - - var defaultShadowMaterial = this._getDepthMaterial(light); - var passConfig = { - getMaterial: function (renderable) { - return renderable.shadowDepthMaterial || defaultShadowMaterial; - }, - isMaterialChanged: isDepthMaterialChanged, - getUniform: getDepthMaterialUniform, - ifRender: function (renderable) { - return renderable.castShadow; - }, - sortCompare: __WEBPACK_IMPORTED_MODULE_6__Renderer__["a" /* default */].opaqueSortCompare - }; - - // First frame - if (!scene.viewBoundingBoxLastFrame.isFinite()) { - var boundingBox = scene.getBoundingBox(); - scene.viewBoundingBoxLastFrame - .copy(boundingBox).applyTransform(sceneCamera.viewMatrix); - } - // Considering moving speed since the bounding box is from last frame - // TODO: add a bias - var clippedFar = Math.min(-scene.viewBoundingBoxLastFrame.min.z, sceneCamera.far); - var clippedNear = Math.max(-scene.viewBoundingBoxLastFrame.max.z, sceneCamera.near); - - var lightCamera = this._getDirectionalLightCamera(light, scene, sceneCamera); - - var lvpMat4Arr = lightViewProjMatrix.array; - lightProjMatrix.copy(lightCamera.projectionMatrix); - __WEBPACK_IMPORTED_MODULE_17__glmatrix_mat4__["a" /* default */].invert(lightViewMatrix.array, lightCamera.worldTransform.array); - __WEBPACK_IMPORTED_MODULE_17__glmatrix_mat4__["a" /* default */].multiply(lightViewMatrix.array, lightViewMatrix.array, sceneCamera.worldTransform.array); - __WEBPACK_IMPORTED_MODULE_17__glmatrix_mat4__["a" /* default */].multiply(lvpMat4Arr, lightProjMatrix.array, lightViewMatrix.array); - - var clipPlanes = []; - var isPerspective = sceneCamera instanceof __WEBPACK_IMPORTED_MODULE_13__camera_Perspective__["a" /* default */]; - - var scaleZ = (sceneCamera.near + sceneCamera.far) / (sceneCamera.near - sceneCamera.far); - var offsetZ = 2 * sceneCamera.near * sceneCamera.far / (sceneCamera.near - sceneCamera.far); - for (var i = 0; i <= light.shadowCascade; i++) { - var clog = clippedNear * Math.pow(clippedFar / clippedNear, i / light.shadowCascade); - var cuni = clippedNear + (clippedFar - clippedNear) * i / light.shadowCascade; - var c = clog * light.cascadeSplitLogFactor + cuni * (1 - light.cascadeSplitLogFactor); - clipPlanes.push(c); - shadowCascadeClips.push(-(-c * scaleZ + offsetZ) / -c); - } - var texture = this._getTexture(light, light.shadowCascade); - directionalLightShadowMaps.push(texture); - - var viewport = renderer.viewport; - - var _gl = renderer.gl; - this._frameBuffer.attach(texture); - this._frameBuffer.bind(renderer); - _gl.clear(_gl.COLOR_BUFFER_BIT | _gl.DEPTH_BUFFER_BIT); - - for (var i = 0; i < light.shadowCascade; i++) { - // Get the splitted frustum - var nearPlane = clipPlanes[i]; - var farPlane = clipPlanes[i + 1]; - if (isPerspective) { - __WEBPACK_IMPORTED_MODULE_17__glmatrix_mat4__["a" /* default */].perspective(splitProjMatrix.array, sceneCamera.fov / 180 * Math.PI, sceneCamera.aspect, nearPlane, farPlane); - } - else { - __WEBPACK_IMPORTED_MODULE_17__glmatrix_mat4__["a" /* default */].ortho( - splitProjMatrix.array, - sceneCamera.left, sceneCamera.right, sceneCamera.bottom, sceneCamera.top, - nearPlane, farPlane - ); - } - splitFrustum.setFromProjection(splitProjMatrix); - splitFrustum.getTransformedBoundingBox(cropBBox, lightViewMatrix); - cropBBox.applyProjection(lightProjMatrix); - var _min = cropBBox.min.array; - var _max = cropBBox.max.array; - _min[0] = Math.max(_min[0], -1); - _min[1] = Math.max(_min[1], -1); - _max[0] = Math.min(_max[0], 1); - _max[1] = Math.min(_max[1], 1); - cropMatrix.ortho(_min[0], _max[0], _min[1], _max[1], 1, -1); - lightCamera.projectionMatrix.multiplyLeft(cropMatrix); - - var shadowSize = light.shadowResolution || 512; - - // Reversed, left to right => far to near - renderer.setViewport((light.shadowCascade - i - 1) * shadowSize, 0, shadowSize, shadowSize, 1); - - var renderList = scene.updateRenderList(lightCamera); - renderer.renderPass(renderList.opaque, lightCamera, passConfig); - - // Filter for VSM - if (this.softShadow === ShadowMapPass.VSM) { - this._gaussianFilter(renderer, texture, texture.width); - } - - var matrix = new __WEBPACK_IMPORTED_MODULE_5__math_Matrix4__["a" /* default */](); - matrix.copy(lightCamera.viewMatrix) - .multiplyLeft(lightCamera.projectionMatrix); - - directionalLightMatrices.push(matrix.array); - - lightCamera.projectionMatrix.copy(lightProjMatrix); - } - - this._frameBuffer.unbind(renderer); - - renderer.setViewport(viewport); - }; - })(), - - renderSpotLightShadow: function (renderer, scene, light, spotLightMatrices, spotLightShadowMaps) { - - var texture = this._getTexture(light); - var lightCamera = this._getSpotLightCamera(light); - var _gl = renderer.gl; - - this._frameBuffer.attach(texture); - this._frameBuffer.bind(renderer); - - _gl.clear(_gl.COLOR_BUFFER_BIT | _gl.DEPTH_BUFFER_BIT); - - var defaultShadowMaterial = this._getDepthMaterial(light); - var passConfig = { - getMaterial: function (renderable) { - return renderable.shadowDepthMaterial || defaultShadowMaterial; - }, - isMaterialChanged: isDepthMaterialChanged, - getUniform: getDepthMaterialUniform, - ifRender: function (renderable) { - return renderable.castShadow; - }, - sortCompare: __WEBPACK_IMPORTED_MODULE_6__Renderer__["a" /* default */].opaqueSortCompare - }; - - var renderList = scene.updateRenderList(lightCamera); - renderer.renderPass(renderList.opaque, lightCamera, passConfig); - - this._frameBuffer.unbind(renderer); - - // Filter for VSM - if (this.softShadow === ShadowMapPass.VSM) { - this._gaussianFilter(renderer, texture, texture.width); - } - - var matrix = new __WEBPACK_IMPORTED_MODULE_5__math_Matrix4__["a" /* default */](); - matrix.copy(lightCamera.worldTransform) - .invert() - .multiplyLeft(lightCamera.projectionMatrix); - - spotLightShadowMaps.push(texture); - spotLightMatrices.push(matrix.array); - }, - - renderPointLightShadow: function (renderer, scene, light, pointLightShadowMaps) { - var texture = this._getTexture(light); - var _gl = renderer.gl; - pointLightShadowMaps.push(texture); - - var defaultShadowMaterial = this._getDepthMaterial(light); - var passConfig = { - getMaterial: function (renderable) { - return renderable.shadowDepthMaterial || defaultShadowMaterial; - }, - getUniform: getDepthMaterialUniform, - sortCompare: __WEBPACK_IMPORTED_MODULE_6__Renderer__["a" /* default */].opaqueSortCompare - }; - - var renderListEachSide = { - px: [], py: [], pz: [], nx: [], ny: [], nz: [] - }; - var bbox = new __WEBPACK_IMPORTED_MODULE_3__math_BoundingBox__["a" /* default */](); - var lightWorldPosition = light.getWorldPosition().array; - var lightBBox = new __WEBPACK_IMPORTED_MODULE_3__math_BoundingBox__["a" /* default */](); - var range = light.range; - lightBBox.min.setArray(lightWorldPosition); - lightBBox.max.setArray(lightWorldPosition); - var extent = new __WEBPACK_IMPORTED_MODULE_2__math_Vector3__["a" /* default */](range, range, range); - lightBBox.max.add(extent); - lightBBox.min.sub(extent); - - var targetsNeedRender = { px: false, py: false, pz: false, nx: false, ny: false, nz: false }; - scene.traverse(function (renderable) { - if (renderable.isRenderable() && renderable.castShadow) { - var geometry = renderable.geometry; - if (!geometry.boundingBox) { - for (var i = 0; i < targets.length; i++) { - renderListEachSide[targets[i]].push(renderable); - } - return; - } - bbox.transformFrom(geometry.boundingBox, renderable.worldTransform); - if (!bbox.intersectBoundingBox(lightBBox)) { - return; - } - - bbox.updateVertices(); - for (var i = 0; i < targets.length; i++) { - targetsNeedRender[targets[i]] = false; - } - for (var i = 0; i < 8; i++) { - var vtx = bbox.vertices[i]; - var x = vtx[0] - lightWorldPosition[0]; - var y = vtx[1] - lightWorldPosition[1]; - var z = vtx[2] - lightWorldPosition[2]; - var absx = Math.abs(x); - var absy = Math.abs(y); - var absz = Math.abs(z); - if (absx > absy) { - if (absx > absz) { - targetsNeedRender[x > 0 ? 'px' : 'nx'] = true; - } - else { - targetsNeedRender[z > 0 ? 'pz' : 'nz'] = true; - } - } - else { - if (absy > absz) { - targetsNeedRender[y > 0 ? 'py' : 'ny'] = true; - } - else { - targetsNeedRender[z > 0 ? 'pz' : 'nz'] = true; - } - } - } - for (var i = 0; i < targets.length; i++) { - if (targetsNeedRender[targets[i]]) { - renderListEachSide[targets[i]].push(renderable); - } - } - } - }); - - for (var i = 0; i < 6; i++) { - var target = targets[i]; - var camera = this._getPointLightCamera(light, target); - - this._frameBuffer.attach(texture, _gl.COLOR_ATTACHMENT0, _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i); - this._frameBuffer.bind(renderer); - _gl.clear(_gl.COLOR_BUFFER_BIT | _gl.DEPTH_BUFFER_BIT); - - renderer.renderPass(renderListEachSide[target], camera, passConfig); - } - - this._frameBuffer.unbind(renderer); - }, - - _getDepthMaterial: function (light) { - var shadowMaterial = this._lightMaterials[light.__uid__]; - var isPointLight = light.type === 'POINT_LIGHT'; - if (!shadowMaterial) { - var shaderPrefix = isPointLight ? 'clay.sm.distance.' : 'clay.sm.depth.'; - shadowMaterial = new __WEBPACK_IMPORTED_MODULE_8__Material__["a" /* default */]({ - precision: this.precision, - shader: new __WEBPACK_IMPORTED_MODULE_7__Shader__["a" /* default */](__WEBPACK_IMPORTED_MODULE_7__Shader__["a" /* default */].source(shaderPrefix + 'vertex'), __WEBPACK_IMPORTED_MODULE_7__Shader__["a" /* default */].source(shaderPrefix + 'fragment')) - }); - - this._lightMaterials[light.__uid__] = shadowMaterial; - } - if (light.shadowSlopeScale != null) { - shadowMaterial.setUniform('slopeScale', light.shadowSlopeScale); - } - if (light.shadowBias != null) { - shadowMaterial.setUniform('bias', light.shadowBias); - } - if (this.softShadow === ShadowMapPass.VSM) { - shadowMaterial.define('fragment', 'USE_VSM'); - } - else { - shadowMaterial.undefine('fragment', 'USE_VSM'); - } - - if (isPointLight) { - shadowMaterial.set('lightPosition', light.getWorldPosition().array); - shadowMaterial.set('range', light.range); - } - - return shadowMaterial; - }, - - _gaussianFilter: function (renderer, texture, size) { - var parameter = { - width: size, - height: size, - type: __WEBPACK_IMPORTED_MODULE_10__Texture__["a" /* default */].FLOAT - }; - var tmpTexture = this._texturePool.get(parameter); - - this._frameBuffer.attach(tmpTexture); - this._frameBuffer.bind(renderer); - this._gaussianPassH.setUniform('texture', texture); - this._gaussianPassH.setUniform('textureWidth', size); - this._gaussianPassH.render(renderer); - - this._frameBuffer.attach(texture); - this._gaussianPassV.setUniform('texture', tmpTexture); - this._gaussianPassV.setUniform('textureHeight', size); - this._gaussianPassV.render(renderer); - this._frameBuffer.unbind(renderer); - - this._texturePool.put(tmpTexture); - }, - - _getTexture: function (light, cascade) { - var key = light.__uid__; - var texture = this._textures[key]; - var resolution = light.shadowResolution || 512; - cascade = cascade || 1; - if (!texture) { - if (light.type === 'POINT_LIGHT') { - texture = new __WEBPACK_IMPORTED_MODULE_12__TextureCube__["a" /* default */](); - } - else { - texture = new __WEBPACK_IMPORTED_MODULE_11__Texture2D__["a" /* default */](); - } - // At most 4 cascade - // TODO share with height ? - texture.width = resolution * cascade; - texture.height = resolution; - if (this.softShadow === ShadowMapPass.VSM) { - texture.type = __WEBPACK_IMPORTED_MODULE_10__Texture__["a" /* default */].FLOAT; - texture.anisotropic = 4; - } - else { - texture.minFilter = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].NEAREST; - texture.magFilter = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].NEAREST; - texture.useMipmap = false; - } - this._textures[key] = texture; - } - - return texture; - }, - - _getPointLightCamera: function (light, target) { - if (!this._lightCameras.point) { - this._lightCameras.point = { - px: new __WEBPACK_IMPORTED_MODULE_13__camera_Perspective__["a" /* default */](), - nx: new __WEBPACK_IMPORTED_MODULE_13__camera_Perspective__["a" /* default */](), - py: new __WEBPACK_IMPORTED_MODULE_13__camera_Perspective__["a" /* default */](), - ny: new __WEBPACK_IMPORTED_MODULE_13__camera_Perspective__["a" /* default */](), - pz: new __WEBPACK_IMPORTED_MODULE_13__camera_Perspective__["a" /* default */](), - nz: new __WEBPACK_IMPORTED_MODULE_13__camera_Perspective__["a" /* default */]() - }; - } - var camera = this._lightCameras.point[target]; - - camera.far = light.range; - camera.fov = 90; - camera.position.set(0, 0, 0); - switch (target) { - case 'px': - camera.lookAt(__WEBPACK_IMPORTED_MODULE_2__math_Vector3__["a" /* default */].POSITIVE_X, __WEBPACK_IMPORTED_MODULE_2__math_Vector3__["a" /* default */].NEGATIVE_Y); - break; - case 'nx': - camera.lookAt(__WEBPACK_IMPORTED_MODULE_2__math_Vector3__["a" /* default */].NEGATIVE_X, __WEBPACK_IMPORTED_MODULE_2__math_Vector3__["a" /* default */].NEGATIVE_Y); - break; - case 'py': - camera.lookAt(__WEBPACK_IMPORTED_MODULE_2__math_Vector3__["a" /* default */].POSITIVE_Y, __WEBPACK_IMPORTED_MODULE_2__math_Vector3__["a" /* default */].POSITIVE_Z); - break; - case 'ny': - camera.lookAt(__WEBPACK_IMPORTED_MODULE_2__math_Vector3__["a" /* default */].NEGATIVE_Y, __WEBPACK_IMPORTED_MODULE_2__math_Vector3__["a" /* default */].NEGATIVE_Z); - break; - case 'pz': - camera.lookAt(__WEBPACK_IMPORTED_MODULE_2__math_Vector3__["a" /* default */].POSITIVE_Z, __WEBPACK_IMPORTED_MODULE_2__math_Vector3__["a" /* default */].NEGATIVE_Y); - break; - case 'nz': - camera.lookAt(__WEBPACK_IMPORTED_MODULE_2__math_Vector3__["a" /* default */].NEGATIVE_Z, __WEBPACK_IMPORTED_MODULE_2__math_Vector3__["a" /* default */].NEGATIVE_Y); - break; - } - light.getWorldPosition(camera.position); - camera.update(); - - return camera; - }, - - _getDirectionalLightCamera: (function () { - var lightViewMatrix = new __WEBPACK_IMPORTED_MODULE_5__math_Matrix4__["a" /* default */](); - var sceneViewBoundingBox = new __WEBPACK_IMPORTED_MODULE_3__math_BoundingBox__["a" /* default */](); - var lightViewBBox = new __WEBPACK_IMPORTED_MODULE_3__math_BoundingBox__["a" /* default */](); - // Camera of directional light will be adjusted - // to contain the view frustum and scene bounding box as tightly as possible - return function (light, scene, sceneCamera) { - if (!this._lightCameras.directional) { - this._lightCameras.directional = new __WEBPACK_IMPORTED_MODULE_14__camera_Orthographic__["a" /* default */](); - } - var camera = this._lightCameras.directional; - - sceneViewBoundingBox.copy(scene.viewBoundingBoxLastFrame); - sceneViewBoundingBox.intersection(sceneCamera.frustum.boundingBox); - // Move to the center of frustum(in world space) - camera.position - .copy(sceneViewBoundingBox.min) - .add(sceneViewBoundingBox.max) - .scale(0.5) - .transformMat4(sceneCamera.worldTransform); - camera.rotation.copy(light.rotation); - camera.scale.copy(light.scale); - camera.updateWorldTransform(); - - // Transform to light view space - __WEBPACK_IMPORTED_MODULE_5__math_Matrix4__["a" /* default */].invert(lightViewMatrix, camera.worldTransform); - __WEBPACK_IMPORTED_MODULE_5__math_Matrix4__["a" /* default */].multiply(lightViewMatrix, lightViewMatrix, sceneCamera.worldTransform); - - lightViewBBox.copy(sceneViewBoundingBox).applyTransform(lightViewMatrix); - - var min = lightViewBBox.min.array; - var max = lightViewBBox.max.array; - - // Move camera to adjust the near to 0 - camera.position.set((min[0] + max[0]) / 2, (min[1] + max[1]) / 2, max[2]) - .transformMat4(camera.worldTransform); - camera.near = 0; - camera.far = -min[2] + max[2]; - // Make sure receivers not in the frustum will stil receive the shadow. - if (isNaN(this.lightFrustumBias)) { - camera.far *= 4; - } - else { - camera.far += this.lightFrustumBias; - } - camera.left = min[0]; - camera.right = max[0]; - camera.top = max[1]; - camera.bottom = min[1]; - camera.update(true); - - return camera; - }; - })(), - - _getSpotLightCamera: function (light) { - if (!this._lightCameras.spot) { - this._lightCameras.spot = new __WEBPACK_IMPORTED_MODULE_13__camera_Perspective__["a" /* default */](); - } - var camera = this._lightCameras.spot; - // Update properties - camera.fov = light.penumbraAngle * 2; - camera.far = light.range; - camera.worldTransform.copy(light.worldTransform); - camera.updateProjectionMatrix(); - __WEBPACK_IMPORTED_MODULE_17__glmatrix_mat4__["a" /* default */].invert(camera.viewMatrix.array, camera.worldTransform.array); - - return camera; - }, - - /** - * @param {clay.Renderer|WebGLRenderingContext} [renderer] - * @memberOf clay.prePass.ShadowMap.prototype - */ - // PENDING Renderer or WebGLRenderingContext - dispose: function (renderer) { - var _gl = renderer.gl || renderer; - - if (this._frameBuffer) { - this._frameBuffer.dispose(_gl); - } - - for (var name in this._textures) { - this._textures[name].dispose(_gl); - } - - this._texturePool.clear(renderer.gl); - - this._depthMaterials = {}; - this._distanceMaterials = {}; - this._textures = {}; - this._lightCameras = {}; - this._shadowMapNumber = { - 'POINT_LIGHT': 0, - 'DIRECTIONAL_LIGHT': 0, - 'SPOT_LIGHT': 0 - }; - this._meshMaterials = {}; - - for (var i = 0; i < this._receivers.length; i++) { - var mesh = this._receivers[i]; - // Mesh may be disposed - if (mesh.material) { - var material = mesh.material; - material.undefine('fragment', 'POINT_LIGHT_SHADOW_COUNT'); - material.undefine('fragment', 'DIRECTIONAL_LIGHT_SHADOW_COUNT'); - material.undefine('fragment', 'AMBIENT_LIGHT_SHADOW_COUNT'); - material.set('shadowEnabled', 0); - } - } - - this._receivers = []; - this._lightsCastShadow = []; - } -}); - -/** - * @name clay.prePass.ShadowMap.VSM - * @type {number} - */ -ShadowMapPass.VSM = 1; - -/** - * @name clay.prePass.ShadowMap.PCF - * @type {number} - */ -ShadowMapPass.PCF = 2; - -/* harmony default export */ __webpack_exports__["a"] = (ShadowMapPass); - - -/***/ }), -/* 175 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export clay.sm.depth.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nattribute vec3 position : POSITION;\nattribute vec2 texcoord : TEXCOORD_0;\n@import clay.chunk.skinning_header\nvarying vec4 v_ViewPosition;\nvarying vec2 v_Texcoord;\nvoid main(){\n vec3 skinnedPosition = position;\n#ifdef SKINNING\n @import clay.chunk.skin_matrix\n skinnedPosition = (skinMatrixWS * vec4(position, 1.0)).xyz;\n#endif\n v_ViewPosition = worldViewProjection * vec4(skinnedPosition, 1.0);\n gl_Position = v_ViewPosition;\n v_Texcoord = texcoord;\n}\n@end\n@export clay.sm.depth.fragment\nvarying vec4 v_ViewPosition;\nvarying vec2 v_Texcoord;\nuniform float bias : 0.001;\nuniform float slopeScale : 1.0;\nuniform sampler2D alphaMap;\nuniform float alphaCutoff: 0.0;\n@import clay.util.encode_float\nvoid main(){\n float depth = v_ViewPosition.z / v_ViewPosition.w;\n if (alphaCutoff > 0.0) {\n if (texture2D(alphaMap, v_Texcoord).a <= alphaCutoff) {\n discard;\n }\n }\n#ifdef USE_VSM\n depth = depth * 0.5 + 0.5;\n float moment1 = depth;\n float moment2 = depth * depth;\n float dx = dFdx(depth);\n float dy = dFdy(depth);\n moment2 += 0.25*(dx*dx+dy*dy);\n gl_FragColor = vec4(moment1, moment2, 0.0, 1.0);\n#else\n float dx = dFdx(depth);\n float dy = dFdy(depth);\n depth += sqrt(dx*dx + dy*dy) * slopeScale + bias;\n gl_FragColor = encodeFloat(depth * 0.5 + 0.5);\n#endif\n}\n@end\n@export clay.sm.debug_depth\nuniform sampler2D depthMap;\nvarying vec2 v_Texcoord;\n@import clay.util.decode_float\nvoid main() {\n vec4 tex = texture2D(depthMap, v_Texcoord);\n#ifdef USE_VSM\n gl_FragColor = vec4(tex.rgb, 1.0);\n#else\n float depth = decodeFloat(tex);\n gl_FragColor = vec4(depth, depth, depth, 1.0);\n#endif\n}\n@end\n@export clay.sm.distance.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform mat4 world : WORLD;\nattribute vec3 position : POSITION;\n@import clay.chunk.skinning_header\nvarying vec3 v_WorldPosition;\nvoid main (){\n vec3 skinnedPosition = position;\n#ifdef SKINNING\n @import clay.chunk.skin_matrix\n skinnedPosition = (skinMatrixWS * vec4(position, 1.0)).xyz;\n#endif\n gl_Position = worldViewProjection * vec4(skinnedPosition , 1.0);\n v_WorldPosition = (world * vec4(skinnedPosition, 1.0)).xyz;\n}\n@end\n@export clay.sm.distance.fragment\nuniform vec3 lightPosition;\nuniform float range : 100;\nvarying vec3 v_WorldPosition;\n@import clay.util.encode_float\nvoid main(){\n float dist = distance(lightPosition, v_WorldPosition);\n#ifdef USE_VSM\n gl_FragColor = vec4(dist, dist * dist, 0.0, 0.0);\n#else\n dist = dist / range;\n gl_FragColor = encodeFloat(dist);\n#endif\n}\n@end\n@export clay.plugin.shadow_map_common\n@import clay.util.decode_float\nfloat tapShadowMap(sampler2D map, vec2 uv, float z){\n vec4 tex = texture2D(map, uv);\n return step(z, decodeFloat(tex) * 2.0 - 1.0);\n}\nfloat pcf(sampler2D map, vec2 uv, float z, float textureSize, vec2 scale) {\n float shadowContrib = tapShadowMap(map, uv, z);\n vec2 offset = vec2(1.0 / textureSize) * scale;\n#ifdef PCF_KERNEL_SIZE\n for (int _idx_ = 0; _idx_ < PCF_KERNEL_SIZE; _idx_++) {{\n shadowContrib += tapShadowMap(map, uv + offset * pcfKernel[_idx_], z);\n }}\n return shadowContrib / float(PCF_KERNEL_SIZE + 1);\n#else\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, 0.0), z);\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(0.0, offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, 0.0), z);\n shadowContrib += tapShadowMap(map, uv+vec2(-offset.x, -offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(offset.x, -offset.y), z);\n shadowContrib += tapShadowMap(map, uv+vec2(0.0, -offset.y), z);\n return shadowContrib / 9.0;\n#endif\n}\nfloat pcf(sampler2D map, vec2 uv, float z, float textureSize) {\n return pcf(map, uv, z, textureSize, vec2(1.0));\n}\nfloat chebyshevUpperBound(vec2 moments, float z){\n float p = 0.0;\n z = z * 0.5 + 0.5;\n if (z <= moments.x) {\n p = 1.0;\n }\n float variance = moments.y - moments.x * moments.x;\n variance = max(variance, 0.0000001);\n float mD = moments.x - z;\n float pMax = variance / (variance + mD * mD);\n pMax = clamp((pMax-0.4)/(1.0-0.4), 0.0, 1.0);\n return max(p, pMax);\n}\nfloat computeShadowContrib(\n sampler2D map, mat4 lightVPM, vec3 position, float textureSize, vec2 scale, vec2 offset\n) {\n vec4 posInLightSpace = lightVPM * vec4(position, 1.0);\n posInLightSpace.xyz /= posInLightSpace.w;\n float z = posInLightSpace.z;\n if(all(greaterThan(posInLightSpace.xyz, vec3(-0.99, -0.99, -1.0))) &&\n all(lessThan(posInLightSpace.xyz, vec3(0.99, 0.99, 1.0)))){\n vec2 uv = (posInLightSpace.xy+1.0) / 2.0;\n #ifdef USE_VSM\n vec2 moments = texture2D(map, uv * scale + offset).xy;\n return chebyshevUpperBound(moments, z);\n #else\n return pcf(map, uv * scale + offset, z, textureSize, scale);\n #endif\n }\n return 1.0;\n}\nfloat computeShadowContrib(sampler2D map, mat4 lightVPM, vec3 position, float textureSize) {\n return computeShadowContrib(map, lightVPM, position, textureSize, vec2(1.0), vec2(0.0));\n}\nfloat computeShadowContribOmni(samplerCube map, vec3 direction, float range)\n{\n float dist = length(direction);\n vec4 shadowTex = textureCube(map, direction);\n#ifdef USE_VSM\n vec2 moments = shadowTex.xy;\n float variance = moments.y - moments.x * moments.x;\n float mD = moments.x - dist;\n float p = variance / (variance + mD * mD);\n if(moments.x + 0.001 < dist){\n return clamp(p, 0.0, 1.0);\n }else{\n return 1.0;\n }\n#else\n return step(dist, (decodeFloat(shadowTex) + 0.0002) * range);\n#endif\n}\n@end\n@export clay.plugin.compute_shadow_map\n#if defined(SPOT_LIGHT_SHADOWMAP_COUNT) || defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT) || defined(POINT_LIGHT_SHADOWMAP_COUNT)\n#ifdef SPOT_LIGHT_SHADOWMAP_COUNT\nuniform sampler2D spotLightShadowMaps[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform mat4 spotLightMatrices[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform float spotLightShadowMapSizes[SPOT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\n#endif\n#ifdef DIRECTIONAL_LIGHT_SHADOWMAP_COUNT\n#if defined(SHADOW_CASCADE)\nuniform sampler2D directionalLightShadowMaps[1]:unconfigurable;\nuniform mat4 directionalLightMatrices[SHADOW_CASCADE]:unconfigurable;\nuniform float directionalLightShadowMapSizes[1]:unconfigurable;\nuniform float shadowCascadeClipsNear[SHADOW_CASCADE]:unconfigurable;\nuniform float shadowCascadeClipsFar[SHADOW_CASCADE]:unconfigurable;\n#else\nuniform sampler2D directionalLightShadowMaps[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform mat4 directionalLightMatrices[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\nuniform float directionalLightShadowMapSizes[DIRECTIONAL_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\n#endif\n#endif\n#ifdef POINT_LIGHT_SHADOWMAP_COUNT\nuniform samplerCube pointLightShadowMaps[POINT_LIGHT_SHADOWMAP_COUNT]:unconfigurable;\n#endif\nuniform bool shadowEnabled : true;\n#ifdef PCF_KERNEL_SIZE\nuniform vec2 pcfKernel[PCF_KERNEL_SIZE];\n#endif\n@import clay.plugin.shadow_map_common\n#if defined(SPOT_LIGHT_SHADOWMAP_COUNT)\nvoid computeShadowOfSpotLights(vec3 position, inout float shadowContribs[SPOT_LIGHT_COUNT] ) {\n float shadowContrib;\n for(int _idx_ = 0; _idx_ < SPOT_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n shadowContrib = computeShadowContrib(\n spotLightShadowMaps[_idx_], spotLightMatrices[_idx_], position,\n spotLightShadowMapSizes[_idx_]\n );\n shadowContribs[_idx_] = shadowContrib;\n }}\n for(int _idx_ = SPOT_LIGHT_SHADOWMAP_COUNT; _idx_ < SPOT_LIGHT_COUNT; _idx_++){{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n#if defined(DIRECTIONAL_LIGHT_SHADOWMAP_COUNT)\n#ifdef SHADOW_CASCADE\nvoid computeShadowOfDirectionalLights(vec3 position, inout float shadowContribs[DIRECTIONAL_LIGHT_COUNT]){\n float depth = (2.0 * gl_FragCoord.z - gl_DepthRange.near - gl_DepthRange.far)\n / (gl_DepthRange.far - gl_DepthRange.near);\n float shadowContrib;\n shadowContribs[0] = 1.0;\n for (int _idx_ = 0; _idx_ < SHADOW_CASCADE; _idx_++) {{\n if (\n depth >= shadowCascadeClipsNear[_idx_] &&\n depth <= shadowCascadeClipsFar[_idx_]\n ) {\n shadowContrib = computeShadowContrib(\n directionalLightShadowMaps[0], directionalLightMatrices[_idx_], position,\n directionalLightShadowMapSizes[0],\n vec2(1.0 / float(SHADOW_CASCADE), 1.0),\n vec2(float(_idx_) / float(SHADOW_CASCADE), 0.0)\n );\n shadowContribs[0] = shadowContrib;\n }\n }}\n for(int _idx_ = DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#else\nvoid computeShadowOfDirectionalLights(vec3 position, inout float shadowContribs[DIRECTIONAL_LIGHT_COUNT]){\n float shadowContrib;\n for(int _idx_ = 0; _idx_ < DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n shadowContrib = computeShadowContrib(\n directionalLightShadowMaps[_idx_], directionalLightMatrices[_idx_], position,\n directionalLightShadowMapSizes[_idx_]\n );\n shadowContribs[_idx_] = shadowContrib;\n }}\n for(int _idx_ = DIRECTIONAL_LIGHT_SHADOWMAP_COUNT; _idx_ < DIRECTIONAL_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n#endif\n#if defined(POINT_LIGHT_SHADOWMAP_COUNT)\nvoid computeShadowOfPointLights(vec3 position, inout float shadowContribs[POINT_LIGHT_COUNT] ){\n vec3 lightPosition;\n vec3 direction;\n for(int _idx_ = 0; _idx_ < POINT_LIGHT_SHADOWMAP_COUNT; _idx_++) {{\n lightPosition = pointLightPosition[_idx_];\n direction = position - lightPosition;\n shadowContribs[_idx_] = computeShadowContribOmni(pointLightShadowMaps[_idx_], direction, pointLightRange[_idx_]);\n }}\n for(int _idx_ = POINT_LIGHT_SHADOWMAP_COUNT; _idx_ < POINT_LIGHT_COUNT; _idx_++) {{\n shadowContribs[_idx_] = 1.0;\n }}\n}\n#endif\n#endif\n@end"); - - -/***/ }), -/* 176 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_claygl_src_Shader__ = __webpack_require__(8); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_claygl_src_Texture2D__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_claygl_src_Texture__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_claygl_src_FrameBuffer__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_claygl_src_compositor_createCompositor__ = __webpack_require__(177); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__SSAOPass__ = __webpack_require__(189); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__SSRPass__ = __webpack_require__(191); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__poissonKernel__ = __webpack_require__(193); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__util_graphicGL__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__NormalPass__ = __webpack_require__(194); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__EdgePass__ = __webpack_require__(196); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_claygl_src_math_Matrix4__ = __webpack_require__(9); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__composite_js__ = __webpack_require__(197); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13_claygl_src_shader_source_compositor_blur_glsl_js__ = __webpack_require__(87); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14_claygl_src_shader_source_compositor_lut_glsl_js__ = __webpack_require__(88); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15_claygl_src_shader_source_compositor_output_glsl_js__ = __webpack_require__(89); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16_claygl_src_shader_source_compositor_bright_glsl_js__ = __webpack_require__(90); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17_claygl_src_shader_source_compositor_downsample_glsl_js__ = __webpack_require__(91); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18_claygl_src_shader_source_compositor_upsample_glsl_js__ = __webpack_require__(92); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19_claygl_src_shader_source_compositor_hdr_glsl_js__ = __webpack_require__(93); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20_claygl_src_shader_source_compositor_blend_glsl_js__ = __webpack_require__(94); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21_claygl_src_shader_source_compositor_fxaa_glsl_js__ = __webpack_require__(95); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__DOF_glsl_js__ = __webpack_require__(198); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__edge_glsl_js__ = __webpack_require__(199); - - - - - - - - - - - - - - - - - - - - - - - - - - - -__WEBPACK_IMPORTED_MODULE_0_claygl_src_Shader__["a" /* default */]['import'](__WEBPACK_IMPORTED_MODULE_13_claygl_src_shader_source_compositor_blur_glsl_js__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_0_claygl_src_Shader__["a" /* default */]['import'](__WEBPACK_IMPORTED_MODULE_14_claygl_src_shader_source_compositor_lut_glsl_js__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_0_claygl_src_Shader__["a" /* default */]['import'](__WEBPACK_IMPORTED_MODULE_15_claygl_src_shader_source_compositor_output_glsl_js__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_0_claygl_src_Shader__["a" /* default */]['import'](__WEBPACK_IMPORTED_MODULE_16_claygl_src_shader_source_compositor_bright_glsl_js__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_0_claygl_src_Shader__["a" /* default */]['import'](__WEBPACK_IMPORTED_MODULE_17_claygl_src_shader_source_compositor_downsample_glsl_js__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_0_claygl_src_Shader__["a" /* default */]['import'](__WEBPACK_IMPORTED_MODULE_18_claygl_src_shader_source_compositor_upsample_glsl_js__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_0_claygl_src_Shader__["a" /* default */]['import'](__WEBPACK_IMPORTED_MODULE_19_claygl_src_shader_source_compositor_hdr_glsl_js__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_0_claygl_src_Shader__["a" /* default */]['import'](__WEBPACK_IMPORTED_MODULE_20_claygl_src_shader_source_compositor_blend_glsl_js__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_0_claygl_src_Shader__["a" /* default */]['import'](__WEBPACK_IMPORTED_MODULE_21_claygl_src_shader_source_compositor_fxaa_glsl_js__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_0_claygl_src_Shader__["a" /* default */]['import'](__WEBPACK_IMPORTED_MODULE_22__DOF_glsl_js__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_0_claygl_src_Shader__["a" /* default */]['import'](__WEBPACK_IMPORTED_MODULE_23__edge_glsl_js__["a" /* default */]); - - -var commonOutputs = { - color : { - parameters : { - width : function (renderer) { - return renderer.getWidth(); - }, - height : function (renderer) { - return renderer.getHeight(); - } - } - } -} - -var FINAL_NODES_CHAIN = ['composite', 'FXAA']; - -function EffectCompositor() { - this._sourceTexture = new __WEBPACK_IMPORTED_MODULE_1_claygl_src_Texture2D__["a" /* default */]({ - type: __WEBPACK_IMPORTED_MODULE_2_claygl_src_Texture__["a" /* default */].HALF_FLOAT - }); - this._depthTexture = new __WEBPACK_IMPORTED_MODULE_1_claygl_src_Texture2D__["a" /* default */]({ - format: __WEBPACK_IMPORTED_MODULE_2_claygl_src_Texture__["a" /* default */].DEPTH_COMPONENT, - type: __WEBPACK_IMPORTED_MODULE_2_claygl_src_Texture__["a" /* default */].UNSIGNED_INT - }); - - this._framebuffer = new __WEBPACK_IMPORTED_MODULE_3_claygl_src_FrameBuffer__["a" /* default */](); - this._framebuffer.attach(this._sourceTexture); - this._framebuffer.attach(this._depthTexture, __WEBPACK_IMPORTED_MODULE_3_claygl_src_FrameBuffer__["a" /* default */].DEPTH_ATTACHMENT); - - this._normalPass = new __WEBPACK_IMPORTED_MODULE_9__NormalPass__["a" /* default */](); - - this._compositor = Object(__WEBPACK_IMPORTED_MODULE_4_claygl_src_compositor_createCompositor__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_12__composite_js__["a" /* default */]); - - var sourceNode = this._compositor.getNodeByName('source'); - sourceNode.texture = this._sourceTexture; - var cocNode = this._compositor.getNodeByName('coc'); - - this._sourceNode = sourceNode; - this._cocNode = cocNode; - this._compositeNode = this._compositor.getNodeByName('composite'); - this._fxaaNode = this._compositor.getNodeByName('FXAA'); - - this._dofBlurNodes = ['dof_far_blur', 'dof_near_blur', 'dof_coc_blur'].map(function (name) { - return this._compositor.getNodeByName(name); - }, this); - - this._dofBlurKernel = 0; - this._dofBlurKernelSize = new Float32Array(0); - - this._finalNodesChain = FINAL_NODES_CHAIN.map(function (name) { - return this._compositor.getNodeByName(name); - }, this); - - var gBufferObj = { - normalTexture: this._normalPass.getNormalTexture(), - depthTexture: this._normalPass.getDepthTexture() - }; - this._ssaoPass = new __WEBPACK_IMPORTED_MODULE_5__SSAOPass__["a" /* default */](gBufferObj); - this._ssrPass = new __WEBPACK_IMPORTED_MODULE_6__SSRPass__["a" /* default */](gBufferObj); - this._edgePass = new __WEBPACK_IMPORTED_MODULE_10__EdgePass__["a" /* default */](gBufferObj); -} - -EffectCompositor.prototype.resize = function (width, height, dpr) { - dpr = dpr || 1; - var width = width * dpr; - var height = height * dpr; - var sourceTexture = this._sourceTexture; - var depthTexture = this._depthTexture; - - sourceTexture.width = width; - sourceTexture.height = height; - depthTexture.width = width; - depthTexture.height = height; -}; - -EffectCompositor.prototype._ifRenderNormalPass = function () { - return this._enableSSAO || this._enableEdge || this._enableSSR; -}; - -EffectCompositor.prototype._getPrevNode = function (node) { - var idx = FINAL_NODES_CHAIN.indexOf(node.name) - 1; - var prevNode = this._finalNodesChain[idx]; - while (prevNode && !this._compositor.getNodeByName(prevNode.name)) { - idx -= 1; - prevNode = this._finalNodesChain[idx]; - } - return prevNode; -}; -EffectCompositor.prototype._getNextNode = function (node) { - var idx = FINAL_NODES_CHAIN.indexOf(node.name) + 1; - var nextNode = this._finalNodesChain[idx]; - while (nextNode && !this._compositor.getNodeByName(nextNode.name)) { - idx += 1; - nextNode = this._finalNodesChain[idx]; - } - return nextNode; -}; -EffectCompositor.prototype._addChainNode = function (node) { - var prevNode = this._getPrevNode(node); - var nextNode = this._getNextNode(node); - if (!prevNode) { - return; - } - - prevNode.outputs = commonOutputs; - node.inputs.texture = prevNode.name; - if (nextNode) { - node.outputs = commonOutputs; - nextNode.inputs.texture = node.name; - } - else { - node.outputs = null; - } - this._compositor.addNode(node); -}; -EffectCompositor.prototype._removeChainNode = function (node) { - var prevNode = this._getPrevNode(node); - var nextNode = this._getNextNode(node); - if (!prevNode) { - return; - } - - if (nextNode) { - prevNode.outputs = commonOutputs; - nextNode.inputs.texture = prevNode.name; - } - else { - prevNode.outputs = null; - } - this._compositor.removeNode(node); -}; -/** - * Update normal - */ -EffectCompositor.prototype.updateNormal = function (renderer, scene, camera, frame) { - if (this._ifRenderNormalPass()) { - this._normalPass.update(renderer, scene, camera); - } -}; - -/** - * Render SSAO after render the scene, before compositing - */ -EffectCompositor.prototype.updateSSAO = function (renderer, scene, camera, frame) { - this._ssaoPass.update(renderer, camera, frame); -}; - -/** - * Enable SSAO effect - */ -EffectCompositor.prototype.enableSSAO = function () { - this._enableSSAO = true; -}; - -/** - * Disable SSAO effect - */ -EffectCompositor.prototype.disableSSAO = function () { - this._enableSSAO = false; -}; - -/** - * Enable SSR effect - */ -EffectCompositor.prototype.enableSSR = function () { - this._enableSSR = true; - // this._normalPass.enableTargetTexture3 = true; -}; -/** - * Disable SSR effect - */ -EffectCompositor.prototype.disableSSR = function () { - this._enableSSR = false; - // this._normalPass.enableTargetTexture3 = false; -}; - -/** - * Render SSAO after render the scene, before compositing - */ -EffectCompositor.prototype.getSSAOTexture = function () { - return this._ssaoPass.getTargetTexture(); -}; - -/** - * @return {clay.FrameBuffer} - */ -EffectCompositor.prototype.getSourceFrameBuffer = function () { - return this._framebuffer; -}; - -/** - * @return {clay.Texture2D} - */ -EffectCompositor.prototype.getSourceTexture = function () { - return this._sourceTexture; -}; - -/** - * Disable fxaa effect - */ -EffectCompositor.prototype.disableFXAA = function () { - this._removeChainNode(this._fxaaNode); -}; - -/** - * Enable fxaa effect - */ -EffectCompositor.prototype.enableFXAA = function () { - this._addChainNode(this._fxaaNode); -}; - -/** - * Enable bloom effect - */ -EffectCompositor.prototype.enableBloom = function () { - this._compositeNode.inputs.bloom = 'bloom_composite'; - this._compositor.dirty(); -}; - -/** - * Disable bloom effect - */ -EffectCompositor.prototype.disableBloom = function () { - this._compositeNode.inputs.bloom = null; - this._compositor.dirty(); -}; - -/** - * Enable depth of field effect - */ -EffectCompositor.prototype.enableDOF = function () { - this._compositeNode.inputs.texture = 'dof_composite'; - this._compositor.dirty(); -}; -/** - * Disable depth of field effect - */ -EffectCompositor.prototype.disableDOF = function () { - this._compositeNode.inputs.texture = 'source'; - this._compositor.dirty(); -}; - -/** - * Enable color correction - */ -EffectCompositor.prototype.enableColorCorrection = function () { - this._compositeNode.define('COLOR_CORRECTION'); - this._enableColorCorrection = true; -}; -/** - * Disable color correction - */ -EffectCompositor.prototype.disableColorCorrection = function () { - this._compositeNode.undefine('COLOR_CORRECTION'); - this._enableColorCorrection = false; -}; - -/** - * Enable edge detection - */ -EffectCompositor.prototype.enableEdge = function () { - this._enableEdge = true; -}; - -/** - * Disable edge detection - */ -EffectCompositor.prototype.disableEdge = function () { - this._enableEdge = false; -}; - -/** - * Set bloom intensity - * @param {number} value - */ -EffectCompositor.prototype.setBloomIntensity = function (value) { - this._compositeNode.setParameter('bloomIntensity', value); -}; - -EffectCompositor.prototype.setSSAOParameter = function (name, value) { - switch (name) { - case 'quality': - // PENDING - var kernelSize = ({ - low: 6, - medium: 12, - high: 32, - ultra: 62 - })[value] || 12; - this._ssaoPass.setParameter('kernelSize', kernelSize); - break; - case 'radius': - this._ssaoPass.setParameter(name, value); - this._ssaoPass.setParameter('bias', value / 200); - break; - case 'intensity': - this._ssaoPass.setParameter(name, value); - break; - default: - if (true) { - console.warn('Unkown SSAO parameter ' + name); - } - } -}; - -EffectCompositor.prototype.setDOFParameter = function (name, value) { - switch (name) { - case 'focalDistance': - case 'focalRange': - case 'fstop': - this._cocNode.setParameter(name, value); - break; - case 'blurRadius': - for (var i = 0; i < this._dofBlurNodes.length; i++) { - this._dofBlurNodes[i].setParameter('blurRadius', value); - } - break; - case 'quality': - var kernelSize = ({ - low: 4, medium: 8, high: 16, ultra: 32 - })[value] || 8; - this._dofBlurKernelSize = kernelSize; - for (var i = 0; i < this._dofBlurNodes.length; i++) { - this._dofBlurNodes[i].pass.material.define('POISSON_KERNEL_SIZE', kernelSize); - } - this._dofBlurKernel = new Float32Array(kernelSize * 2); - break; - default: - if (true) { - console.warn('Unkown DOF parameter ' + name); - } - } -}; - -EffectCompositor.prototype.setSSRParameter = function (name, value) { - if (value == null) { - return; - } - switch (name) { - case 'quality': - // PENDING - var maxIteration = ({ - low: 10, - medium: 15, - high: 30, - ultra: 80 - })[value] || 20; - var pixelStride = ({ - low: 32, - medium: 16, - high: 8, - ultra: 4 - })[value] || 16; - this._ssrPass.setParameter('maxIteration', maxIteration); - this._ssrPass.setParameter('pixelStride', pixelStride); - break; - case 'maxRoughness': - this._ssrPass.setParameter('minGlossiness', Math.max(Math.min(1.0 - value, 1.0), 0.0)); - break; - case 'physical': - this.setPhysicallyCorrectSSR(value); - break; - default: - console.warn('Unkown SSR parameter ' + name); - } -}; - -EffectCompositor.prototype.setPhysicallyCorrectSSR = function (physical) { - this._ssrPass.setPhysicallyCorrect(physical); -}; - -/** - * Set color of edge - */ -EffectCompositor.prototype.setEdgeColor = function (value) { - var color = __WEBPACK_IMPORTED_MODULE_8__util_graphicGL__["a" /* default */].parseColor(value); - this._edgePass.setParameter('edgeColor', color); -}; - -EffectCompositor.prototype.setExposure = function (value) { - this._compositeNode.setParameter('exposure', Math.pow(2, value)); -}; - -EffectCompositor.prototype.setColorLookupTexture = function (image, api) { - this._compositeNode.pass.material.setTextureImage('lut', this._enableColorCorrection ? image : 'none', api, { - minFilter: __WEBPACK_IMPORTED_MODULE_8__util_graphicGL__["a" /* default */].Texture.NEAREST, - magFilter: __WEBPACK_IMPORTED_MODULE_8__util_graphicGL__["a" /* default */].Texture.NEAREST, - flipY: false - }); -}; -EffectCompositor.prototype.setColorCorrection = function (type, value) { - this._compositeNode.setParameter(type, value); -}; - -EffectCompositor.prototype.isSSREnabled = function () { - return this._enableSSR; -}; - -EffectCompositor.prototype.composite = function (renderer, scene, camera, framebuffer, frame) { - - var sourceTexture = this._sourceTexture; - var targetTexture = sourceTexture; - if (this._enableEdge) { - this._edgePass.update(renderer, camera, sourceTexture, frame); - sourceTexture = targetTexture = this._edgePass.getTargetTexture(); - } - if (this._enableSSR) { - this._ssrPass.update(renderer, camera, sourceTexture, frame); - targetTexture = this._ssrPass.getTargetTexture(); - - this._ssrPass.setSSAOTexture( - this._enableSSAO ? this._ssaoPass.getTargetTexture() : null - ); - // var lights = scene.getLights(); - // for (var i = 0; i < lights.length; i++) { - // if (lights[i].cubemap) { - // this._ssrPass.setAmbientCubemap(lights[i].cubemap, lights[i].intensity); - // } - // } - } - this._sourceNode.texture = targetTexture; - - this._cocNode.setParameter('depth', this._depthTexture); - - var blurKernel = this._dofBlurKernel; - var blurKernelSize = this._dofBlurKernelSize; - var frameAll = Math.floor(__WEBPACK_IMPORTED_MODULE_7__poissonKernel__["a" /* default */].length / 2 / blurKernelSize); - var kernelOffset = frame % frameAll; - - for (var i = 0; i < blurKernelSize * 2; i++) { - blurKernel[i] = __WEBPACK_IMPORTED_MODULE_7__poissonKernel__["a" /* default */][i + kernelOffset * blurKernelSize * 2]; - } - - for (var i = 0; i < this._dofBlurNodes.length; i++) { - this._dofBlurNodes[i].setParameter('percent', frame / 30.0); - this._dofBlurNodes[i].setParameter('poissonKernel', blurKernel); - } - - this._cocNode.setParameter('zNear', camera.near); - this._cocNode.setParameter('zFar', camera.far); - - this._compositor.render(renderer, framebuffer); -}; - -EffectCompositor.prototype.dispose = function (renderer) { - this._sourceTexture.dispose(renderer); - this._depthTexture.dispose(renderer); - this._framebuffer.dispose(renderer); - this._compositor.dispose(renderer); - - this._normalPass.dispose(renderer); - this._ssaoPass.dispose(renderer); -}; - -/* harmony default export */ __webpack_exports__["a"] = (EffectCompositor); - -/***/ }), -/* 177 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__createCompositor__ = __webpack_require__(178); -// DEPRECATED - -/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__createCompositor__["a" /* default */]); - -/***/ }), -/* 178 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__core_util__ = __webpack_require__(23); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__compositor_Compositor__ = __webpack_require__(179); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__compositor_SceneNode__ = __webpack_require__(181); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__compositor_TextureNode__ = __webpack_require__(182); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__compositor_FilterNode__ = __webpack_require__(183); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__Shader__ = __webpack_require__(8); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__Texture__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__Texture2D__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__TextureCube__ = __webpack_require__(27); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__shader_registerBuiltinCompositor__ = __webpack_require__(184); - - - - - - - - - - - - -Object(__WEBPACK_IMPORTED_MODULE_9__shader_registerBuiltinCompositor__["a" /* default */])(__WEBPACK_IMPORTED_MODULE_5__Shader__["a" /* default */]); - -var shaderSourceReg = /^#source\((.*?)\)/; - -/** - * @name clay.createCompositor - * @function - * @param {Object} json - * @param {Object} [opts] - * @return {clay.compositor.Compositor} - */ -function createCompositor(json, opts) { - var compositor = new __WEBPACK_IMPORTED_MODULE_1__compositor_Compositor__["a" /* default */](); - opts = opts || {}; - - var lib = { - textures: {}, - parameters: {} - }; - var afterLoad = function(shaderLib, textureLib) { - for (var i = 0; i < json.nodes.length; i++) { - var nodeInfo = json.nodes[i]; - var node = createNode(nodeInfo, lib, opts); - if (node) { - compositor.addNode(node); - } - } - }; - - for (var name in json.parameters) { - var paramInfo = json.parameters[name]; - lib.parameters[name] = convertParameter(paramInfo); - } - // TODO load texture asynchronous - loadTextures(json, lib, opts, function(textureLib) { - lib.textures = textureLib; - afterLoad(); - }); - - return compositor; -} - -function createNode(nodeInfo, lib, opts) { - var type = nodeInfo.type || 'filter'; - var shaderSource; - var inputs; - var outputs; - - if (type === 'filter') { - var shaderExp = nodeInfo.shader.trim(); - var res = shaderSourceReg.exec(shaderExp); - if (res) { - shaderSource = __WEBPACK_IMPORTED_MODULE_5__Shader__["a" /* default */].source(res[1].trim()); - } - else if (shaderExp.charAt(0) === '#') { - shaderSource = lib.shaders[shaderExp.substr(1)]; - } - if (!shaderSource) { - shaderSource = shaderExp; - } - if (!shaderSource) { - return; - } - } - - if (nodeInfo.inputs) { - inputs = {}; - for (var name in nodeInfo.inputs) { - if (typeof nodeInfo.inputs[name] === 'string') { - inputs[name] = nodeInfo.inputs[name]; - } - else { - inputs[name] = { - node: nodeInfo.inputs[name].node, - pin: nodeInfo.inputs[name].pin - }; - } - } - } - if (nodeInfo.outputs) { - outputs = {}; - for (var name in nodeInfo.outputs) { - var outputInfo = nodeInfo.outputs[name]; - outputs[name] = {}; - if (outputInfo.attachment != null) { - outputs[name].attachment = outputInfo.attachment; - } - if (outputInfo.keepLastFrame != null) { - outputs[name].keepLastFrame = outputInfo.keepLastFrame; - } - if (outputInfo.outputLastFrame != null) { - outputs[name].outputLastFrame = outputInfo.outputLastFrame; - } - if (outputInfo.parameters) { - outputs[name].parameters = convertParameter(outputInfo.parameters); - } - } - } - var node; - if (type === 'scene') { - node = new __WEBPACK_IMPORTED_MODULE_2__compositor_SceneNode__["a" /* default */]({ - name: nodeInfo.name, - scene: opts.scene, - camera: opts.camera, - outputs: outputs - }); - } - else if (type === 'texture') { - node = new __WEBPACK_IMPORTED_MODULE_3__compositor_TextureNode__["a" /* default */]({ - name: nodeInfo.name, - outputs: outputs - }); - } - // Default is filter - else { - node = new __WEBPACK_IMPORTED_MODULE_4__compositor_FilterNode__["a" /* default */]({ - name: nodeInfo.name, - shader: shaderSource, - inputs: inputs, - outputs: outputs - }); - } - if (node) { - if (nodeInfo.parameters) { - for (var name in nodeInfo.parameters) { - var val = nodeInfo.parameters[name]; - if (typeof(val) === 'string') { - val = val.trim(); - if (val.charAt(0) === '#') { - val = lib.textures[val.substr(1)]; - } - else { - node.on( - 'beforerender', createSizeSetHandler( - name, tryConvertExpr(val) - ) - ); - } - } - node.setParameter(name, val); - } - } - if (nodeInfo.defines && node.pass) { - for (var name in nodeInfo.defines) { - var val = nodeInfo.defines[name]; - node.pass.material.define('fragment', name, val); - } - } - } - return node; -} - -function defaultWidthFunc(width, height) { - return width; -} -function defaultHeightFunc(width, height) { - return height; -} - -function convertParameter(paramInfo) { - var param = {}; - if (!paramInfo) { - return param; - } - ['type', 'minFilter', 'magFilter', 'wrapS', 'wrapT', 'flipY', 'useMipmap'] - .forEach(function(name) { - var val = paramInfo[name]; - if (val != null) { - // Convert string to enum - if (typeof val === 'string') { - val = __WEBPACK_IMPORTED_MODULE_6__Texture__["a" /* default */][val]; - } - param[name] = val; - } - }); - - var sizeScale = paramInfo.scale || 1; - ['width', 'height'] - .forEach(function(name) { - if (paramInfo[name] != null) { - var val = paramInfo[name]; - if (typeof val === 'string') { - val = val.trim(); - param[name] = createSizeParser( - name, tryConvertExpr(val), sizeScale - ); - } - else { - param[name] = val; - } - } - }); - if (!param.width) { - param.width = defaultWidthFunc; - } - if (!param.height) { - param.height = defaultHeightFunc; - } - - if (paramInfo.useMipmap != null) { - param.useMipmap = paramInfo.useMipmap; - } - return param; -} - -function loadTextures(json, lib, opts, callback) { - if (!json.textures) { - callback({}); - return; - } - var textures = {}; - var loading = 0; - - var cbd = false; - var textureRootPath = opts.textureRootPath; - __WEBPACK_IMPORTED_MODULE_0__core_util__["a" /* default */].each(json.textures, function(textureInfo, name) { - var texture; - var path = textureInfo.path; - var parameters = convertParameter(textureInfo.parameters); - if (Array.isArray(path) && path.length === 6) { - if (textureRootPath) { - path = path.map(function(item) { - return __WEBPACK_IMPORTED_MODULE_0__core_util__["a" /* default */].relative2absolute(item, textureRootPath); - }); - } - texture = new __WEBPACK_IMPORTED_MODULE_8__TextureCube__["a" /* default */](parameters); - } - else if(typeof path === 'string') { - if (textureRootPath) { - path = __WEBPACK_IMPORTED_MODULE_0__core_util__["a" /* default */].relative2absolute(path, textureRootPath); - } - texture = new __WEBPACK_IMPORTED_MODULE_7__Texture2D__["a" /* default */](parameters); - } - else { - return; - } - - texture.load(path); - loading++; - texture.once('success', function() { - textures[name] = texture; - loading--; - if (loading === 0) { - callback(textures); - cbd = true; - } - }); - }); - - if (loading === 0 && !cbd) { - callback(textures); - } -} - -function createSizeSetHandler(name, exprFunc) { - return function (renderer) { - // PENDING viewport size or window size - var dpr = renderer.getDevicePixelRatio(); - // PENDING If multiply dpr ? - var width = renderer.getWidth(); - var height = renderer.getHeight(); - var result = exprFunc(width, height, dpr); - this.setParameter(name, result); - }; -} - -function createSizeParser(name, exprFunc, scale) { - scale = scale || 1; - return function (renderer) { - var dpr = renderer.getDevicePixelRatio(); - var width = renderer.getWidth() * scale; - var height = renderer.getHeight() * scale; - return exprFunc(width, height, dpr); - }; -} - -function tryConvertExpr(string) { - // PENDING - var exprRes = /^expr\((.*)\)$/.exec(string); - if (exprRes) { - try { - var func = new Function('width', 'height', 'dpr', 'return ' + exprRes[1]); - // Try run t - func(1, 1); - - return func; - } - catch (e) { - throw new Error('Invalid expression.'); - } - } -} - -/* harmony default export */ __webpack_exports__["a"] = (createCompositor); - - -/***/ }), -/* 179 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Graph__ = __webpack_require__(180); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__TexturePool__ = __webpack_require__(86); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__FrameBuffer__ = __webpack_require__(10); - - - - -/** - * Compositor provide graph based post processing - * - * @constructor clay.compositor.Compositor - * @extends clay.compositor.Graph - * - */ -var Compositor = __WEBPACK_IMPORTED_MODULE_0__Graph__["a" /* default */].extend(function() { - return { - // Output node - _outputs: [], - - _texturePool: new __WEBPACK_IMPORTED_MODULE_1__TexturePool__["a" /* default */](), - - _frameBuffer: new __WEBPACK_IMPORTED_MODULE_2__FrameBuffer__["a" /* default */]({ - depthBuffer: false - }) - }; -}, -/** @lends clay.compositor.Compositor.prototype */ -{ - addNode: function(node) { - __WEBPACK_IMPORTED_MODULE_0__Graph__["a" /* default */].prototype.addNode.call(this, node); - node._compositor = this; - }, - /** - * @param {clay.Renderer} renderer - */ - render: function(renderer, frameBuffer) { - if (this._dirty) { - this.update(); - this._dirty = false; - - this._outputs.length = 0; - for (var i = 0; i < this.nodes.length; i++) { - if (!this.nodes[i].outputs) { - this._outputs.push(this.nodes[i]); - } - } - } - - for (var i = 0; i < this.nodes.length; i++) { - // Update the reference number of each output texture - this.nodes[i].beforeFrame(); - } - - for (var i = 0; i < this._outputs.length; i++) { - this._outputs[i].updateReference(); - } - - for (var i = 0; i < this._outputs.length; i++) { - this._outputs[i].render(renderer, frameBuffer); - } - - for (var i = 0; i < this.nodes.length; i++) { - // Clear up - this.nodes[i].afterFrame(); - } - }, - - allocateTexture: function (parameters) { - return this._texturePool.get(parameters); - }, - - releaseTexture: function (parameters) { - this._texturePool.put(parameters); - }, - - getFrameBuffer: function () { - return this._frameBuffer; - }, - - /** - * Dispose compositor - * @param {clay.Renderer} renderer - */ - dispose: function (renderer) { - this._texturePool.clear(renderer); - } -}); - -/* harmony default export */ __webpack_exports__["a"] = (Compositor); - - -/***/ }), -/* 180 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__core_Base__ = __webpack_require__(7); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__CompositorNode__ = __webpack_require__(48); - - - -/** - * @constructor clay.compositor.Graph - * @extends clay.core.Base - */ -var Graph = __WEBPACK_IMPORTED_MODULE_0__core_Base__["a" /* default */].extend(function () { - return /** @lends clay.compositor.Graph# */ { - /** - * @type {Array.} - */ - nodes: [] - }; -}, -/** @lends clay.compositor.Graph.prototype */ -{ - - /** - * Mark to update - */ - dirty: function () { - this._dirty = true; - }, - /** - * @param {clay.compositor.CompositorNode} node - */ - addNode: function (node) { - - if (this.nodes.indexOf(node) >= 0) { - return; - } - - this.nodes.push(node); - - this._dirty = true; - }, - /** - * @param {clay.compositor.CompositorNode|string} node - */ - removeNode: function (node) { - if (typeof node === 'string') { - node = this.getNodeByName(node); - } - var idx = this.nodes.indexOf(node); - if (idx >= 0) { - this.nodes.splice(idx, 1); - this._dirty = true; - } - }, - /** - * @param {string} name - * @return {clay.compositor.CompositorNode} - */ - getNodeByName: function (name) { - for (var i = 0; i < this.nodes.length; i++) { - if (this.nodes[i].name === name) { - return this.nodes[i]; - } - } - }, - /** - * Update links of graph - */ - update: function () { - for (var i = 0; i < this.nodes.length; i++) { - this.nodes[i].clear(); - } - // Traverse all the nodes and build the graph - for (var i = 0; i < this.nodes.length; i++) { - var node = this.nodes[i]; - - if (!node.inputs) { - continue; - } - for (var inputName in node.inputs) { - if (!node.inputs[inputName]) { - continue; - } - if (node.pass && !node.pass.material.isUniformEnabled(inputName)) { - console.warn('Pin ' + node.name + '.' + inputName + ' not used.'); - continue; - } - var fromPinInfo = node.inputs[inputName]; - - var fromPin = this.findPin(fromPinInfo); - if (fromPin) { - node.link(inputName, fromPin.node, fromPin.pin); - } - else { - if (typeof fromPinInfo === 'string') { - console.warn('Node ' + fromPinInfo + ' not exist'); - } - else { - console.warn('Pin of ' + fromPinInfo.node + '.' + fromPinInfo.pin + ' not exist'); - } - } - } - } - }, - - findPin: function (input) { - var node; - // Try to take input as a directly a node - if (typeof input === 'string' || input instanceof __WEBPACK_IMPORTED_MODULE_1__CompositorNode__["a" /* default */]) { - input = { - node: input - }; - } - - if (typeof input.node === 'string') { - for (var i = 0; i < this.nodes.length; i++) { - var tmp = this.nodes[i]; - if (tmp.name === input.node) { - node = tmp; - } - } - } - else { - node = input.node; - } - if (node) { - var inputPin = input.pin; - if (!inputPin) { - // Use first pin defaultly - if (node.outputs) { - inputPin = Object.keys(node.outputs)[0]; - } - } - if (node.outputs[inputPin]) { - return { - node: node, - pin: inputPin - }; - } - } - } -}); - -/* harmony default export */ __webpack_exports__["a"] = (Graph); - - -/***/ }), -/* 181 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__CompositorNode__ = __webpack_require__(48); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__core_glenum__ = __webpack_require__(11); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__FrameBuffer__ = __webpack_require__(10); - - - - -/** - * @constructor clay.compositor.SceneNode - * @extends clay.compositor.CompositorNode - */ -var SceneNode = __WEBPACK_IMPORTED_MODULE_0__CompositorNode__["a" /* default */].extend( -/** @lends clay.compositor.SceneNode# */ -{ - name: 'scene', - /** - * @type {clay.Scene} - */ - scene: null, - /** - * @type {clay.Camera} - */ - camera: null, - /** - * @type {boolean} - */ - autoUpdateScene: true, - /** - * @type {boolean} - */ - preZ: false - -}, function() { - this.frameBuffer = new __WEBPACK_IMPORTED_MODULE_2__FrameBuffer__["a" /* default */](); -}, { - render: function(renderer) { - - this._rendering = true; - var _gl = renderer.gl; - - this.trigger('beforerender'); - - var renderInfo; - - if (!this.outputs) { - - renderInfo = renderer.render(this.scene, this.camera, !this.autoUpdateScene, this.preZ); - - } - else { - - var frameBuffer = this.frameBuffer; - for (var name in this.outputs) { - var parameters = this.updateParameter(name, renderer); - var outputInfo = this.outputs[name]; - var texture = this._compositor.allocateTexture(parameters); - this._outputTextures[name] = texture; - - var attachment = outputInfo.attachment || _gl.COLOR_ATTACHMENT0; - if (typeof(attachment) == 'string') { - attachment = _gl[attachment]; - } - frameBuffer.attach(texture, attachment); - } - frameBuffer.bind(renderer); - - // MRT Support in chrome - // https://www.khronos.org/registry/webgl/sdk/tests/conformance/extensions/ext-draw-buffers.html - var ext = renderer.getGLExtension('EXT_draw_buffers'); - if (ext) { - var bufs = []; - for (var attachment in this.outputs) { - attachment = parseInt(attachment); - if (attachment >= _gl.COLOR_ATTACHMENT0 && attachment <= _gl.COLOR_ATTACHMENT0 + 8) { - bufs.push(attachment); - } - } - ext.drawBuffersEXT(bufs); - } - - // Always clear - // PENDING - renderer.saveClear(); - renderer.clearBit = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].DEPTH_BUFFER_BIT | __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].COLOR_BUFFER_BIT; - renderInfo = renderer.render(this.scene, this.camera, !this.autoUpdateScene, this.preZ); - renderer.restoreClear(); - - frameBuffer.unbind(renderer); - } - - this.trigger('afterrender', renderInfo); - - this._rendering = false; - this._rendered = true; - } -}); - -/* harmony default export */ __webpack_exports__["a"] = (SceneNode); - - -/***/ }), -/* 182 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__CompositorNode__ = __webpack_require__(48); - - -/** - * @constructor clay.compositor.TextureNode - * @extends clay.compositor.CompositorNode - */ -var TextureNode = __WEBPACK_IMPORTED_MODULE_0__CompositorNode__["a" /* default */].extend(function() { - return /** @lends clay.compositor.TextureNode# */ { - /** - * @type {clay.Texture2D} - */ - texture: null, - - // Texture node must have output without parameters - outputs: { - color: {} - } - }; -}, function () { -}, { - - getOutput: function (renderer, name) { - return this.texture; - }, - - // Do nothing - beforeFrame: function () {}, - afterFrame: function () {} -}); - -/* harmony default export */ __webpack_exports__["a"] = (TextureNode); - - -/***/ }), -/* 183 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Pass__ = __webpack_require__(16); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__CompositorNode__ = __webpack_require__(48); -// TODO Shader library - - - -// TODO curlnoise demo wrong - -// PENDING -// Use topological sort ? - -/** - * Filter node - * - * @constructor clay.compositor.FilterNode - * @extends clay.compositor.CompositorNode - * - * @example - var node = new clay.compositor.FilterNode({ - name: 'fxaa', - shader: clay.Shader.source('clay.compositor.fxaa'), - inputs: { - texture: { - node: 'scene', - pin: 'color' - } - }, - // Multiple outputs is preserved for MRT support in WebGL2.0 - outputs: { - color: { - attachment: clay.FrameBuffer.COLOR_ATTACHMENT0 - parameters: { - format: clay.Texture.RGBA, - width: 512, - height: 512 - }, - // Node will keep the RTT rendered in last frame - keepLastFrame: true, - // Force the node output the RTT rendered in last frame - outputLastFrame: true - } - } - }); - * - */ -var FilterNode = __WEBPACK_IMPORTED_MODULE_1__CompositorNode__["a" /* default */].extend(function () { - return /** @lends clay.compositor.FilterNode# */ { - /** - * @type {string} - */ - name: '', - - /** - * @type {Object} - */ - inputs: {}, - - /** - * @type {Object} - */ - outputs: null, - - /** - * @type {string} - */ - shader: '', - - /** - * Input links, will be updated by the graph - * @example: - * inputName: { - * node: someNode, - * pin: 'xxxx' - * } - * @type {Object} - */ - inputLinks: {}, - - /** - * Output links, will be updated by the graph - * @example: - * outputName: { - * node: someNode, - * pin: 'xxxx' - * } - * @type {Object} - */ - outputLinks: {}, - - /** - * @type {clay.compositor.Pass} - */ - pass: null, - - // Save the output texture of previous frame - // Will be used when there exist a circular reference - _prevOutputTextures: {}, - _outputTextures: {}, - - // Example: { name: 2 } - _outputReferences: {}, - - _rendering: false, - // If rendered in this frame - _rendered: false, - - _compositor: null - }; -}, function () { - - var pass = new __WEBPACK_IMPORTED_MODULE_0__Pass__["a" /* default */]({ - fragment: this.shader - }); - this.pass = pass; -}, -/** @lends clay.compositor.FilterNode.prototype */ -{ - /** - * @param {clay.Renderer} renderer - */ - render: function (renderer, frameBuffer) { - this.trigger('beforerender', renderer); - - this._rendering = true; - - var _gl = renderer.gl; - - for (var inputName in this.inputLinks) { - var link = this.inputLinks[inputName]; - var inputTexture = link.node.getOutput(renderer, link.pin); - this.pass.setUniform(inputName, inputTexture); - } - // Output - if (!this.outputs) { - this.pass.outputs = null; - - this._compositor.getFrameBuffer().unbind(renderer); - - this.pass.render(renderer, frameBuffer); - } - else { - this.pass.outputs = {}; - - var attachedTextures = {}; - for (var name in this.outputs) { - var parameters = this.updateParameter(name, renderer); - if (isNaN(parameters.width)) { - this.updateParameter(name, renderer); - } - var outputInfo = this.outputs[name]; - var texture = this._compositor.allocateTexture(parameters); - this._outputTextures[name] = texture; - var attachment = outputInfo.attachment || _gl.COLOR_ATTACHMENT0; - if (typeof(attachment) === 'string') { - attachment = _gl[attachment]; - } - attachedTextures[attachment] = texture; - } - this._compositor.getFrameBuffer().bind(renderer); - - for (var attachment in attachedTextures) { - // FIXME attachment changes in different nodes - this._compositor.getFrameBuffer().attach( - attachedTextures[attachment], attachment - ); - } - - this.pass.render(renderer); - - // Because the data of texture is changed over time, - // Here update the mipmaps of texture each time after rendered; - this._compositor.getFrameBuffer().updateMipmap(renderer); - } - - for (var inputName in this.inputLinks) { - var link = this.inputLinks[inputName]; - link.node.removeReference(link.pin); - } - - this._rendering = false; - this._rendered = true; - - this.trigger('afterrender', renderer); - }, - - // TODO Remove parameter function callback - updateParameter: function (outputName, renderer) { - var outputInfo = this.outputs[outputName]; - var parameters = outputInfo.parameters; - var parametersCopy = outputInfo._parametersCopy; - if (!parametersCopy) { - parametersCopy = outputInfo._parametersCopy = {}; - } - if (parameters) { - for (var key in parameters) { - if (key !== 'width' && key !== 'height') { - parametersCopy[key] = parameters[key]; - } - } - } - var width, height; - if (parameters.width instanceof Function) { - width = parameters.width.call(this, renderer); - } - else { - width = parameters.width; - } - if (parameters.height instanceof Function) { - height = parameters.height.call(this, renderer); - } - else { - height = parameters.height; - } - width = Math.ceil(width); - height = Math.ceil(height); - if ( - parametersCopy.width !== width - || parametersCopy.height !== height - ) { - if (this._outputTextures[outputName]) { - this._outputTextures[outputName].dispose(renderer); - } - } - parametersCopy.width = width; - parametersCopy.height = height; - - return parametersCopy; - }, - - /** - * Set parameter - * @param {string} name - * @param {} value - */ - setParameter: function (name, value) { - this.pass.setUniform(name, value); - }, - /** - * Get parameter value - * @param {string} name - * @return {} - */ - getParameter: function (name) { - return this.pass.getUniform(name); - }, - /** - * Set parameters - * @param {Object} obj - */ - setParameters: function (obj) { - for (var name in obj) { - this.setParameter(name, obj[name]); - } - }, - // /** - // * Set shader code - // * @param {string} shaderStr - // */ - // setShader: function (shaderStr) { - // var material = this.pass.material; - // material.shader.setFragment(shaderStr); - // material.attachShader(material.shader, true); - // }, - /** - * Proxy of pass.material.define('fragment', xxx); - * @param {string} symbol - * @param {number} [val] - */ - define: function (symbol, val) { - this.pass.material.define('fragment', symbol, val); - }, - - /** - * Proxy of pass.material.undefine('fragment', xxx) - * @param {string} symbol - */ - undefine: function (symbol) { - this.pass.material.undefine('fragment', symbol); - }, - - removeReference: function (outputName) { - this._outputReferences[outputName]--; - if (this._outputReferences[outputName] === 0) { - var outputInfo = this.outputs[outputName]; - if (outputInfo.keepLastFrame) { - if (this._prevOutputTextures[outputName]) { - this._compositor.releaseTexture(this._prevOutputTextures[outputName]); - } - this._prevOutputTextures[outputName] = this._outputTextures[outputName]; - } - else { - // Output of this node have alreay been used by all other nodes - // Put the texture back to the pool. - this._compositor.releaseTexture(this._outputTextures[outputName]); - } - } - }, - - clear: function () { - __WEBPACK_IMPORTED_MODULE_1__CompositorNode__["a" /* default */].prototype.clear.call(this); - - // Default disable all texture - this.pass.material.disableTexturesAll(); - } -}); - -/* harmony default export */ __webpack_exports__["a"] = (FilterNode); - - -/***/ }), -/* 184 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (immutable) */ __webpack_exports__["a"] = register; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__source_compositor_coloradjust_glsl_js__ = __webpack_require__(185); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__source_compositor_blur_glsl_js__ = __webpack_require__(87); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__source_compositor_lum_glsl_js__ = __webpack_require__(186); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__source_compositor_lut_glsl_js__ = __webpack_require__(88); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__source_compositor_vignette_glsl_js__ = __webpack_require__(187); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__source_compositor_output_glsl_js__ = __webpack_require__(89); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__source_compositor_bright_glsl_js__ = __webpack_require__(90); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__source_compositor_downsample_glsl_js__ = __webpack_require__(91); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__source_compositor_upsample_glsl_js__ = __webpack_require__(92); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__source_compositor_hdr_glsl_js__ = __webpack_require__(93); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__source_compositor_lensflare_glsl_js__ = __webpack_require__(188); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__source_compositor_blend_glsl_js__ = __webpack_require__(94); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__source_compositor_fxaa_glsl_js__ = __webpack_require__(95); - - - - - - - - - - - - - -// import fxaa3Essl from './source/compositor/fxaa3.glsl.js'; - -// TODO Must export a module and be used in the other modules. Or it will be tree shaked -function register(Shader) { - // Some build in shaders - Shader['import'](__WEBPACK_IMPORTED_MODULE_0__source_compositor_coloradjust_glsl_js__["a" /* default */]); - Shader['import'](__WEBPACK_IMPORTED_MODULE_1__source_compositor_blur_glsl_js__["a" /* default */]); - Shader['import'](__WEBPACK_IMPORTED_MODULE_2__source_compositor_lum_glsl_js__["a" /* default */]); - Shader['import'](__WEBPACK_IMPORTED_MODULE_3__source_compositor_lut_glsl_js__["a" /* default */]); - Shader['import'](__WEBPACK_IMPORTED_MODULE_4__source_compositor_vignette_glsl_js__["a" /* default */]); - Shader['import'](__WEBPACK_IMPORTED_MODULE_5__source_compositor_output_glsl_js__["a" /* default */]); - Shader['import'](__WEBPACK_IMPORTED_MODULE_6__source_compositor_bright_glsl_js__["a" /* default */]); - Shader['import'](__WEBPACK_IMPORTED_MODULE_7__source_compositor_downsample_glsl_js__["a" /* default */]); - Shader['import'](__WEBPACK_IMPORTED_MODULE_8__source_compositor_upsample_glsl_js__["a" /* default */]); - Shader['import'](__WEBPACK_IMPORTED_MODULE_9__source_compositor_hdr_glsl_js__["a" /* default */]); - Shader['import'](__WEBPACK_IMPORTED_MODULE_10__source_compositor_lensflare_glsl_js__["a" /* default */]); - Shader['import'](__WEBPACK_IMPORTED_MODULE_11__source_compositor_blend_glsl_js__["a" /* default */]); - - Shader['import'](__WEBPACK_IMPORTED_MODULE_12__source_compositor_fxaa_glsl_js__["a" /* default */]); - -} - -/***/ }), -/* 185 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export clay.compositor.coloradjust\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float brightness : 0.0;\nuniform float contrast : 1.0;\nuniform float exposure : 0.0;\nuniform float gamma : 1.0;\nuniform float saturation : 1.0;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = clamp(tex.rgb + vec3(brightness), 0.0, 1.0);\n color = clamp( (color-vec3(0.5))*contrast+vec3(0.5), 0.0, 1.0);\n color = clamp( color * pow(2.0, exposure), 0.0, 1.0);\n color = clamp( pow(color, vec3(gamma)), 0.0, 1.0);\n float luminance = dot( color, w );\n color = mix(vec3(luminance), color, saturation);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.brightness\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float brightness : 0.0;\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = tex.rgb + vec3(brightness);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.contrast\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float contrast : 1.0;\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord);\n vec3 color = (tex.rgb-vec3(0.5))*contrast+vec3(0.5);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.exposure\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float exposure : 0.0;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = tex.rgb * pow(2.0, exposure);\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.gamma\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float gamma : 1.0;\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = pow(tex.rgb, vec3(gamma));\n gl_FragColor = vec4(color, tex.a);\n}\n@end\n@export clay.compositor.saturation\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float saturation : 1.0;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D(texture, v_Texcoord);\n vec3 color = tex.rgb;\n float luminance = dot(color, w);\n color = mix(vec3(luminance), color, saturation);\n gl_FragColor = vec4(color, tex.a);\n}\n@end"); - - -/***/ }), -/* 186 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export clay.compositor.hdr.log_lum\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\n@import clay.util.rgbm\nvoid main()\n{\n vec4 tex = decodeHDR(texture2D(texture, v_Texcoord));\n float luminance = dot(tex.rgb, w);\n luminance = log(luminance + 0.001);\n gl_FragColor = encodeHDR(vec4(vec3(luminance), 1.0));\n}\n@end\n@export clay.compositor.hdr.lum_adaption\nvarying vec2 v_Texcoord;\nuniform sampler2D adaptedLum;\nuniform sampler2D currentLum;\nuniform float frameTime : 0.02;\n@import clay.util.rgbm\nvoid main()\n{\n float fAdaptedLum = decodeHDR(texture2D(adaptedLum, vec2(0.5, 0.5))).r;\n float fCurrentLum = exp(encodeHDR(texture2D(currentLum, vec2(0.5, 0.5))).r);\n fAdaptedLum += (fCurrentLum - fAdaptedLum) * (1.0 - pow(0.98, 30.0 * frameTime));\n gl_FragColor = encodeHDR(vec4(vec3(fAdaptedLum), 1.0));\n}\n@end\n@export clay.compositor.lum\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nconst vec3 w = vec3(0.2125, 0.7154, 0.0721);\nvoid main()\n{\n vec4 tex = texture2D( texture, v_Texcoord );\n float luminance = dot(tex.rgb, w);\n gl_FragColor = vec4(vec3(luminance), 1.0);\n}\n@end"); - - -/***/ }), -/* 187 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export clay.compositor.vignette\n#define OUTPUT_ALPHA\nvarying vec2 v_Texcoord;\nuniform sampler2D texture;\nuniform float darkness: 1;\nuniform float offset: 1;\n@import clay.util.rgbm\nvoid main()\n{\n vec4 texel = decodeHDR(texture2D(texture, v_Texcoord));\n gl_FragColor.rgb = texel.rgb;\n vec2 uv = (v_Texcoord - vec2(0.5)) * vec2(offset);\n gl_FragColor = encodeHDR(vec4(mix(texel.rgb, vec3(1.0 - darkness), dot(uv, uv)), texel.a));\n}\n@end"); - - -/***/ }), -/* 188 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export clay.compositor.lensflare\n#define SAMPLE_NUMBER 8\nuniform sampler2D texture;\nuniform sampler2D lenscolor;\nuniform vec2 textureSize : [512, 512];\nuniform float dispersal : 0.3;\nuniform float haloWidth : 0.4;\nuniform float distortion : 1.0;\nvarying vec2 v_Texcoord;\n@import clay.util.rgbm\nvec4 textureDistorted(\n in vec2 texcoord,\n in vec2 direction,\n in vec3 distortion\n) {\n return vec4(\n decodeHDR(texture2D(texture, texcoord + direction * distortion.r)).r,\n decodeHDR(texture2D(texture, texcoord + direction * distortion.g)).g,\n decodeHDR(texture2D(texture, texcoord + direction * distortion.b)).b,\n 1.0\n );\n}\nvoid main()\n{\n vec2 texcoord = -v_Texcoord + vec2(1.0); vec2 textureOffset = 1.0 / textureSize;\n vec2 ghostVec = (vec2(0.5) - texcoord) * dispersal;\n vec2 haloVec = normalize(ghostVec) * haloWidth;\n vec3 distortion = vec3(-textureOffset.x * distortion, 0.0, textureOffset.x * distortion);\n vec4 result = vec4(0.0);\n for (int i = 0; i < SAMPLE_NUMBER; i++)\n {\n vec2 offset = fract(texcoord + ghostVec * float(i));\n float weight = length(vec2(0.5) - offset) / length(vec2(0.5));\n weight = pow(1.0 - weight, 10.0);\n result += textureDistorted(offset, normalize(ghostVec), distortion) * weight;\n }\n result *= texture2D(lenscolor, vec2(length(vec2(0.5) - texcoord)) / length(vec2(0.5)));\n float weight = length(vec2(0.5) - fract(texcoord + haloVec)) / length(vec2(0.5));\n weight = pow(1.0 - weight, 10.0);\n vec2 offset = fract(texcoord + haloVec);\n result += textureDistorted(offset, normalize(ghostVec), distortion) * weight;\n gl_FragColor = result;\n}\n@end"); - - -/***/ }), -/* 189 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_claygl_src_math_Matrix4__ = __webpack_require__(9); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_claygl_src_math_Vector3__ = __webpack_require__(3); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_claygl_src_Texture2D__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_claygl_src_Texture__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_claygl_src_compositor_Pass__ = __webpack_require__(16); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_claygl_src_Shader__ = __webpack_require__(8); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_claygl_src_FrameBuffer__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__halton__ = __webpack_require__(49); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__SSAO_glsl_js__ = __webpack_require__(190); - - - - - - - - - - -__WEBPACK_IMPORTED_MODULE_5_claygl_src_Shader__["a" /* default */].import(__WEBPACK_IMPORTED_MODULE_8__SSAO_glsl_js__["a" /* default */]); - -function generateNoiseData(size) { - var data = new Uint8Array(size * size * 4); - var n = 0; - var v3 = new __WEBPACK_IMPORTED_MODULE_1_claygl_src_math_Vector3__["a" /* default */](); - - for (var i = 0; i < size; i++) { - for (var j = 0; j < size; j++) { - v3.set(Math.random() * 2 - 1, Math.random() * 2 - 1, 0).normalize(); - data[n++] = (v3.x * 0.5 + 0.5) * 255; - data[n++] = (v3.y * 0.5 + 0.5) * 255; - data[n++] = 0; - data[n++] = 255; - } - } - return data; -} - -function generateNoiseTexture(size) { - return new __WEBPACK_IMPORTED_MODULE_2_claygl_src_Texture2D__["a" /* default */]({ - pixels: generateNoiseData(size), - wrapS: __WEBPACK_IMPORTED_MODULE_3_claygl_src_Texture__["a" /* default */].REPEAT, - wrapT: __WEBPACK_IMPORTED_MODULE_3_claygl_src_Texture__["a" /* default */].REPEAT, - width: size, - height: size - }); -} - -function generateKernel(size, offset, hemisphere) { - var kernel = new Float32Array(size * 3); - offset = offset || 0; - for (var i = 0; i < size; i++) { - var phi = Object(__WEBPACK_IMPORTED_MODULE_7__halton__["a" /* default */])(i + offset, 2) * (hemisphere ? 1 : 2) * Math.PI; - var theta = Object(__WEBPACK_IMPORTED_MODULE_7__halton__["a" /* default */])(i + offset, 3) * Math.PI; - var r = Math.random(); - var x = Math.cos(phi) * Math.sin(theta) * r; - var y = Math.cos(theta) * r; - var z = Math.sin(phi) * Math.sin(theta) * r; - - kernel[i * 3] = x; - kernel[i * 3 + 1] = y; - kernel[i * 3 + 2] = z; - } - return kernel; - - // var kernel = new Float32Array(size * 3); - // var v3 = new Vector3(); - // for (var i = 0; i < size; i++) { - // v3.set(Math.random() * 2 - 1, Math.random() * 2 - 1, Math.random()) - // .normalize().scale(Math.random()); - // kernel[i * 3] = v3.x; - // kernel[i * 3 + 1] = v3.y; - // kernel[i * 3 + 2] = v3.z; - // } - // return kernel; -} - -function SSAOPass(opt) { - opt = opt || {}; - - this._ssaoPass = new __WEBPACK_IMPORTED_MODULE_4_claygl_src_compositor_Pass__["a" /* default */]({ - fragment: __WEBPACK_IMPORTED_MODULE_5_claygl_src_Shader__["a" /* default */].source('ecgl.ssao.estimate') - }); - this._blurPass = new __WEBPACK_IMPORTED_MODULE_4_claygl_src_compositor_Pass__["a" /* default */]({ - fragment: __WEBPACK_IMPORTED_MODULE_5_claygl_src_Shader__["a" /* default */].source('ecgl.ssao.blur') - }); - this._framebuffer = new __WEBPACK_IMPORTED_MODULE_6_claygl_src_FrameBuffer__["a" /* default */]({ - depthBuffer: false - }); - - this._ssaoTexture = new __WEBPACK_IMPORTED_MODULE_2_claygl_src_Texture2D__["a" /* default */](); - this._blurTexture = new __WEBPACK_IMPORTED_MODULE_2_claygl_src_Texture2D__["a" /* default */](); - this._blurTexture2 = new __WEBPACK_IMPORTED_MODULE_2_claygl_src_Texture2D__["a" /* default */](); - - this._depthTex = opt.depthTexture; - this._normalTex = opt.normalTexture; - - this.setNoiseSize(4); - this.setKernelSize(opt.kernelSize || 12); - if (opt.radius != null) { - this.setParameter('radius', opt.radius); - } - if (opt.power != null) { - this.setParameter('power', opt.power); - } - - if (!this._normalTex) { - this._ssaoPass.material.disableTexture('normalTex'); - this._blurPass.material.disableTexture('normalTex'); - } - if (!this._depthTex) { - this._blurPass.material.disableTexture('depthTex'); - } - - this._blurPass.material.setUniform('normalTex', this._normalTex); - this._blurPass.material.setUniform('depthTex', this._depthTex); -} - -SSAOPass.prototype.setDepthTexture = function (depthTex) { - this._depthTex = depthTex; -}; - -SSAOPass.prototype.setNormalTexture = function (normalTex) { - this._normalTex = normalTex; - this._ssaoPass.material[normalTex ? 'enableTexture' : 'disableTexture']('normalTex'); - // Switch between hemisphere and shere kernel. - this.setKernelSize(this._kernelSize); -}; - -SSAOPass.prototype.update = function (renderer, camera, frame) { - var width = renderer.getWidth(); - var height = renderer.getHeight(); - - var ssaoPass = this._ssaoPass; - var blurPass = this._blurPass; - - ssaoPass.setUniform('kernel', this._kernels[frame % this._kernels.length]); - ssaoPass.setUniform('depthTex', this._depthTex); - if (this._normalTex != null) { - ssaoPass.setUniform('normalTex', this._normalTex); - } - ssaoPass.setUniform('depthTexSize', [this._depthTex.width, this._depthTex.height]); - - var viewInverseTranspose = new __WEBPACK_IMPORTED_MODULE_0_claygl_src_math_Matrix4__["a" /* default */](); - __WEBPACK_IMPORTED_MODULE_0_claygl_src_math_Matrix4__["a" /* default */].transpose(viewInverseTranspose, camera.worldTransform); - - ssaoPass.setUniform('projection', camera.projectionMatrix.array); - ssaoPass.setUniform('projectionInv', camera.invProjectionMatrix.array); - ssaoPass.setUniform('viewInverseTranspose', viewInverseTranspose.array); - - var ssaoTexture = this._ssaoTexture; - var blurTexture = this._blurTexture; - var blurTexture2 = this._blurTexture2; - - ssaoTexture.width = width / 2; - ssaoTexture.height = height / 2; - blurTexture.width = width; - blurTexture.height = height; - blurTexture2.width = width; - blurTexture2.height = height; - - this._framebuffer.attach(ssaoTexture); - this._framebuffer.bind(renderer); - renderer.gl.clearColor(1, 1, 1, 1); - renderer.gl.clear(renderer.gl.COLOR_BUFFER_BIT); - ssaoPass.render(renderer); - - blurPass.setUniform('textureSize', [width / 2, height / 2]); - blurPass.setUniform('projection', camera.projectionMatrix.array); - this._framebuffer.attach(blurTexture); - blurPass.setUniform('direction', 0); - blurPass.setUniform('ssaoTexture', ssaoTexture); - blurPass.render(renderer); - - this._framebuffer.attach(blurTexture2); - blurPass.setUniform('textureSize', [width, height]); - blurPass.setUniform('direction', 1); - blurPass.setUniform('ssaoTexture', blurTexture); - blurPass.render(renderer); - - this._framebuffer.unbind(renderer); - - // Restore clear - var clearColor = renderer.clearColor; - renderer.gl.clearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]); -}; - -SSAOPass.prototype.getTargetTexture = function () { - return this._blurTexture2; -} - -SSAOPass.prototype.setParameter = function (name, val) { - if (name === 'noiseTexSize') { - this.setNoiseSize(val); - } - else if (name === 'kernelSize') { - this.setKernelSize(val); - } - else if (name === 'intensity') { - this._ssaoPass.material.set('intensity', val); - } - else { - this._ssaoPass.setUniform(name, val); - } -}; - -SSAOPass.prototype.setKernelSize = function (size) { - this._kernelSize = size; - this._ssaoPass.material.define('fragment', 'KERNEL_SIZE', size); - this._kernels = this._kernels || []; - for (var i = 0; i < 30; i++) { - this._kernels[i] = generateKernel(size, i * size, !!this._normalTex); - } -}; - -SSAOPass.prototype.setNoiseSize = function (size) { - var texture = this._ssaoPass.getUniform('noiseTex'); - if (!texture) { - texture = generateNoiseTexture(size); - this._ssaoPass.setUniform('noiseTex', generateNoiseTexture(size)); - } - else { - texture.data = generateNoiseData(size); - texture.width = texture.height = size; - texture.dirty(); - } - - this._ssaoPass.setUniform('noiseTexSize', [size, size]); -}; - -SSAOPass.prototype.dispose = function (renderer) { - this._blurTexture.dispose(renderer); - this._ssaoTexture.dispose(renderer); - this._blurTexture2.dispose(renderer); -}; - -/* harmony default export */ __webpack_exports__["a"] = (SSAOPass); - -/***/ }), -/* 190 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export ecgl.ssao.estimate\n\nuniform sampler2D depthTex;\n\nuniform sampler2D normalTex;\n\nuniform sampler2D noiseTex;\n\nuniform vec2 depthTexSize;\n\nuniform vec2 noiseTexSize;\n\nuniform mat4 projection;\n\nuniform mat4 projectionInv;\n\nuniform mat4 viewInverseTranspose;\n\nuniform vec3 kernel[KERNEL_SIZE];\n\nuniform float radius : 1;\n\nuniform float power : 1;\n\nuniform float bias: 1e-2;\n\nuniform float intensity: 1.0;\n\nvarying vec2 v_Texcoord;\n\nfloat ssaoEstimator(in vec3 originPos, in mat3 kernelBasis) {\n float occlusion = 0.0;\n\n for (int i = 0; i < KERNEL_SIZE; i++) {\n vec3 samplePos = kernel[i];\n#ifdef NORMALTEX_ENABLED\n samplePos = kernelBasis * samplePos;\n#endif\n samplePos = samplePos * radius + originPos;\n\n vec4 texCoord = projection * vec4(samplePos, 1.0);\n texCoord.xy /= texCoord.w;\n\n vec4 depthTexel = texture2D(depthTex, texCoord.xy * 0.5 + 0.5);\n\n float sampleDepth = depthTexel.r * 2.0 - 1.0;\n if (projection[3][3] == 0.0) {\n sampleDepth = projection[3][2] / (sampleDepth * projection[2][3] - projection[2][2]);\n }\n else {\n sampleDepth = (sampleDepth - projection[3][2]) / projection[2][2];\n }\n \n float rangeCheck = smoothstep(0.0, 1.0, radius / abs(originPos.z - sampleDepth));\n occlusion += rangeCheck * step(samplePos.z, sampleDepth - bias);\n }\n#ifdef NORMALTEX_ENABLED\n occlusion = 1.0 - occlusion / float(KERNEL_SIZE);\n#else\n occlusion = 1.0 - clamp((occlusion / float(KERNEL_SIZE) - 0.6) * 2.5, 0.0, 1.0);\n#endif\n return pow(occlusion, power);\n}\n\nvoid main()\n{\n\n vec4 depthTexel = texture2D(depthTex, v_Texcoord);\n\n#ifdef NORMALTEX_ENABLED\n vec4 tex = texture2D(normalTex, v_Texcoord);\n if (dot(tex.rgb, tex.rgb) == 0.0) {\n gl_FragColor = vec4(1.0);\n return;\n }\n vec3 N = tex.rgb * 2.0 - 1.0;\n N = (viewInverseTranspose * vec4(N, 0.0)).xyz;\n\n vec2 noiseTexCoord = depthTexSize / vec2(noiseTexSize) * v_Texcoord;\n vec3 rvec = texture2D(noiseTex, noiseTexCoord).rgb * 2.0 - 1.0;\n vec3 T = normalize(rvec - N * dot(rvec, N));\n vec3 BT = normalize(cross(N, T));\n mat3 kernelBasis = mat3(T, BT, N);\n#else\n if (depthTexel.r > 0.99999) {\n gl_FragColor = vec4(1.0);\n return;\n }\n mat3 kernelBasis;\n#endif\n\n float z = depthTexel.r * 2.0 - 1.0;\n\n vec4 projectedPos = vec4(v_Texcoord * 2.0 - 1.0, z, 1.0);\n vec4 p4 = projectionInv * projectedPos;\n\n vec3 position = p4.xyz / p4.w;\n\n float ao = ssaoEstimator(position, kernelBasis);\n ao = clamp(1.0 - (1.0 - ao) * intensity, 0.0, 1.0);\n gl_FragColor = vec4(vec3(ao), 1.0);\n}\n\n@end\n\n\n@export ecgl.ssao.blur\n#define SHADER_NAME SSAO_BLUR\n\nuniform sampler2D ssaoTexture;\n\n#ifdef NORMALTEX_ENABLED\nuniform sampler2D normalTex;\n#endif\n\nvarying vec2 v_Texcoord;\n\nuniform vec2 textureSize;\nuniform float blurSize : 1.0;\n\nuniform int direction: 0.0;\n\n#ifdef DEPTHTEX_ENABLED\nuniform sampler2D depthTex;\nuniform mat4 projection;\nuniform float depthRange : 0.5;\n\nfloat getLinearDepth(vec2 coord)\n{\n float depth = texture2D(depthTex, coord).r * 2.0 - 1.0;\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n}\n#endif\n\nvoid main()\n{\n float kernel[5];\n kernel[0] = 0.122581;\n kernel[1] = 0.233062;\n kernel[2] = 0.288713;\n kernel[3] = 0.233062;\n kernel[4] = 0.122581;\n\n vec2 off = vec2(0.0);\n if (direction == 0) {\n off[0] = blurSize / textureSize.x;\n }\n else {\n off[1] = blurSize / textureSize.y;\n }\n\n vec2 coord = v_Texcoord;\n\n float sum = 0.0;\n float weightAll = 0.0;\n\n#ifdef NORMALTEX_ENABLED\n vec3 centerNormal = texture2D(normalTex, v_Texcoord).rgb * 2.0 - 1.0;\n#endif\n#if defined(DEPTHTEX_ENABLED)\n float centerDepth = getLinearDepth(v_Texcoord);\n#endif\n\n for (int i = 0; i < 5; i++) {\n vec2 coord = clamp(v_Texcoord + vec2(float(i) - 2.0) * off, vec2(0.0), vec2(1.0));\n\n float w = kernel[i];\n#ifdef NORMALTEX_ENABLED\n vec3 normal = texture2D(normalTex, coord).rgb * 2.0 - 1.0;\n w *= clamp(dot(normal, centerNormal), 0.0, 1.0);\n#endif\n#ifdef DEPTHTEX_ENABLED\n float d = getLinearDepth(coord);\n w *= (1.0 - smoothstep(abs(centerDepth - d) / depthRange, 0.0, 1.0));\n#endif\n\n weightAll += w;\n sum += texture2D(ssaoTexture, coord).r * w;\n }\n\n gl_FragColor = vec4(vec3(sum / weightAll), 1.0);\n}\n\n@end\n"); - - -/***/ }), -/* 191 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_claygl_src_math_Matrix4__ = __webpack_require__(9); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_claygl_src_math_Vector3__ = __webpack_require__(3); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_claygl_src_Texture2D__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_claygl_src_Texture__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_claygl_src_compositor_Pass__ = __webpack_require__(16); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_claygl_src_Shader__ = __webpack_require__(8); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_claygl_src_FrameBuffer__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__halton__ = __webpack_require__(49); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_claygl_src_util_cubemap__ = __webpack_require__(77); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__SSR_glsl_js__ = __webpack_require__(192); - - - - - - - - - - - - -__WEBPACK_IMPORTED_MODULE_5_claygl_src_Shader__["a" /* default */].import(__WEBPACK_IMPORTED_MODULE_9__SSR_glsl_js__["a" /* default */]); - -function SSRPass(opt) { - opt = opt || {}; - - this._ssrPass = new __WEBPACK_IMPORTED_MODULE_4_claygl_src_compositor_Pass__["a" /* default */]({ - fragment: __WEBPACK_IMPORTED_MODULE_5_claygl_src_Shader__["a" /* default */].source('ecgl.ssr.main'), - clearColor: [0, 0, 0, 0] - }); - this._blurPass1 = new __WEBPACK_IMPORTED_MODULE_4_claygl_src_compositor_Pass__["a" /* default */]({ - fragment: __WEBPACK_IMPORTED_MODULE_5_claygl_src_Shader__["a" /* default */].source('ecgl.ssr.blur'), - clearColor: [0, 0, 0, 0] - }); - this._blurPass2 = new __WEBPACK_IMPORTED_MODULE_4_claygl_src_compositor_Pass__["a" /* default */]({ - fragment: __WEBPACK_IMPORTED_MODULE_5_claygl_src_Shader__["a" /* default */].source('ecgl.ssr.blur'), - clearColor: [0, 0, 0, 0] - }); - this._blendPass = new __WEBPACK_IMPORTED_MODULE_4_claygl_src_compositor_Pass__["a" /* default */]({ - fragment: __WEBPACK_IMPORTED_MODULE_5_claygl_src_Shader__["a" /* default */].source('clay.compositor.blend') - }); - this._blendPass.material.disableTexturesAll(); - this._blendPass.material.enableTexture(['texture1', 'texture2']); - - this._ssrPass.setUniform('gBufferTexture1', opt.normalTexture); - this._ssrPass.setUniform('gBufferTexture2', opt.depthTexture); - // this._ssrPass.setUniform('gBufferTexture3', opt.albedoTexture); - - this._blurPass1.setUniform('gBufferTexture1', opt.normalTexture); - this._blurPass1.setUniform('gBufferTexture2', opt.depthTexture); - - this._blurPass2.setUniform('gBufferTexture1', opt.normalTexture); - this._blurPass2.setUniform('gBufferTexture2', opt.depthTexture); - - this._blurPass2.material.define('fragment', 'VERTICAL'); - this._blurPass2.material.define('fragment', 'BLEND'); - - this._ssrTexture = new __WEBPACK_IMPORTED_MODULE_2_claygl_src_Texture2D__["a" /* default */]({ - type: __WEBPACK_IMPORTED_MODULE_3_claygl_src_Texture__["a" /* default */].HALF_FLOAT - }); - this._texture2 = new __WEBPACK_IMPORTED_MODULE_2_claygl_src_Texture2D__["a" /* default */]({ - type: __WEBPACK_IMPORTED_MODULE_3_claygl_src_Texture__["a" /* default */].HALF_FLOAT - }); - this._texture3 = new __WEBPACK_IMPORTED_MODULE_2_claygl_src_Texture2D__["a" /* default */]({ - type: __WEBPACK_IMPORTED_MODULE_3_claygl_src_Texture__["a" /* default */].HALF_FLOAT - }); - this._prevTexture = new __WEBPACK_IMPORTED_MODULE_2_claygl_src_Texture2D__["a" /* default */]({ - type: __WEBPACK_IMPORTED_MODULE_3_claygl_src_Texture__["a" /* default */].HALF_FLOAT - }); - this._currentTexture = new __WEBPACK_IMPORTED_MODULE_2_claygl_src_Texture2D__["a" /* default */]({ - type: __WEBPACK_IMPORTED_MODULE_3_claygl_src_Texture__["a" /* default */].HALF_FLOAT - }); - - this._frameBuffer = new __WEBPACK_IMPORTED_MODULE_6_claygl_src_FrameBuffer__["a" /* default */]({ - depthBuffer: false - }); - - this._normalDistribution = null; - - this._totalSamples = 256; - this._samplePerFrame = 4; - - this._ssrPass.material.define('fragment', 'SAMPLE_PER_FRAME', this._samplePerFrame); - this._ssrPass.material.define('fragment', 'TOTAL_SAMPLES', this._totalSamples); - - this._downScale = 1; -} - -SSRPass.prototype.setAmbientCubemap = function (specularCubemap, specularIntensity) { - this._ssrPass.material.set('specularCubemap', specularCubemap); - this._ssrPass.material.set('specularIntensity', specularIntensity); - - var enableSpecularMap = specularCubemap && specularIntensity; - this._ssrPass.material[enableSpecularMap ? 'enableTexture' : 'disableTexture']('specularCubemap'); -}; - -SSRPass.prototype.update = function (renderer, camera, sourceTexture, frame) { - var width = renderer.getWidth(); - var height = renderer.getHeight(); - var ssrTexture = this._ssrTexture; - var texture2 = this._texture2; - var texture3 = this._texture3; - ssrTexture.width = this._prevTexture.width = this._currentTexture.width = width / this._downScale; - ssrTexture.height = this._prevTexture.height = this._currentTexture.height = height / this._downScale; - - texture2.width = texture3.width = width; - texture2.height = texture3.height = height; - - var frameBuffer = this._frameBuffer; - - var ssrPass = this._ssrPass; - var blurPass1 = this._blurPass1; - var blurPass2 = this._blurPass2; - var blendPass = this._blendPass; - - var toViewSpace = new __WEBPACK_IMPORTED_MODULE_0_claygl_src_math_Matrix4__["a" /* default */](); - var toWorldSpace = new __WEBPACK_IMPORTED_MODULE_0_claygl_src_math_Matrix4__["a" /* default */](); - __WEBPACK_IMPORTED_MODULE_0_claygl_src_math_Matrix4__["a" /* default */].transpose(toViewSpace, camera.worldTransform); - __WEBPACK_IMPORTED_MODULE_0_claygl_src_math_Matrix4__["a" /* default */].transpose(toWorldSpace, camera.viewMatrix); - - ssrPass.setUniform('sourceTexture', sourceTexture); - ssrPass.setUniform('projection', camera.projectionMatrix.array); - ssrPass.setUniform('projectionInv', camera.invProjectionMatrix.array); - ssrPass.setUniform('toViewSpace', toViewSpace.array); - ssrPass.setUniform('toWorldSpace', toWorldSpace.array); - ssrPass.setUniform('nearZ', camera.near); - - var percent = frame / this._totalSamples * this._samplePerFrame; - ssrPass.setUniform('jitterOffset', percent); - ssrPass.setUniform('sampleOffset', frame * this._samplePerFrame); - - blurPass1.setUniform('textureSize', [ssrTexture.width, ssrTexture.height]); - blurPass2.setUniform('textureSize', [width, height]); - blurPass2.setUniform('sourceTexture', sourceTexture); - - blurPass1.setUniform('projection', camera.projectionMatrix.array); - blurPass2.setUniform('projection', camera.projectionMatrix.array); - - frameBuffer.attach(ssrTexture); - frameBuffer.bind(renderer); - ssrPass.render(renderer); - - if (this._physicallyCorrect) { - frameBuffer.attach(this._currentTexture); - blendPass.setUniform('texture1', this._prevTexture); - blendPass.setUniform('texture2', ssrTexture); - blendPass.material.set({ - 'weight1': frame >= 1 ? 0.95 : 0, - 'weight2': frame >= 1 ? 0.05 : 1 - // weight1: frame >= 1 ? 1 : 0, - // weight2: 1 - }); - blendPass.render(renderer); - } - - frameBuffer.attach(texture2); - blurPass1.setUniform('texture', this._physicallyCorrect ? this._currentTexture : ssrTexture); - blurPass1.render(renderer); - - frameBuffer.attach(texture3); - blurPass2.setUniform('texture', texture2); - blurPass2.render(renderer); - frameBuffer.unbind(renderer); - - if (this._physicallyCorrect) { - var tmp = this._prevTexture; - this._prevTexture = this._currentTexture; - this._currentTexture = tmp; - } -}; - -SSRPass.prototype.getTargetTexture = function () { - return this._texture3; -}; - -SSRPass.prototype.setParameter = function (name, val) { - if (name === 'maxIteration') { - this._ssrPass.material.define('fragment', 'MAX_ITERATION', val); - } - else { - this._ssrPass.setUniform(name, val); - } -}; - -SSRPass.prototype.setPhysicallyCorrect = function (isPhysicallyCorrect) { - if (isPhysicallyCorrect) { - if (!this._normalDistribution) { - this._normalDistribution = __WEBPACK_IMPORTED_MODULE_8_claygl_src_util_cubemap__["a" /* default */].generateNormalDistribution(64, this._totalSamples); - } - this._ssrPass.material.define('fragment', 'PHYSICALLY_CORRECT'); - this._ssrPass.material.set('normalDistribution', this._normalDistribution); - this._ssrPass.material.set('normalDistributionSize', [64, this._totalSamples]); - } - else { - this._ssrPass.material.undefine('fragment', 'PHYSICALLY_CORRECT'); - } - - this._physicallyCorrect = isPhysicallyCorrect; -}; - -SSRPass.prototype.setSSAOTexture = function (texture) { - var blendPass = this._blurPass2; - if (texture) { - blendPass.material.enableTexture('ssaoTex'); - blendPass.material.set('ssaoTex', texture); - } - else { - blendPass.material.disableTexture('ssaoTex'); - } -}; - -SSRPass.prototype.isFinished = function (frame) { - if (this._physicallyCorrect) { - return frame > (this._totalSamples / this._samplePerFrame); - } - else { - return true; - } -}; - -SSRPass.prototype.dispose = function (renderer) { - this._ssrTexture.dispose(renderer); - this._texture2.dispose(renderer); - this._texture3.dispose(renderer); - this._prevTexture.dispose(renderer); - this._currentTexture.dispose(renderer); - this._frameBuffer.dispose(renderer); -}; - -/* harmony default export */ __webpack_exports__["a"] = (SSRPass); - -/***/ }), -/* 192 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export ecgl.ssr.main\n\n#define SHADER_NAME SSR\n#define MAX_ITERATION 20;\n#define SAMPLE_PER_FRAME 5;\n#define TOTAL_SAMPLES 128;\n\nuniform sampler2D sourceTexture;\nuniform sampler2D gBufferTexture1;\nuniform sampler2D gBufferTexture2;\nuniform sampler2D gBufferTexture3;\nuniform samplerCube specularCubemap;\nuniform float specularIntensity: 1;\n\nuniform mat4 projection;\nuniform mat4 projectionInv;\nuniform mat4 toViewSpace;\nuniform mat4 toWorldSpace;\n\nuniform float maxRayDistance: 200;\n\nuniform float pixelStride: 16;\nuniform float pixelStrideZCutoff: 50; \nuniform float screenEdgeFadeStart: 0.9; \nuniform float eyeFadeStart : 0.2; uniform float eyeFadeEnd: 0.8; \nuniform float minGlossiness: 0.2; uniform float zThicknessThreshold: 1;\n\nuniform float nearZ;\nuniform vec2 viewportSize : VIEWPORT_SIZE;\n\nuniform float jitterOffset: 0;\n\nvarying vec2 v_Texcoord;\n\n#ifdef DEPTH_DECODE\n@import clay.util.decode_float\n#endif\n\n#ifdef PHYSICALLY_CORRECT\nuniform sampler2D normalDistribution;\nuniform float sampleOffset: 0;\nuniform vec2 normalDistributionSize;\n\nvec3 transformNormal(vec3 H, vec3 N) {\n vec3 upVector = N.y > 0.999 ? vec3(1.0, 0.0, 0.0) : vec3(0.0, 1.0, 0.0);\n vec3 tangentX = normalize(cross(N, upVector));\n vec3 tangentZ = cross(N, tangentX);\n return normalize(tangentX * H.x + N * H.y + tangentZ * H.z);\n}\nvec3 importanceSampleNormalGGX(float i, float roughness, vec3 N) {\n float p = fract((i + sampleOffset) / float(TOTAL_SAMPLES));\n vec3 H = texture2D(normalDistribution,vec2(roughness, p)).rgb;\n return transformNormal(H, N);\n}\nfloat G_Smith(float g, float ndv, float ndl) {\n float roughness = 1.0 - g;\n float k = roughness * roughness / 2.0;\n float G1V = ndv / (ndv * (1.0 - k) + k);\n float G1L = ndl / (ndl * (1.0 - k) + k);\n return G1L * G1V;\n}\nvec3 F_Schlick(float ndv, vec3 spec) {\n return spec + (1.0 - spec) * pow(1.0 - ndv, 5.0);\n}\n#endif\n\nfloat fetchDepth(sampler2D depthTexture, vec2 uv)\n{\n vec4 depthTexel = texture2D(depthTexture, uv);\n return depthTexel.r * 2.0 - 1.0;\n}\n\nfloat linearDepth(float depth)\n{\n if (projection[3][3] == 0.0) {\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n }\n else {\n return (depth - projection[3][2]) / projection[2][2];\n }\n}\n\nbool rayIntersectDepth(float rayZNear, float rayZFar, vec2 hitPixel)\n{\n if (rayZFar > rayZNear)\n {\n float t = rayZFar; rayZFar = rayZNear; rayZNear = t;\n }\n float cameraZ = linearDepth(fetchDepth(gBufferTexture2, hitPixel));\n return rayZFar <= cameraZ && rayZNear >= cameraZ - zThicknessThreshold;\n}\n\n\nbool traceScreenSpaceRay(\n vec3 rayOrigin, vec3 rayDir, float jitter,\n out vec2 hitPixel, out vec3 hitPoint, out float iterationCount\n)\n{\n float rayLength = ((rayOrigin.z + rayDir.z * maxRayDistance) > -nearZ)\n ? (-nearZ - rayOrigin.z) / rayDir.z : maxRayDistance;\n\n vec3 rayEnd = rayOrigin + rayDir * rayLength;\n\n vec4 H0 = projection * vec4(rayOrigin, 1.0);\n vec4 H1 = projection * vec4(rayEnd, 1.0);\n\n float k0 = 1.0 / H0.w, k1 = 1.0 / H1.w;\n\n vec3 Q0 = rayOrigin * k0, Q1 = rayEnd * k1;\n\n vec2 P0 = (H0.xy * k0 * 0.5 + 0.5) * viewportSize;\n vec2 P1 = (H1.xy * k1 * 0.5 + 0.5) * viewportSize;\n\n P1 += dot(P1 - P0, P1 - P0) < 0.0001 ? 0.01 : 0.0;\n vec2 delta = P1 - P0;\n\n bool permute = false;\n if (abs(delta.x) < abs(delta.y)) {\n permute = true;\n delta = delta.yx;\n P0 = P0.yx;\n P1 = P1.yx;\n }\n float stepDir = sign(delta.x);\n float invdx = stepDir / delta.x;\n\n vec3 dQ = (Q1 - Q0) * invdx;\n float dk = (k1 - k0) * invdx;\n\n vec2 dP = vec2(stepDir, delta.y * invdx);\n\n float strideScaler = 1.0 - min(1.0, -rayOrigin.z / pixelStrideZCutoff);\n float pixStride = 1.0 + strideScaler * pixelStride;\n\n dP *= pixStride; dQ *= pixStride; dk *= pixStride;\n\n vec4 pqk = vec4(P0, Q0.z, k0);\n vec4 dPQK = vec4(dP, dQ.z, dk);\n\n pqk += dPQK * jitter;\n float rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w);\n float rayZNear;\n\n bool intersect = false;\n\n vec2 texelSize = 1.0 / viewportSize;\n\n iterationCount = 0.0;\n\n for (int i = 0; i < MAX_ITERATION; i++)\n {\n pqk += dPQK;\n\n rayZNear = rayZFar;\n rayZFar = (dPQK.z * 0.5 + pqk.z) / (dPQK.w * 0.5 + pqk.w);\n\n hitPixel = permute ? pqk.yx : pqk.xy;\n hitPixel *= texelSize;\n\n intersect = rayIntersectDepth(rayZNear, rayZFar, hitPixel);\n\n iterationCount += 1.0;\n\n dPQK *= 1.2;\n\n if (intersect) {\n break;\n }\n }\n\n Q0.xy += dQ.xy * iterationCount;\n Q0.z = pqk.z;\n hitPoint = Q0 / pqk.w;\n\n return intersect;\n}\n\nfloat calculateAlpha(\n float iterationCount, float reflectivity,\n vec2 hitPixel, vec3 hitPoint, float dist, vec3 rayDir\n)\n{\n float alpha = clamp(reflectivity, 0.0, 1.0);\n alpha *= 1.0 - (iterationCount / float(MAX_ITERATION));\n vec2 hitPixelNDC = hitPixel * 2.0 - 1.0;\n float maxDimension = min(1.0, max(abs(hitPixelNDC.x), abs(hitPixelNDC.y)));\n alpha *= 1.0 - max(0.0, maxDimension - screenEdgeFadeStart) / (1.0 - screenEdgeFadeStart);\n\n float _eyeFadeStart = eyeFadeStart;\n float _eyeFadeEnd = eyeFadeEnd;\n if (_eyeFadeStart > _eyeFadeEnd) {\n float tmp = _eyeFadeEnd;\n _eyeFadeEnd = _eyeFadeStart;\n _eyeFadeStart = tmp;\n }\n\n float eyeDir = clamp(rayDir.z, _eyeFadeStart, _eyeFadeEnd);\n alpha *= 1.0 - (eyeDir - _eyeFadeStart) / (_eyeFadeEnd - _eyeFadeStart);\n\n alpha *= 1.0 - clamp(dist / maxRayDistance, 0.0, 1.0);\n\n return alpha;\n}\n\n@import clay.util.rand\n\n@import clay.util.rgbm\n\nvoid main()\n{\n vec4 normalAndGloss = texture2D(gBufferTexture1, v_Texcoord);\n\n if (dot(normalAndGloss.rgb, vec3(1.0)) == 0.0) {\n discard;\n }\n\n float g = normalAndGloss.a;\n#if !defined(PHYSICALLY_CORRECT)\n if (g <= minGlossiness) {\n discard;\n }\n#endif\n\n float reflectivity = (g - minGlossiness) / (1.0 - minGlossiness);\n\n vec3 N = normalize(normalAndGloss.rgb * 2.0 - 1.0);\n N = normalize((toViewSpace * vec4(N, 0.0)).xyz);\n\n vec4 projectedPos = vec4(v_Texcoord * 2.0 - 1.0, fetchDepth(gBufferTexture2, v_Texcoord), 1.0);\n vec4 pos = projectionInv * projectedPos;\n vec3 rayOrigin = pos.xyz / pos.w;\n vec3 V = -normalize(rayOrigin);\n\n float ndv = clamp(dot(N, V), 0.0, 1.0);\n float iterationCount;\n float jitter = rand(fract(v_Texcoord + jitterOffset));\n\n#ifdef PHYSICALLY_CORRECT\n vec4 color = vec4(vec3(0.0), 1.0);\n vec4 albedoMetalness = texture2D(gBufferTexture3, v_Texcoord);\n vec3 albedo = albedoMetalness.rgb;\n float m = albedoMetalness.a;\n vec3 diffuseColor = albedo * (1.0 - m);\n vec3 spec = mix(vec3(0.04), albedo, m);\n\n float jitter2 = rand(fract(v_Texcoord)) * float(TOTAL_SAMPLES);\n\n for (int i = 0; i < SAMPLE_PER_FRAME; i++) {\n vec3 H = importanceSampleNormalGGX(float(i) + jitter2, 1.0 - g, N);\n vec3 rayDir = normalize(reflect(-V, H));\n#else\n vec3 rayDir = normalize(reflect(-V, N));\n#endif\n vec2 hitPixel;\n vec3 hitPoint;\n\n bool intersect = traceScreenSpaceRay(rayOrigin, rayDir, jitter, hitPixel, hitPoint, iterationCount);\n\n float dist = distance(rayOrigin, hitPoint);\n\n vec3 hitNormal = texture2D(gBufferTexture1, hitPixel).rgb * 2.0 - 1.0;\n hitNormal = normalize((toViewSpace * vec4(hitNormal, 0.0)).xyz);\n#ifdef PHYSICALLY_CORRECT\n float ndl = clamp(dot(N, rayDir), 0.0, 1.0);\n float vdh = clamp(dot(V, H), 0.0, 1.0);\n float ndh = clamp(dot(N, H), 0.0, 1.0);\n vec3 litTexel = vec3(0.0);\n if (dot(hitNormal, rayDir) < 0.0 && intersect) {\n litTexel = texture2D(sourceTexture, hitPixel).rgb;\n litTexel *= pow(clamp(1.0 - dist / 200.0, 0.0, 1.0), 3.0);\n\n }\n else {\n #ifdef SPECULARCUBEMAP_ENABLED\n vec3 rayDirW = normalize(toWorldSpace * vec4(rayDir, 0.0)).rgb;\n litTexel = RGBMDecode(textureCubeLodEXT(specularCubemap, rayDirW, 0.0), 8.12).rgb * specularIntensity;\n#endif\n }\n color.rgb += ndl * litTexel * (\n F_Schlick(ndl, spec) * G_Smith(g, ndv, ndl) * vdh / (ndh * ndv + 0.001)\n );\n }\n color.rgb /= float(SAMPLE_PER_FRAME);\n#else\n #if !defined(SPECULARCUBEMAP_ENABLED)\n if (dot(hitNormal, rayDir) >= 0.0) {\n discard;\n }\n if (!intersect) {\n discard;\n }\n#endif\n float alpha = clamp(calculateAlpha(iterationCount, reflectivity, hitPixel, hitPoint, dist, rayDir), 0.0, 1.0);\n vec4 color = texture2D(sourceTexture, hitPixel);\n color.rgb *= alpha;\n\n#ifdef SPECULARCUBEMAP_ENABLED\n vec3 rayDirW = normalize(toWorldSpace * vec4(rayDir, 0.0)).rgb;\n alpha = alpha * (intersect ? 1.0 : 0.0);\n float bias = (1.0 -g) * 5.0;\n color.rgb += (1.0 - alpha)\n * RGBMDecode(textureCubeLodEXT(specularCubemap, rayDirW, bias), 8.12).rgb\n * specularIntensity;\n#endif\n\n#endif\n\n gl_FragColor = encodeHDR(color);\n}\n@end\n\n@export ecgl.ssr.blur\n\nuniform sampler2D texture;\nuniform sampler2D gBufferTexture1;\nuniform sampler2D gBufferTexture2;\nuniform mat4 projection;\nuniform float depthRange : 0.05;\n\nvarying vec2 v_Texcoord;\n\nuniform vec2 textureSize;\nuniform float blurSize : 1.0;\n\n#ifdef BLEND\n #ifdef SSAOTEX_ENABLED\nuniform sampler2D ssaoTex;\n #endif\nuniform sampler2D sourceTexture;\n#endif\n\nfloat getLinearDepth(vec2 coord)\n{\n float depth = texture2D(gBufferTexture2, coord).r * 2.0 - 1.0;\n return projection[3][2] / (depth * projection[2][3] - projection[2][2]);\n}\n\n@import clay.util.rgbm\n\n\nvoid main()\n{\n @import clay.compositor.kernel.gaussian_9\n\n vec4 centerNTexel = texture2D(gBufferTexture1, v_Texcoord);\n float g = centerNTexel.a;\n float maxBlurSize = clamp(1.0 - g, 0.0, 1.0) * blurSize;\n#ifdef VERTICAL\n vec2 off = vec2(0.0, maxBlurSize / textureSize.y);\n#else\n vec2 off = vec2(maxBlurSize / textureSize.x, 0.0);\n#endif\n\n vec2 coord = v_Texcoord;\n\n vec4 sum = vec4(0.0);\n float weightAll = 0.0;\n\n vec3 cN = centerNTexel.rgb * 2.0 - 1.0;\n float cD = getLinearDepth(v_Texcoord);\n for (int i = 0; i < 9; i++) {\n vec2 coord = clamp((float(i) - 4.0) * off + v_Texcoord, vec2(0.0), vec2(1.0));\n float w = gaussianKernel[i]\n * clamp(dot(cN, texture2D(gBufferTexture1, coord).rgb * 2.0 - 1.0), 0.0, 1.0);\n float d = getLinearDepth(coord);\n w *= (1.0 - smoothstep(abs(cD - d) / depthRange, 0.0, 1.0));\n\n weightAll += w;\n sum += decodeHDR(texture2D(texture, coord)) * w;\n }\n\n#ifdef BLEND\n float aoFactor = 1.0;\n #ifdef SSAOTEX_ENABLED\n aoFactor = texture2D(ssaoTex, v_Texcoord).r;\n #endif\n gl_FragColor = encodeHDR(\n sum / weightAll * aoFactor + decodeHDR(texture2D(sourceTexture, v_Texcoord))\n );\n#else\n gl_FragColor = encodeHDR(sum / weightAll);\n#endif\n}\n\n@end"); - - -/***/ }), -/* 193 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -// Based on https://bl.ocks.org/mbostock/19168c663618b707158 - -/* harmony default export */ __webpack_exports__["a"] = ([ -0.0, 0.0, --0.321585265978, -0.154972575841, -0.458126042375, 0.188473391593, -0.842080129861, 0.527766490688, -0.147304551086, -0.659453822776, --0.331943915203, -0.940619700594, -0.0479226680259, 0.54812163202, -0.701581552186, -0.709825561388, --0.295436780218, 0.940589268233, --0.901489676764, 0.237713156085, -0.973570876096, -0.109899459384, --0.866792314779, -0.451805525005, -0.330975007087, 0.800048655954, --0.344275183665, 0.381779221166, --0.386139432542, -0.437418421534, --0.576478634965, -0.0148463392551, -0.385798197415, -0.262426961053, --0.666302061145, 0.682427250835, --0.628010632582, -0.732836215494, -0.10163141741, -0.987658134403, -0.711995289051, -0.320024291314, -0.0296005138058, 0.950296523438, -0.0130612307608, -0.351024443122, --0.879596633704, -0.10478487883, -0.435712737232, 0.504254490347, -0.779203817497, 0.206477676721, -0.388264289969, -0.896736162545, --0.153106280781, -0.629203242522, --0.245517550697, 0.657969239148, -0.126830499058, 0.26862328493, --0.634888119007, -0.302301223431, -0.617074219636, 0.779817204925 -]); - -/***/ }), -/* 194 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_claygl_src_Texture2D__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_claygl_src_Texture__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_claygl_src_Shader__ = __webpack_require__(8); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_claygl_src_FrameBuffer__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_claygl_src_Material__ = __webpack_require__(19); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_claygl_src_compositor_Pass__ = __webpack_require__(16); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_claygl_src_util_texture__ = __webpack_require__(61); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__util_shader_normal_glsl_js__ = __webpack_require__(195); -// NormalPass will generate normal and depth data. - -// TODO Animation - - - - - - - - - -__WEBPACK_IMPORTED_MODULE_2_claygl_src_Shader__["a" /* default */].import(__WEBPACK_IMPORTED_MODULE_7__util_shader_normal_glsl_js__["a" /* default */]); - -function attachTextureToSlot(renderer, program, symbol, texture, slot) { - var gl = renderer.gl; - program.setUniform(gl, '1i', symbol, slot); - - gl.activeTexture(gl.TEXTURE0 + slot); - // Maybe texture is not loaded yet; - if (texture.isRenderable()) { - texture.bind(renderer); - } - else { - // Bind texture to null - texture.unbind(renderer); - } -} - -// TODO Use globalShader insteadof globalMaterial? -function getBeforeRenderHook (renderer, defaultNormalMap, defaultBumpMap, defaultRoughnessMap, normalMaterial) { - - var previousNormalMap; - var previousBumpMap; - var previousRoughnessMap; - var previousRenderable; - var gl = renderer.gl; - - return function (renderable, normalMaterial, prevNormalMaterial) { - // Material not change - if (previousRenderable && previousRenderable.material === renderable.material) { - return; - } - - var material = renderable.material; - var program = renderable.__program; - - var roughness = material.get('roughness'); - if (roughness == null) { - roughness = 1; - } - - var normalMap = material.get('normalMap') || defaultNormalMap; - var roughnessMap = material.get('roughnessMap'); - var bumpMap = material.get('bumpMap'); - var uvRepeat = material.get('uvRepeat'); - var uvOffset = material.get('uvOffset'); - var detailUvRepeat = material.get('detailUvRepeat'); - var detailUvOffset = material.get('detailUvOffset'); - - var useBumpMap = !!bumpMap && material.isTextureEnabled('bumpMap'); - var useRoughnessMap = !!roughnessMap && material.isTextureEnabled('roughnessMap'); - var doubleSide = material.isDefined('fragment', 'DOUBLE_SIDED'); - - bumpMap = bumpMap || defaultBumpMap; - roughnessMap = roughnessMap || defaultRoughnessMap; - - if (prevNormalMaterial !== normalMaterial) { - normalMaterial.set('normalMap', normalMap); - normalMaterial.set('bumpMap', bumpMap); - normalMaterial.set('roughnessMap', roughnessMap); - normalMaterial.set('useBumpMap', useBumpMap); - normalMaterial.set('useRoughnessMap', useRoughnessMap); - normalMaterial.set('doubleSide', doubleSide); - uvRepeat != null && normalMaterial.set('uvRepeat', uvRepeat); - uvOffset != null && normalMaterial.set('uvOffset', uvOffset); - detailUvRepeat != null && normalMaterial.set('detailUvRepeat', detailUvRepeat); - detailUvOffset != null && normalMaterial.set('detailUvOffset', detailUvOffset); - - normalMaterial.set('roughness', roughness); - } - else { - program.setUniform(gl, '1f', 'roughness', roughness); - - if (previousNormalMap !== normalMap) { - attachTextureToSlot(renderer, program, 'normalMap', normalMap, 0); - } - if (previousBumpMap !== bumpMap && bumpMap) { - attachTextureToSlot(renderer, program, 'bumpMap', bumpMap, 1); - } - if (previousRoughnessMap !== roughnessMap && roughnessMap) { - attachTextureToSlot(renderer, program, 'roughnessMap', roughnessMap, 2); - } - if (uvRepeat != null) { - program.setUniform(gl, '2f', 'uvRepeat', uvRepeat); - } - if (uvOffset != null) { - program.setUniform(gl, '2f', 'uvOffset', uvOffset); - } - if (detailUvRepeat != null) { - program.setUniform(gl, '2f', 'detailUvRepeat', detailUvRepeat); - } - if (detailUvOffset != null) { - program.setUniform(gl, '2f', 'detailUvOffset', detailUvOffset); - } - program.setUniform(gl, '1i', 'useBumpMap', +useBumpMap); - program.setUniform(gl, '1i', 'useRoughnessMap', +useRoughnessMap); - program.setUniform(gl, '1i', 'doubleSide', +doubleSide); - } - - previousNormalMap = normalMap; - previousBumpMap = bumpMap; - previousRoughnessMap = roughnessMap; - - previousRenderable = renderable; - }; -} - -function NormalPass(opt) { - opt = opt || {}; - - this._depthTex = new __WEBPACK_IMPORTED_MODULE_0_claygl_src_Texture2D__["a" /* default */]({ - format: __WEBPACK_IMPORTED_MODULE_1_claygl_src_Texture__["a" /* default */].DEPTH_COMPONENT, - type: __WEBPACK_IMPORTED_MODULE_1_claygl_src_Texture__["a" /* default */].UNSIGNED_INT - }); - this._normalTex = new __WEBPACK_IMPORTED_MODULE_0_claygl_src_Texture2D__["a" /* default */]({ - type: __WEBPACK_IMPORTED_MODULE_1_claygl_src_Texture__["a" /* default */].HALF_FLOAT - }); - - this._framebuffer = new __WEBPACK_IMPORTED_MODULE_3_claygl_src_FrameBuffer__["a" /* default */](); - this._framebuffer.attach(this._normalTex); - this._framebuffer.attach(this._depthTex, __WEBPACK_IMPORTED_MODULE_3_claygl_src_FrameBuffer__["a" /* default */].DEPTH_ATTACHMENT); - - this._normalMaterial = new __WEBPACK_IMPORTED_MODULE_4_claygl_src_Material__["a" /* default */]({ - shader: new __WEBPACK_IMPORTED_MODULE_2_claygl_src_Shader__["a" /* default */]( - __WEBPACK_IMPORTED_MODULE_2_claygl_src_Shader__["a" /* default */].source('ecgl.normal.vertex'), - __WEBPACK_IMPORTED_MODULE_2_claygl_src_Shader__["a" /* default */].source('ecgl.normal.fragment') - ) - }); - this._normalMaterial.enableTexture(['normalMap', 'bumpMap', 'roughnessMap']); - - this._defaultNormalMap = __WEBPACK_IMPORTED_MODULE_6_claygl_src_util_texture__["a" /* default */].createBlank('#000'); - this._defaultBumpMap = __WEBPACK_IMPORTED_MODULE_6_claygl_src_util_texture__["a" /* default */].createBlank('#000'); - this._defaultRoughessMap = __WEBPACK_IMPORTED_MODULE_6_claygl_src_util_texture__["a" /* default */].createBlank('#000'); - - - this._debugPass = new __WEBPACK_IMPORTED_MODULE_5_claygl_src_compositor_Pass__["a" /* default */]({ - fragment: __WEBPACK_IMPORTED_MODULE_2_claygl_src_Shader__["a" /* default */].source('clay.compositor.output') - }); - this._debugPass.setUniform('texture', this._normalTex); - this._debugPass.material.undefine('fragment', 'OUTPUT_ALPHA'); -} - -NormalPass.prototype.getDepthTexture = function () { - return this._depthTex; -}; - -NormalPass.prototype.getNormalTexture = function () { - return this._normalTex; -}; - -NormalPass.prototype.update = function (renderer, scene, camera) { - - var width = renderer.getWidth(); - var height = renderer.getHeight(); - - var depthTexture = this._depthTex; - var normalTexture = this._normalTex; - var normalMaterial = this._normalMaterial; - - depthTexture.width = width; - depthTexture.height = height; - normalTexture.width = width; - normalTexture.height = height; - - var opaqueList = scene.getRenderList(camera).opaque; - - this._framebuffer.bind(renderer); - renderer.gl.clearColor(0, 0, 0, 0); - renderer.gl.clear(renderer.gl.COLOR_BUFFER_BIT | renderer.gl.DEPTH_BUFFER_BIT); - renderer.gl.disable(renderer.gl.BLEND); - - renderer.renderPass(opaqueList, camera, { - getMaterial: function () { - return normalMaterial; - }, - ifRender: function (object) { - return object.renderNormal; - }, - beforeRender: getBeforeRenderHook( - renderer, this._defaultNormalMap, this._defaultBumpMap, this._defaultRoughessMap, this._normalMaterial - ), - sort: renderer.opaqueSortCompare - }); - this._framebuffer.unbind(renderer); -}; - -NormalPass.prototype.renderDebug = function (renderer) { - this._debugPass.render(renderer); -}; - -NormalPass.prototype.dispose = function (renderer) { - this._depthTex.dispose(renderer); - this._normalTex.dispose(renderer); -} - -/* harmony default export */ __webpack_exports__["a"] = (NormalPass); - -/***/ }), -/* 195 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export ecgl.normal.vertex\n\n@import ecgl.common.transformUniforms\n\n@import ecgl.common.uv.header\n\n@import ecgl.common.attributes\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\n@import ecgl.common.normalMap.vertexHeader\n\n@import ecgl.common.vertexAnimation.header\n\nvoid main()\n{\n\n @import ecgl.common.vertexAnimation.main\n\n @import ecgl.common.uv.main\n\n v_Normal = normalize((worldInverseTranspose * vec4(normal, 0.0)).xyz);\n v_WorldPosition = (world * vec4(pos, 1.0)).xyz;\n\n @import ecgl.common.normalMap.vertexMain\n\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n\n}\n\n\n@end\n\n\n@export ecgl.normal.fragment\n\n#define ROUGHNESS_CHANEL 0\n\nuniform bool useBumpMap;\nuniform bool useRoughnessMap;\nuniform bool doubleSide;\nuniform float roughness;\n\n@import ecgl.common.uv.fragmentHeader\n\nvarying vec3 v_Normal;\nvarying vec3 v_WorldPosition;\n\nuniform mat4 viewInverse : VIEWINVERSE;\n\n@import ecgl.common.normalMap.fragmentHeader\n@import ecgl.common.bumpMap.header\n\nuniform sampler2D roughnessMap;\n\nvoid main()\n{\n vec3 N = v_Normal;\n \n bool flipNormal = false;\n if (doubleSide) {\n vec3 eyePos = viewInverse[3].xyz;\n vec3 V = normalize(eyePos - v_WorldPosition);\n\n if (dot(N, V) < 0.0) {\n flipNormal = true;\n }\n }\n\n @import ecgl.common.normalMap.fragmentMain\n\n if (useBumpMap) {\n N = bumpNormal(v_WorldPosition, v_Normal, N);\n }\n\n float g = 1.0 - roughness;\n\n if (useRoughnessMap) {\n float g2 = 1.0 - texture2D(roughnessMap, v_DetailTexcoord)[ROUGHNESS_CHANEL];\n g = clamp(g2 + (g - 0.5) * 2.0, 0.0, 1.0);\n }\n\n if (flipNormal) {\n N = -N;\n }\n\n gl_FragColor.rgb = (N.xyz + 1.0) * 0.5;\n gl_FragColor.a = g;\n}\n@end"); - - -/***/ }), -/* 196 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_claygl_src_math_Matrix4__ = __webpack_require__(9); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_claygl_src_math_Vector3__ = __webpack_require__(3); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_claygl_src_Texture2D__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_claygl_src_Texture__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_claygl_src_compositor_Pass__ = __webpack_require__(16); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_claygl_src_Shader__ = __webpack_require__(8); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_claygl_src_FrameBuffer__ = __webpack_require__(10); - - - - - - - - -function EdgePass(opt) { - opt = opt || {}; - - this._edgePass = new __WEBPACK_IMPORTED_MODULE_4_claygl_src_compositor_Pass__["a" /* default */]({ - fragment: __WEBPACK_IMPORTED_MODULE_5_claygl_src_Shader__["a" /* default */].source('ecgl.edge') - }); - - this._edgePass.setUniform('normalTexture', opt.normalTexture); - this._edgePass.setUniform('depthTexture', opt.depthTexture); - - this._targetTexture = new __WEBPACK_IMPORTED_MODULE_2_claygl_src_Texture2D__["a" /* default */]({ - type: __WEBPACK_IMPORTED_MODULE_3_claygl_src_Texture__["a" /* default */].HALF_FLOAT - }); - - this._frameBuffer = new __WEBPACK_IMPORTED_MODULE_6_claygl_src_FrameBuffer__["a" /* default */](); - this._frameBuffer.attach(this._targetTexture); -} - -EdgePass.prototype.update = function (renderer, camera, sourceTexture, frame) { - var width = renderer.getWidth(); - var height = renderer.getHeight(); - var texture = this._targetTexture; - texture.width = width; - texture.height = height; - var frameBuffer = this._frameBuffer; - - frameBuffer.bind(renderer); - this._edgePass.setUniform('projectionInv', camera.invProjectionMatrix.array); - this._edgePass.setUniform('textureSize', [width, height]); - this._edgePass.setUniform('texture', sourceTexture); - this._edgePass.render(renderer); - - frameBuffer.unbind(renderer); -}; - -EdgePass.prototype.getTargetTexture = function () { - return this._targetTexture; -}; - -EdgePass.prototype.setParameter = function (name, val) { - this._edgePass.setUniform(name, val); -}; - -EdgePass.prototype.dispose = function (renderer) { - this._targetTexture.dispose(renderer); - this._frameBuffer.dispose(renderer); -}; - -/* harmony default export */ __webpack_exports__["a"] = (EdgePass); - -/***/ }), -/* 197 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ({ - 'type' : 'compositor', - 'nodes' : [ - { - 'name': 'source', - 'type': 'texture', - 'outputs': { - 'color': {} - } - }, - { - 'name': 'source_half', - 'shader': '#source(clay.compositor.downsample)', - 'inputs': { - 'texture': 'source' - }, - 'outputs': { - 'color': { - 'parameters': { - 'width': 'expr(width * 1.0 / 2)', - 'height': 'expr(height * 1.0 / 2)', - 'type': 'HALF_FLOAT' - } - } - }, - 'parameters' : { - 'textureSize': 'expr( [width * 1.0, height * 1.0] )' - } - }, - - - { - 'name' : 'bright', - 'shader' : '#source(clay.compositor.bright)', - 'inputs' : { - 'texture' : 'source_half' - }, - 'outputs' : { - 'color' : { - 'parameters' : { - 'width' : 'expr(width * 1.0 / 2)', - 'height' : 'expr(height * 1.0 / 2)', - 'type': 'HALF_FLOAT' - } - } - }, - 'parameters' : { - 'threshold' : 2, - 'scale': 4, - 'textureSize': 'expr([width * 1.0 / 2, height / 2])' - } - }, - - { - 'name': 'bright_downsample_4', - 'shader' : '#source(clay.compositor.downsample)', - 'inputs' : { - 'texture' : 'bright' - }, - 'outputs' : { - 'color' : { - 'parameters' : { - 'width' : 'expr(width * 1.0 / 4)', - 'height' : 'expr(height * 1.0 / 4)', - 'type': 'HALF_FLOAT' - } - } - }, - 'parameters' : { - 'textureSize': 'expr( [width * 1.0 / 2, height / 2] )' - } - }, - { - 'name': 'bright_downsample_8', - 'shader' : '#source(clay.compositor.downsample)', - 'inputs' : { - 'texture' : 'bright_downsample_4' - }, - 'outputs' : { - 'color' : { - 'parameters' : { - 'width' : 'expr(width * 1.0 / 8)', - 'height' : 'expr(height * 1.0 / 8)', - 'type': 'HALF_FLOAT' - } - } - }, - 'parameters' : { - 'textureSize': 'expr( [width * 1.0 / 4, height / 4] )' - } - }, - { - 'name': 'bright_downsample_16', - 'shader' : '#source(clay.compositor.downsample)', - 'inputs' : { - 'texture' : 'bright_downsample_8' - }, - 'outputs' : { - 'color' : { - 'parameters' : { - 'width' : 'expr(width * 1.0 / 16)', - 'height' : 'expr(height * 1.0 / 16)', - 'type': 'HALF_FLOAT' - } - } - }, - 'parameters' : { - 'textureSize': 'expr( [width * 1.0 / 8, height / 8] )' - } - }, - { - 'name': 'bright_downsample_32', - 'shader' : '#source(clay.compositor.downsample)', - 'inputs' : { - 'texture' : 'bright_downsample_16' - }, - 'outputs' : { - 'color' : { - 'parameters' : { - 'width' : 'expr(width * 1.0 / 32)', - 'height' : 'expr(height * 1.0 / 32)', - 'type': 'HALF_FLOAT' - } - } - }, - 'parameters' : { - 'textureSize': 'expr( [width * 1.0 / 16, height / 16] )' - } - }, - - - { - 'name' : 'bright_upsample_16_blur_h', - 'shader' : '#source(clay.compositor.gaussian_blur)', - 'inputs' : { - 'texture' : 'bright_downsample_32' - }, - 'outputs' : { - 'color' : { - 'parameters' : { - 'width' : 'expr(width * 1.0 / 16)', - 'height' : 'expr(height * 1.0 / 16)', - 'type': 'HALF_FLOAT' - } - } - }, - 'parameters' : { - 'blurSize' : 1, - 'blurDir': 0.0, - 'textureSize': 'expr( [width * 1.0 / 32, height / 32] )' - } - }, - { - 'name' : 'bright_upsample_16_blur_v', - 'shader' : '#source(clay.compositor.gaussian_blur)', - 'inputs' : { - 'texture' : 'bright_upsample_16_blur_h' - }, - 'outputs' : { - 'color' : { - 'parameters' : { - 'width' : 'expr(width * 1.0 / 16)', - 'height' : 'expr(height * 1.0 / 16)', - 'type': 'HALF_FLOAT' - } - } - }, - 'parameters' : { - 'blurSize' : 1, - 'blurDir': 1.0, - 'textureSize': 'expr( [width * 1.0 / 16, height * 1.0 / 16] )' - } - }, - - - - { - 'name' : 'bright_upsample_8_blur_h', - 'shader' : '#source(clay.compositor.gaussian_blur)', - 'inputs' : { - 'texture' : 'bright_downsample_16' - }, - 'outputs' : { - 'color' : { - 'parameters' : { - 'width' : 'expr(width * 1.0 / 8)', - 'height' : 'expr(height * 1.0 / 8)', - 'type': 'HALF_FLOAT' - } - } - }, - 'parameters' : { - 'blurSize' : 1, - 'blurDir': 0.0, - 'textureSize': 'expr( [width * 1.0 / 16, height * 1.0 / 16] )' - } - }, - { - 'name' : 'bright_upsample_8_blur_v', - 'shader' : '#source(clay.compositor.gaussian_blur)', - 'inputs' : { - 'texture' : 'bright_upsample_8_blur_h' - }, - 'outputs' : { - 'color' : { - 'parameters' : { - 'width' : 'expr(width * 1.0 / 8)', - 'height' : 'expr(height * 1.0 / 8)', - 'type': 'HALF_FLOAT' - } - } - }, - 'parameters' : { - 'blurSize' : 1, - 'blurDir': 1.0, - 'textureSize': 'expr( [width * 1.0 / 8, height * 1.0 / 8] )' - } - }, - { - 'name' : 'bright_upsample_8_blend', - 'shader' : '#source(clay.compositor.blend)', - 'inputs' : { - 'texture1' : 'bright_upsample_8_blur_v', - 'texture2' : 'bright_upsample_16_blur_v' - }, - 'outputs' : { - 'color' : { - 'parameters' : { - 'width' : 'expr(width * 1.0 / 8)', - 'height' : 'expr(height * 1.0 / 8)', - 'type': 'HALF_FLOAT' - } - } - }, - 'parameters' : { - 'weight1' : 0.3, - 'weight2' : 0.7 - } - }, - - - { - 'name' : 'bright_upsample_4_blur_h', - 'shader' : '#source(clay.compositor.gaussian_blur)', - 'inputs' : { - 'texture' : 'bright_downsample_8' - }, - 'outputs' : { - 'color' : { - 'parameters' : { - 'width' : 'expr(width * 1.0 / 4)', - 'height' : 'expr(height * 1.0 / 4)', - 'type': 'HALF_FLOAT' - } - } - }, - 'parameters' : { - 'blurSize' : 1, - 'blurDir': 0.0, - 'textureSize': 'expr( [width * 1.0 / 8, height * 1.0 / 8] )' - } - }, - { - 'name' : 'bright_upsample_4_blur_v', - 'shader' : '#source(clay.compositor.gaussian_blur)', - 'inputs' : { - 'texture' : 'bright_upsample_4_blur_h' - }, - 'outputs' : { - 'color' : { - 'parameters' : { - 'width' : 'expr(width * 1.0 / 4)', - 'height' : 'expr(height * 1.0 / 4)', - 'type': 'HALF_FLOAT' - } - } - }, - 'parameters' : { - 'blurSize' : 1, - 'blurDir': 1.0, - 'textureSize': 'expr( [width * 1.0 / 4, height * 1.0 / 4] )' - } - }, - { - 'name' : 'bright_upsample_4_blend', - 'shader' : '#source(clay.compositor.blend)', - 'inputs' : { - 'texture1' : 'bright_upsample_4_blur_v', - 'texture2' : 'bright_upsample_8_blend' - }, - 'outputs' : { - 'color' : { - 'parameters' : { - 'width' : 'expr(width * 1.0 / 4)', - 'height' : 'expr(height * 1.0 / 4)', - 'type': 'HALF_FLOAT' - } - } - }, - 'parameters' : { - 'weight1' : 0.3, - 'weight2' : 0.7 - } - }, - - - - - - { - 'name' : 'bright_upsample_2_blur_h', - 'shader' : '#source(clay.compositor.gaussian_blur)', - 'inputs' : { - 'texture' : 'bright_downsample_4' - }, - 'outputs' : { - 'color' : { - 'parameters' : { - 'width' : 'expr(width * 1.0 / 2)', - 'height' : 'expr(height * 1.0 / 2)', - 'type': 'HALF_FLOAT' - } - } - }, - 'parameters' : { - 'blurSize' : 1, - 'blurDir': 0.0, - 'textureSize': 'expr( [width * 1.0 / 4, height * 1.0 / 4] )' - } - }, - { - 'name' : 'bright_upsample_2_blur_v', - 'shader' : '#source(clay.compositor.gaussian_blur)', - 'inputs' : { - 'texture' : 'bright_upsample_2_blur_h' - }, - 'outputs' : { - 'color' : { - 'parameters' : { - 'width' : 'expr(width * 1.0 / 2)', - 'height' : 'expr(height * 1.0 / 2)', - 'type': 'HALF_FLOAT' - } - } - }, - 'parameters' : { - 'blurSize' : 1, - 'blurDir': 1.0, - 'textureSize': 'expr( [width * 1.0 / 2, height * 1.0 / 2] )' - } - }, - { - 'name' : 'bright_upsample_2_blend', - 'shader' : '#source(clay.compositor.blend)', - 'inputs' : { - 'texture1' : 'bright_upsample_2_blur_v', - 'texture2' : 'bright_upsample_4_blend' - }, - 'outputs' : { - 'color' : { - 'parameters' : { - 'width' : 'expr(width * 1.0 / 2)', - 'height' : 'expr(height * 1.0 / 2)', - 'type': 'HALF_FLOAT' - } - } - }, - 'parameters' : { - 'weight1' : 0.3, - 'weight2' : 0.7 - } - }, - - - - { - 'name' : 'bright_upsample_full_blur_h', - 'shader' : '#source(clay.compositor.gaussian_blur)', - 'inputs' : { - 'texture' : 'bright' - }, - 'outputs' : { - 'color' : { - 'parameters' : { - 'width' : 'expr(width * 1.0)', - 'height' : 'expr(height * 1.0)', - 'type': 'HALF_FLOAT' - } - } - }, - 'parameters' : { - 'blurSize' : 1, - 'blurDir': 0.0, - 'textureSize': 'expr( [width * 1.0 / 2, height * 1.0 / 2] )' - } - }, - { - 'name' : 'bright_upsample_full_blur_v', - 'shader' : '#source(clay.compositor.gaussian_blur)', - 'inputs' : { - 'texture' : 'bright_upsample_full_blur_h' - }, - 'outputs' : { - 'color' : { - 'parameters' : { - 'width' : 'expr(width * 1.0)', - 'height' : 'expr(height * 1.0)', - 'type': 'HALF_FLOAT' - } - } - }, - 'parameters' : { - 'blurSize' : 1, - 'blurDir': 1.0, - 'textureSize': 'expr( [width * 1.0, height * 1.0] )' - } - }, - { - 'name' : 'bloom_composite', - 'shader' : '#source(clay.compositor.blend)', - 'inputs' : { - 'texture1' : 'bright_upsample_full_blur_v', - 'texture2' : 'bright_upsample_2_blend' - }, - 'outputs' : { - 'color' : { - 'parameters' : { - 'width' : 'expr(width * 1.0)', - 'height' : 'expr(height * 1.0)', - 'type': 'HALF_FLOAT' - } - } - }, - 'parameters' : { - 'weight1' : 0.3, - 'weight2' : 0.7 - } - }, - - - { - 'name': 'coc', - 'shader': '#source(ecgl.dof.coc)', - 'outputs': { - 'color': { - 'parameters': { - 'minFilter': 'NEAREST', - 'magFilter': 'NEAREST', - 'width': 'expr(width * 1.0)', - 'height': 'expr(height * 1.0)' - } - } - }, - 'parameters': { - 'focalDist': 50, - 'focalRange': 30 - } - }, - - { - 'name': 'dof_far_blur', - 'shader': '#source(ecgl.dof.diskBlur)', - 'inputs': { - 'texture': 'source', - 'coc': 'coc' - }, - 'outputs': { - 'color': { - 'parameters': { - 'width': 'expr(width * 1.0)', - 'height': 'expr(height * 1.0)', - 'type': 'HALF_FLOAT' - } - } - }, - 'parameters': { - 'textureSize': 'expr( [width * 1.0, height * 1.0] )' - } - }, - { - 'name': 'dof_near_blur', - 'shader': '#source(ecgl.dof.diskBlur)', - 'inputs': { - 'texture': 'source', - 'coc': 'coc' - }, - 'outputs': { - 'color': { - 'parameters': { - 'width': 'expr(width * 1.0)', - 'height': 'expr(height * 1.0)', - 'type': 'HALF_FLOAT' - } - } - }, - 'parameters': { - 'textureSize': 'expr( [width * 1.0, height * 1.0] )' - }, - 'defines': { - 'BLUR_NEARFIELD': null - } - }, - - - { - 'name': 'dof_coc_blur', - 'shader': '#source(ecgl.dof.diskBlur)', - 'inputs': { - 'texture': 'coc' - }, - 'outputs': { - 'color': { - 'parameters': { - 'minFilter': 'NEAREST', - 'magFilter': 'NEAREST', - 'width': 'expr(width * 1.0)', - 'height': 'expr(height * 1.0)' - } - } - }, - 'parameters': { - 'textureSize': 'expr( [width * 1.0, height * 1.0] )' - }, - 'defines': { - 'BLUR_COC': null - } - }, - - { - 'name': 'dof_composite', - 'shader': '#source(ecgl.dof.composite)', - 'inputs': { - 'original': 'source', - 'blurred': 'dof_far_blur', - 'nearfield': 'dof_near_blur', - 'coc': 'coc', - 'nearcoc': 'dof_coc_blur' - }, - 'outputs': { - 'color': { - 'parameters': { - 'width': 'expr(width * 1.0)', - 'height': 'expr(height * 1.0)', - 'type': 'HALF_FLOAT' - } - } - } - }, - { - 'name' : 'composite', - 'shader' : '#source(clay.compositor.hdr.composite)', - 'inputs' : { - 'texture': 'source', - 'bloom' : 'bloom_composite' - }, - 'defines': { - // Images are all premultiplied alpha before composite because of blending. - // 'PREMULTIPLY_ALPHA': null, - // 'DEBUG': 2 - } - }, - { - 'name' : 'FXAA', - 'shader' : '#source(clay.compositor.fxaa)', - 'inputs' : { - 'texture' : 'composite' - } - } - ] -}); - -/***/ }), -/* 198 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export ecgl.dof.coc\n\nuniform sampler2D depth;\n\nuniform float zNear: 0.1;\nuniform float zFar: 2000;\n\nuniform float focalDistance: 3;\nuniform float focalRange: 1;\nuniform float focalLength: 30;\nuniform float fstop: 2.8;\n\nvarying vec2 v_Texcoord;\n\n@import clay.util.encode_float\n\nvoid main()\n{\n float z = texture2D(depth, v_Texcoord).r * 2.0 - 1.0;\n\n float dist = 2.0 * zNear * zFar / (zFar + zNear - z * (zFar - zNear));\n\n float aperture = focalLength / fstop;\n\n float coc;\n\n float uppper = focalDistance + focalRange;\n float lower = focalDistance - focalRange;\n if (dist <= uppper && dist >= lower) {\n coc = 0.5;\n }\n else {\n float focalAdjusted = dist > uppper ? uppper : lower;\n\n coc = abs(aperture * (focalLength * (dist - focalAdjusted)) / (dist * (focalAdjusted - focalLength)));\n coc = clamp(coc, 0.0, 2.0) / 2.00001;\n\n if (dist < lower) {\n coc = -coc;\n }\n coc = coc * 0.5 + 0.5;\n }\n\n gl_FragColor = encodeFloat(coc);\n}\n@end\n\n\n@export ecgl.dof.composite\n\n#define DEBUG 0\n\nuniform sampler2D original;\nuniform sampler2D blurred;\nuniform sampler2D nearfield;\nuniform sampler2D coc;\nuniform sampler2D nearcoc;\nvarying vec2 v_Texcoord;\n\n@import clay.util.rgbm\n@import clay.util.float\n\nvoid main()\n{\n vec4 blurredColor = texture2D(blurred, v_Texcoord);\n vec4 originalColor = texture2D(original, v_Texcoord);\n\n float fCoc = decodeFloat(texture2D(coc, v_Texcoord));\n\n fCoc = abs(fCoc * 2.0 - 1.0);\n\n float weight = smoothstep(0.0, 1.0, fCoc);\n \n#ifdef NEARFIELD_ENABLED\n vec4 nearfieldColor = texture2D(nearfield, v_Texcoord);\n float fNearCoc = decodeFloat(texture2D(nearcoc, v_Texcoord));\n fNearCoc = abs(fNearCoc * 2.0 - 1.0);\n\n gl_FragColor = encodeHDR(\n mix(\n nearfieldColor, mix(originalColor, blurredColor, weight),\n pow(1.0 - fNearCoc, 4.0)\n )\n );\n#else\n gl_FragColor = encodeHDR(mix(originalColor, blurredColor, weight));\n#endif\n\n}\n\n@end\n\n\n\n@export ecgl.dof.diskBlur\n\n#define POISSON_KERNEL_SIZE 16;\n\nuniform sampler2D texture;\nuniform sampler2D coc;\nvarying vec2 v_Texcoord;\n\nuniform float blurRadius : 10.0;\nuniform vec2 textureSize : [512.0, 512.0];\n\nuniform vec2 poissonKernel[POISSON_KERNEL_SIZE];\n\nuniform float percent;\n\nfloat nrand(const in vec2 n) {\n return fract(sin(dot(n.xy ,vec2(12.9898,78.233))) * 43758.5453);\n}\n\n@import clay.util.rgbm\n@import clay.util.float\n\n\nvoid main()\n{\n vec2 offset = blurRadius / textureSize;\n\n float rnd = 6.28318 * nrand(v_Texcoord + 0.07 * percent );\n float cosa = cos(rnd);\n float sina = sin(rnd);\n vec4 basis = vec4(cosa, -sina, sina, cosa);\n\n#if !defined(BLUR_NEARFIELD) && !defined(BLUR_COC)\n offset *= abs(decodeFloat(texture2D(coc, v_Texcoord)) * 2.0 - 1.0);\n#endif\n\n#ifdef BLUR_COC\n float cocSum = 0.0;\n#else\n vec4 color = vec4(0.0);\n#endif\n\n\n float weightSum = 0.0;\n\n for (int i = 0; i < POISSON_KERNEL_SIZE; i++) {\n vec2 ofs = poissonKernel[i];\n\n ofs = vec2(dot(ofs, basis.xy), dot(ofs, basis.zw));\n\n vec2 uv = v_Texcoord + ofs * offset;\n vec4 texel = texture2D(texture, uv);\n\n float w = 1.0;\n#ifdef BLUR_COC\n float fCoc = decodeFloat(texel) * 2.0 - 1.0;\n cocSum += clamp(fCoc, -1.0, 0.0) * w;\n#else\n texel = texel;\n #if !defined(BLUR_NEARFIELD)\n float fCoc = decodeFloat(texture2D(coc, uv)) * 2.0 - 1.0;\n w *= abs(fCoc);\n #endif\n texel.rgb *= texel.a;\n color += texel * w;\n#endif\n\n weightSum += w;\n }\n\n#ifdef BLUR_COC\n gl_FragColor = encodeFloat(clamp(cocSum / weightSum, -1.0, 0.0) * 0.5 + 0.5);\n#else\n color /= weightSum;\n color.rgb /= (color.a + 0.0001);\n gl_FragColor = color;\n#endif\n}\n\n@end"); - - -/***/ }), -/* 199 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export ecgl.edge\n\nuniform sampler2D texture;\n\nuniform sampler2D normalTexture;\nuniform sampler2D depthTexture;\n\nuniform mat4 projectionInv;\n\nuniform vec2 textureSize;\n\nuniform vec4 edgeColor: [0,0,0,0.8];\n\nvarying vec2 v_Texcoord;\n\nvec3 packColor(vec2 coord) {\n float z = texture2D(depthTexture, coord).r * 2.0 - 1.0;\n vec4 p = vec4(v_Texcoord * 2.0 - 1.0, z, 1.0);\n vec4 p4 = projectionInv * p;\n\n return vec3(\n texture2D(normalTexture, coord).rg,\n -p4.z / p4.w / 5.0\n );\n}\n\nvoid main() {\n vec2 cc = v_Texcoord;\n vec3 center = packColor(cc);\n\n float size = clamp(1.0 - (center.z - 10.0) / 100.0, 0.0, 1.0) * 0.5;\n float dx = size / textureSize.x;\n float dy = size / textureSize.y;\n\n vec2 coord;\n vec3 topLeft = packColor(cc+vec2(-dx, -dy));\n vec3 top = packColor(cc+vec2(0.0, -dy));\n vec3 topRight = packColor(cc+vec2(dx, -dy));\n vec3 left = packColor(cc+vec2(-dx, 0.0));\n vec3 right = packColor(cc+vec2(dx, 0.0));\n vec3 bottomLeft = packColor(cc+vec2(-dx, dy));\n vec3 bottom = packColor(cc+vec2(0.0, dy));\n vec3 bottomRight = packColor(cc+vec2(dx, dy));\n\n vec3 v = -topLeft-2.0*top-topRight+bottomLeft+2.0*bottom+bottomRight;\n vec3 h = -bottomLeft-2.0*left-topLeft+bottomRight+2.0*right+topRight;\n\n float edge = sqrt(dot(h, h) + dot(v, v));\n\n edge = smoothstep(0.8, 1.0, edge);\n\n gl_FragColor = mix(texture2D(texture, v_Texcoord), vec4(edgeColor.rgb, 1.0), edgeColor.a * edge);\n}\n@end"); - - -/***/ }), -/* 200 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__halton__ = __webpack_require__(49); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_claygl_src_compositor_Pass__ = __webpack_require__(16); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_claygl_src_FrameBuffer__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_claygl_src_Texture2D__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__ = __webpack_require__(8); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_claygl_src_math_Matrix4__ = __webpack_require__(9); -// Temporal Super Sample for static Scene - - - - - - - -function TemporalSuperSampling (frames) { - var haltonSequence = []; - - for (var i = 0; i < 30; i++) { - haltonSequence.push([Object(__WEBPACK_IMPORTED_MODULE_0__halton__["a" /* default */])(i, 2), Object(__WEBPACK_IMPORTED_MODULE_0__halton__["a" /* default */])(i, 3)]); - } - - this._haltonSequence = haltonSequence; - - this._frame = 0; - - this._sourceTex = new __WEBPACK_IMPORTED_MODULE_3_claygl_src_Texture2D__["a" /* default */](); - this._sourceFb = new __WEBPACK_IMPORTED_MODULE_2_claygl_src_FrameBuffer__["a" /* default */](); - this._sourceFb.attach(this._sourceTex); - - // Frame texture before temporal supersampling - this._prevFrameTex = new __WEBPACK_IMPORTED_MODULE_3_claygl_src_Texture2D__["a" /* default */](); - this._outputTex = new __WEBPACK_IMPORTED_MODULE_3_claygl_src_Texture2D__["a" /* default */](); - - var blendPass = this._blendPass = new __WEBPACK_IMPORTED_MODULE_1_claygl_src_compositor_Pass__["a" /* default */]({ - fragment: __WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].source('clay.compositor.blend') - }); - blendPass.material.disableTexturesAll(); - blendPass.material.enableTexture(['texture1', 'texture2']); - - this._blendFb = new __WEBPACK_IMPORTED_MODULE_2_claygl_src_FrameBuffer__["a" /* default */]({ - depthBuffer: false - }); - - this._outputPass = new __WEBPACK_IMPORTED_MODULE_1_claygl_src_compositor_Pass__["a" /* default */]({ - fragment: __WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].source('clay.compositor.output'), - // TODO, alpha is premultiplied? - blendWithPrevious: true - }); - this._outputPass.material.define('fragment', 'OUTPUT_ALPHA'); - this._outputPass.material.blend = function (_gl) { - // FIXME. - // Output is premultiplied alpha when BLEND is enabled ? - // http://stackoverflow.com/questions/2171085/opengl-blending-with-previous-contents-of-framebuffer - _gl.blendEquationSeparate(_gl.FUNC_ADD, _gl.FUNC_ADD); - _gl.blendFuncSeparate(_gl.ONE, _gl.ONE_MINUS_SRC_ALPHA, _gl.ONE, _gl.ONE_MINUS_SRC_ALPHA); - }; -} - -TemporalSuperSampling.prototype = { - - constructor: TemporalSuperSampling, - - /** - * Jitter camera projectionMatrix - * @parma {clay.Renderer} renderer - * @param {clay.Camera} camera - */ - jitterProjection: function (renderer, camera) { - var viewport = renderer.viewport; - var dpr = viewport.devicePixelRatio || renderer.getDevicePixelRatio(); - var width = viewport.width * dpr; - var height = viewport.height * dpr; - - var offset = this._haltonSequence[this._frame % this._haltonSequence.length]; - - var translationMat = new __WEBPACK_IMPORTED_MODULE_5_claygl_src_math_Matrix4__["a" /* default */](); - translationMat.array[12] = (offset[0] * 2.0 - 1.0) / width; - translationMat.array[13] = (offset[1] * 2.0 - 1.0) / height; - - __WEBPACK_IMPORTED_MODULE_5_claygl_src_math_Matrix4__["a" /* default */].mul(camera.projectionMatrix, translationMat, camera.projectionMatrix); - - __WEBPACK_IMPORTED_MODULE_5_claygl_src_math_Matrix4__["a" /* default */].invert(camera.invProjectionMatrix, camera.projectionMatrix); - }, - - /** - * Reset accumulating frame - */ - resetFrame: function () { - this._frame = 0; - }, - - /** - * Return current frame - */ - getFrame: function () { - return this._frame; - }, - - /** - * Get source framebuffer for usage - */ - getSourceFrameBuffer: function () { - return this._sourceFb; - }, - - getOutputTexture: function () { - return this._outputTex; - }, - - resize: function (width, height) { - this._prevFrameTex.width = width; - this._prevFrameTex.height = height; - - this._outputTex.width = width; - this._outputTex.height = height; - - this._sourceTex.width = width; - this._sourceTex.height = height; - - this._prevFrameTex.dirty(); - this._outputTex.dirty(); - this._sourceTex.dirty(); - }, - - isFinished: function () { - return this._frame >= this._haltonSequence.length; - }, - - render: function (renderer, sourceTex, notOutput) { - var blendPass = this._blendPass; - if (this._frame === 0) { - // Direct output - blendPass.setUniform('weight1', 0); - blendPass.setUniform('weight2', 1); - } - else { - blendPass.setUniform('weight1', 0.9); - blendPass.setUniform('weight2', 0.1); - } - blendPass.setUniform('texture1', this._prevFrameTex); - blendPass.setUniform('texture2', sourceTex || this._sourceTex); - - this._blendFb.attach(this._outputTex); - this._blendFb.bind(renderer); - blendPass.render(renderer); - this._blendFb.unbind(renderer); - - if (!notOutput) { - this._outputPass.setUniform('texture', this._outputTex); - this._outputPass.render(renderer); - } - - // Swap texture - var tmp = this._prevFrameTex; - this._prevFrameTex = this._outputTex; - this._outputTex = tmp; - - this._frame++; - }, - - dispose: function (renderer) { - this._sourceFb.dispose(renderer); - this._blendFb.dispose(renderer); - this._prevFrameTex.dispose(renderer); - this._outputTex.dispose(renderer); - this._sourceTex.dispose(renderer); - this._outputPass.dispose(renderer); - this._blendPass.dispose(renderer); - } -}; - -/* harmony default export */ __webpack_exports__["a"] = (TemporalSuperSampling); - -/***/ }), -/* 201 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__geo3D_Geo3DModel__ = __webpack_require__(202); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__geo3D_Geo3DView__ = __webpack_require__(203); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__coord_geo3DCreator__ = __webpack_require__(98); - - - - - - - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerAction({ - type: 'geo3DChangeCamera', - event: 'geo3dcamerachanged', - update: 'series:updateCamera' -}, function (payload, ecModel) { - ecModel.eachComponent({ - mainType: 'geo3D', query: payload - }, function (componentModel) { - componentModel.setView(payload); - }); -}); - -/***/ }), -/* 202 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__common_componentViewControlMixin__ = __webpack_require__(44); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_componentPostEffectMixin__ = __webpack_require__(28); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_componentLightMixin__ = __webpack_require__(29); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_componentShadingMixin__ = __webpack_require__(31); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__coord_geo3D_geo3DModelMixin__ = __webpack_require__(96); - - - - - - - -var Geo3DModel = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendComponentModel({ - - type: 'geo3D', - - layoutMode: 'box', - - coordinateSystem: null, - - optionUpdated: function () { - var option = this.option; - - option.regions = this.getFilledRegions(option.regions, option.map); - - var dimensions = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.helper.completeDimensions(['value'], option.data, { - encodeDef: this.get('encode'), - dimsDef: this.get('dimensions') - }); - var list = new __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.List(dimensions, this); - list.initData(option.regions); - - var regionModelMap = {}; - list.each(function (idx) { - var name = list.getName(idx); - var itemModel = list.getItemModel(idx); - regionModelMap[name] = itemModel; - }); - - this._regionModelMap = regionModelMap; - - this._data = list; - }, - - getData: function () { - return this._data; - }, - - getRegionModel: function (idx) { - var name = this.getData().getName(idx); - return this._regionModelMap[name] || new __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.Model(null, this); - }, - - getRegionPolygonCoords: function (idx) { - var name = this.getData().getName(idx); - var region = this.coordinateSystem.getRegion(name); - - return region ? region.geometries : []; - }, - - /** - * Format label - * @param {string} name Region name - * @param {string} [status='normal'] 'normal' or 'emphasis' - * @return {string} - */ - getFormattedLabel: function (dataIndex, status) { - var name = this._data.getName(dataIndex); - var regionModel = this.getRegionModel(name); - var formatter = regionModel.get(status === 'normal' ? ['label', 'formatter'] : ['emphasis', 'label', 'formatter']); - if (formatter == null) { - formatter = regionModel.get(['label', 'formatter']); - } - var params = { - name: name - }; - if (typeof formatter === 'function') { - params.status = status; - return formatter(params); - } - else if (typeof formatter === 'string') { - var serName = params.seriesName; - return formatter.replace('{a}', serName != null ? serName : ''); - } - else { - return name; - } - }, - - defaultOption: { - - // itemStyle: {}, - // height, - // label: {} - // realisticMaterial - regions: [] - } -}); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(Geo3DModel.prototype, __WEBPACK_IMPORTED_MODULE_5__coord_geo3D_geo3DModelMixin__["a" /* default */]); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(Geo3DModel.prototype, __WEBPACK_IMPORTED_MODULE_1__common_componentViewControlMixin__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(Geo3DModel.prototype, __WEBPACK_IMPORTED_MODULE_2__common_componentPostEffectMixin__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(Geo3DModel.prototype, __WEBPACK_IMPORTED_MODULE_3__common_componentLightMixin__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(Geo3DModel.prototype, __WEBPACK_IMPORTED_MODULE_4__common_componentShadingMixin__["a" /* default */]); - -/* unused harmony default export */ var _unused_webpack_default_export = (Geo3DModel); - -/***/ }), -/* 203 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__common_Geo3DBuilder__ = __webpack_require__(64); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_graphicGL__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_OrbitControl__ = __webpack_require__(45); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_SceneHelper__ = __webpack_require__(30); - - - - - - - -/* unused harmony default export */ var _unused_webpack_default_export = (__WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts___default.a.extendComponentView({ - - type: 'geo3D', - - __ecgl__: true, - - init: function (ecModel, api) { - - this._geo3DBuilder = new __WEBPACK_IMPORTED_MODULE_0__common_Geo3DBuilder__["a" /* default */](api); - this.groupGL = new __WEBPACK_IMPORTED_MODULE_2__util_graphicGL__["a" /* default */].Node(); - - this._lightRoot = new __WEBPACK_IMPORTED_MODULE_2__util_graphicGL__["a" /* default */].Node(); - this._sceneHelper = new __WEBPACK_IMPORTED_MODULE_4__common_SceneHelper__["a" /* default */](this._lightRoot); - this._sceneHelper.initLight(this._lightRoot); - - this._control = new __WEBPACK_IMPORTED_MODULE_3__util_OrbitControl__["a" /* default */]({ - zr: api.getZr() - }); - this._control.init(); - }, - - render: function (geo3DModel, ecModel, api) { - this.groupGL.add(this._geo3DBuilder.rootNode); - - var geo3D = geo3DModel.coordinateSystem; - - if (!geo3D || !geo3D.viewGL) { - return; - } - - // Always have light. - geo3D.viewGL.add(this._lightRoot); - - if (geo3DModel.get('show')) { - geo3D.viewGL.add(this.groupGL); - } - else { - geo3D.viewGL.remove(this.groupGL); - } - - var control = this._control; - control.setViewGL(geo3D.viewGL); - - var viewControlModel = geo3DModel.getModel('viewControl'); - control.setFromViewControlModel(viewControlModel, 0); - - this._sceneHelper.setScene(geo3D.viewGL.scene); - this._sceneHelper.updateLight(geo3DModel); - - // Set post effect - geo3D.viewGL.setPostEffect(geo3DModel.getModel('postEffect'), api); - geo3D.viewGL.setTemporalSuperSampling(geo3DModel.getModel('temporalSuperSampling')); - - // Must update after geo3D.viewGL.setPostEffect - this._geo3DBuilder.update(geo3DModel, ecModel, api, 0, geo3DModel.getData().count()); - var srgbDefineMethod = geo3D.viewGL.isLinearSpace() ? 'define' : 'undefine'; - this._geo3DBuilder.rootNode.traverse(function (mesh) { - if (mesh.material) { - mesh.material[srgbDefineMethod]('fragment', 'SRGB_DECODE'); - } - }); - - control.off('update'); - control.on('update', function () { - api.dispatchAction({ - type: 'geo3DChangeCamera', - alpha: control.getAlpha(), - beta: control.getBeta(), - distance: control.getDistance(), - center: control.getCenter(), - from: this.uid, - geo3DId: geo3DModel.id - }); - }); - control.update(); - }, - - afterRender: function (geo3DModel, ecModel, api, layerGL) { - var renderer = layerGL.renderer; - this._sceneHelper.updateAmbientCubemap(renderer, geo3DModel, api); - - this._sceneHelper.updateSkybox(renderer, geo3DModel, api); - }, - - dispose: function () { - this._control.dispose(); - } -})); - -/***/ }), -/* 204 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -// https://github.com/mapbox/earcut/blob/master/src/earcut.js - -/* harmony default export */ __webpack_exports__["a"] = (earcut); - -function earcut(data, holeIndices, dim) { - - dim = dim || 2; - - var hasHoles = holeIndices && holeIndices.length, - outerLen = hasHoles ? holeIndices[0] * dim : data.length, - outerNode = linkedList(data, 0, outerLen, dim, true), - triangles = []; - - if (!outerNode) return triangles; - - var minX, minY, maxX, maxY, x, y, size; - - if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim); - - // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox - if (data.length > 80 * dim) { - minX = maxX = data[0]; - minY = maxY = data[1]; - - for (var i = dim; i < outerLen; i += dim) { - x = data[i]; - y = data[i + 1]; - if (x < minX) minX = x; - if (y < minY) minY = y; - if (x > maxX) maxX = x; - if (y > maxY) maxY = y; - } - - // minX, minY and size are later used to transform coords into integers for z-order calculation - size = Math.max(maxX - minX, maxY - minY); - } - - earcutLinked(outerNode, triangles, dim, minX, minY, size); - - return triangles; -} - -// create a circular doubly linked list from polygon points in the specified winding order -function linkedList(data, start, end, dim, clockwise) { - var i, last; - - if (clockwise === (signedArea(data, start, end, dim) > 0)) { - for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last); - } else { - for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last); - } - - if (last && equals(last, last.next)) { - removeNode(last); - last = last.next; - } - - return last; -} - -// eliminate colinear or duplicate points -function filterPoints(start, end) { - if (!start) return start; - if (!end) end = start; - - var p = start, - again; - do { - again = false; - - if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) { - removeNode(p); - p = end = p.prev; - if (p === p.next) return null; - again = true; - - } else { - p = p.next; - } - } while (again || p !== end); - - return end; -} - -// main ear slicing loop which triangulates a polygon (given as a linked list) -function earcutLinked(ear, triangles, dim, minX, minY, size, pass) { - if (!ear) return; - - // interlink polygon nodes in z-order - if (!pass && size) indexCurve(ear, minX, minY, size); - - var stop = ear, - prev, next; - - // iterate through ears, slicing them one by one - while (ear.prev !== ear.next) { - prev = ear.prev; - next = ear.next; - - if (size ? isEarHashed(ear, minX, minY, size) : isEar(ear)) { - // cut off the triangle - triangles.push(prev.i / dim); - triangles.push(ear.i / dim); - triangles.push(next.i / dim); - - removeNode(ear); - - // skipping the next vertice leads to less sliver triangles - ear = next.next; - stop = next.next; - - continue; - } - - ear = next; - - // if we looped through the whole remaining polygon and can't find any more ears - if (ear === stop) { - // try filtering points and slicing again - if (!pass) { - earcutLinked(filterPoints(ear), triangles, dim, minX, minY, size, 1); - - // if this didn't work, try curing all small self-intersections locally - } else if (pass === 1) { - ear = cureLocalIntersections(ear, triangles, dim); - earcutLinked(ear, triangles, dim, minX, minY, size, 2); - - // as a last resort, try splitting the remaining polygon into two - } else if (pass === 2) { - splitEarcut(ear, triangles, dim, minX, minY, size); - } - - break; - } - } -} - -// check whether a polygon node forms a valid ear with adjacent nodes -function isEar(ear) { - var a = ear.prev, - b = ear, - c = ear.next; - - if (area(a, b, c) >= 0) return false; // reflex, can't be an ear - - // now make sure we don't have other points inside the potential ear - var p = ear.next.next; - - while (p !== ear.prev) { - if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && - area(p.prev, p, p.next) >= 0) return false; - p = p.next; - } - - return true; -} - -function isEarHashed(ear, minX, minY, size) { - var a = ear.prev, - b = ear, - c = ear.next; - - if (area(a, b, c) >= 0) return false; // reflex, can't be an ear - - // triangle bbox; min & max are calculated like this for speed - var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x), - minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y), - maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x), - maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y); - - // z-order range for the current triangle bbox; - var minZ = zOrder(minTX, minTY, minX, minY, size), - maxZ = zOrder(maxTX, maxTY, minX, minY, size); - - // first look for points inside the triangle in increasing z-order - var p = ear.nextZ; - - while (p && p.z <= maxZ) { - if (p !== ear.prev && p !== ear.next && - pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && - area(p.prev, p, p.next) >= 0) return false; - p = p.nextZ; - } - - // then look for points in decreasing z-order - p = ear.prevZ; - - while (p && p.z >= minZ) { - if (p !== ear.prev && p !== ear.next && - pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && - area(p.prev, p, p.next) >= 0) return false; - p = p.prevZ; - } - - return true; -} - -// go through all polygon nodes and cure small local self-intersections -function cureLocalIntersections(start, triangles, dim) { - var p = start; - do { - var a = p.prev, - b = p.next.next; - - if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) { - - triangles.push(a.i / dim); - triangles.push(p.i / dim); - triangles.push(b.i / dim); - - // remove two nodes involved - removeNode(p); - removeNode(p.next); - - p = start = b; - } - p = p.next; - } while (p !== start); - - return p; -} - -// try splitting polygon into two and triangulate them independently -function splitEarcut(start, triangles, dim, minX, minY, size) { - // look for a valid diagonal that divides the polygon into two - var a = start; - do { - var b = a.next.next; - while (b !== a.prev) { - if (a.i !== b.i && isValidDiagonal(a, b)) { - // split the polygon in two by the diagonal - var c = splitPolygon(a, b); - - // filter colinear points around the cuts - a = filterPoints(a, a.next); - c = filterPoints(c, c.next); - - // run earcut on each half - earcutLinked(a, triangles, dim, minX, minY, size); - earcutLinked(c, triangles, dim, minX, minY, size); - return; - } - b = b.next; - } - a = a.next; - } while (a !== start); -} - -// link every hole into the outer loop, producing a single-ring polygon without holes -function eliminateHoles(data, holeIndices, outerNode, dim) { - var queue = [], - i, len, start, end, list; - - for (i = 0, len = holeIndices.length; i < len; i++) { - start = holeIndices[i] * dim; - end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; - list = linkedList(data, start, end, dim, false); - if (list === list.next) list.steiner = true; - queue.push(getLeftmost(list)); - } - - queue.sort(compareX); - - // process holes from left to right - for (i = 0; i < queue.length; i++) { - eliminateHole(queue[i], outerNode); - outerNode = filterPoints(outerNode, outerNode.next); - } - - return outerNode; -} - -function compareX(a, b) { - return a.x - b.x; -} - -// find a bridge between vertices that connects hole with an outer ring and and link it -function eliminateHole(hole, outerNode) { - outerNode = findHoleBridge(hole, outerNode); - if (outerNode) { - var b = splitPolygon(outerNode, hole); - filterPoints(b, b.next); - } -} - -// David Eberly's algorithm for finding a bridge between hole and outer polygon -function findHoleBridge(hole, outerNode) { - var p = outerNode, - hx = hole.x, - hy = hole.y, - qx = -Infinity, - m; - - // find a segment intersected by a ray from the hole's leftmost point to the left; - // segment's endpoint with lesser x will be potential connection point - do { - if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) { - var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); - if (x <= hx && x > qx) { - qx = x; - if (x === hx) { - if (hy === p.y) return p; - if (hy === p.next.y) return p.next; - } - m = p.x < p.next.x ? p : p.next; - } - } - p = p.next; - } while (p !== outerNode); - - if (!m) return null; - - if (hx === qx) return m.prev; // hole touches outer segment; pick lower endpoint - - // look for points inside the triangle of hole point, segment intersection and endpoint; - // if there are no points found, we have a valid connection; - // otherwise choose the point of the minimum angle with the ray as connection point - - var stop = m, - mx = m.x, - my = m.y, - tanMin = Infinity, - tan; - - p = m.next; - - while (p !== stop) { - if (hx >= p.x && p.x >= mx && hx !== p.x && - pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) { - - tan = Math.abs(hy - p.y) / (hx - p.x); // tangential - - if ((tan < tanMin || (tan === tanMin && p.x > m.x)) && locallyInside(p, hole)) { - m = p; - tanMin = tan; - } - } - - p = p.next; - } - - return m; -} - -// interlink polygon nodes in z-order -function indexCurve(start, minX, minY, size) { - var p = start; - do { - if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, size); - p.prevZ = p.prev; - p.nextZ = p.next; - p = p.next; - } while (p !== start); - - p.prevZ.nextZ = null; - p.prevZ = null; - - sortLinked(p); -} - -// Simon Tatham's linked list merge sort algorithm -// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html -function sortLinked(list) { - var i, p, q, e, tail, numMerges, pSize, qSize, - inSize = 1; - - do { - p = list; - list = null; - tail = null; - numMerges = 0; - - while (p) { - numMerges++; - q = p; - pSize = 0; - for (i = 0; i < inSize; i++) { - pSize++; - q = q.nextZ; - if (!q) break; - } - qSize = inSize; - - while (pSize > 0 || (qSize > 0 && q)) { - - if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) { - e = p; - p = p.nextZ; - pSize--; - } else { - e = q; - q = q.nextZ; - qSize--; - } - - if (tail) tail.nextZ = e; - else list = e; - - e.prevZ = tail; - tail = e; - } - - p = q; - } - - tail.nextZ = null; - inSize *= 2; - - } while (numMerges > 1); - - return list; -} - -// z-order of a point given coords and size of the data bounding box -function zOrder(x, y, minX, minY, size) { - // coords are transformed into non-negative 15-bit integer range - x = 32767 * (x - minX) / size; - y = 32767 * (y - minY) / size; - - x = (x | (x << 8)) & 0x00FF00FF; - x = (x | (x << 4)) & 0x0F0F0F0F; - x = (x | (x << 2)) & 0x33333333; - x = (x | (x << 1)) & 0x55555555; - - y = (y | (y << 8)) & 0x00FF00FF; - y = (y | (y << 4)) & 0x0F0F0F0F; - y = (y | (y << 2)) & 0x33333333; - y = (y | (y << 1)) & 0x55555555; - - return x | (y << 1); -} - -// find the leftmost node of a polygon ring -function getLeftmost(start) { - var p = start, - leftmost = start; - do { - if (p.x < leftmost.x) leftmost = p; - p = p.next; - } while (p !== start); - - return leftmost; -} - -// check if a point lies within a convex triangle -function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) { - return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && - (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && - (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0; -} - -// check if a diagonal between two polygon nodes is valid (lies in polygon interior) -function isValidDiagonal(a, b) { - return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && - locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b); -} - -// signed area of a triangle -function area(p, q, r) { - return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); -} - -// check if two points are equal -function equals(p1, p2) { - return p1.x === p2.x && p1.y === p2.y; -} - -// check if two segments intersect -function intersects(p1, q1, p2, q2) { - if ((equals(p1, q1) && equals(p2, q2)) || - (equals(p1, q2) && equals(p2, q1))) return true; - return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 && - area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0; -} - -// check if a polygon diagonal intersects any polygon segments -function intersectsPolygon(a, b) { - var p = a; - do { - if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && - intersects(p, p.next, a, b)) return true; - p = p.next; - } while (p !== a); - - return false; -} - -// check if a polygon diagonal is locally inside the polygon -function locallyInside(a, b) { - return area(a.prev, a, a.next) < 0 ? - area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : - area(a, b, a.prev) < 0 || area(a, a.next, b) < 0; -} - -// check if the middle point of a polygon diagonal is inside the polygon -function middleInside(a, b) { - var p = a, - inside = false, - px = (a.x + b.x) / 2, - py = (a.y + b.y) / 2; - do { - if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y && - (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)) - inside = !inside; - p = p.next; - } while (p !== a); - - return inside; -} - -// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two; -// if one belongs to the outer ring and another to a hole, it merges it into a single ring -function splitPolygon(a, b) { - var a2 = new Node(a.i, a.x, a.y), - b2 = new Node(b.i, b.x, b.y), - an = a.next, - bp = b.prev; - - a.next = b; - b.prev = a; - - a2.next = an; - an.prev = a2; - - b2.next = a2; - a2.prev = b2; - - bp.next = b2; - b2.prev = bp; - - return b2; -} - -// create a node and optionally link it with previous one (in a circular doubly linked list) -function insertNode(i, x, y, last) { - var p = new Node(i, x, y); - - if (!last) { - p.prev = p; - p.next = p; - - } else { - p.next = last.next; - p.prev = last; - last.next.prev = p; - last.next = p; - } - return p; -} - -function removeNode(p) { - p.next.prev = p.prev; - p.prev.next = p.next; - - if (p.prevZ) p.prevZ.nextZ = p.nextZ; - if (p.nextZ) p.nextZ.prevZ = p.prevZ; -} - -function Node(i, x, y) { - // vertice index in coordinates array - this.i = i; - - // vertex coordinates - this.x = x; - this.y = y; - - // previous and next vertice nodes in a polygon ring - this.prev = null; - this.next = null; - - // z-order curve value - this.z = null; - - // previous and next nodes in z-order - this.prevZ = null; - this.nextZ = null; - - // indicates whether this is a steiner point - this.steiner = false; -} - -// return a percentage difference between the polygon area and its triangulation area; -// used to verify correctness of triangulation -earcut.deviation = function (data, holeIndices, dim, triangles) { - var hasHoles = holeIndices && holeIndices.length; - var outerLen = hasHoles ? holeIndices[0] * dim : data.length; - - var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim)); - if (hasHoles) { - for (var i = 0, len = holeIndices.length; i < len; i++) { - var start = holeIndices[i] * dim; - var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; - polygonArea -= Math.abs(signedArea(data, start, end, dim)); - } - } - - var trianglesArea = 0; - for (i = 0; i < triangles.length; i += 3) { - var a = triangles[i] * dim; - var b = triangles[i + 1] * dim; - var c = triangles[i + 2] * dim; - trianglesArea += Math.abs( - (data[a] - data[c]) * (data[b + 1] - data[a + 1]) - - (data[a] - data[b]) * (data[c + 1] - data[a + 1])); - } - - return polygonArea === 0 && trianglesArea === 0 ? 0 : - Math.abs((trianglesArea - polygonArea) / polygonArea); -}; - -function signedArea(data, start, end, dim) { - var sum = 0; - for (var i = start, j = end - dim; i < end; i += dim) { - sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]); - j = i; - } - return sum; -} - -/***/ }), -/* 205 */ -/***/ (function(module, exports, __webpack_require__) { - -var zrUtil = __webpack_require__(13); - -/* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -*/ -var coordsOffsetMap = { - '南海诸岛': [32, 80], - // 全国 - '广东': [0, -10], - '香港': [10, 5], - '澳门': [-10, 10], - //'北京': [-10, 0], - '天津': [5, 5] -}; - -function _default(geo) { - zrUtil.each(geo.regions, function (region) { - var coordFix = coordsOffsetMap[region.name]; - - if (coordFix) { - var cp = region.center; - cp[0] += coordFix[0] / 10.5; - cp[1] += -coordFix[1] / (10.5 / 0.75); - } - }); -} - -module.exports = _default; - -/***/ }), -/* 206 */ -/***/ (function(module, exports, __webpack_require__) { - -var zrUtil = __webpack_require__(13); - -/* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -*/ -var geoCoordMap = { - 'Russia': [100, 60], - 'United States': [-99, 38], - 'United States of America': [-99, 38] -}; - -function _default(geo) { - zrUtil.each(geo.regions, function (region) { - var geoCoord = geoCoordMap[region.name]; - - if (geoCoord) { - var cp = region.center; - cp[0] = geoCoord[0]; - cp[1] = geoCoord[1]; - } - }); -} - -module.exports = _default; - -/***/ }), -/* 207 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__globe_GlobeModel__ = __webpack_require__(208); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__globe_GlobeView__ = __webpack_require__(209); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__coord_globeCreator__ = __webpack_require__(211); - - - - - - - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerAction({ - type: 'globeChangeCamera', - event: 'globecamerachanged', - update: 'series:updateCamera' -}, function (payload, ecModel) { - ecModel.eachComponent({ - mainType: 'globe', query: payload - }, function (componentModel) { - componentModel.setView(payload); - }); -}); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerAction({ - type: 'globeUpdateDisplacment', - event: 'globedisplacementupdated', - update: 'update' -}, function (payload, ecModel) { - // Noop -}); - -/***/ }), -/* 208 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__common_componentViewControlMixin__ = __webpack_require__(44); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_componentPostEffectMixin__ = __webpack_require__(28); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_componentLightMixin__ = __webpack_require__(29); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_componentShadingMixin__ = __webpack_require__(31); - - - - - - - -function defaultId(option, idx) { - option.id = option.id || option.name || (idx + ''); -} -var GlobeModel = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendComponentModel({ - - type: 'globe', - - layoutMode: 'box', - - coordinateSystem: null, - - init: function () { - GlobeModel.superApply(this, 'init', arguments); - - __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.each(this.option.layers, function (layerOption, idx) { - __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(layerOption, this.defaultLayerOption); - defaultId(layerOption, idx); - }, this); - }, - - mergeOption: function (option) { - // TODO test - var oldLayers = this.option.layers; - this.option.layers = null; - GlobeModel.superApply(this, 'mergeOption', arguments); - - function createLayerMap(layers) { - return __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.reduce(layers, function (obj, layerOption, idx) { - defaultId(layerOption, idx); - obj[layerOption.id] = layerOption; - return obj; - }, {}); - } - if (oldLayers && oldLayers.length) { - var newLayerMap = createLayerMap(option.layers); - var oldLayerMap = createLayerMap(oldLayers); - for (var id in newLayerMap) { - if (oldLayerMap[id]) { - __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(oldLayerMap[id], newLayerMap[id], true); - } - else { - oldLayers.push(option.layers[id]); - } - } - // Copy back - this.option.layers = oldLayers; - } - // else overwrite - - // Set default - __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.each(this.option.layers, function (layerOption) { - __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(layerOption, this.defaultLayerOption); - }, this); - }, - - optionUpdated: function () { - this.updateDisplacementHash(); - }, - - defaultLayerOption: { - show: true, - type: 'overlay' - }, - - defaultOption: { - - show: true, - - zlevel: -10, - - // Layout used for viewport - left: 0, - top: 0, - width: '100%', - height: '100%', - - environment: 'auto', - - baseColor: '#fff', - - // Base albedo texture - baseTexture: '', - - // Height texture for bump mapping and vertex displacement - heightTexture: '', - - // Texture for vertex displacement, default use heightTexture - displacementTexture: '', - // Scale of vertex displacement, available only if displacementTexture is set. - displacementScale: 0, - - // Detail of displacement. 'low', 'medium', 'high', 'ultra' - displacementQuality: 'medium', - - // Globe radius - globeRadius: 100, - - // Globe outer radius. Which is max of altitude. - globeOuterRadius: 150, - - // Shading of globe - shading: 'lambert', - - // Extend light - light: { - // Main sun light - main: { - // Time, default it will use system time - time: '' - } - }, - - // light - // postEffect - // temporalSuperSampling - - viewControl: { - autoRotate: true, - - panSensitivity: 0, - - targetCoord: null - }, - - - // { - // show: true, - // name: 'cloud', - // type: 'overlay', - // shading: 'lambert', - // distance: 10, - // texture: '' - // } - // { - // type: 'blend', - // blendTo: 'albedo' - // blendType: 'source-over' - // } - - layers: [] - }, - - setDisplacementData: function (data, width, height) { - this.displacementData = data; - this.displacementWidth = width; - this.displacementHeight = height; - }, - - getDisplacementTexture: function () { - return this.get('displacementTexture') || this.get('heightTexture'); - }, - - getDisplacemenScale: function () { - var displacementTexture = this.getDisplacementTexture(); - var displacementScale = this.get('displacementScale'); - if (!displacementTexture || displacementTexture === 'none') { - displacementScale = 0; - } - return displacementScale; - }, - - hasDisplacement: function () { - return this.getDisplacemenScale() > 0; - }, - - _displacementChanged: true, - - _displacementScale: 0, - - updateDisplacementHash: function () { - var displacementTexture = this.getDisplacementTexture(); - var displacementScale = this.getDisplacemenScale(); - - this._displacementChanged = - this._displacementTexture !== displacementTexture - || this._displacementScale !== displacementScale; - - this._displacementTexture = displacementTexture; - this._displacementScale = displacementScale; - }, - - isDisplacementChanged: function () { - return this._displacementChanged; - } -}); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(GlobeModel.prototype, __WEBPACK_IMPORTED_MODULE_1__common_componentViewControlMixin__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(GlobeModel.prototype, __WEBPACK_IMPORTED_MODULE_2__common_componentPostEffectMixin__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(GlobeModel.prototype, __WEBPACK_IMPORTED_MODULE_3__common_componentLightMixin__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(GlobeModel.prototype, __WEBPACK_IMPORTED_MODULE_4__common_componentShadingMixin__["a" /* default */]); - -/* unused harmony default export */ var _unused_webpack_default_export = (GlobeModel); - -/***/ }), -/* 209 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_OrbitControl__ = __webpack_require__(45); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_SceneHelper__ = __webpack_require__(30); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_sunCalc__ = __webpack_require__(210); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__util_retrieve__ = __webpack_require__(2); - - - - - - - - - -/* unused harmony default export */ var _unused_webpack_default_export = (__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendComponentView({ - - type: 'globe', - - __ecgl__: true, - - _displacementScale: 0, - - init: function (ecModel, api) { - this.groupGL = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Node(); - - /** - * @type {clay.geometry.Sphere} - * @private - */ - this._sphereGeometry = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].SphereGeometry({ - widthSegments: 200, - heightSegments: 100, - dynamic: true - }); - this._overlayGeometry = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].SphereGeometry({ - widthSegments: 80, - heightSegments: 40 - }); - - /** - * @type {clay.geometry.Plane} - */ - this._planeGeometry = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].PlaneGeometry(); - - /** - * @type {clay.geometry.Mesh} - */ - this._earthMesh = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Mesh({ - renderNormal: true - }); - - this._lightRoot = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Node(); - this._sceneHelper = new __WEBPACK_IMPORTED_MODULE_3__common_SceneHelper__["a" /* default */](); - this._sceneHelper.initLight(this._lightRoot); - - this.groupGL.add(this._earthMesh); - - this._control = new __WEBPACK_IMPORTED_MODULE_2__util_OrbitControl__["a" /* default */]({ - zr: api.getZr() - }); - - this._control.init(); - - this._layerMeshes = {}; - }, - - render: function (globeModel, ecModel, api) { - var coordSys = globeModel.coordinateSystem; - var shading = globeModel.get('shading'); - - // Always have light. - coordSys.viewGL.add(this._lightRoot); - - if (globeModel.get('show')) { - // Add self to scene; - coordSys.viewGL.add(this.groupGL); - } - else { - coordSys.viewGL.remove(this.groupGL); - } - - this._sceneHelper.setScene(coordSys.viewGL.scene); - - // Set post effect - coordSys.viewGL.setPostEffect(globeModel.getModel('postEffect'), api); - coordSys.viewGL.setTemporalSuperSampling(globeModel.getModel('temporalSuperSampling')); - - var earthMesh = this._earthMesh; - - earthMesh.geometry = this._sphereGeometry; - - var shadingPrefix = 'ecgl.' + shading; - if (!earthMesh.material || earthMesh.material.shader.name !== shadingPrefix) { - earthMesh.material = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].createMaterial(shadingPrefix); - } - - __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].setMaterialFromModel( - shading, earthMesh.material, globeModel, api - ); - ['roughnessMap', 'metalnessMap', 'detailMap', 'normalMap'].forEach(function (texName) { - var texture = earthMesh.material.get(texName); - if (texture) { - texture.flipY = false; - } - }) - - earthMesh.material.set('color', __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor( - globeModel.get('baseColor') - )); - - // shrink a little - var scale = coordSys.radius * 0.99; - earthMesh.scale.set(scale, scale, scale); - - var diffuseTexture = earthMesh.material.setTextureImage('diffuseMap', globeModel.get('baseTexture'), api, { - flipY: false, - anisotropic: 8 - }); - if (diffuseTexture && diffuseTexture.surface) { - diffuseTexture.surface.attachToMesh(earthMesh); - } - - // Update bump map - var bumpTexture = earthMesh.material.setTextureImage('bumpMap', globeModel.get('heightTexture'), api, { - flipY: false, - anisotropic: 8 - }); - if (bumpTexture && bumpTexture.surface) { - bumpTexture.surface.attachToMesh(earthMesh); - } - - earthMesh.material[globeModel.get('postEffect.enable') ? 'define' : 'undefine']('fragment', 'SRGB_DECODE'); - - this._updateLight(globeModel, api); - - this._displaceVertices(globeModel, api); - - this._updateViewControl(globeModel, api); - - this._updateLayers(globeModel, api); - }, - - afterRender: function (globeModel, ecModel, api, layerGL) { - // Create ambient cubemap after render because we need to know the renderer. - // TODO - var renderer = layerGL.renderer; - - this._sceneHelper.updateAmbientCubemap(renderer, globeModel, api); - - this._sceneHelper.updateSkybox(renderer, globeModel, api); - }, - - - _updateLayers: function (globeModel, api) { - var coordSys = globeModel.coordinateSystem; - var layers = globeModel.get('layers'); - - var lastDistance = coordSys.radius; - var layerDiffuseTextures = []; - var layerDiffuseIntensity = []; - - var layerEmissiveTextures = []; - var layerEmissionIntensity = []; - __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.each(layers, function (layerOption) { - var layerModel = new __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.Model(layerOption); - var layerType = layerModel.get('type'); - - var texture = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].loadTexture(layerModel.get('texture'), api, { - flipY: false, - anisotropic: 8 - }); - if (texture.surface) { - texture.surface.attachToMesh(this._earthMesh); - } - - if (layerType === 'blend') { - var blendTo = layerModel.get('blendTo'); - var intensity = __WEBPACK_IMPORTED_MODULE_5__util_retrieve__["a" /* default */].firstNotNull(layerModel.get('intensity'), 1.0); - if (blendTo === 'emission') { - layerEmissiveTextures.push(texture); - layerEmissionIntensity.push(intensity); - } - else { // Default is albedo - layerDiffuseTextures.push(texture); - layerDiffuseIntensity.push(intensity); - } - } - else { // Default use overlay - var id = layerModel.get('id'); - var overlayMesh = this._layerMeshes[id]; - if (!overlayMesh) { - overlayMesh = this._layerMeshes[id] = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Mesh({ - geometry: this._overlayGeometry, - castShadow: false, - ignorePicking: true - }); - } - var shading = layerModel.get('shading'); - - if (shading === 'lambert') { - overlayMesh.material = overlayMesh.__lambertMaterial || new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Material({ - autoUpdateTextureStatus: false, - shader: __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].createShader('ecgl.lambert'), - transparent: true, - depthMask: false - }); - overlayMesh.__lambertMaterial = overlayMesh.material; - } - else { // color - overlayMesh.material = overlayMesh.__colorMaterial || new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Material({ - autoUpdateTextureStatus: false, - shader: __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].createShader('ecgl.color'), - transparent: true, - depthMask: false - }); - overlayMesh.__colorMaterial = overlayMesh.material; - } - // overlay should be transparent if texture is not loaded yet. - overlayMesh.material.enableTexture('diffuseMap'); - - var distance = layerModel.get('distance'); - // Based on distance of last layer - var radius = lastDistance + (distance == null ? coordSys.radius / 100 : distance); - overlayMesh.scale.set(radius, radius, radius); - - lastDistance = radius; - - // FIXME Exists blink. - var blankTexture = this._blankTexture || (this._blankTexture = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].createBlankTexture('rgba(255, 255, 255, 0)')); - overlayMesh.material.set('diffuseMap', blankTexture); - - __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].loadTexture(layerModel.get('texture'), api, { - flipY: false, - anisotropic: 8 - }, function (texture) { - if (texture.surface) { - texture.surface.attachToMesh(overlayMesh); - } - overlayMesh.material.set('diffuseMap', texture); - api.getZr().refresh(); - }); - - layerModel.get('show') ? this.groupGL.add(overlayMesh) : this.groupGL.remove(overlayMesh); - } - }, this); - - var earthMaterial = this._earthMesh.material; - earthMaterial.define('fragment', 'LAYER_DIFFUSEMAP_COUNT', layerDiffuseTextures.length); - earthMaterial.define('fragment', 'LAYER_EMISSIVEMAP_COUNT', layerEmissiveTextures.length); - - earthMaterial.set('layerDiffuseMap', layerDiffuseTextures); - earthMaterial.set('layerDiffuseIntensity', layerDiffuseIntensity); - earthMaterial.set('layerEmissiveMap', layerEmissiveTextures); - earthMaterial.set('layerEmissionIntensity', layerEmissionIntensity); - - var debugWireframeModel = globeModel.getModel('debug.wireframe'); - if (debugWireframeModel.get('show')) { - earthMaterial.define('both', 'WIREFRAME_TRIANGLE'); - var color = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor( - debugWireframeModel.get('lineStyle.color') || 'rgba(0,0,0,0.5)' - ); - var width = __WEBPACK_IMPORTED_MODULE_5__util_retrieve__["a" /* default */].firstNotNull( - debugWireframeModel.get('lineStyle.width'), 1 - ); - earthMaterial.set('wireframeLineWidth', width); - earthMaterial.set('wireframeLineColor', color); - } - else { - earthMaterial.undefine('both', 'WIREFRAME_TRIANGLE'); - } - }, - - _updateViewControl: function (globeModel, api) { - var coordSys = globeModel.coordinateSystem; - // Update camera - var viewControlModel = globeModel.getModel('viewControl'); - - var camera = coordSys.viewGL.camera; - var self = this; - - function makeAction() { - return { - type: 'globeChangeCamera', - alpha: control.getAlpha(), - beta: control.getBeta(), - distance: control.getDistance() - coordSys.radius, - center: control.getCenter(), - from: self.uid, - globeId: globeModel.id - }; - } - - // Update control - var control = this._control; - control.setViewGL(coordSys.viewGL); - - var coord = viewControlModel.get('targetCoord'); - var alpha, beta; - if (coord != null) { - beta = coord[0] + 90; - alpha = coord[1]; - } - - control.setFromViewControlModel(viewControlModel, { - baseDistance: coordSys.radius, - alpha: alpha, - beta: beta - }); - - control.off('update'); - control.on('update', function () { - api.dispatchAction(makeAction()); - }); - }, - - _displaceVertices: function (globeModel, api) { - var displacementQuality = globeModel.get('displacementQuality'); - var showDebugWireframe = globeModel.get('debug.wireframe.show'); - var globe = globeModel.coordinateSystem; - - if (!globeModel.isDisplacementChanged() - && displacementQuality === this._displacementQuality - && showDebugWireframe === this._showDebugWireframe - ) { - return; - } - - this._displacementQuality = displacementQuality; - this._showDebugWireframe = showDebugWireframe; - - var geometry = this._sphereGeometry; - - var widthSegments = ({ - low: 100, - medium: 200, - high: 400, - ultra: 800 - })[displacementQuality] || 200; - var heightSegments = widthSegments / 2; - if (geometry.widthSegments !== widthSegments || showDebugWireframe) { - geometry.widthSegments = widthSegments; - geometry.heightSegments = heightSegments; - geometry.build(); - } - - this._doDisplaceVertices(geometry, globe); - - if (showDebugWireframe) { - geometry.generateBarycentric(); - } - }, - - _doDisplaceVertices: function (geometry, globe) { - var positionArr = geometry.attributes.position.value; - var uvArr = geometry.attributes.texcoord0.value; - - var originalPositionArr = geometry.__originalPosition; - if (!originalPositionArr || originalPositionArr.length !== positionArr.length) { - originalPositionArr = new Float32Array(positionArr.length); - originalPositionArr.set(positionArr); - geometry.__originalPosition = originalPositionArr; - } - - var width = globe.displacementWidth; - var height = globe.displacementHeight; - var data = globe.displacementData; - - for (var i = 0; i < geometry.vertexCount; i++) { - var i3 = i * 3; - var i2 = i * 2; - var x = originalPositionArr[i3 + 1]; - var y = originalPositionArr[i3 + 2]; - var z = originalPositionArr[i3 + 3]; - - var u = uvArr[i2++]; - var v = uvArr[i2++]; - - var j = Math.round(u * (width - 1)); - var k = Math.round(v * (height - 1)); - var idx = k * width + j; - var scale = data ? data[idx] : 0; - - positionArr[i3 + 1] = x + x * scale; - positionArr[i3 + 2] = y + y * scale; - positionArr[i3 + 3] = z + z * scale; - } - - geometry.generateVertexNormals(); - geometry.dirty(); - - geometry.updateBoundingBox(); - }, - - _updateLight: function (globeModel, api) { - var earthMesh = this._earthMesh; - - this._sceneHelper.updateLight(globeModel); - var mainLight = this._sceneHelper.mainLight; - - // Put sun in the right position - var time = globeModel.get('light.main.time') || new Date(); - - // http://en.wikipedia.org/wiki/Azimuth - var pos = __WEBPACK_IMPORTED_MODULE_4__util_sunCalc__["a" /* default */].getPosition(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.number.parseDate(time), 0, 0); - var r0 = Math.cos(pos.altitude); - // FIXME How to calculate the y ? - mainLight.position.y = -r0 * Math.cos(pos.azimuth); - mainLight.position.x = Math.sin(pos.altitude); - mainLight.position.z = r0 * Math.sin(pos.azimuth); - mainLight.lookAt(earthMesh.getWorldPosition()); - }, - - dispose: function (ecModel, api) { - this.groupGL.removeAll(); - this._control.dispose(); - } -})); - -/***/ }), -/* 210 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* - (c) 2011-2014, Vladimir Agafonkin - SunCalc is a JavaScript library for calculating sun/mooon position and light phases. - https://github.com/mourner/suncalc -*/ - -// shortcuts for easier to read formulas - -var PI = Math.PI, - sin = Math.sin, - cos = Math.cos, - tan = Math.tan, - asin = Math.asin, - atan = Math.atan2, - rad = PI / 180; - -// sun calculations are based on http://aa.quae.nl/en/reken/zonpositie.html formulas - - -// date/time constants and conversions - -var dayMs = 1000 * 60 * 60 * 24, - J1970 = 2440588, - J2000 = 2451545; - -function toJulian (date) { return date.valueOf() / dayMs - 0.5 + J1970; } -function toDays (date) { return toJulian(date) - J2000; } - - -// general calculations for position - -var e = rad * 23.4397; // obliquity of the Earth - -function rightAscension(l, b) { return atan(sin(l) * cos(e) - tan(b) * sin(e), cos(l)); } -function declination(l, b) { return asin(sin(b) * cos(e) + cos(b) * sin(e) * sin(l)); } - -function azimuth(H, phi, dec) { return atan(sin(H), cos(H) * sin(phi) - tan(dec) * cos(phi)); } -function altitude(H, phi, dec) { return asin(sin(phi) * sin(dec) + cos(phi) * cos(dec) * cos(H)); } - -function siderealTime(d, lw) { return rad * (280.16 + 360.9856235 * d) - lw; } - - -// general sun calculations - -function solarMeanAnomaly(d) { return rad * (357.5291 + 0.98560028 * d); } - -function eclipticLongitude(M) { - - var C = rad * (1.9148 * sin(M) + 0.02 * sin(2 * M) + 0.0003 * sin(3 * M)), // equation of center - P = rad * 102.9372; // perihelion of the Earth - - return M + C + P + PI; -} - -function sunCoords(d) { - - var M = solarMeanAnomaly(d), - L = eclipticLongitude(M); - - return { - dec: declination(L, 0), - ra: rightAscension(L, 0) - }; -} - -var SunCalc = {}; - -// calculates sun position for a given date and latitude/longitude - -SunCalc.getPosition = function (date, lat, lng) { - - var lw = rad * -lng, - phi = rad * lat, - d = toDays(date), - - c = sunCoords(d), - H = siderealTime(d, lw) - c.ra; - - return { - azimuth: azimuth(H, phi, c.dec), - altitude: altitude(H, phi, c.dec) - }; -}; - -/* harmony default export */ __webpack_exports__["a"] = (SunCalc); - -/***/ }), -/* 211 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__globe_Globe__ = __webpack_require__(212); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_echarts_lib_util_layout__ = __webpack_require__(47); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_echarts_lib_util_layout___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_echarts_lib_util_layout__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__core_ViewGL__ = __webpack_require__(22); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_retrieve__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__util_graphicGL__ = __webpack_require__(1); - - - - - - - -function getDisplacementData(img, displacementScale) { - var canvas = document.createElement('canvas'); - var ctx = canvas.getContext('2d'); - var width = img.width; - var height = img.height; - canvas.width = width; - canvas.height = height; - ctx.drawImage(img, 0, 0, width, height); - var rgbaArr = ctx.getImageData(0, 0, width, height).data; - - var displacementArr = new Float32Array(rgbaArr.length / 4); - for (var i = 0; i < rgbaArr.length / 4; i++) { - var x = rgbaArr[i * 4]; - displacementArr[i] = x / 255 * displacementScale; - } - return { - data: displacementArr, - width: width, - height: height - }; -} - -function resizeGlobe(globeModel, api) { - // Use left/top/width/height - var boxLayoutOption = globeModel.getBoxLayoutParams(); - - var viewport = __WEBPACK_IMPORTED_MODULE_2_echarts_lib_util_layout___default.a.getLayoutRect(boxLayoutOption, { - width: api.getWidth(), - height: api.getHeight() - }); - - // Flip Y - viewport.y = api.getHeight() - viewport.y - viewport.height; - - this.viewGL.setViewport(viewport.x, viewport.y, viewport.width, viewport.height, api.getDevicePixelRatio()); - - this.radius = globeModel.get('globeRadius'); - - var outerRadius = globeModel.get('globeOuterRadius'); - if (this.altitudeAxis) { - this.altitudeAxis.setExtent(0, outerRadius - this.radius); - } -} - -function updateGlobe(ecModel, api) { - - var altitudeDataExtent = [Infinity, -Infinity] - - ecModel.eachSeries(function (seriesModel) { - if (seriesModel.coordinateSystem !== this) { - return; - } - - // Get altitude data extent. - var data = seriesModel.getData(); - var altDims = seriesModel.coordDimToDataDim('alt'); - var altDim = altDims && altDims[0]; - if (altDim) { - // TODO altitiude is in coords of lines. - var dataExtent = data.getDataExtent(altDim, true); - altitudeDataExtent[0] = Math.min( - altitudeDataExtent[0], dataExtent[0] - ); - altitudeDataExtent[1] = Math.max( - altitudeDataExtent[1], dataExtent[1] - ); - } - }, this); - // Create altitude axis - if (altitudeDataExtent && isFinite(altitudeDataExtent[1] - altitudeDataExtent[0])) { - var scale = __WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts___default.a.helper.createScale( - altitudeDataExtent, { - type: 'value', - // PENDING - min: 'dataMin', - max: 'dataMax' - } - ); - this.altitudeAxis = new __WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts___default.a.Axis('altitude', scale); - // Resize again - this.resize(this.model, api); - } -} - -var globeCreator = { - - dimensions: __WEBPACK_IMPORTED_MODULE_0__globe_Globe__["a" /* default */].prototype.dimensions, - - create: function (ecModel, api) { - - var globeList = []; - - ecModel.eachComponent('globe', function (globeModel) { - - // FIXME - globeModel.__viewGL = globeModel.__viewGL || new __WEBPACK_IMPORTED_MODULE_3__core_ViewGL__["a" /* default */](); - - var globe = new __WEBPACK_IMPORTED_MODULE_0__globe_Globe__["a" /* default */](); - globe.viewGL = globeModel.__viewGL; - - globeModel.coordinateSystem = globe; - globe.model = globeModel; - globeList.push(globe); - - // Inject resize - globe.resize = resizeGlobe; - globe.resize(globeModel, api); - - globe.update = updateGlobe; - }); - - ecModel.eachSeries(function (seriesModel) { - if (seriesModel.get('coordinateSystem') === 'globe') { - var globeModel = seriesModel.getReferringComponents('globe')[0]; - if (!globeModel) { - globeModel = ecModel.getComponent('globe'); - } - - if (!globeModel) { - throw new Error('globe "' + __WEBPACK_IMPORTED_MODULE_4__util_retrieve__["a" /* default */].firstNotNull( - seriesModel.get('globe3DIndex'), - seriesModel.get('globe3DId'), - 0 - ) + '" not found'); - } - - var coordSys = globeModel.coordinateSystem; - - seriesModel.coordinateSystem = coordSys; - } - }); - - ecModel.eachComponent('globe', function (globeModel, idx) { - var globe = globeModel.coordinateSystem; - - // Update displacement data - var displacementTextureValue = globeModel.getDisplacementTexture(); - var displacementScale = globeModel.getDisplacemenScale(); - - if (globeModel.isDisplacementChanged()) { - if (globeModel.hasDisplacement()) { - var immediateLoaded = true; - __WEBPACK_IMPORTED_MODULE_5__util_graphicGL__["a" /* default */].loadTexture(displacementTextureValue, api, function (texture) { - var img = texture.image; - var displacementData = getDisplacementData(img, displacementScale); - globeModel.setDisplacementData(displacementData.data, displacementData.width, displacementData.height); - if (!immediateLoaded) { - // Update layouts - api.dispatchAction({ - type: 'globeUpdateDisplacment' - }); - } - }); - immediateLoaded = false; - } - else { - globe.setDisplacementData(null, 0, 0); - } - - globe.setDisplacementData( - globeModel.displacementData, globeModel.displacementWidth, globeModel.displacementHeight - ); - } - }); - - return globeList; - } -}; - -__WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts___default.a.registerCoordinateSystem('globe', globeCreator); - -/* unused harmony default export */ var _unused_webpack_default_export = (globeCreator); - -/***/ }), -/* 212 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_claygl_src_dep_glmatrix__ = __webpack_require__(6); - -var vec3 = __WEBPACK_IMPORTED_MODULE_0_claygl_src_dep_glmatrix__["a" /* default */].vec3; - - -function Globe(radius) { - - this.radius = radius; - - this.viewGL = null; - - this.altitudeAxis; - - // Displacement data provided by texture. - this.displacementData = null; - this.displacementWidth; - this.displacementHeight; -} - -Globe.prototype = { - - constructor: Globe, - - dimensions: ['lng', 'lat', 'alt'], - - type: 'globe', - - containPoint: function () {}, - - setDisplacementData: function (data, width, height) { - this.displacementData = data; - this.displacementWidth = width; - this.displacementHeight = height; - }, - - _getDisplacementScale: function (lng, lat) { - var i = (lng + 180) / 360 * (this.displacementWidth - 1); - var j = (90 - lat) / 180 * (this.displacementHeight - 1); - // NEAREST SAMPLING - // TODO Better bilinear sampling - var idx = Math.round(i) + Math.round(j) * this.displacementWidth; - return this.displacementData[idx]; - }, - - dataToPoint: function (data, out) { - var lng = data[0]; - var lat = data[1]; - // Default have 0 altitude - var altVal = data[2] || 0; - - var r = this.radius; - if (this.displacementData) { - r *= 1 + this._getDisplacementScale(lng, lat); - } - if (this.altitudeAxis) { - r += this.altitudeAxis.dataToCoord(altVal); - } - - lng = lng * Math.PI / 180; - lat = lat * Math.PI / 180; - - var r0 = Math.cos(lat) * r; - - out = out || []; - // PENDING - out[0] = -r0 * Math.cos(lng + Math.PI); - out[1] = Math.sin(lat) * r; - out[2] = r0 * Math.sin(lng + Math.PI); - - return out; - }, - - pointToData: function (point, out) { - var x = point[0]; - var y = point[1]; - var z = point[2]; - var len = vec3.len(point); - x /= len; - y /= len; - z /= len; - - var theta = Math.asin(y); - var phi = Math.atan2(z, -x); - if (phi < 0) { - phi = Math.PI * 2 + phi; - } - - var lat = theta * 180 / Math.PI; - var lng = phi * 180 / Math.PI - 180; - - out = out || []; - out[0] = lng; - out[1] = lat; - out[2] = len - this.radius; - if (this.altitudeAxis) { - out[2] = this.altitudeAxis.coordToData(out[2]); - } - - return out; - } -}; - -/* harmony default export */ __webpack_exports__["a"] = (Globe); - -/***/ }), -/* 213 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__coord_mapbox3DCreator__ = __webpack_require__(214); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__mapbox3D_Mapbox3DModel__ = __webpack_require__(216); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__mapbox3D_Mapbox3DView__ = __webpack_require__(217); - - - - - - - - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerAction({ - type: 'mapbox3DChangeCamera', - event: 'mapbox3dcamerachanged', - update: 'mapbox3D:updateCamera' -}, function (payload, ecModel) { - ecModel.eachComponent({ - mainType: 'mapbox3D', query: payload - }, function (componentModel) { - componentModel.setMapboxCameraOption(payload); - }); -}); - -/***/ }), -/* 214 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__mapbox3D_Mapbox3D__ = __webpack_require__(215); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__mapServiceCommon_createMapService3DCreator__ = __webpack_require__(101); - - - - -var mapbox3DCreator = Object(__WEBPACK_IMPORTED_MODULE_2__mapServiceCommon_createMapService3DCreator__["a" /* default */])('mapbox3D', __WEBPACK_IMPORTED_MODULE_0__mapbox3D_Mapbox3D__["a" /* default */], function (mapbox3DList) { - mapbox3DList.forEach(function (mapbox3D) { - mapbox3D.setCameraOption(mapbox3D.model.getMapboxCameraOption()); - }); -}); -__WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts___default.a.registerCoordinateSystem('mapbox3D', mapbox3DCreator); - -/* unused harmony default export */ var _unused_webpack_default_export = (mapbox3DCreator); - -/***/ }), -/* 215 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__mapServiceCommon_MapService3D__ = __webpack_require__(100); - - -function Mapbox3D() { - __WEBPACK_IMPORTED_MODULE_0__mapServiceCommon_MapService3D__["a" /* default */].apply(this, arguments); -} - -Mapbox3D.prototype = new __WEBPACK_IMPORTED_MODULE_0__mapServiceCommon_MapService3D__["a" /* default */](); -Mapbox3D.prototype.constructor = Mapbox3D; -Mapbox3D.prototype.type = 'mapbox3D'; - -/* harmony default export */ __webpack_exports__["a"] = (Mapbox3D); - -/***/ }), -/* 216 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__common_componentPostEffectMixin__ = __webpack_require__(28); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_componentLightMixin__ = __webpack_require__(29); - - - - - -var MAPBOX_CAMERA_OPTION = ['zoom', 'center', 'pitch', 'bearing']; - -var Mapbox3DModel = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendComponentModel({ - - type: 'mapbox3D', - - layoutMode: 'box', - - coordinateSystem: null, - - defaultOption: { - zlevel: -10, - - style: 'mapbox://styles/mapbox/light-v9', - - center: [0, 0], - - zoom: 0, - - pitch: 0, - - bearing: 0, - - light: { - main: { - alpha: 20, - beta: 30 - } - }, - - altitudeScale: 1, - // Default depend on altitudeScale - boxHeight: 'auto' - }, - - getMapboxCameraOption: function () { - var self = this; - return MAPBOX_CAMERA_OPTION.reduce(function (obj, key) { - obj[key] = self.get(key); - return obj; - }, {}); - }, - - setMapboxCameraOption: function (option) { - if (option != null) { - MAPBOX_CAMERA_OPTION.forEach(function (key) { - if (option[key] != null) { - this.option[key] = option[key]; - } - }, this); - } - }, - - /** - * Get mapbox instance - */ - getMapbox: function () { - return this._mapbox; - }, - - setMapbox: function (mapbox) { - this._mapbox = mapbox; - } -}); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(Mapbox3DModel.prototype, __WEBPACK_IMPORTED_MODULE_1__common_componentPostEffectMixin__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(Mapbox3DModel.prototype, __WEBPACK_IMPORTED_MODULE_2__common_componentLightMixin__["a" /* default */]); - -/* unused harmony default export */ var _unused_webpack_default_export = (Mapbox3DModel); - -/***/ }), -/* 217 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Mapbox3DLayer__ = __webpack_require__(218); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_SceneHelper__ = __webpack_require__(30); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_graphicGL__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_shader_displayShadow_glsl_js__ = __webpack_require__(102); - - - - - - - -__WEBPACK_IMPORTED_MODULE_3__util_graphicGL__["a" /* default */].Shader.import(__WEBPACK_IMPORTED_MODULE_4__util_shader_displayShadow_glsl_js__["a" /* default */]); - -var TILE_SIZE = 512; - -/* unused harmony default export */ var _unused_webpack_default_export = (__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendComponentView({ - - type: 'mapbox3D', - - __ecgl__: true, - - init: function (ecModel, api) { - var zr = api.getZr(); - this._zrLayer = new __WEBPACK_IMPORTED_MODULE_1__Mapbox3DLayer__["a" /* default */]('mapbox3D', zr); - zr.painter.insertLayer(-1000, this._zrLayer); - - this._lightRoot = new __WEBPACK_IMPORTED_MODULE_3__util_graphicGL__["a" /* default */].Node(); - this._sceneHelper = new __WEBPACK_IMPORTED_MODULE_2__common_SceneHelper__["a" /* default */](this._lightRoot); - this._sceneHelper.initLight(this._lightRoot); - - var mapbox = this._zrLayer.getMapbox(); - var dispatchInteractAction = this._dispatchInteractAction.bind(this, api, mapbox); - - // PENDING - ['zoom', 'rotate', 'drag', 'pitch', 'rotate', 'move'].forEach(function (eName) { - mapbox.on(eName, dispatchInteractAction); - }); - - this._groundMesh = new __WEBPACK_IMPORTED_MODULE_3__util_graphicGL__["a" /* default */].Mesh({ - geometry: new __WEBPACK_IMPORTED_MODULE_3__util_graphicGL__["a" /* default */].PlaneGeometry(), - material: new __WEBPACK_IMPORTED_MODULE_3__util_graphicGL__["a" /* default */].Material({ - shader: new __WEBPACK_IMPORTED_MODULE_3__util_graphicGL__["a" /* default */].Shader({ - vertex: __WEBPACK_IMPORTED_MODULE_3__util_graphicGL__["a" /* default */].Shader.source('ecgl.displayShadow.vertex'), - fragment: __WEBPACK_IMPORTED_MODULE_3__util_graphicGL__["a" /* default */].Shader.source('ecgl.displayShadow.fragment') - }), - depthMask: false - }), - // Render first - renderOrder: -100, - culling: false, - castShadow: false, - $ignorePicking: true, - renderNormal: true - }); - }, - - render: function (mapbox3DModel, ecModel, api) { - var mapbox = this._zrLayer.getMapbox(); - var styleDesc = mapbox3DModel.get('style'); - - var styleStr = JSON.stringify(styleDesc); - if (styleStr !== this._oldStyleStr) { - if (styleDesc) { - mapbox.setStyle(styleDesc); - } - } - this._oldStyleStr = styleStr; - - mapbox.setCenter(mapbox3DModel.get('center')); - mapbox.setZoom(mapbox3DModel.get('zoom')); - mapbox.setPitch(mapbox3DModel.get('pitch')); - mapbox.setBearing(mapbox3DModel.get('bearing')); - - mapbox3DModel.setMapbox(mapbox); - - var coordSys = mapbox3DModel.coordinateSystem; - - // Not add to rootNode. Or light direction will be stretched by rootNode scale - coordSys.viewGL.scene.add(this._lightRoot); - coordSys.viewGL.add(this._groundMesh); - - this._updateGroundMesh(); - - // Update lights - this._sceneHelper.setScene(coordSys.viewGL.scene); - this._sceneHelper.updateLight(mapbox3DModel); - - // Update post effects - coordSys.viewGL.setPostEffect(mapbox3DModel.getModel('postEffect'), api); - coordSys.viewGL.setTemporalSuperSampling(mapbox3DModel.getModel('temporalSuperSampling')); - - this._mapbox3DModel = mapbox3DModel; - }, - - afterRender: function (mapbox3DModel, ecModel, api, layerGL) { - var renderer = layerGL.renderer; - this._sceneHelper.updateAmbientCubemap(renderer, mapbox3DModel, api); - this._sceneHelper.updateSkybox(renderer, mapbox3DModel, api); - - // FIXME If other series changes coordinate system. - // FIXME When doing progressive rendering. - mapbox3DModel.coordinateSystem.viewGL.scene.traverse(function (mesh) { - if (mesh.material) { - mesh.material.define('fragment', 'NORMAL_UP_AXIS', 2); - mesh.material.define('fragment', 'NORMAL_FRONT_AXIS', 1); - } - }); - }, - - updateCamera: function (mapbox3DModel, ecModel, api, payload) { - mapbox3DModel.coordinateSystem.setCameraOption(payload); - - this._updateGroundMesh(); - - api.getZr().refresh(); - }, - - _dispatchInteractAction: function (api, mapbox, mapbox3DModel) { - api.dispatchAction({ - type: 'mapbox3DChangeCamera', - pitch: mapbox.getPitch(), - zoom: mapbox.getZoom(), - center: mapbox.getCenter().toArray(), - bearing: mapbox.getBearing(), - mapbox3DId: this._mapbox3DModel && this._mapbox3DModel.id - }); - }, - - _updateGroundMesh: function () { - if (this._mapbox3DModel) { - var coordSys = this._mapbox3DModel.coordinateSystem; - var pt = coordSys.dataToPoint(coordSys.center); - this._groundMesh.position.set(pt[0], pt[1], -0.001); - - var plane = new __WEBPACK_IMPORTED_MODULE_3__util_graphicGL__["a" /* default */].Plane(new __WEBPACK_IMPORTED_MODULE_3__util_graphicGL__["a" /* default */].Vector3(0, 0, 1), 0); - var ray1 = coordSys.viewGL.camera.castRay(new __WEBPACK_IMPORTED_MODULE_3__util_graphicGL__["a" /* default */].Vector2(-1, -1)); - var ray2 = coordSys.viewGL.camera.castRay(new __WEBPACK_IMPORTED_MODULE_3__util_graphicGL__["a" /* default */].Vector2(1, 1)); - var pos0 = ray1.intersectPlane(plane); - var pos1 = ray2.intersectPlane(plane); - var scale = pos0.dist(pos1) / coordSys.viewGL.rootNode.scale.x; - this._groundMesh.scale.set(scale, scale, 1); - } - }, - - dispose: function (ecModel, api) { - if (this._zrLayer) { - this._zrLayer.dispose(); - } - api.getZr().painter.delLayer(-1000); - } -})); - -/***/ }), -/* 218 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/** - * @constructor - * @alias module:echarts-gl/component/mapbox3D/Mapbox3DLayer - * @param {string} id Layer ID - * @param {module:zrender/ZRender} zr - */ -function Mapbox3DLayer (id, zr) { - this.id = id; - this.zr = zr; - - this.dom = document.createElement('div'); - this.dom.style.cssText = 'position:absolute;left:0;right:0;top:0;bottom:0;'; - - // FIXME If in module environment. - if (!mapboxgl) { - throw new Error('Mapbox GL library must be included. See https://www.mapbox.com/mapbox-gl-js/api/'); - } - - this._mapbox = new mapboxgl.Map({ - container: this.dom - }); - - // Proxy events - this._initEvents(); - -} - -Mapbox3DLayer.prototype.resize = function () { - this._mapbox.resize(); -}; - -Mapbox3DLayer.prototype.getMapbox = function () { - return this._mapbox; -}; - -Mapbox3DLayer.prototype.clear = function () {}; -Mapbox3DLayer.prototype.refresh = function () { - this._mapbox.resize(); -}; - -var EVENTS = ['mousedown', 'mouseup', 'click', 'dblclick', 'mousemove', - 'mousewheel', 'wheel', - 'touchstart', 'touchend', 'touchmove', 'touchcancel' -]; -Mapbox3DLayer.prototype._initEvents = function () { - // Event is bound on canvas container. - var mapboxRoot = this._mapbox.getCanvasContainer(); - this._handlers = this._handlers || { - contextmenu: function (e) { - e.preventDefault(); - return false; - } - }; - EVENTS.forEach(function (eName) { - this._handlers[eName] = function (e) { - var obj = {}; - for (var name in e) { - obj[name] = e[name]; - } - obj.bubbles = false; - var newE = new e.constructor(e.type, obj); - mapboxRoot.dispatchEvent(newE); - }; - this.zr.dom.addEventListener(eName, this._handlers[eName]); - }, this); - - // PENDING - this.zr.dom.addEventListener('contextmenu', this._handlers.contextmenu); -}; - -Mapbox3DLayer.prototype.dispose = function () { - EVENTS.forEach(function (eName) { - this.zr.dom.removeEventListener(eName, this._handlers[eName]); - }, this); -}; - -/* harmony default export */ __webpack_exports__["a"] = (Mapbox3DLayer); - -/***/ }), -/* 219 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__coord_maptalks3DCreator__ = __webpack_require__(220); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__maptalks3D_Maptalks3DModel__ = __webpack_require__(222); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__maptalks3D_Maptalks3DView__ = __webpack_require__(223); -// Thanks to https://gitee.com/iverson_hu/maptalks-echarts-gl - - - - - - - - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerAction({ - type: 'maptalks3DChangeCamera', - event: 'maptalks3dcamerachanged', - update: 'maptalks3D:updateCamera' -}, function (payload, ecModel) { - ecModel.eachComponent({ - mainType: 'maptalks3D', query: payload - }, function (componentModel) { - componentModel.setMaptalksCameraOption(payload); - }); -}); - -/***/ }), -/* 220 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__maptalks3D_Maptalks3D__ = __webpack_require__(221); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__mapServiceCommon_createMapService3DCreator__ = __webpack_require__(101); - - - - -var maptalks3DCreator = Object(__WEBPACK_IMPORTED_MODULE_2__mapServiceCommon_createMapService3DCreator__["a" /* default */])('maptalks3D', __WEBPACK_IMPORTED_MODULE_0__maptalks3D_Maptalks3D__["a" /* default */], function (maptalks3DList) { - maptalks3DList.forEach(function (maptalks3D) { - maptalks3D.setCameraOption(maptalks3D.model.getMaptalksCameraOption()); - }); -}); -__WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts___default.a.registerCoordinateSystem('maptalks3D', maptalks3DCreator); - -/* unused harmony default export */ var _unused_webpack_default_export = (maptalks3DCreator); - -/***/ }), -/* 221 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__mapServiceCommon_MapService3D__ = __webpack_require__(100); - - -function Maptalks3D() { - __WEBPACK_IMPORTED_MODULE_0__mapServiceCommon_MapService3D__["a" /* default */].apply(this, arguments); - - this.maxPitch = 85; - this.zoomOffset = 1; -} - -Maptalks3D.prototype = new __WEBPACK_IMPORTED_MODULE_0__mapServiceCommon_MapService3D__["a" /* default */](); -Maptalks3D.prototype.constructor = Maptalks3D; -Maptalks3D.prototype.type = 'maptalks3D'; - -/* harmony default export */ __webpack_exports__["a"] = (Maptalks3D); - -/***/ }), -/* 222 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__common_componentPostEffectMixin__ = __webpack_require__(28); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_componentLightMixin__ = __webpack_require__(29); - - - - - -var MAPTALKS_CAMERA_OPTION = ['zoom', 'center', 'pitch', 'bearing']; - -var Maptalks3DModel = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendComponentModel({ - - type: 'maptalks3D', - - layoutMode: 'box', - - coordinateSystem: null, - - defaultOption: { - zlevel: -10, - - urlTemplate: 'http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', - attribution: '© OpenStreetMap contributors, © CARTO', - - center: [0, 0], - - zoom: 0, - - pitch: 0, - - bearing: 0, - - light: { - main: { - alpha: 20, - beta: 30 - } - }, - - altitudeScale: 1, - // Default depend on altitudeScale - boxHeight: 'auto' - }, - - getMaptalksCameraOption: function () { - var self = this; - return MAPTALKS_CAMERA_OPTION.reduce(function (obj, key) { - obj[key] = self.get(key); - return obj; - }, {}); - }, - - setMaptalksCameraOption: function (option) { - if (option != null) { - MAPTALKS_CAMERA_OPTION.forEach(function (key) { - if (option[key] != null) { - this.option[key] = option[key]; - } - }, this); - } - }, - - /** - * Get maptalks instance - */ - getMaptalks: function () { - return this._maptalks; - }, - - setMaptalks: function (maptalks) { - this._maptalks = maptalks; - } -}); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(Maptalks3DModel.prototype, __WEBPACK_IMPORTED_MODULE_1__common_componentPostEffectMixin__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(Maptalks3DModel.prototype, __WEBPACK_IMPORTED_MODULE_2__common_componentLightMixin__["a" /* default */]); - -/* unused harmony default export */ var _unused_webpack_default_export = (Maptalks3DModel); - -/***/ }), -/* 223 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__Maptalks3DLayer__ = __webpack_require__(224); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_SceneHelper__ = __webpack_require__(30); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_graphicGL__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_shader_displayShadow_glsl_js__ = __webpack_require__(102); - - - - - - - -__WEBPACK_IMPORTED_MODULE_3__util_graphicGL__["a" /* default */].Shader.import(__WEBPACK_IMPORTED_MODULE_4__util_shader_displayShadow_glsl_js__["a" /* default */]); - -/* unused harmony default export */ var _unused_webpack_default_export = (__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendComponentView({ - - type: 'maptalks3D', - - __ecgl__: true, - - init: function (ecModel, api) { - this._groundMesh = new __WEBPACK_IMPORTED_MODULE_3__util_graphicGL__["a" /* default */].Mesh({ - geometry: new __WEBPACK_IMPORTED_MODULE_3__util_graphicGL__["a" /* default */].PlaneGeometry(), - material: new __WEBPACK_IMPORTED_MODULE_3__util_graphicGL__["a" /* default */].Material({ - shader: new __WEBPACK_IMPORTED_MODULE_3__util_graphicGL__["a" /* default */].Shader({ - vertex: __WEBPACK_IMPORTED_MODULE_3__util_graphicGL__["a" /* default */].Shader.source('ecgl.displayShadow.vertex'), - fragment: __WEBPACK_IMPORTED_MODULE_3__util_graphicGL__["a" /* default */].Shader.source('ecgl.displayShadow.fragment') - }), - depthMask: false - }), - // Render first - renderOrder: -100, - culling: false, - castShadow: false, - $ignorePicking: true, - renderNormal: true - }); - }, - - _initMaptalksLayer: function (mapbox3DModel, api) { - var zr = api.getZr(); - this._zrLayer = new __WEBPACK_IMPORTED_MODULE_1__Maptalks3DLayer__["a" /* default */]('maptalks3D', zr, mapbox3DModel.get('center'), mapbox3DModel.get('zoom')); - zr.painter.insertLayer(-1000, this._zrLayer); - - this._lightRoot = new __WEBPACK_IMPORTED_MODULE_3__util_graphicGL__["a" /* default */].Node(); - this._sceneHelper = new __WEBPACK_IMPORTED_MODULE_2__common_SceneHelper__["a" /* default */](this._lightRoot); - this._sceneHelper.initLight(this._lightRoot); - - var maptalks = this._zrLayer.getMaptalks(); - var dispatchInteractAction = this._dispatchInteractAction.bind(this, api, maptalks); - - // PENDING - ['zoomend', 'zooming', 'zoomstart', 'dragrotating', 'pitch', 'pitchend', 'movestart', - 'moving', 'moveend', 'resize', 'touchstart', 'touchmove', 'touchend'].forEach(function (eName) { - maptalks.on(eName, dispatchInteractAction); - }); - - }, - - render: function (maptalks3DModel, ecModel, api) { - if (!this._zrLayer) { - this._initMaptalksLayer(maptalks3DModel, api); - } - - var mtks = this._zrLayer.getMaptalks(); - var urlTemplate = maptalks3DModel.get('urlTemplate'); - - var baseLayer = mtks.getBaseLayer(); - if (urlTemplate !== this._oldUrlTemplate) { - if (!baseLayer) { - baseLayer = new maptalks.TileLayer('maptalks-echarts-gl-baselayer', { - urlTemplate: urlTemplate, - // used sequentially to help with browser parallel requests per domain limitation - subdomains: ['a', 'b', 'c'], - attribution: maptalks3DModel.get('attribution') - }); - mtks.setBaseLayer(baseLayer); - } - else { - // PENDING setOptions may not work? - baseLayer.setOptions({ - urlTemplate: urlTemplate, - attribution: maptalks3DModel.get('attribution') - }); - } - } - this._oldUrlTemplate = urlTemplate; - - mtks.setCenter(maptalks3DModel.get('center')); - mtks.setZoom(maptalks3DModel.get('zoom'),{ animation: false }); - mtks.setPitch(maptalks3DModel.get('pitch')); - mtks.setBearing(maptalks3DModel.get('bearing')); - - maptalks3DModel.setMaptalks(mtks); - - var coordSys = maptalks3DModel.coordinateSystem; - - // Not add to rootNode. Or light direction will be stretched by rootNode scale - coordSys.viewGL.scene.add(this._lightRoot); - coordSys.viewGL.add(this._groundMesh); - - this._updateGroundMesh(); - - // Update lights - this._sceneHelper.setScene(coordSys.viewGL.scene); - this._sceneHelper.updateLight(maptalks3DModel); - - // Update post effects - coordSys.viewGL.setPostEffect(maptalks3DModel.getModel('postEffect'), api); - coordSys.viewGL.setTemporalSuperSampling(maptalks3DModel.getModel('temporalSuperSampling')); - - this._maptalks3DModel = maptalks3DModel; - }, - - afterRender: function (maptalks3DModel, ecModel, api, layerGL) { - var renderer = layerGL.renderer; - this._sceneHelper.updateAmbientCubemap(renderer, maptalks3DModel, api); - this._sceneHelper.updateSkybox(renderer, maptalks3DModel, api); - - // FIXME If other series changes coordinate system. - // FIXME When doing progressive rendering. - maptalks3DModel.coordinateSystem.viewGL.scene.traverse(function (mesh) { - if (mesh.material) { - mesh.material.define('fragment', 'NORMAL_UP_AXIS', 2); - mesh.material.define('fragment', 'NORMAL_FRONT_AXIS', 1); - } - }); - }, - - updateCamera: function (maptalks3DModel, ecModel, api, payload) { - maptalks3DModel.coordinateSystem.setCameraOption(payload); - - this._updateGroundMesh(); - - api.getZr().refresh(); - }, - - _dispatchInteractAction: function (api, maptalks, maptalks3DModel) { - api.dispatchAction({ - type: 'maptalks3DChangeCamera', - pitch: maptalks.getPitch(), - zoom: maptalks.getZoom(), - center: maptalks.getCenter().toArray(), - bearing: maptalks.getBearing(), - maptalks3DId: this._maptalks3DModel && this._maptalks3DModel.id - }); - }, - - _updateGroundMesh: function () { - if (this._maptalks3DModel) { - var coordSys = this._maptalks3DModel.coordinateSystem; - var pt = coordSys.dataToPoint(coordSys.center); - this._groundMesh.position.set(pt[0], pt[1], -0.001); - - var plane = new __WEBPACK_IMPORTED_MODULE_3__util_graphicGL__["a" /* default */].Plane(new __WEBPACK_IMPORTED_MODULE_3__util_graphicGL__["a" /* default */].Vector3(0, 0, 1), 0); - var ray1 = coordSys.viewGL.camera.castRay(new __WEBPACK_IMPORTED_MODULE_3__util_graphicGL__["a" /* default */].Vector2(-1, -1)); - var ray2 = coordSys.viewGL.camera.castRay(new __WEBPACK_IMPORTED_MODULE_3__util_graphicGL__["a" /* default */].Vector2(1, 1)); - var pos0 = ray1.intersectPlane(plane); - var pos1 = ray2.intersectPlane(plane); - var scale = pos0.dist(pos1) / coordSys.viewGL.rootNode.scale.x; - this._groundMesh.scale.set(scale, scale, 1); - } - }, - - dispose: function (ecModel, api) { - if (this._zrLayer) { - this._zrLayer.dispose(); - } - api.getZr().painter.delLayer(-1000); - } -})); - -/***/ }), -/* 224 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/** - * @constructor - * @alias module:echarts-gl/component/maptalks/Maptalks3DLayer - * @param {string} id Layer ID - * @param {module:zrender/ZRender} zr - */ -function Maptalks3DLayer (id, zr, defaultCenter, defaultZoom) { - this.id = id; - this.zr = zr; - - this.dom = document.createElement('div'); - this.dom.style.cssText = 'position:absolute;left:0;right:0;top:0;bottom:0;'; - - // FIXME If in module environment. - if (!maptalks) { - throw new Error('Maptalks library must be included. See https://maptalks.org'); - } - - this._maptalks = new maptalks.Map(this.dom, { - center: defaultCenter, - zoom: defaultZoom, - fog: false - // fogColor: [0, 0, 0] - }); - - // Proxy events - this._initEvents(); - -} - -Maptalks3DLayer.prototype.resize = function () { - this._maptalks.checkSize(); -}; - -Maptalks3DLayer.prototype.getMaptalks = function () { - return this._maptalks; -}; - -Maptalks3DLayer.prototype.clear = function () {}; -Maptalks3DLayer.prototype.refresh = function () { - this._maptalks.checkSize(); -}; - -var EVENTS = ['mousedown', 'mouseup', 'click', 'dblclick', 'mousemove', - 'mousewheel', 'DOMMouseScroll', - 'touchstart', 'touchend', 'touchmove', 'touchcancel' -]; -Maptalks3DLayer.prototype._initEvents = function () { - // Event is bound on canvas container. - var maptalksRoot = this.dom; - this._handlers = this._handlers || { - contextmenu: function (e) { - e.preventDefault(); - return false; - } - }; - EVENTS.forEach(function (eName) { - this._handlers[eName] = function (e) { - var obj = {}; - for (var name in e) { - obj[name] = e[name]; - } - obj.bubbles = false; - var newE = new e.constructor(e.type, obj); - if (eName === 'mousewheel' || eName === 'DOMMouseScroll') { - // maptalks listens events to different elements? - maptalksRoot.dispatchEvent(newE); - } - else { - maptalksRoot.firstElementChild.dispatchEvent(newE); - } - }; - this.zr.dom.addEventListener(eName, this._handlers[eName]); - }, this); - - // PENDING - this.zr.dom.addEventListener('contextmenu', this._handlers.contextmenu); -}; - -Maptalks3DLayer.prototype.dispose = function () { - EVENTS.forEach(function (eName) { - this.zr.dom.removeEventListener(eName, this._handlers[eName]); - }, this); - this._maptalks.remove(); -}; - -/* harmony default export */ __webpack_exports__["a"] = (Maptalks3DLayer); - - -/***/ }), -/* 225 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__bar3D_bar3DLayout__ = __webpack_require__(226); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__bar3D_Bar3DView__ = __webpack_require__(229); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__bar3D_Bar3DSeries__ = __webpack_require__(231); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_opacityVisual__ = __webpack_require__(17); - - - - - - - - - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerVisual(Object(__WEBPACK_IMPORTED_MODULE_4__common_opacityVisual__["a" /* default */])('bar3D')); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerProcessor(function (ecModel, api) { - ecModel.eachSeriesByType('bar3d', function (seriesModel) { - var data = seriesModel.getData(); - data.filterSelf(function (idx) { - return data.hasValue(idx); - }); - }); -}); - -/***/ }), -/* 226 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_claygl_src_math_Vector3__ = __webpack_require__(3); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_claygl_src_dep_glmatrix__ = __webpack_require__(6); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__cartesian3DLayout__ = __webpack_require__(227); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__evaluateBarSparseness__ = __webpack_require__(228); - - - - - - -var vec3 = __WEBPACK_IMPORTED_MODULE_2_claygl_src_dep_glmatrix__["a" /* default */].vec3; -var isDimensionStacked = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.helper.dataStack.isDimensionStacked; - -function globeLayout(seriesModel, coordSys) { - var data = seriesModel.getData(); - var barMinHeight = seriesModel.get('minHeight') || 0; - var barSize = seriesModel.get('barSize'); - var dims = ['lng', 'lat', 'alt'].map(function (coordDimName) { - return seriesModel.coordDimToDataDim(coordDimName)[0]; - }); - if (barSize == null) { - var perimeter = coordSys.radius * Math.PI; - var fillRatio = Object(__WEBPACK_IMPORTED_MODULE_4__evaluateBarSparseness__["a" /* default */])(data, dims[0], dims[1]); - barSize = [ - perimeter / Math.sqrt(data.count() / fillRatio), - perimeter / Math.sqrt(data.count() / fillRatio) - ]; - } - else if (!__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.isArray(barSize)) { - barSize = [barSize, barSize]; - } - - var valueDim = getValueDimension(data, dims); - - data.each(dims, function (lng, lat, val, idx) { - var stackedValue = data.get(valueDim.dimension, idx); - var baseValue = valueDim.isStacked ? (stackedValue - val) : coordSys.altitudeAxis.scale.getExtent()[0]; - // TODO Stacked with minHeight. - var height = Math.max(coordSys.altitudeAxis.dataToCoord(val), barMinHeight); - var start = coordSys.dataToPoint([lng, lat, baseValue]); - var end = coordSys.dataToPoint([lng, lat, stackedValue]); - var dir = vec3.sub([], end, start); - vec3.normalize(dir, dir); - var size = [barSize[0], height, barSize[1]]; - data.setItemLayout(idx, [start, dir, size]); - }); - - data.setLayout('orient', __WEBPACK_IMPORTED_MODULE_1_claygl_src_math_Vector3__["a" /* default */].UP.array); -} - -function geo3DLayout(seriesModel, coordSys) { - var data = seriesModel.getData(); - var barSize = seriesModel.get('barSize'); - var barMinHeight = seriesModel.get('minHeight') || 0; - var dims = ['lng', 'lat', 'alt'].map(function (coordDimName) { - return seriesModel.coordDimToDataDim(coordDimName)[0]; - }); - if (barSize == null) { - var size = Math.min(coordSys.size[0], coordSys.size[2]); - - var fillRatio = Object(__WEBPACK_IMPORTED_MODULE_4__evaluateBarSparseness__["a" /* default */])(data, dims[0], dims[1]); - barSize = [ - size / Math.sqrt(data.count() / fillRatio), - size / Math.sqrt(data.count() / fillRatio) - ]; - } - else if (!__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.isArray(barSize)) { - barSize = [barSize, barSize]; - } - var dir = [0, 1, 0]; - - var valueDim = getValueDimension(data, dims); - - data.each(dims, function (lng, lat, val, idx) { - var stackedValue = data.get(valueDim.dimension, idx); - var baseValue = valueDim.isStacked ? (stackedValue - val) : coordSys.altitudeAxis.scale.getExtent()[0]; - - var height = Math.max(coordSys.altitudeAxis.dataToCoord(val), barMinHeight); - var start = coordSys.dataToPoint([lng, lat, baseValue]); - var size = [barSize[0], height, barSize[1]]; - data.setItemLayout(idx, [start, dir, size]); - }); - - data.setLayout('orient', [1, 0, 0]); -} - -function mapService3DLayout(seriesModel, coordSys) { - var data = seriesModel.getData(); - var dimLng = seriesModel.coordDimToDataDim('lng')[0]; - var dimLat = seriesModel.coordDimToDataDim('lat')[0]; - var dimAlt = seriesModel.coordDimToDataDim('alt')[0]; - var barSize = seriesModel.get('barSize'); - var barMinHeight = seriesModel.get('minHeight') || 0; - - if (barSize == null) { - var xExtent = data.getDataExtent(dimLng); - var yExtent = data.getDataExtent(dimLat); - var corner0 = coordSys.dataToPoint([xExtent[0], yExtent[0]]); - var corner1 = coordSys.dataToPoint([xExtent[1], yExtent[1]]); - - var size = Math.min( - Math.abs(corner0[0] - corner1[0]), - Math.abs(corner0[1] - corner1[1]) - ) || 1; - - var fillRatio = Object(__WEBPACK_IMPORTED_MODULE_4__evaluateBarSparseness__["a" /* default */])(data, dimLng, dimLat); - // PENDING, data density - barSize = [ - size / Math.sqrt(data.count() / fillRatio), - size / Math.sqrt(data.count() / fillRatio) - ]; - } - else { - if (!__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.isArray(barSize)) { - barSize = [barSize, barSize]; - } - barSize[0] /= coordSys.getScale() / 16; - barSize[1] /= coordSys.getScale() / 16; - } - - var dir = [0, 0, 1]; - var dims = [dimLng, dimLat, dimAlt]; - - var valueDim = getValueDimension(data, dims); - - data.each(dims, function (lng, lat, val, idx) { - var stackedValue = data.get(valueDim.dimension, idx); - var baseValue = valueDim.isStacked ? (stackedValue - val) : 0; - - var start = coordSys.dataToPoint([lng, lat, baseValue]); - var end = coordSys.dataToPoint([lng, lat, stackedValue]); - var height = Math.max(end[2] - start[2], barMinHeight); - var size = [barSize[0], height, barSize[1]]; - data.setItemLayout(idx, [start, dir, size]); - }); - - data.setLayout('orient', [1, 0, 0]); -} - -function getValueDimension(data, dataDims) { - var isStacked = isDimensionStacked(data, dataDims[2]); - return { - dimension: isStacked - ? data.getCalculationInfo('stackResultDimension') - : dataDims[2], - isStacked: isStacked - }; -} - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerLayout(function (ecModel, api) { - ecModel.eachSeriesByType('bar3D', function (seriesModel) { - var coordSys = seriesModel.coordinateSystem; - var coordSysType = coordSys && coordSys.type; - if (coordSysType === 'globe') { - globeLayout(seriesModel, coordSys); - } - else if (coordSysType === 'cartesian3D') { - Object(__WEBPACK_IMPORTED_MODULE_3__cartesian3DLayout__["a" /* default */])(seriesModel, coordSys); - } - else if (coordSysType === 'geo3D') { - geo3DLayout(seriesModel, coordSys); - } - else if (coordSysType === 'mapbox3D' || coordSysType === 'maptalks3D') { - mapService3DLayout(seriesModel, coordSys); - } - else { - if (true) { - if (!coordSys) { - throw new Error('bar3D doesn\'t have coordinate system.'); - } - else { - throw new Error('bar3D doesn\'t support coordinate system ' + coordSys.type); - } - } - } - }); -}); - -/***/ }), -/* 227 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_claygl_src_dep_glmatrix__ = __webpack_require__(6); - - -var vec3 = __WEBPACK_IMPORTED_MODULE_1_claygl_src_dep_glmatrix__["a" /* default */].vec3; -var isDimensionStacked = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.helper.dataStack.isDimensionStacked; - -function ifCrossZero(extent) { - var min = extent[0]; - var max = extent[1]; - return !((min > 0 && max > 0) || (min < 0 && max < 0)); -}; - -function cartesian3DLayout(seriesModel, coordSys) { - - var data = seriesModel.getData(); - // var barOnPlane = seriesModel.get('onGridPlane'); - - var barSize = seriesModel.get('barSize'); - if (barSize == null) { - var size = coordSys.size; - var barWidth; - var barDepth; - var xAxis = coordSys.getAxis('x'); - var yAxis = coordSys.getAxis('y'); - - if (xAxis.type === 'category') { - barWidth = xAxis.getBandWidth() * 0.7; - } - else { - // PENDING - barWidth = Math.round(size[0] / Math.sqrt(data.count())) * 0.6; - } - if (yAxis.type === 'category') { - barDepth = yAxis.getBandWidth() * 0.7; - } - else { - barDepth = Math.round(size[1] / Math.sqrt(data.count())) * 0.6; - } - barSize = [barWidth, barDepth]; - } - else if (!__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.isArray(barSize)) { - barSize = [barSize, barSize]; - } - - var zAxisExtent = coordSys.getAxis('z').scale.getExtent(); - var ifZAxisCrossZero = ifCrossZero(zAxisExtent); - - var dims = ['x', 'y', 'z'].map(function (coordDimName) { - return seriesModel.coordDimToDataDim(coordDimName)[0]; - }); - - var isStacked = isDimensionStacked(data, dims[2]); - var valueDim = isStacked - ? data.getCalculationInfo('stackResultDimension') - : dims[2]; - - data.each(dims, function (x, y, z, idx) { - // TODO zAxis is inversed - // TODO On different plane. - var stackedValue = data.get(valueDim, idx); - - var baseValue = isStacked ? (stackedValue - z) - : (ifZAxisCrossZero ? 0 : zAxisExtent[0]); - - var start = coordSys.dataToPoint([x, y, baseValue]); - var end = coordSys.dataToPoint([x, y, stackedValue]); - var height = vec3.dist(start, end); - // PENDING When zAxis is not cross zero. - var dir = [0, end[1] < start[1] ? -1 : 1, 0]; - if (Math.abs(height) === 0) { - // TODO - height = 0.1; - } - var size = [barSize[0], height, barSize[1]]; - data.setItemLayout(idx, [start, dir, size]); - }); - - data.setLayout('orient', [1, 0, 0]); -} - -/* harmony default export */ __webpack_exports__["a"] = (cartesian3DLayout); - -/***/ }), -/* 228 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = (function (data, dimX, dimY) { - var xExtent = data.getDataExtent(dimX); - var yExtent = data.getDataExtent(dimY); - - // TODO Handle one data situation - var xSpan = (xExtent[1] - xExtent[0]) || xExtent[0]; - var ySpan = (yExtent[1] - yExtent[0]) || yExtent[0]; - var dimSize = 50; - var tmp = new Uint8Array(dimSize * dimSize); - for (var i = 0; i < data.count(); i++) { - var x = data.get(dimX, i); - var y = data.get(dimY, i); - var xIdx = Math.floor((x - xExtent[0]) / xSpan * (dimSize - 1)); - var yIdx = Math.floor((y - yExtent[0]) / ySpan * (dimSize - 1)); - var idx = yIdx * dimSize + xIdx; - tmp[idx] = tmp[idx] || 1; - } - var filledCount = 0; - for (var i = 0; i < tmp.length; i++) { - if (tmp[i]) { - filledCount++; - } - } - return filledCount / tmp.length; -});; - -/***/ }), -/* 229 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_retrieve__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_format__ = __webpack_require__(32); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_geometry_Bars3DGeometry__ = __webpack_require__(230); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__component_common_LabelsBuilder__ = __webpack_require__(66); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_claygl_src_dep_glmatrix__ = __webpack_require__(6); - - - - - - - -var vec3 = __WEBPACK_IMPORTED_MODULE_6_claygl_src_dep_glmatrix__["a" /* default */].vec3; - -/* unused harmony default export */ var _unused_webpack_default_export = (__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendChartView({ - - type: 'bar3D', - - __ecgl__: true, - - init: function (ecModel, api) { - - this.groupGL = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Node(); - - this._api = api; - - this._labelsBuilder = new __WEBPACK_IMPORTED_MODULE_5__component_common_LabelsBuilder__["a" /* default */](256, 256, api); - var self = this; - this._labelsBuilder.getLabelPosition = function (dataIndex, position, distance) { - if (self._data) { - var layout = self._data.getItemLayout(dataIndex); - var start = layout[0]; - var dir = layout[1]; - var height = layout[2][1]; - return vec3.scaleAndAdd([], start, dir, distance + height); - } - else { - return [0, 0]; - } - }; - - // Give a large render order. - this._labelsBuilder.getMesh().renderOrder = 100; - }, - - render: function (seriesModel, ecModel, api) { - - // Swap barMesh - var tmp = this._prevBarMesh; - this._prevBarMesh = this._barMesh; - this._barMesh = tmp; - - if (!this._barMesh) { - this._barMesh = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Mesh({ - geometry: new __WEBPACK_IMPORTED_MODULE_4__util_geometry_Bars3DGeometry__["a" /* default */](), - shadowDepthMaterial: new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Material({ - shader: new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Shader( - __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Shader.source('ecgl.sm.depth.vertex'), - __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Shader.source('ecgl.sm.depth.fragment') - ) - }), - // Only cartesian3D enable culling - // FIXME Performance - culling: seriesModel.coordinateSystem.type === 'cartesian3D', - // Render after axes - renderOrder: 10, - // Render normal in normal pass - renderNormal: true - }); - } - - this.groupGL.remove(this._prevBarMesh); - this.groupGL.add(this._barMesh); - this.groupGL.add(this._labelsBuilder.getMesh()); - - var coordSys = seriesModel.coordinateSystem; - this._doRender(seriesModel, api); - if (coordSys && coordSys.viewGL) { - coordSys.viewGL.add(this.groupGL); - - var methodName = coordSys.viewGL.isLinearSpace() ? 'define' : 'undefine'; - this._barMesh.material[methodName]('fragment', 'SRGB_DECODE'); - } - - this._data = seriesModel.getData(); - - this._labelsBuilder.updateData(this._data); - - this._labelsBuilder.updateLabels(); - - this._updateAnimation(seriesModel); - }, - - _updateAnimation: function (seriesModel) { - __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].updateVertexAnimation( - [['prevPosition', 'position'], - ['prevNormal', 'normal']], - this._prevBarMesh, - this._barMesh, - seriesModel - ); - }, - - _doRender: function (seriesModel, api) { - var data = seriesModel.getData(); - var shading = seriesModel.get('shading'); - var enableNormal = shading !== 'color'; - var self = this; - var barMesh = this._barMesh; - - var shadingPrefix = 'ecgl.' + shading; - if (!barMesh.material || barMesh.material.shader.name !== shadingPrefix) { - barMesh.material = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].createMaterial(shadingPrefix, ['VERTEX_COLOR']); - } - - __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].setMaterialFromModel( - shading, barMesh.material, seriesModel, api - ); - - barMesh.geometry.enableNormal = enableNormal; - - barMesh.geometry.resetOffset(); - - // Bevel settings - var bevelSize = seriesModel.get('bevelSize'); - var bevelSegments = seriesModel.get('bevelSmoothness'); - barMesh.geometry.bevelSegments = bevelSegments; - - barMesh.geometry.bevelSize = bevelSize; - - var colorArr = []; - var vertexColors = new Float32Array(data.count() * 4); - var colorOffset = 0; - var barCount = 0; - var hasTransparent = false; - - data.each(function (idx) { - if (!data.hasValue(idx)) { - return; - } - var color = data.getItemVisual(idx, 'color'); - - var opacity = data.getItemVisual(idx, 'opacity'); - if (opacity == null) { - opacity = 1; - } - - __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor(color, colorArr); - colorArr[3] *= opacity; - vertexColors[colorOffset++] = colorArr[0]; - vertexColors[colorOffset++] = colorArr[1]; - vertexColors[colorOffset++] = colorArr[2]; - vertexColors[colorOffset++] = colorArr[3]; - - if (colorArr[3] > 0) { - barCount++; - if (colorArr[3] < 0.99) { - hasTransparent = true; - } - } - }); - - barMesh.geometry.setBarCount(barCount); - - var orient = data.getLayout('orient'); - - // Map of dataIndex and barIndex. - var barIndexOfData = this._barIndexOfData = new Int32Array(data.count()); - var barCount = 0; - data.each(function (idx) { - if (!data.hasValue(idx)) { - barIndexOfData[idx] = -1; - return; - } - var layout = data.getItemLayout(idx); - var start = layout[0]; - var dir = layout[1]; - var size = layout[2]; - - var idx4 = idx * 4; - colorArr[0] = vertexColors[idx4++]; - colorArr[1] = vertexColors[idx4++]; - colorArr[2] = vertexColors[idx4++]; - colorArr[3] = vertexColors[idx4++]; - if (colorArr[3] > 0) { - self._barMesh.geometry.addBar(start, dir, orient, size, colorArr, idx); - barIndexOfData[idx] = barCount++; - } - }); - - barMesh.geometry.dirty(); - barMesh.geometry.updateBoundingBox(); - - var material = barMesh.material; - material.transparent = hasTransparent; - material.depthMask = !hasTransparent; - barMesh.geometry.sortTriangles = hasTransparent; - - this._initHandler(seriesModel, api); - }, - - _initHandler: function (seriesModel, api) { - var data = seriesModel.getData(); - var barMesh = this._barMesh; - var isCartesian3D = seriesModel.coordinateSystem.type === 'cartesian3D'; - - barMesh.seriesIndex = seriesModel.seriesIndex; - - var lastDataIndex = -1; - barMesh.off('mousemove'); - barMesh.off('mouseout'); - barMesh.on('mousemove', function (e) { - var dataIndex = barMesh.geometry.getDataIndexOfVertex(e.triangle[0]); - if (dataIndex !== lastDataIndex) { - this._downplay(lastDataIndex); - this._highlight(dataIndex); - this._labelsBuilder.updateLabels([dataIndex]); - - if (isCartesian3D) { - api.dispatchAction({ - type: 'grid3DShowAxisPointer', - value: [data.get('x', dataIndex), data.get('y', dataIndex), data.get('z', dataIndex, true)] - }); - } - } - - lastDataIndex = dataIndex; - barMesh.dataIndex = dataIndex; - }, this); - barMesh.on('mouseout', function (e) { - this._downplay(lastDataIndex); - this._labelsBuilder.updateLabels(); - lastDataIndex = -1; - barMesh.dataIndex = -1; - - if (isCartesian3D) { - api.dispatchAction({ - type: 'grid3DHideAxisPointer' - }); - } - }, this); - }, - - _highlight: function (dataIndex) { - var data = this._data; - if (!data) { - return; - } - var barIndex = this._barIndexOfData[dataIndex]; - if (barIndex < 0) { - return; - } - - var itemModel = data.getItemModel(dataIndex); - var emphasisItemStyleModel = itemModel.getModel('emphasis.itemStyle'); - var emphasisColor = emphasisItemStyleModel.get('color'); - var emphasisOpacity = emphasisItemStyleModel.get('opacity'); - if (emphasisColor == null) { - var color = data.getItemVisual(dataIndex, 'color'); - emphasisColor = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.color.lift(color, -0.4); - } - if (emphasisOpacity == null) { - emphasisOpacity = data.getItemVisual(dataIndex, 'opacity'); - } - var colorArr = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor(emphasisColor); - colorArr[3] *= emphasisOpacity; - - this._barMesh.geometry.setColor(barIndex, colorArr); - - this._api.getZr().refresh(); - }, - - _downplay: function (dataIndex) { - var data = this._data; - if (!data) { - return; - } - var barIndex = this._barIndexOfData[dataIndex]; - if (barIndex < 0) { - return; - } - - var color = data.getItemVisual(dataIndex, 'color'); - var opacity = data.getItemVisual(dataIndex, 'opacity'); - - var colorArr = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor(color); - colorArr[3] *= opacity; - - this._barMesh.geometry.setColor(barIndex, colorArr); - - this._api.getZr().refresh(); - }, - - highlight: function (seriesModel, ecModel, api, payload) { - this._toggleStatus('highlight', seriesModel, ecModel, api, payload); - }, - - downplay: function (seriesModel, ecModel, api, payload) { - this._toggleStatus('downplay', seriesModel, ecModel, api, payload); - }, - - _toggleStatus: function (status, seriesModel, ecModel, api, payload) { - var data = seriesModel.getData(); - var dataIndex = __WEBPACK_IMPORTED_MODULE_2__util_retrieve__["a" /* default */].queryDataIndex(data, payload); - - var self = this; - if (dataIndex != null) { - __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.each(__WEBPACK_IMPORTED_MODULE_3__util_format__["a" /* default */].normalizeToArray(dataIndex), function (dataIdx) { - status === 'highlight' ? this._highlight(dataIdx) : this._downplay(dataIdx); - }, this); - } - else { - data.each(function (dataIdx) { - status === 'highlight' ? self._highlight(dataIdx) : self._downplay(dataIdx); - }); - } - }, - - remove: function () { - this.groupGL.removeAll(); - }, - - dispose: function () { - this.groupGL.removeAll(); - } -})); - -/***/ }), -/* 230 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__dynamicConvertMixin__ = __webpack_require__(38); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__trianglesSortMixin__ = __webpack_require__(65); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_claygl_src_Geometry__ = __webpack_require__(15); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_claygl_src_dep_glmatrix__ = __webpack_require__(6); -/** - * Geometry collecting bars data - * - * @module echarts-gl/chart/bars/BarsGeometry - * @author Yi Shen(http://github.com/pissang) - */ - - - - - - - -var vec3 = __WEBPACK_IMPORTED_MODULE_4_claygl_src_dep_glmatrix__["a" /* default */].vec3; -var mat3 = __WEBPACK_IMPORTED_MODULE_4_claygl_src_dep_glmatrix__["a" /* default */].mat3; - -/** - * @constructor - * @alias module:echarts-gl/chart/bars/BarsGeometry - * @extends clay.Geometry - */ -var BarsGeometry = __WEBPACK_IMPORTED_MODULE_3_claygl_src_Geometry__["a" /* default */].extend(function () { - return { - - attributes: { - position: new __WEBPACK_IMPORTED_MODULE_3_claygl_src_Geometry__["a" /* default */].Attribute('position', 'float', 3, 'POSITION'), - normal: new __WEBPACK_IMPORTED_MODULE_3_claygl_src_Geometry__["a" /* default */].Attribute('normal', 'float', 3, 'NORMAL'), - color: new __WEBPACK_IMPORTED_MODULE_3_claygl_src_Geometry__["a" /* default */].Attribute('color', 'float', 4, 'COLOR'), - - prevPosition: new __WEBPACK_IMPORTED_MODULE_3_claygl_src_Geometry__["a" /* default */].Attribute('prevPosition', 'float', 3), - prevNormal: new __WEBPACK_IMPORTED_MODULE_3_claygl_src_Geometry__["a" /* default */].Attribute('prevNormal', 'float', 3) - }, - - dynamic: true, - - enableNormal: false, - - bevelSize: 1, - bevelSegments: 0, - - // Map from vertexIndex to dataIndex. - _dataIndices: null, - - _vertexOffset: 0, - _triangleOffset: 0 - }; -}, -/** @lends module:echarts-gl/chart/bars/BarsGeometry.prototype */ -{ - - resetOffset: function () { - this._vertexOffset = 0; - this._triangleOffset = 0; - }, - - setBarCount: function (barCount) { - var enableNormal = this.enableNormal; - var vertexCount = this.getBarVertexCount() * barCount; - var triangleCount = this.getBarTriangleCount() * barCount; - - if (this.vertexCount !== vertexCount) { - this.attributes.position.init(vertexCount); - if (enableNormal) { - this.attributes.normal.init(vertexCount); - } - else { - this.attributes.normal.value = null; - } - this.attributes.color.init(vertexCount); - } - - if (this.triangleCount !== triangleCount) { - this.indices = vertexCount > 0xffff ? new Uint32Array(triangleCount * 3) : new Uint16Array(triangleCount * 3); - - this._dataIndices = new Uint32Array(vertexCount); - } - }, - - getBarVertexCount: function () { - var bevelSegments = this.bevelSize > 0 ? this.bevelSegments : 0; - return bevelSegments > 0 ? this._getBevelBarVertexCount(bevelSegments) - : (this.enableNormal ? 24 : 8); - }, - - getBarTriangleCount: function () { - var bevelSegments = this.bevelSize > 0 ? this.bevelSegments : 0; - return bevelSegments > 0 ? this._getBevelBarTriangleCount(bevelSegments) - : 12; - }, - - _getBevelBarVertexCount: function (bevelSegments) { - return (bevelSegments + 1) * 4 * (bevelSegments + 1) * 2; - }, - - _getBevelBarTriangleCount: function (bevelSegments) { - var widthSegments = bevelSegments * 4 + 3; - var heightSegments = bevelSegments * 2 + 1; - return (widthSegments + 1) * heightSegments * 2 + 4; - }, - - setColor: function (idx, color) { - var vertexCount = this.getBarVertexCount(); - var start = vertexCount * idx; - var end = vertexCount * (idx + 1); - for (var i = start; i < end; i++) { - this.attributes.color.set(i, color); - } - this.dirtyAttribute('color'); - }, - - /** - * Get dataIndex of vertex. - * @param {number} vertexIndex - */ - getDataIndexOfVertex: function (vertexIndex) { - return this._dataIndices ? this._dataIndices[vertexIndex] : null; - }, - - /** - * Add a bar - * @param {Array.} start - * @param {Array.} end - * @param {Array.} orient right direction - * @param {Array.} size size on x and z - * @param {Array.} color - */ - addBar: (function () { - var v3Create = vec3.create; - var v3ScaleAndAdd = vec3.scaleAndAdd; - - var end = v3Create(); - var px = v3Create(); - var py = v3Create(); - var pz = v3Create(); - var nx = v3Create(); - var ny = v3Create(); - var nz = v3Create(); - - var pts = []; - var normals = []; - for (var i = 0; i < 8; i++) { - pts[i] = v3Create(); - } - - var cubeFaces4 = [ - // PX - [0, 1, 5, 4], - // NX - [2, 3, 7, 6], - // PY - [4, 5, 6, 7], - // NY - [3, 2, 1, 0], - // PZ - [0, 4, 7, 3], - // NZ - [1, 2, 6, 5] - ]; - var face4To3 = [ - 0, 1, 2, 0, 2, 3 - ]; - var cubeFaces3 = []; - for (var i = 0; i < cubeFaces4.length; i++) { - var face4 = cubeFaces4[i]; - for (var j = 0; j < 2; j++) { - var face = []; - for (var k = 0; k < 3; k++) { - face.push(face4[face4To3[j * 3 + k]]); - } - cubeFaces3.push(face); - } - } - return function (start, dir, leftDir, size, color, dataIndex) { - - // Use vertex, triangle maybe sorted. - var startVertex = this._vertexOffset; - - if (this.bevelSize > 0 && this.bevelSegments > 0) { - this._addBevelBar(start, dir, leftDir, size, this.bevelSize, this.bevelSegments, color); - } - else { - vec3.copy(py, dir); - vec3.normalize(py, py); - // x * y => z - vec3.cross(pz, leftDir, py); - vec3.normalize(pz, pz); - // y * z => x - vec3.cross(px, py, pz); - vec3.normalize(pz, pz); - - vec3.negate(nx, px); - vec3.negate(ny, py); - vec3.negate(nz, pz); - - v3ScaleAndAdd(pts[0], start, px, size[0] / 2); - v3ScaleAndAdd(pts[0], pts[0], pz, size[2] / 2); - v3ScaleAndAdd(pts[1], start, px, size[0] / 2); - v3ScaleAndAdd(pts[1], pts[1], nz, size[2] / 2); - v3ScaleAndAdd(pts[2], start, nx, size[0] / 2); - v3ScaleAndAdd(pts[2], pts[2], nz, size[2] / 2); - v3ScaleAndAdd(pts[3], start, nx, size[0] / 2); - v3ScaleAndAdd(pts[3], pts[3], pz, size[2] / 2); - - v3ScaleAndAdd(end, start, py, size[1]); - - v3ScaleAndAdd(pts[4], end, px, size[0] / 2); - v3ScaleAndAdd(pts[4], pts[4], pz, size[2] / 2); - v3ScaleAndAdd(pts[5], end, px, size[0] / 2); - v3ScaleAndAdd(pts[5], pts[5], nz, size[2] / 2); - v3ScaleAndAdd(pts[6], end, nx, size[0] / 2); - v3ScaleAndAdd(pts[6], pts[6], nz, size[2] / 2); - v3ScaleAndAdd(pts[7], end, nx, size[0] / 2); - v3ScaleAndAdd(pts[7], pts[7], pz, size[2] / 2); - - var attributes = this.attributes; - if (this.enableNormal) { - normals[0] = px; - normals[1] = nx; - normals[2] = py; - normals[3] = ny; - normals[4] = pz; - normals[5] = nz; - - var vertexOffset = this._vertexOffset; - for (var i = 0; i < cubeFaces4.length; i++) { - var idx3 = this._triangleOffset * 3; - for (var k = 0; k < 6; k++) { - this.indices[idx3++] = vertexOffset + face4To3[k]; - } - vertexOffset += 4; - this._triangleOffset += 2; - } - - for (var i = 0; i < cubeFaces4.length; i++) { - var normal = normals[i]; - for (var k = 0; k < 4; k++) { - var idx = cubeFaces4[i][k]; - attributes.position.set(this._vertexOffset, pts[idx]); - attributes.normal.set(this._vertexOffset, normal); - attributes.color.set(this._vertexOffset++, color); - } - } - } - else { - for (var i = 0; i < cubeFaces3.length; i++) { - var idx3 = this._triangleOffset * 3; - for (var k = 0; k < 3; k++) { - this.indices[idx3 + k] = cubeFaces3[i][k] + this._vertexOffset; - } - this._triangleOffset++; - } - - for (var i = 0; i < pts.length; i++) { - attributes.position.set(this._vertexOffset, pts[i]); - attributes.color.set(this._vertexOffset++, color); - } - } - } - - var endVerex = this._vertexOffset; - - for (var i = startVertex; i < endVerex; i++) { - this._dataIndices[i] = dataIndex; - } - }; - })(), - - /** - * Add a bar with bevel - * @param {Array.} start - * @param {Array.} end - * @param {Array.} orient right direction - * @param {Array.} size size on x and z - * @param {number} bevelSize - * @param {number} bevelSegments - * @param {Array.} color - */ - _addBevelBar: (function () { - var px = vec3.create(); - var py = vec3.create(); - var pz = vec3.create(); - - var rotateMat = mat3.create(); - - var bevelStartSize = []; - - var xOffsets = [1, -1, -1, 1]; - var zOffsets = [1, 1, -1, -1]; - var yOffsets = [2, 0]; - - return function (start, dir, leftDir, size, bevelSize, bevelSegments, color) { - vec3.copy(py, dir); - vec3.normalize(py, py); - // x * y => z - vec3.cross(pz, leftDir, py); - vec3.normalize(pz, pz); - // y * z => x - vec3.cross(px, py, pz); - vec3.normalize(pz, pz); - - rotateMat[0] = px[0]; rotateMat[1] = px[1]; rotateMat[2] = px[2]; - rotateMat[3] = py[0]; rotateMat[4] = py[1]; rotateMat[5] = py[2]; - rotateMat[6] = pz[0]; rotateMat[7] = pz[1]; rotateMat[8] = pz[2]; - - bevelSize = Math.min(size[0], size[2]) / 2 * bevelSize; - - for (var i = 0; i < 3; i++) { - bevelStartSize[i] = Math.max(size[i] - bevelSize * 2, 0); - } - var rx = (size[0] - bevelStartSize[0]) / 2; - var ry = (size[1] - bevelStartSize[1]) / 2; - var rz = (size[2] - bevelStartSize[2]) / 2; - - var pos = []; - var normal = []; - var vertexOffset = this._vertexOffset; - - var endIndices = []; - for (var i = 0; i < 2; i++) { - endIndices[i] = endIndices[i] = []; - - for (var m = 0; m <= bevelSegments; m++) { - for (var j = 0; j < 4; j++) { - if ((m === 0 && i === 0) || (i === 1 && m === bevelSegments)) { - endIndices[i].push(vertexOffset); - } - for (var n = 0; n <= bevelSegments; n++) { - - var phi = n / bevelSegments * Math.PI / 2 + Math.PI / 2 * j; - var theta = m / bevelSegments * Math.PI / 2 + Math.PI / 2 * i; - // var r = rx < ry ? (rz < rx ? rz : rx) : (rz < ry ? rz : ry); - normal[0] = rx * Math.cos(phi) * Math.sin(theta); - normal[1] = ry * Math.cos(theta); - normal[2] = rz * Math.sin(phi) * Math.sin(theta); - pos[0] = normal[0] + xOffsets[j] * bevelStartSize[0] / 2; - pos[1] = (normal[1] + ry) + yOffsets[i] * bevelStartSize[1] / 2; - pos[2] = normal[2] + zOffsets[j] * bevelStartSize[2] / 2; - - // Normal is not right if rx, ry, rz not equal. - if (!(Math.abs(rx - ry) < 1e-6 && Math.abs(ry - rz) < 1e-6)) { - normal[0] /= rx * rx; - normal[1] /= ry * ry; - normal[2] /= rz * rz; - } - vec3.normalize(normal, normal); - - vec3.transformMat3(pos, pos, rotateMat); - vec3.transformMat3(normal, normal, rotateMat); - vec3.add(pos, pos, start); - - this.attributes.position.set(vertexOffset, pos); - if (this.enableNormal) { - this.attributes.normal.set(vertexOffset, normal); - } - this.attributes.color.set(vertexOffset, color); - vertexOffset++; - } - } - } - } - - var widthSegments = bevelSegments * 4 + 3; - var heightSegments = bevelSegments * 2 + 1; - - var len = widthSegments + 1; - - for (var j = 0; j < heightSegments; j ++) { - for (var i = 0; i <= widthSegments; i ++) { - var i2 = j * len + i + this._vertexOffset; - var i1 = (j * len + (i + 1) % len) + this._vertexOffset; - var i4 = (j + 1) * len + (i + 1) % len + this._vertexOffset; - var i3 = (j + 1) * len + i + this._vertexOffset; - - this.setTriangleIndices(this._triangleOffset++, [i4, i2, i1]); - this.setTriangleIndices(this._triangleOffset++, [i4, i3, i2]); - } - } - - // Close top and bottom - this.setTriangleIndices(this._triangleOffset++, [endIndices[0][0], endIndices[0][2], endIndices[0][1]]); - this.setTriangleIndices(this._triangleOffset++, [endIndices[0][0], endIndices[0][3], endIndices[0][2]]); - this.setTriangleIndices(this._triangleOffset++, [endIndices[1][0], endIndices[1][1], endIndices[1][2]]); - this.setTriangleIndices(this._triangleOffset++, [endIndices[1][0], endIndices[1][2], endIndices[1][3]]); - - this._vertexOffset = vertexOffset; - }; - })() -}); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.defaults(BarsGeometry.prototype, __WEBPACK_IMPORTED_MODULE_1__dynamicConvertMixin__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.defaults(BarsGeometry.prototype, __WEBPACK_IMPORTED_MODULE_2__trianglesSortMixin__["a" /* default */]); - -/* harmony default export */ __webpack_exports__["a"] = (BarsGeometry); - -/***/ }), -/* 231 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__component_common_componentShadingMixin__ = __webpack_require__(31); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_format__ = __webpack_require__(32); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_formatTooltip__ = __webpack_require__(39); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_createList__ = __webpack_require__(50); - - - - - - -var Bar3DSeries = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendSeriesModel({ - - type: 'series.bar3D', - - dependencies: ['globe'], - - visualColorAccessPath: 'itemStyle.color', - - getInitialData: function (option, ecModel) { - return Object(__WEBPACK_IMPORTED_MODULE_4__common_createList__["a" /* default */])(this); - }, - - getFormattedLabel: function (dataIndex, status, dataType, dimIndex) { - var text = __WEBPACK_IMPORTED_MODULE_2__util_format__["a" /* default */].getFormattedLabel(this, dataIndex, status, dataType, dimIndex); - if (text == null) { - text = this.getData().get('z', dataIndex); - } - return text; - }, - - formatTooltip: function (dataIndex) { - return Object(__WEBPACK_IMPORTED_MODULE_3__common_formatTooltip__["a" /* default */])(this, dataIndex); - }, - - defaultOption: { - - coordinateSystem: 'cartesian3D', - - globeIndex: 0, - - grid3DIndex: 0, - - zlevel: -10, - - // bevelSize, 0 has no bevel - bevelSize: 0, - // higher is smoother - bevelSmoothness: 2, - - // Bar width and depth - // barSize: [1, 1], - - // On grid plane when coordinateSystem is cartesian3D - onGridPlane: 'xy', - - // Shading of globe - shading: 'color', - - minHeight: 0, - - itemStyle: { - opacity: 1 - }, - - label: { - show: false, - distance: 2, - textStyle: { - fontSize: 14, - color: '#000', - backgroundColor: 'rgba(255,255,255,0.7)', - padding: 3, - borderRadius: 3 - } - }, - - emphasis: { - label: { - show: true - } - }, - - animationDurationUpdate: 500 - } -}); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(Bar3DSeries.prototype, __WEBPACK_IMPORTED_MODULE_1__component_common_componentShadingMixin__["a" /* default */]); - -/* unused harmony default export */ var _unused_webpack_default_export = (Bar3DSeries); - -/***/ }), -/* 232 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__line3D_Line3DSeries__ = __webpack_require__(233); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__line3D_Line3DView__ = __webpack_require__(234); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_echarts_lib_visual_symbol__ = __webpack_require__(51); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_echarts_lib_visual_symbol___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_echarts_lib_visual_symbol__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_opacityVisual__ = __webpack_require__(17); - - - - - - - - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerVisual(__WEBPACK_IMPORTED_MODULE_3_echarts_lib_visual_symbol___default()('line3D', 'circle', null)); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerVisual(Object(__WEBPACK_IMPORTED_MODULE_4__common_opacityVisual__["a" /* default */])('line3D')); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerLayout(function (ecModel, api) { - ecModel.eachSeriesByType('line3D', function (seriesModel) { - var data = seriesModel.getData(); - var coordSys = seriesModel.coordinateSystem; - - if (coordSys) { - if (coordSys.type !== 'cartesian3D') { - if (true) { - console.error('line3D needs cartesian3D coordinateSystem'); - } - return; - } - var points = new Float32Array(data.count() * 3); - - var item = []; - var out = []; - - var coordDims = coordSys.dimensions; - var dims = coordDims.map(function (coordDim) { - return seriesModel.coordDimToDataDim(coordDim)[0]; - }); - - if (coordSys) { - data.each(dims, function (x, y, z, idx) { - item[0] = x; - item[1] = y; - item[2] = z; - - coordSys.dataToPoint(item, out); - points[idx * 3] = out[0]; - points[idx * 3 + 1] = out[1]; - points[idx * 3 + 2] = out[2]; - }); - } - data.setLayout('points', points); - } - }); -}); - -/***/ }), -/* 233 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__common_formatTooltip__ = __webpack_require__(39); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_createList__ = __webpack_require__(50); - - - - -var Line3DSeries = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendSeriesModel({ - - type: 'series.line3D', - - dependencies: ['grid3D'], - - visualColorAccessPath: 'lineStyle.color', - - getInitialData: function (option, ecModel) { - return Object(__WEBPACK_IMPORTED_MODULE_2__common_createList__["a" /* default */])(this); - }, - - formatTooltip: function (dataIndex) { - return Object(__WEBPACK_IMPORTED_MODULE_1__common_formatTooltip__["a" /* default */])(this, dataIndex); - }, - - defaultOption: { - coordinateSystem: 'cartesian3D', - zlevel: -10, - - // Cartesian coordinate system - grid3DIndex: 0, - - lineStyle: { - width: 2 - }, - - animationDurationUpdate: 500 - } -}); - -/* unused harmony default export */ var _unused_webpack_default_export = (Line3DSeries); - -/***/ }), -/* 234 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_retrieve__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_geometry_Lines3D__ = __webpack_require__(25); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_claygl_src_math_Matrix4__ = __webpack_require__(9); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_claygl_src_math_Vector3__ = __webpack_require__(3); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_zrender_lib_contain_line__ = __webpack_require__(235); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_zrender_lib_contain_line___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_zrender_lib_contain_line__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_claygl_src_dep_glmatrix__ = __webpack_require__(6); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__util_shader_lines3D_glsl_js__ = __webpack_require__(46); - - - - - - - - - - - -var vec3 = __WEBPACK_IMPORTED_MODULE_7_claygl_src_dep_glmatrix__["a" /* default */].vec3; - -__WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Shader.import(__WEBPACK_IMPORTED_MODULE_8__util_shader_lines3D_glsl_js__["a" /* default */]); - -/* unused harmony default export */ var _unused_webpack_default_export = (__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendChartView({ - - type: 'line3D', - - __ecgl__: true, - - init: function (ecModel, api) { - - this.groupGL = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Node(); - - this._api = api; - }, - - render: function (seriesModel, ecModel, api) { - var tmp = this._prevLine3DMesh; - this._prevLine3DMesh = this._line3DMesh; - this._line3DMesh = tmp; - - if (!this._line3DMesh) { - this._line3DMesh = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Mesh({ - geometry: new __WEBPACK_IMPORTED_MODULE_3__util_geometry_Lines3D__["a" /* default */]({ - useNativeLine: false, - sortTriangles: true - }), - material: new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Material({ - shader: __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].createShader('ecgl.meshLines3D') - }), - // Render after axes - renderOrder: 10 - }); - this._line3DMesh.geometry.pick = this._pick.bind(this); - } - - this.groupGL.remove(this._prevLine3DMesh); - this.groupGL.add(this._line3DMesh); - - var coordSys = seriesModel.coordinateSystem; - if (coordSys && coordSys.viewGL) { - coordSys.viewGL.add(this.groupGL); - // TODO - var methodName = coordSys.viewGL.isLinearSpace() ? 'define' : 'undefine'; - this._line3DMesh.material[methodName]('fragment', 'SRGB_DECODE'); - } - this._doRender(seriesModel, api); - - this._data = seriesModel.getData(); - - this._camera = coordSys.viewGL.camera; - - this.updateCamera(); - - this._updateAnimation(seriesModel); - }, - - updateCamera: function () { - this._updateNDCPosition(); - }, - - _doRender: function (seriesModel, api) { - var data = seriesModel.getData(); - var lineMesh = this._line3DMesh; - - lineMesh.geometry.resetOffset(); - - var points = data.getLayout('points'); - - var colorArr = []; - var vertexColors = new Float32Array(points.length / 3 * 4); - var colorOffset = 0; - var hasTransparent = false; - - data.each(function (idx) { - var color = data.getItemVisual(idx, 'color'); - var opacity = data.getItemVisual(idx, 'opacity'); - if (opacity == null) { - opacity = 1; - } - - __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor(color, colorArr); - colorArr[3] *= opacity; - vertexColors[colorOffset++] = colorArr[0]; - vertexColors[colorOffset++] = colorArr[1]; - vertexColors[colorOffset++] = colorArr[2]; - vertexColors[colorOffset++] = colorArr[3]; - - if (colorArr[3] < 0.99) { - hasTransparent = true; - } - }); - - lineMesh.geometry.setVertexCount( - lineMesh.geometry.getPolylineVertexCount(points) - ); - lineMesh.geometry.setTriangleCount( - lineMesh.geometry.getPolylineTriangleCount(points) - ); - - lineMesh.geometry.addPolyline( - points, vertexColors, - __WEBPACK_IMPORTED_MODULE_2__util_retrieve__["a" /* default */].firstNotNull(seriesModel.get('lineStyle.width'), 1) - ); - - lineMesh.geometry.dirty(); - lineMesh.geometry.updateBoundingBox(); - - var material = lineMesh.material; - material.transparent = hasTransparent; - material.depthMask = !hasTransparent; - - var debugWireframeModel = seriesModel.getModel('debug.wireframe'); - if (debugWireframeModel.get('show')) { - lineMesh.geometry.createAttribute('barycentric', 'float', 3); - lineMesh.geometry.generateBarycentric(); - lineMesh.material.set('both', 'WIREFRAME_TRIANGLE'); - lineMesh.material.set( - 'wireframeLineColor', __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor( - debugWireframeModel.get('lineStyle.color') || 'rgba(0,0,0,0.5)' - ) - ); - lineMesh.material.set( - 'wireframeLineWidth', __WEBPACK_IMPORTED_MODULE_2__util_retrieve__["a" /* default */].firstNotNull( - debugWireframeModel.get('lineStyle.width'), 1 - ) - ); - } - else { - lineMesh.material.set('both', 'WIREFRAME_TRIANGLE'); - } - - this._points = points; - - this._initHandler(seriesModel, api); - }, - - _updateAnimation: function (seriesModel) { - __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].updateVertexAnimation( - [['prevPosition', 'position'], - ['prevPositionPrev', 'positionPrev'], - ['prevPositionNext', 'positionNext']], - this._prevLine3DMesh, - this._line3DMesh, - seriesModel - ); - }, - - _initHandler: function (seriesModel, api) { - var data = seriesModel.getData(); - var coordSys = seriesModel.coordinateSystem; - var lineMesh = this._line3DMesh; - - var lastDataIndex = -1; - - lineMesh.seriesIndex = seriesModel.seriesIndex; - - lineMesh.off('mousemove'); - lineMesh.off('mouseout'); - lineMesh.on('mousemove', function (e) { - var value = coordSys.pointToData(e.point.array); - var dataIndex = data.indicesOfNearest('x', value[0])[0]; - if (dataIndex !== lastDataIndex) { - // this._downplay(lastDataIndex); - // this._highlight(dataIndex); - - api.dispatchAction({ - type: 'grid3DShowAxisPointer', - value: [data.get('x', dataIndex), data.get('y', dataIndex), data.get('z', dataIndex)] - }); - - lineMesh.dataIndex = dataIndex; - } - - - lastDataIndex = dataIndex; - }, this); - lineMesh.on('mouseout', function (e) { - // this._downplay(lastDataIndex); - lastDataIndex = -1; - lineMesh.dataIndex = -1; - api.dispatchAction({ - type: 'grid3DHideAxisPointer' - }); - }, this); - }, - - // _highlight: function (dataIndex) { - // var data = this._data; - // if (!data) { - // return; - // } - - // }, - - // _downplay: function (dataIndex) { - // var data = this._data; - // if (!data) { - // return; - // } - // }, - - _updateNDCPosition: function () { - - var worldViewProjection = new __WEBPACK_IMPORTED_MODULE_4_claygl_src_math_Matrix4__["a" /* default */](); - var camera = this._camera; - __WEBPACK_IMPORTED_MODULE_4_claygl_src_math_Matrix4__["a" /* default */].multiply(worldViewProjection, camera.projectionMatrix, camera.viewMatrix); - - var positionNDC = this._positionNDC; - var points = this._points; - var nPoints = points.length / 3; - if (!positionNDC || positionNDC.length / 2 !== nPoints) { - positionNDC = this._positionNDC = new Float32Array(nPoints * 2); - } - var pos = []; - for (var i = 0; i < nPoints; i++) { - var i3 = i * 3; - var i2 = i * 2; - pos[0] = points[i3]; - pos[1] = points[i3 + 1]; - pos[2] = points[i3 + 2]; - pos[3] = 1; - - vec3.transformMat4(pos, pos, worldViewProjection.array); - positionNDC[i2] = pos[0] / pos[3]; - positionNDC[i2 + 1] = pos[1] / pos[3]; - } - }, - - _pick: function (x, y, renderer, camera, renderable, out) { - var positionNDC = this._positionNDC; - var seriesModel = this._data.hostModel; - var lineWidth = seriesModel.get('lineStyle.width'); - - var dataIndex = -1; - var width = renderer.viewport.width; - var height = renderer.viewport.height; - - var halfWidth = width * 0.5; - var halfHeight = height * 0.5; - x = (x + 1) * halfWidth; - y = (y + 1) * halfHeight; - - for (var i = 1; i < positionNDC.length / 2; i++) { - var x0 = (positionNDC[(i - 1) * 2] + 1) * halfWidth; - var y0 = (positionNDC[(i - 1) * 2 + 1] + 1) * halfHeight; - var x1 = (positionNDC[i * 2] + 1) * halfWidth; - var y1 = (positionNDC[i * 2 + 1] + 1) * halfHeight; - - if (__WEBPACK_IMPORTED_MODULE_6_zrender_lib_contain_line___default.a.containStroke(x0, y0, x1, y1, lineWidth, x, y)) { - var dist0 = (x0 - x) * (x0 - x) + (y0 - y) * (y0 - y); - var dist1 = (x1 - x) * (x1 - x) + (y1 - y) * (y1 - y); - // Nearest point. - dataIndex = dist0 < dist1 ? (i - 1) : i; - } - } - - if (dataIndex >= 0) { - var i3 = dataIndex * 3; - var point = new __WEBPACK_IMPORTED_MODULE_5_claygl_src_math_Vector3__["a" /* default */]( - this._points[i3], - this._points[i3 + 1], - this._points[i3 + 2] - ); - - out.push({ - dataIndex: dataIndex, - point: point, - pointWorld: point.clone(), - target: this._line3DMesh, - distance: this._camera.getWorldPosition().dist(point) - }); - } - }, - - remove: function () { - this.groupGL.removeAll(); - }, - - dispose: function () { - this.groupGL.removeAll(); - } -})); - -/***/ }), -/* 235 */ -/***/ (function(module, exports) { - -/** - * 线段包含判断 - * @param {number} x0 - * @param {number} y0 - * @param {number} x1 - * @param {number} y1 - * @param {number} lineWidth - * @param {number} x - * @param {number} y - * @return {boolean} - */ -function containStroke(x0, y0, x1, y1, lineWidth, x, y) { - if (lineWidth === 0) { - return false; - } - - var _l = lineWidth; - var _a = 0; - var _b = x0; // Quick reject - - if (y > y0 + _l && y > y1 + _l || y < y0 - _l && y < y1 - _l || x > x0 + _l && x > x1 + _l || x < x0 - _l && x < x1 - _l) { - return false; - } - - if (x0 !== x1) { - _a = (y0 - y1) / (x0 - x1); - _b = (x0 * y1 - x1 * y0) / (x0 - x1); - } else { - return Math.abs(x - x0) <= _l / 2; - } - - var tmp = _a * x - y + _b; - - var _s = tmp * tmp / (_a * _a + 1); - - return _s <= _l / 2 * _l / 2; -} - -exports.containStroke = containStroke; - -/***/ }), -/* 236 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__scatter3D_Scatter3DSeries__ = __webpack_require__(237); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__scatter3D_Scatter3DView__ = __webpack_require__(238); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_echarts_lib_visual_symbol__ = __webpack_require__(51); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_echarts_lib_visual_symbol___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_echarts_lib_visual_symbol__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_opacityVisual__ = __webpack_require__(17); - - - - - - - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerVisual(__WEBPACK_IMPORTED_MODULE_3_echarts_lib_visual_symbol___default()('scatter3D', 'circle', null)); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerVisual(Object(__WEBPACK_IMPORTED_MODULE_4__common_opacityVisual__["a" /* default */])('scatter3D')); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerLayout({ - seriesType: 'scatter3D', - reset: function (seriesModel) { - var coordSys = seriesModel.coordinateSystem; - - if (coordSys) { - var coordDims = coordSys.dimensions; - if (coordDims.length < 3) { - if (true) { - console.error('scatter3D needs 3D coordinateSystem'); - } - return; - } - var dims = coordDims.map(function (coordDim) { - return seriesModel.coordDimToDataDim(coordDim)[0]; - }); - - var item = []; - var out = []; - - return { - progress: function (params, data) { - var points = new Float32Array((params.end - params.start) * 3); - for (var idx = params.start; idx < params.end; idx++) { - var idx3 = (idx - params.start) * 3; - item[0] = data.get(dims[0], idx); - item[1] = data.get(dims[1], idx); - item[2] = data.get(dims[2], idx); - coordSys.dataToPoint(item, out); - points[idx3] = out[0]; - points[idx3 + 1] = out[1]; - points[idx3 + 2] = out[2]; - } - data.setLayout('points', points); - } - }; - } - } -}); - -/***/ }), -/* 237 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_format__ = __webpack_require__(32); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_formatTooltip__ = __webpack_require__(39); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_createList__ = __webpack_require__(50); - - - - - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendSeriesModel({ - - type: 'series.scatter3D', - - dependencies: ['globe', 'grid3D', 'geo3D'], - - visualColorAccessPath: 'itemStyle.color', - - getInitialData: function (option, ecModel) { - return Object(__WEBPACK_IMPORTED_MODULE_3__common_createList__["a" /* default */])(this); - }, - - getFormattedLabel: function (dataIndex, status, dataType, dimIndex) { - var text = __WEBPACK_IMPORTED_MODULE_1__util_format__["a" /* default */].getFormattedLabel(this, dataIndex, status, dataType, dimIndex); - if (text == null) { - var data = this.getData(); - var lastDim = data.dimensions[data.dimensions.length - 1]; - text = data.get(lastDim, dataIndex); - } - return text; - }, - - formatTooltip: function (dataIndex) { - return Object(__WEBPACK_IMPORTED_MODULE_2__common_formatTooltip__["a" /* default */])(this, dataIndex); - }, - - defaultOption: { - coordinateSystem: 'cartesian3D', - zlevel: -10, - - progressive: 1e5, - progressiveThreshold: 1e5, - - // Cartesian coordinate system - grid3DIndex: 0, - - globeIndex: 0, - - symbol: 'circle', - symbolSize: 10, - - // Support source-over, lighter - blendMode: 'source-over', - - label: { - show: false, - position: 'right', - // Screen space distance - distance: 5, - - textStyle: { - fontSize: 14, - color: '#000', - backgroundColor: 'rgba(255,255,255,0.7)', - padding: 3, - borderRadius: 3 - } - }, - - itemStyle: { - opacity: 0.8 - }, - - emphasis: { - label: { - show: true - } - }, - - animationDurationUpdate: 500 - } -}); - -/***/ }), -/* 238 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_retrieve__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_format__ = __webpack_require__(32); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_PointsBuilder__ = __webpack_require__(67); - - - - - - - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendChartView({ - - type: 'scatter3D', - - __ecgl__: true, - - init: function (ecModel, api) { - - this.groupGL = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Node(); - - this._pointsBuilderList = []; - this._currentStep = 0; - }, - - render: function (seriesModel, ecModel, api) { - this.groupGL.removeAll(); - if (!seriesModel.getData().count()) { - return; - } - - var coordSys = seriesModel.coordinateSystem; - if (coordSys && coordSys.viewGL) { - coordSys.viewGL.add(this.groupGL); - this._camera = coordSys.viewGL.camera; - - var pointsBuilder = this._pointsBuilderList[0]; - if (!pointsBuilder) { - pointsBuilder = this._pointsBuilderList[0] = new __WEBPACK_IMPORTED_MODULE_4__common_PointsBuilder__["a" /* default */](false, api); - } - this._pointsBuilderList.length = 1; - - this.groupGL.add(pointsBuilder.rootNode); - pointsBuilder.update(seriesModel, ecModel, api); - pointsBuilder.updateView(coordSys.viewGL.camera); - } - else { - if (true) { - throw new Error('Invalid coordinate system'); - } - } - }, - - incrementalPrepareRender: function (seriesModel, ecModel, api) { - var coordSys = seriesModel.coordinateSystem; - if (coordSys && coordSys.viewGL) { - coordSys.viewGL.add(this.groupGL); - this._camera = coordSys.viewGL.camera; - } - else { - if (true) { - throw new Error('Invalid coordinate system'); - } - } - - this.groupGL.removeAll(); - this._currentStep = 0; - }, - - incrementalRender: function (params, seriesModel, ecModel, api) { - // TODO Sort transparency. - if (params.end <= params.start) { - return; - } - var pointsBuilder = this._pointsBuilderList[this._currentStep]; - if (!pointsBuilder) { - pointsBuilder = new __WEBPACK_IMPORTED_MODULE_4__common_PointsBuilder__["a" /* default */](false, api); - this._pointsBuilderList[this._currentStep] = pointsBuilder; - } - this.groupGL.add(pointsBuilder.rootNode); - - pointsBuilder.update(seriesModel, ecModel, api, params.start, params.end); - pointsBuilder.updateView(seriesModel.coordinateSystem.viewGL.camera); - - this._currentStep++; - }, - - updateCamera: function () { - this._pointsBuilderList.forEach(function (pointsBuilder) { - pointsBuilder.updateView(this._camera); - }, this); - }, - - highlight: function (seriesModel, ecModel, api, payload) { - this._toggleStatus('highlight', seriesModel, ecModel, api, payload); - }, - - downplay: function (seriesModel, ecModel, api, payload) { - this._toggleStatus('downplay', seriesModel, ecModel, api, payload); - }, - - _toggleStatus: function (status, seriesModel, ecModel, api, payload) { - var data = seriesModel.getData(); - var dataIndex = __WEBPACK_IMPORTED_MODULE_2__util_retrieve__["a" /* default */].queryDataIndex(data, payload); - - var isHighlight = status === 'highlight'; - if (dataIndex != null) { - __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.each(__WEBPACK_IMPORTED_MODULE_3__util_format__["a" /* default */].normalizeToArray(dataIndex), function (dataIdx) { - for (var i = 0; i < this._pointsBuilderList.length; i++) { - var pointsBuilder = this._pointsBuilderList[i]; - isHighlight ? pointsBuilder.highlight(data, dataIdx) : pointsBuilder.downplay(data, dataIdx); - } - }, this); - } - else { - // PENDING, OPTIMIZE - data.each(function (dataIdx) { - for (var i = 0; i < this._pointsBuilderList.length; i++) { - var pointsBuilder = this._pointsBuilderList[i]; - isHighlight ? pointsBuilder.highlight(data, dataIdx) : pointsBuilder.downplay(data, dataIdx); - } - }); - } - }, - - dispose: function () { - this.groupGL.removeAll(); - }, - - remove: function () { - this.groupGL.removeAll(); - } -}); - -/***/ }), -/* 239 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); - - -function makeSprite(size, canvas, draw) { - // http://simonsarris.com/blog/346-how-you-clear-your-canvas-matters - // http://jsperf.com/canvasclear - // Set width and height is fast - // And use the exist canvas if possible - // http://jsperf.com/create-canvas-vs-set-width-height/2 - var canvas = canvas || document.createElement('canvas'); - canvas.width = size; - canvas.height = size; - var ctx = canvas.getContext('2d'); - - draw && draw(ctx); - - return canvas; -} - -function makePath(symbol, symbolSize, style, marginBias) { - if (!__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.isArray(symbolSize)) { - symbolSize = [symbolSize, symbolSize]; - } - var margin = spriteUtil.getMarginByStyle(style, marginBias); - var width = symbolSize[0] + margin.left + margin.right; - var height = symbolSize[1] + margin.top + margin.bottom; - var path = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.helper.createSymbol(symbol, 0, 0, symbolSize[0], symbolSize[1]); - - var size = Math.max(width, height); - - path.position = [margin.left, margin.top]; - if (width > height) { - path.position[1] += (size - height) / 2; - } - else { - path.position[0] += (size - width) / 2; - } - - var rect = path.getBoundingRect(); - path.position[0] -= rect.x; - path.position[1] -= rect.y; - - path.setStyle(style); - - path.update(); - - path.__size = size; - - return path; -} - - // http://www.valvesoftware.com/publications/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf -function generateSDF(ctx, sourceImageData, range) { - - var sourceWidth = sourceImageData.width; - var sourceHeight = sourceImageData.height; - - var width = ctx.canvas.width; - var height = ctx.canvas.height; - - var scaleX = sourceWidth / width; - var scaleY = sourceHeight / height; - - function sign(r) { - return r < 128 ? 1 : -1; - } - function searchMinDistance(x, y) { - var minDistSqr = Infinity; - x = Math.floor(x * scaleX); - y = Math.floor(y * scaleY); - var i = y * sourceWidth + x; - var r = sourceImageData.data[i * 4]; - var a = sign(r); - // Search for min distance - for (var y2 = Math.max(y - range, 0); y2 < Math.min(y + range, sourceHeight); y2++) { - for (var x2 = Math.max(x - range, 0); x2 < Math.min(x + range, sourceWidth); x2++) { - var i = y2 * sourceWidth + x2; - var r2 = sourceImageData.data[i * 4]; - var b = sign(r2); - var dx = x2 - x; - var dy = y2 - y; - if (a !== b) { - var distSqr = dx * dx + dy * dy; - if (distSqr < minDistSqr) { - minDistSqr = distSqr; - } - } - } - } - return a * Math.sqrt(minDistSqr); - } - - var sdfImageData = ctx.createImageData(width, height); - for (var y = 0; y < height; y++) { - for (var x = 0; x < width; x++) { - var dist = searchMinDistance(x, y); - - var normalized = dist / range * 0.5 + 0.5; - var i = (y * width + x) * 4; - sdfImageData.data[i++] = (1.0 - normalized) * 255; - sdfImageData.data[i++] = (1.0 - normalized) * 255; - sdfImageData.data[i++] = (1.0 - normalized) * 255; - sdfImageData.data[i++] = 255; - } - } - - return sdfImageData; -} - -var spriteUtil = { - - getMarginByStyle: function (style) { - var minMargin = style.minMargin || 0; - - var lineWidth = 0; - if (style.stroke && style.stroke !== 'none') { - lineWidth = style.lineWidth == null ? 1 : style.lineWidth; - } - var shadowBlurSize = style.shadowBlur || 0; - var shadowOffsetX = style.shadowOffsetX || 0; - var shadowOffsetY = style.shadowOffsetY || 0; - - var margin = {}; - margin.left = Math.max(lineWidth / 2, -shadowOffsetX + shadowBlurSize, minMargin); - margin.right = Math.max(lineWidth / 2, shadowOffsetX + shadowBlurSize, minMargin); - margin.top = Math.max(lineWidth / 2, -shadowOffsetY + shadowBlurSize, minMargin); - margin.bottom = Math.max(lineWidth / 2, shadowOffsetY + shadowBlurSize, minMargin); - - return margin; - }, - - // TODO Not consider shadowOffsetX, shadowOffsetY. - /** - * @param {string} symbol - * @param {number | Array.} symbolSize - * @param {Object} style - */ - createSymbolSprite: function (symbol, symbolSize, style, canvas) { - var path = makePath(symbol, symbolSize, style); - - var margin = spriteUtil.getMarginByStyle(style); - - return { - image: makeSprite(path.__size, canvas, function (ctx) { - path.brush(ctx); - }), - margin: margin - }; - }, - - createSDFFromCanvas: function (canvas, size, range, outCanvas) { - // TODO Create a low resolution SDF from high resolution image. - return makeSprite(size, outCanvas, function (outCtx) { - var ctx = canvas.getContext('2d'); - var imgData = ctx.getImageData(0, 0, canvas.width, canvas.height); - - outCtx.putImageData(generateSDF(outCtx, imgData, range), 0, 0); - }); - }, - - createSimpleSprite: function (size, canvas) { - return makeSprite(size, canvas, function (ctx) { - var halfSize = size / 2; - ctx.beginPath(); - ctx.arc(halfSize, halfSize, 60, 0, Math.PI * 2, false) ; - ctx.closePath(); - - var gradient = ctx.createRadialGradient( - halfSize, halfSize, 0, halfSize, halfSize, halfSize - ); - gradient.addColorStop(0, 'rgba(255, 255, 255, 1)'); - gradient.addColorStop(0.5, 'rgba(255, 255, 255, 0.5)'); - gradient.addColorStop(1, 'rgba(255, 255, 255, 0)'); - ctx.fillStyle = gradient; - ctx.fill(); - }); - } -}; - -/* harmony default export */ __webpack_exports__["a"] = (spriteUtil); - -/***/ }), -/* 240 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util_graphicGL__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_geometry_verticesSortMixin__ = __webpack_require__(241); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_claygl_src_dep_glmatrix__ = __webpack_require__(6); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__sdfSprite_glsl_js__ = __webpack_require__(242); - - - - -var vec4 = __WEBPACK_IMPORTED_MODULE_3_claygl_src_dep_glmatrix__["a" /* default */].vec4; - - -__WEBPACK_IMPORTED_MODULE_0__util_graphicGL__["a" /* default */].Shader.import(__WEBPACK_IMPORTED_MODULE_4__sdfSprite_glsl_js__["a" /* default */]); - -var PointsMesh = __WEBPACK_IMPORTED_MODULE_0__util_graphicGL__["a" /* default */].Mesh.extend(function () { - var geometry = new __WEBPACK_IMPORTED_MODULE_0__util_graphicGL__["a" /* default */].Geometry({ - dynamic: true, - attributes: { - color: new __WEBPACK_IMPORTED_MODULE_0__util_graphicGL__["a" /* default */].Geometry.Attribute('color', 'float', 4, 'COLOR'), - position: new __WEBPACK_IMPORTED_MODULE_0__util_graphicGL__["a" /* default */].Geometry.Attribute('position', 'float', 3, 'POSITION'), - size: new __WEBPACK_IMPORTED_MODULE_0__util_graphicGL__["a" /* default */].Geometry.Attribute('size', 'float', 1), - prevPosition: new __WEBPACK_IMPORTED_MODULE_0__util_graphicGL__["a" /* default */].Geometry.Attribute('prevPosition', 'float', 3), - prevSize: new __WEBPACK_IMPORTED_MODULE_0__util_graphicGL__["a" /* default */].Geometry.Attribute('prevSize', 'float', 1) - } - }); - __WEBPACK_IMPORTED_MODULE_2_echarts_lib_echarts___default.a.util.extend(geometry, __WEBPACK_IMPORTED_MODULE_1__util_geometry_verticesSortMixin__["a" /* default */]); - - var material = new __WEBPACK_IMPORTED_MODULE_0__util_graphicGL__["a" /* default */].Material({ - shader: __WEBPACK_IMPORTED_MODULE_0__util_graphicGL__["a" /* default */].createShader('ecgl.sdfSprite'), - transparent: true, - depthMask: false - }); - material.enableTexture('sprite'); - material.define('both', 'VERTEX_COLOR'); - material.define('both', 'VERTEX_SIZE'); - - var sdfTexture = new __WEBPACK_IMPORTED_MODULE_0__util_graphicGL__["a" /* default */].Texture2D({ - image: document.createElement('canvas'), - flipY: false - }); - - material.set('sprite', sdfTexture); - - // Custom pick methods. - geometry.pick = this._pick.bind(this); - - return { - geometry: geometry, - material: material, - mode: __WEBPACK_IMPORTED_MODULE_0__util_graphicGL__["a" /* default */].Mesh.POINTS, - - sizeScale: 1 - }; -}, { - - _pick: function (x, y, renderer, camera, renderable, out) { - var positionNDC = this._positionNDC; - if (!positionNDC) { - return; - } - - var viewport = renderer.viewport; - var ndcScaleX = 2 / viewport.width; - var ndcScaleY = 2 / viewport.height; - // From near to far. indices have been sorted. - for (var i = this.geometry.vertexCount - 1; i >= 0; i--) { - var idx; - if (!this.geometry.indices) { - idx = i; - } - else { - idx = this.geometry.indices[i]; - } - - var cx = positionNDC[idx * 2]; - var cy = positionNDC[idx * 2 + 1]; - - var size = this.geometry.attributes.size.get(idx) / this.sizeScale; - var halfSize = size / 2; - - if ( - x > (cx - halfSize * ndcScaleX) && x < (cx + halfSize * ndcScaleX) - && y > (cy - halfSize * ndcScaleY) && y < (cy + halfSize * ndcScaleY) - ) { - var point = new __WEBPACK_IMPORTED_MODULE_0__util_graphicGL__["a" /* default */].Vector3(); - var pointWorld = new __WEBPACK_IMPORTED_MODULE_0__util_graphicGL__["a" /* default */].Vector3(); - this.geometry.attributes.position.get(idx, point.array); - __WEBPACK_IMPORTED_MODULE_0__util_graphicGL__["a" /* default */].Vector3.transformMat4(pointWorld, point, this.worldTransform); - out.push({ - vertexIndex: idx, - point: point, - pointWorld: pointWorld, - target: this, - distance: pointWorld.distance(camera.getWorldPosition()) - }); - } - } - }, - - updateNDCPosition: function (worldViewProjection, is2D, api) { - var positionNDC = this._positionNDC; - var geometry = this.geometry; - if (!positionNDC || positionNDC.length / 2 !== geometry.vertexCount) { - positionNDC = this._positionNDC = new Float32Array(geometry.vertexCount * 2); - } - - var pos = vec4.create(); - for (var i = 0; i < geometry.vertexCount; i++) { - geometry.attributes.position.get(i, pos); - pos[3] = 1; - vec4.transformMat4(pos, pos, worldViewProjection.array); - vec4.scale(pos, pos, 1 / pos[3]); - - positionNDC[i * 2] = pos[0]; - positionNDC[i * 2 + 1] = pos[1]; - } - } -}); - -/* harmony default export */ __webpack_exports__["a"] = (PointsMesh); - -/***/ }), -/* 241 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ProgressiveQuickSort__ = __webpack_require__(97); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_claygl_src_dep_glmatrix__ = __webpack_require__(6); - - -var vec3 = __WEBPACK_IMPORTED_MODULE_1_claygl_src_dep_glmatrix__["a" /* default */].vec3; - -/* harmony default export */ __webpack_exports__["a"] = ({ - - needsSortVertices: function () { - return this.sortVertices; - }, - - needsSortVerticesProgressively: function () { - return this.needsSortVertices() && this.vertexCount >= 2e4; - }, - - doSortVertices: function (cameraPos, frame) { - var indices = this.indices; - var p = vec3.create(); - - if (!indices) { - indices = this.indices = this.vertexCount > 0xffff ? new Uint32Array(this.vertexCount) : new Uint16Array(this.vertexCount); - for (var i = 0; i < indices.length; i++) { - indices[i] = i; - } - } - // Do progressive quick sort. - if (frame === 0) { - var posAttr = this.attributes.position; - var cameraPos = cameraPos.array; - var noneCount = 0; - if (!this._zList || this._zList.length !== this.vertexCount) { - this._zList = new Float32Array(this.vertexCount); - } - - var firstZ; - for (var i = 0; i < this.vertexCount; i++) { - posAttr.get(i, p); - // Camera position is in object space - var z = vec3.sqrDist(p, cameraPos); - if (isNaN(z)) { - // Put far away, NaN value may cause sort slow - z = 1e7; - noneCount++; - } - if (i === 0) { - firstZ = z; - z = 0; - } - else { - // Only store the difference to avoid the precision issue. - z = z - firstZ; - } - this._zList[i] = z; - } - - this._noneCount = noneCount; - } - - if (this.vertexCount < 2e4) { - // Use simple native sort for simple geometries. - if (frame === 0) { - this._simpleSort(this._noneCount / this.vertexCount > 0.05); - } - } - else { - for (var i = 0; i < 3; i++) { - this._progressiveQuickSort(frame * 3 + i); - } - } - - this.dirtyIndices(); - }, - - _simpleSort: function (useNativeQuickSort) { - var zList = this._zList; - var indices = this.indices; - function compare(a, b) { - // Sort from far to near. which is descending order - return zList[b] - zList[a]; - } - - // When too much value are equal, using native quick sort with three partition.. - // or the simple quick sort will be nearly O(n*n) - // http://stackoverflow.com/questions/5126586/quicksort-complexity-when-all-the-elements-are-same - - // Otherwise simple quicksort is more effecient than v8 native quick sort when data all different. - if (useNativeQuickSort) { - Array.prototype.sort.call(indices, compare); - } - else { - __WEBPACK_IMPORTED_MODULE_0__ProgressiveQuickSort__["a" /* default */].sort(indices, compare, 0, indices.length - 1); - } - }, - - _progressiveQuickSort: function (frame) { - var zList = this._zList; - var indices = this.indices; - - this._quickSort = this._quickSort || new __WEBPACK_IMPORTED_MODULE_0__ProgressiveQuickSort__["a" /* default */](); - - this._quickSort.step(indices, function (a, b) { - return zList[b] - zList[a]; - }, frame); - } -}); - -/***/ }), -/* 242 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export ecgl.sdfSprite.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform float elapsedTime : 0;\n\nattribute vec3 position : POSITION;\n\n#ifdef VERTEX_SIZE\nattribute float size;\n#else\nuniform float u_Size;\n#endif\n\n#ifdef VERTEX_COLOR\nattribute vec4 a_FillColor: COLOR;\nvarying vec4 v_Color;\n#endif\n\n#ifdef VERTEX_ANIMATION\nattribute vec3 prevPosition;\nattribute float prevSize;\nuniform float percent : 1.0;\n#endif\n\n\n#ifdef POSITIONTEXTURE_ENABLED\nuniform sampler2D positionTexture;\n#endif\n\nvarying float v_Size;\n\nvoid main()\n{\n\n#ifdef POSITIONTEXTURE_ENABLED\n gl_Position = worldViewProjection * vec4(texture2D(positionTexture, position.xy).xy, -10.0, 1.0);\n#else\n\n #ifdef VERTEX_ANIMATION\n vec3 pos = mix(prevPosition, position, percent);\n #else\n vec3 pos = position;\n #endif\n gl_Position = worldViewProjection * vec4(pos, 1.0);\n#endif\n\n#ifdef VERTEX_SIZE\n#ifdef VERTEX_ANIMATION\n v_Size = mix(prevSize, size, percent);\n#else\n v_Size = size;\n#endif\n#else\n v_Size = u_Size;\n#endif\n\n#ifdef VERTEX_COLOR\n v_Color = a_FillColor;\n #endif\n\n gl_PointSize = v_Size;\n}\n\n@end\n\n@export ecgl.sdfSprite.fragment\n\nuniform vec4 color: [1, 1, 1, 1];\nuniform vec4 strokeColor: [1, 1, 1, 1];\nuniform float smoothing: 0.07;\n\nuniform float lineWidth: 0.0;\n\n#ifdef VERTEX_COLOR\nvarying vec4 v_Color;\n#endif\n\nvarying float v_Size;\n\nuniform sampler2D sprite;\n\n@import clay.util.srgb\n\nvoid main()\n{\n gl_FragColor = color;\n\n vec4 _strokeColor = strokeColor;\n\n#ifdef VERTEX_COLOR\n gl_FragColor *= v_Color;\n #endif\n\n#ifdef SPRITE_ENABLED\n float d = texture2D(sprite, gl_PointCoord).r;\n gl_FragColor.a *= smoothstep(0.5 - smoothing, 0.5 + smoothing, d);\n\n if (lineWidth > 0.0) {\n float sLineWidth = lineWidth / 2.0;\n\n float outlineMaxValue0 = 0.5 + sLineWidth;\n float outlineMaxValue1 = 0.5 + sLineWidth + smoothing;\n float outlineMinValue0 = 0.5 - sLineWidth - smoothing;\n float outlineMinValue1 = 0.5 - sLineWidth;\n\n if (d <= outlineMaxValue1 && d >= outlineMinValue0) {\n float a = _strokeColor.a;\n if (d <= outlineMinValue1) {\n a = a * smoothstep(outlineMinValue0, outlineMinValue1, d);\n }\n else {\n a = a * smoothstep(outlineMaxValue1, outlineMaxValue0, d);\n }\n gl_FragColor.rgb = mix(gl_FragColor.rgb * gl_FragColor.a, _strokeColor.rgb, a);\n gl_FragColor.a = gl_FragColor.a * (1.0 - a) + a;\n }\n }\n#endif\n\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(gl_FragColor);\n#endif\n}\n@end"); - - -/***/ }), -/* 243 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__lines3D_lines3DLayout__ = __webpack_require__(244); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__lines3D_Lines3DView__ = __webpack_require__(245); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__lines3D_Lines3DSeries__ = __webpack_require__(248); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_opacityVisual__ = __webpack_require__(17); - - - - - - - - - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerVisual(Object(__WEBPACK_IMPORTED_MODULE_4__common_opacityVisual__["a" /* default */])('lines3D')); - - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerAction({ - type: 'lines3DPauseEffect', - event: 'lines3deffectpaused', - update: 'series.lines3D:pauseEffect' -}, function () {}); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerAction({ - type: 'lines3DResumeEffect', - event: 'lines3deffectresumed', - update: 'series.lines3D:resumeEffect' -}, function () {}); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerAction({ - type: 'lines3DToggleEffect', - event: 'lines3deffectchanged', - update: 'series.lines3D:toggleEffect' -}, function () {}); - -/***/ }), -/* 244 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_claygl_src_dep_glmatrix__ = __webpack_require__(6); - - -var vec3 = __WEBPACK_IMPORTED_MODULE_1_claygl_src_dep_glmatrix__["a" /* default */].vec3; -var vec2 = __WEBPACK_IMPORTED_MODULE_1_claygl_src_dep_glmatrix__["a" /* default */].vec2; -var normalize = vec3.normalize; -var cross = vec3.cross; -var sub = vec3.sub; -var add = vec3.add; -var create = vec3.create; - -var normal = create(); -var tangent = create(); -var bitangent = create(); -var halfVector = create(); - -var coord0 = []; -var coord1 = []; - -function getCubicPointsOnGlobe(coords, coordSys) { - vec2.copy(coord0, coords[0]); - vec2.copy(coord1, coords[1]); - - var pts = []; - var p0 = pts[0] = create(); - var p1 = pts[1] = create(); - var p2 = pts[2] = create(); - var p3 = pts[3] = create(); - coordSys.dataToPoint(coord0, p0); - coordSys.dataToPoint(coord1, p3); - // Get p1 - normalize(normal, p0); - // TODO p0-p3 is parallel with normal - sub(tangent, p3, p0); - normalize(tangent, tangent); - cross(bitangent, tangent, normal); - normalize(bitangent, bitangent); - cross(tangent, normal, bitangent); - // p1 is half vector of p0 and tangent on p0 - add(p1, normal, tangent); - normalize(p1, p1); - - // Get p2 - normalize(normal, p3); - sub(tangent, p0, p3); - normalize(tangent, tangent); - cross(bitangent, tangent, normal); - normalize(bitangent, bitangent); - cross(tangent, normal, bitangent); - // p2 is half vector of p3 and tangent on p3 - add(p2, normal, tangent); - normalize(p2, p2); - - // Project distance of p0 on halfVector - add(halfVector, p0, p3); - normalize(halfVector, halfVector); - var projDist = vec3.dot(p0, halfVector); - // Angle of halfVector and p1 - var cosTheta = vec3.dot(halfVector, p1); - - var len = (Math.max(vec3.len(p0), vec3.len(p3)) - projDist) / cosTheta * 2; - - vec3.scaleAndAdd(p1, p0, p1, len); - vec3.scaleAndAdd(p2, p3, p2, len); - - return pts; -} - -function getCubicPointsOnPlane(coords, coordSys, up) { - var pts = []; - var p0 = pts[0] = vec3.create(); - var p1 = pts[1] = vec3.create(); - var p2 = pts[2] = vec3.create(); - var p3 = pts[3] = vec3.create(); - - coordSys.dataToPoint(coords[0], p0); - coordSys.dataToPoint(coords[1], p3); - - var len = vec3.dist(p0, p3); - vec3.lerp(p1, p0, p3, 0.3); - vec3.lerp(p2, p0, p3, 0.3); - - vec3.scaleAndAdd(p1, p1, up, Math.min(len * 0.1, 10)); - vec3.scaleAndAdd(p2, p2, up, Math.min(len * 0.1, 10)); - - return pts; -} - -function getPolylinePoints(coords, coordSys) { - var pts = new Float32Array(coords.length * 3); - var off = 0; - var pt = []; - for (var i = 0; i < coords.length; i++) { - coordSys.dataToPoint(coords[i], pt); - pts[off++] = pt[0]; - pts[off++] = pt[1]; - pts[off++] = pt[2]; - } - return pts; -} - -function prepareCoords(data) { - var coordsList = []; - - data.each(function (idx) { - var itemModel = data.getItemModel(idx); - var coords = (itemModel.option instanceof Array) ? - itemModel.option : itemModel.getShallow('coords', true); - - if (true) { - if (!(coords instanceof Array && coords.length > 0 && coords[0] instanceof Array)) { - throw new Error('Invalid coords ' + JSON.stringify(coords) + '. Lines must have 2d coords array in data item.'); - } - } - coordsList.push(coords); - }); - - return { - coordsList: coordsList - }; -} - -function layoutGlobe(seriesModel, coordSys) { - var data = seriesModel.getData(); - var isPolyline = seriesModel.get('polyline'); - - data.setLayout('lineType', isPolyline ? 'polyline' : 'cubicBezier'); - - var res = prepareCoords(data); - - data.each(function (idx) { - var coords = res.coordsList[idx]; - var getPointsMethod = isPolyline ? getPolylinePoints : getCubicPointsOnGlobe; - data.setItemLayout(idx, getPointsMethod(coords, coordSys)); - }); -} - -function layoutOnPlane(seriesModel, coordSys, normal) { - var data = seriesModel.getData(); - var isPolyline = seriesModel.get('polyline'); - - var res = prepareCoords(data); - - data.setLayout('lineType', isPolyline ? 'polyline' : 'cubicBezier'); - - data.each(function (idx) { - var coords = res.coordsList[idx]; - var pts = isPolyline ? getPolylinePoints(coords, coordSys) - : getCubicPointsOnPlane(coords, coordSys, normal); - data.setItemLayout(idx, pts); - }); -} - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerLayout(function (ecModel, api) { - ecModel.eachSeriesByType('lines3D', function (seriesModel) { - var coordSys = seriesModel.coordinateSystem; - if (coordSys.type === 'globe') { - layoutGlobe(seriesModel, coordSys); - } - else if (coordSys.type === 'geo3D') { - layoutOnPlane(seriesModel, coordSys, [0, 1, 0]); - } - else if (coordSys.type === 'mapbox3D' || coordSys.type === 'maptalks3D') { - layoutOnPlane(seriesModel, coordSys, [0, 0, 1]); - } - }); -}); - -/***/ }), -/* 245 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_geometry_Lines3D__ = __webpack_require__(25); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__TrailMesh2__ = __webpack_require__(246); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_shader_lines3D_glsl_js__ = __webpack_require__(46); - - - -// import TrailMesh from './TrailMesh'; - - - -__WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Shader.import(__WEBPACK_IMPORTED_MODULE_4__util_shader_lines3D_glsl_js__["a" /* default */]); - -function getCoordSysSize(coordSys) { - if (coordSys.radius != null) { - return coordSys.radius; - } - if (coordSys.size != null) { - return Math.max(coordSys.size[0], coordSys.size[1], coordSys.size[2]); - } - else { - return 100; - } -} - -/* unused harmony default export */ var _unused_webpack_default_export = (__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendChartView({ - - type: 'lines3D', - - __ecgl__: true, - - init: function (ecModel, api) { - this.groupGL = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Node(); - - this._meshLinesMaterial = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Material({ - shader: __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].createShader('ecgl.meshLines3D'), - transparent: true, - depthMask: false - }); - this._linesMesh = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Mesh({ - geometry: new __WEBPACK_IMPORTED_MODULE_2__util_geometry_Lines3D__["a" /* default */](), - material: this._meshLinesMaterial, - $ignorePicking: true - }); - - // this._trailMesh = new TrailMesh(); - this._trailMesh = new __WEBPACK_IMPORTED_MODULE_3__TrailMesh2__["a" /* default */](); - }, - - render: function (seriesModel, ecModel, api) { - - this.groupGL.add(this._linesMesh); - - var coordSys = seriesModel.coordinateSystem; - var data = seriesModel.getData(); - - if (coordSys && coordSys.viewGL) { - var viewGL = coordSys.viewGL; - viewGL.add(this.groupGL); - - this._updateLines(seriesModel, ecModel, api); - - var methodName = coordSys.viewGL.isLinearSpace() ? 'define' : 'undefine'; - this._linesMesh.material[methodName]('fragment', 'SRGB_DECODE'); - this._trailMesh.material[methodName]('fragment', 'SRGB_DECODE'); - } - - var trailMesh = this._trailMesh; - trailMesh.stopAnimation(); - - if (seriesModel.get('effect.show')) { - this.groupGL.add(trailMesh); - - trailMesh.updateData(data, api, this._linesMesh.geometry); - - trailMesh.__time = trailMesh.__time || 0; - var time = 3600 * 1000; // 1hour - this._curveEffectsAnimator = trailMesh.animate('', { loop: true }) - .when(time, { - __time: time - }) - .during(function () { - trailMesh.setAnimationTime(trailMesh.__time); - }) - .start(); - } - else { - this.groupGL.remove(trailMesh); - this._curveEffectsAnimator = null; - } - - this._linesMesh.material.blend = this._trailMesh.material.blend - = seriesModel.get('blendMode') === 'lighter' - ? __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].additiveBlend : null; - }, - - pauseEffect: function () { - if (this._curveEffectsAnimator) { - this._curveEffectsAnimator.pause(); - } - }, - - resumeEffect: function () { - if (this._curveEffectsAnimator) { - this._curveEffectsAnimator.resume(); - } - }, - - toggleEffect: function () { - var animator = this._curveEffectsAnimator; - if (animator) { - animator.isPaused() ? animator.resume() : animator.pause(); - } - }, - - _updateLines: function (seriesModel, ecModel, api) { - var data = seriesModel.getData(); - var coordSys = seriesModel.coordinateSystem; - var geometry = this._linesMesh.geometry; - var isPolyline = seriesModel.get('polyline'); - - geometry.expandLine = true; - - var size = getCoordSysSize(coordSys); - geometry.segmentScale = size / 20; - - var lineWidthQueryPath = 'lineStyle.width'.split('.'); - var dpr = api.getDevicePixelRatio(); - var maxLineWidth = 0; - data.each(function (idx) { - var itemModel = data.getItemModel(idx); - var lineWidth = itemModel.get(lineWidthQueryPath); - if (lineWidth == null) { - lineWidth = 1; - } - data.setItemVisual(idx, 'lineWidth', lineWidth); - maxLineWidth = Math.max(lineWidth, maxLineWidth); - }); - - // Must set useNativeLine before calling any other methods - geometry.useNativeLine = false; - - var nVertex = 0; - var nTriangle = 0; - data.each(function (idx) { - var pts = data.getItemLayout(idx); - if (isPolyline) { - nVertex += geometry.getPolylineVertexCount(pts); - nTriangle += geometry.getPolylineTriangleCount(pts); - } - else { - nVertex += geometry.getCubicCurveVertexCount(pts[0], pts[1], pts[2], pts[3]); - nTriangle += geometry.getCubicCurveTriangleCount(pts[0], pts[1], pts[2], pts[3]); - } - }); - - geometry.setVertexCount(nVertex); - geometry.setTriangleCount(nTriangle); - geometry.resetOffset(); - - var colorArr = []; - data.each(function (idx) { - var pts = data.getItemLayout(idx); - var color = data.getItemVisual(idx, 'color'); - var opacity = data.getItemVisual(idx, 'opacity'); - var lineWidth = data.getItemVisual(idx, 'lineWidth') * dpr; - if (opacity == null) { - opacity = 1; - } - - colorArr = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor(color, colorArr); - colorArr[3] *= opacity; - if (isPolyline) { - geometry.addPolyline(pts, colorArr, lineWidth); - } - else { - geometry.addCubicCurve(pts[0], pts[1], pts[2], pts[3], colorArr, lineWidth); - } - }); - - geometry.dirty(); - }, - - remove: function () { - this.groupGL.removeAll(); - }, - - dispose: function () { - this.groupGL.removeAll(); - } -})); - -/***/ }), -/* 246 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_claygl_src_dep_glmatrix__ = __webpack_require__(6); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_geometry_Lines3D__ = __webpack_require__(25); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__shader_trail2_glsl_js__ = __webpack_require__(247); - - - - - - - -var vec3 = __WEBPACK_IMPORTED_MODULE_2_claygl_src_dep_glmatrix__["a" /* default */].vec3; - -function sign(a) { - return a > 0 ? 1 : -1; -} - -__WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Shader.import(__WEBPACK_IMPORTED_MODULE_4__shader_trail2_glsl_js__["a" /* default */]); - -/* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Mesh.extend(function () { - - var material = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Material({ - shader: new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Shader( - __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Shader.source('ecgl.trail2.vertex'), - __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Shader.source('ecgl.trail2.fragment') - ), - transparent: true, - depthMask: false - }); - - var geometry = new __WEBPACK_IMPORTED_MODULE_3__util_geometry_Lines3D__["a" /* default */]({ - dynamic: true - }); - geometry.createAttribute('dist', 'float', 1); - geometry.createAttribute('distAll', 'float', 1); - geometry.createAttribute('start', 'float', 1); - - return { - geometry: geometry, - material: material, - culling: false, - $ignorePicking: true - }; -}, { - - updateData: function (data, api, lines3DGeometry) { - var seriesModel = data.hostModel; - var geometry = this.geometry; - - var effectModel = seriesModel.getModel('effect'); - var size = effectModel.get('trailWidth') * api.getDevicePixelRatio(); - var trailLength = effectModel.get('trailLength'); - - var speed = seriesModel.get('effect.constantSpeed'); - var period = seriesModel.get('effect.period') * 1000; - var useConstantSpeed = speed != null; - - if (true) { - if (!this.getScene()) { - console.error('TrailMesh must been add to scene before updateData'); - } - } - - useConstantSpeed - ? this.material.set('speed', speed / 1000) - : this.material.set('period', period); - - this.material[useConstantSpeed ? 'define' : 'undefine']('vertex', 'CONSTANT_SPEED'); - - var isPolyline = seriesModel.get('polyline'); - - geometry.trailLength = trailLength; - this.material.set('trailLength', trailLength); - - geometry.resetOffset(); - - ['position', 'positionPrev', 'positionNext'].forEach(function (attrName) { - geometry.attributes[attrName].value = lines3DGeometry.attributes[attrName].value; - }); - - var extraAttrs = ['dist', 'distAll', 'start', 'offset', 'color']; - - extraAttrs.forEach(function (attrName) { - geometry.attributes[attrName].init(geometry.vertexCount); - }); - geometry.indices = lines3DGeometry.indices; - - var colorArr = []; - var effectColor = effectModel.get('trailColor'); - var effectOpacity = effectModel.get('trailOpacity'); - var hasEffectColor = effectColor != null; - var hasEffectOpacity = effectOpacity != null; - - this.updateWorldTransform(); - var xScale = this.worldTransform.x.len(); - var yScale = this.worldTransform.y.len(); - var zScale = this.worldTransform.z.len(); - - var vertexOffset = 0; - - var maxDistance = 0; - - data.each(function (idx) { - var pts = data.getItemLayout(idx); - var opacity = hasEffectOpacity ? effectOpacity : data.getItemVisual(idx, 'opacity'); - var color = data.getItemVisual(idx, 'color'); - - if (opacity == null) { - opacity = 1; - } - colorArr = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor(hasEffectColor ? effectColor : color, colorArr); - colorArr[3] *= opacity; - - var vertexCount = isPolyline - ? lines3DGeometry.getPolylineVertexCount(pts) - : lines3DGeometry.getCubicCurveVertexCount(pts[0], pts[1], pts[2], pts[3]) - - var dist = 0; - var pos = []; - var posPrev = []; - for (var i = vertexOffset; i < vertexOffset + vertexCount; i++) { - geometry.attributes.position.get(i, pos); - pos[0] *= xScale; - pos[1] *= yScale; - pos[2] *= zScale; - if (i > vertexOffset) { - dist += vec3.dist(pos, posPrev); - } - geometry.attributes.dist.set(i, dist); - vec3.copy(posPrev, pos); - } - - maxDistance = Math.max(maxDistance, dist); - - var randomStart = Math.random() * (useConstantSpeed ? dist : period); - for (var i = vertexOffset; i < vertexOffset + vertexCount; i++) { - geometry.attributes.distAll.set(i, dist); - geometry.attributes.start.set(i, randomStart); - - geometry.attributes.offset.set( - i, sign(lines3DGeometry.attributes.offset.get(i)) * size / 2 - ); - geometry.attributes.color.set(i, colorArr); - } - - vertexOffset += vertexCount; - }); - - this.material.set('spotSize', maxDistance * 0.1 * trailLength); - this.material.set('spotIntensity', effectModel.get('spotIntensity')); - - geometry.dirty(); - }, - - setAnimationTime: function (time) { - this.material.set('time', time); - } -})); - -/***/ }), -/* 247 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export ecgl.trail2.vertex\nattribute vec3 position: POSITION;\nattribute vec3 positionPrev;\nattribute vec3 positionNext;\nattribute float offset;\nattribute float dist;\nattribute float distAll;\nattribute float start;\n\nattribute vec4 a_Color : COLOR;\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform vec4 viewport : VIEWPORT;\nuniform float near : NEAR;\n\nuniform float speed : 0;\nuniform float trailLength: 0.3;\nuniform float time;\nuniform float period: 1000;\n\nuniform float spotSize: 1;\n\nvarying vec4 v_Color;\nvarying float v_Percent;\nvarying float v_SpotPercent;\n\n@import ecgl.common.wireframe.vertexHeader\n\n@import ecgl.lines3D.clipNear\n\nvoid main()\n{\n @import ecgl.lines3D.expandLine\n\n gl_Position = currProj;\n\n v_Color = a_Color;\n\n @import ecgl.common.wireframe.vertexMain\n\n#ifdef CONSTANT_SPEED\n float t = mod((speed * time + start) / distAll, 1. + trailLength) - trailLength;\n#else\n float t = mod((time + start) / period, 1. + trailLength) - trailLength;\n#endif\n\n float trailLen = distAll * trailLength;\n\n v_Percent = (dist - t * distAll) / trailLen;\n\n v_SpotPercent = spotSize / distAll;\n\n }\n@end\n\n\n@export ecgl.trail2.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nuniform float spotIntensity: 5;\n\nvarying vec4 v_Color;\nvarying float v_Percent;\nvarying float v_SpotPercent;\n\n@import ecgl.common.wireframe.fragmentHeader\n\n@import clay.util.srgb\n\nvoid main()\n{\n if (v_Percent > 1.0 || v_Percent < 0.0) {\n discard;\n }\n\n float fade = v_Percent;\n\n#ifdef SRGB_DECODE\n gl_FragColor = sRGBToLinear(color * v_Color);\n#else\n gl_FragColor = color * v_Color;\n#endif\n\n @import ecgl.common.wireframe.fragmentMain\n\n if (v_Percent > (1.0 - v_SpotPercent)) {\n gl_FragColor.rgb *= spotIntensity;\n }\n\n gl_FragColor.a *= fade;\n}\n\n@end"); - - -/***/ }), -/* 248 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); - - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendSeriesModel({ - - type: 'series.lines3D', - - dependencies: ['globe'], - - visualColorAccessPath: 'lineStyle.color', - - getInitialData: function (option, ecModel) { - var lineData = new __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.List(['value'], this); - lineData.hasItemOption = false; - lineData.initData(option.data, [], function (dataItem, dimName, dataIndex, dimIndex) { - // dataItem is simply coords - if (dataItem instanceof Array) { - return NaN; - } - else { - lineData.hasItemOption = true; - var value = dataItem.value; - if (value != null) { - return value instanceof Array ? value[dimIndex] : value; - } - } - }); - - return lineData; - }, - - defaultOption: { - - coordinateSystem: 'globe', - - globeIndex: 0, - - geo3DIndex: 0, - - zlevel: -10, - - polyline: false, - - effect: { - show: false, - period: 4, - // Trail width - trailWidth: 4, - trailLength: 0.2, - - spotIntensity: 6 - }, - - silent: true, - - // Support source-over, lighter - blendMode: 'source-over', - - lineStyle: { - width: 1, - opacity: 0.5 - // color - } - } -}); - -/***/ }), -/* 249 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__polygons3D_Polygons3DSeries__ = __webpack_require__(250); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__polygons3D_Polygons3DView__ = __webpack_require__(251); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_opacityVisual__ = __webpack_require__(17); - - - - - - - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerVisual(Object(__WEBPACK_IMPORTED_MODULE_3__common_opacityVisual__["a" /* default */])('polygons3D')); - -/***/ }), -/* 250 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__component_common_componentShadingMixin__ = __webpack_require__(31); - - - -function transformPolygon(coordSys, poly) { - var ret = []; - for (var i = 0; i < poly.length; i++) { - ret.push(coordSys.dataToPoint(poly[i])); - } - return ret; -} - -var Polygons3DSeries = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendSeriesModel({ - - type: 'series.polygons3D', - - getRegionModel: function (idx) { - return this.getData().getItemModel(idx); - }, - - getRegionPolygonCoords: function (idx) { - var coordSys = this.coordinateSystem; - var itemModel = this.getData().getItemModel(idx); - var coords = itemModel.option instanceof Array - ? itemModel.option : itemModel.getShallow('coords'); - if (!itemModel.get('multiPolygon')) { - coords = [coords]; - } - // TODO Validate - var out = []; - for (var i = 0; i < coords.length; i++) { - // TODO Convert here ? - var interiors = []; - for (var k = 1; k < coords[i].length; k++) { - interiors.push(transformPolygon(coordSys, coords[i][k])); - } - out.push({ - exterior: transformPolygon(coordSys, coords[i][0]), - interiors: interiors - }); - } - return out; - }, - - getInitialData: function (option) { - var polygonsData = new __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.List(['value'], this); - polygonsData.hasItemOption = false; - polygonsData.initData(option.data, [], function (dataItem, dimName, dataIndex, dimIndex) { - // dataItem is simply coords - if (dataItem instanceof Array) { - return NaN; - } - else { - polygonsData.hasItemOption = true; - var value = dataItem.value; - if (value != null) { - return value instanceof Array ? value[dimIndex] : value; - } - } - }); - - return polygonsData; - }, - - defaultOption: { - - show: true, - - data: null, - - multiPolygon: false, - - progressiveThreshold: 1e3, - progressive: 1e3, - - zlevel: -10, - - label: { - show: false, - // Distance in 3d space. - distance: 2, - - textStyle: { - fontSize: 20, - color: '#000', - backgroundColor: 'rgba(255,255,255,0.7)', - padding: 3, - borderRadius: 4 - } - }, - - itemStyle: { - color: '#fff', - borderWidth: 0, - borderColor: '#333' - }, - - emphasis: { - itemStyle: { - color: '#639fc0' - }, - label: { - show: true - } - } - } -}); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(Polygons3DSeries.prototype, __WEBPACK_IMPORTED_MODULE_1__component_common_componentShadingMixin__["a" /* default */]); - -/* unused harmony default export */ var _unused_webpack_default_export = (Polygons3DSeries); - -/***/ }), -/* 251 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__component_common_Geo3DBuilder__ = __webpack_require__(64); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_graphicGL__ = __webpack_require__(1); - - - - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendChartView({ - - type: 'polygons3D', - - __ecgl__: true, - - init: function (ecModel, api) { - this.groupGL = new __WEBPACK_IMPORTED_MODULE_2__util_graphicGL__["a" /* default */].Node(); - - this._geo3DBuilderList = []; - - this._currentStep = 0; - }, - - render: function (seriesModel, ecModel, api) { - this.groupGL.removeAll(); - - var coordSys = seriesModel.coordinateSystem; - if (coordSys && coordSys.viewGL) { - coordSys.viewGL.add(this.groupGL); - } - - var geo3DBuilder = this._geo3DBuilderList[0]; - if (!geo3DBuilder) { - geo3DBuilder = new __WEBPACK_IMPORTED_MODULE_1__component_common_Geo3DBuilder__["a" /* default */](api); - geo3DBuilder.extrudeY = coordSys.type !== 'mapbox3D' - && coordSys.type !== 'maptalks3D'; - this._geo3DBuilderList[0] = geo3DBuilder; - } - this._updateShaderDefines(coordSys, geo3DBuilder); - - geo3DBuilder.update(seriesModel, ecModel, api); - this._geo3DBuilderList.length = 1; - - this.groupGL.add(geo3DBuilder.rootNode); - }, - - incrementalPrepareRender: function (seriesModel, ecModel, api) { - this.groupGL.removeAll(); - - var coordSys = seriesModel.coordinateSystem; - if (coordSys && coordSys.viewGL) { - coordSys.viewGL.add(this.groupGL); - } - - this._currentStep = 0; - }, - - incrementalRender: function (params, seriesModel, ecModel, api) { - var geo3DBuilder = this._geo3DBuilderList[this._currentStep]; - var coordSys = seriesModel.coordinateSystem; - if (!geo3DBuilder) { - geo3DBuilder = new __WEBPACK_IMPORTED_MODULE_1__component_common_Geo3DBuilder__["a" /* default */](api); - geo3DBuilder.extrudeY = coordSys.type !== 'mapbox3D' - && coordSys.type !== 'maptalks3D'; - this._geo3DBuilderList[this._currentStep] = geo3DBuilder; - } - geo3DBuilder.update(seriesModel, ecModel, api, params.start, params.end); - this.groupGL.add(geo3DBuilder.rootNode); - - this._updateShaderDefines(coordSys, geo3DBuilder); - - this._currentStep++; - }, - - _updateShaderDefines: function (coordSys, geo3DBuilder) { - var methodName = coordSys.viewGL.isLinearSpace() ? 'define' : 'undefine'; - geo3DBuilder.rootNode.traverse(function (mesh) { - if (mesh.material) { - mesh.material[methodName]('fragment', 'SRGB_DECODE'); - - // FIXME - if (coordSys.type === 'mapbox3D' || coordSys.type === 'maptalks3D') { - mesh.material.define('fragment', 'NORMAL_UP_AXIS', 2); - mesh.material.define('fragment', 'NORMAL_FRONT_AXIS', 1); - } - } - }); - }, - - remove: function () { - this.groupGL.removeAll(); - }, - - dispose: function () { - this.groupGL.removeAll(); - } -}); - -/***/ }), -/* 252 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__surface_SurfaceSeries__ = __webpack_require__(253); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__surface_SurfaceView__ = __webpack_require__(254); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__surface_surfaceLayout__ = __webpack_require__(255); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_opacityVisual__ = __webpack_require__(17); - - - - - - - - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerVisual(Object(__WEBPACK_IMPORTED_MODULE_4__common_opacityVisual__["a" /* default */])('surface')); - - -/***/ }), -/* 253 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__component_common_componentShadingMixin__ = __webpack_require__(31); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__common_formatTooltip__ = __webpack_require__(39); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_createList__ = __webpack_require__(50); - - - - - -var SurfaceSeries = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendSeriesModel({ - - type: 'series.surface', - - dependencies: ['globe', 'grid3D', 'geo3D'], - - visualColorAccessPath: 'itemStyle.color', - - formatTooltip: function (dataIndex) { - return Object(__WEBPACK_IMPORTED_MODULE_2__common_formatTooltip__["a" /* default */])(this, dataIndex); - }, - - getInitialData: function (option, ecModel) { - var data = option.data; - - function validateDimension(dimOpts) { - return !(isNaN(dimOpts.min) || isNaN(dimOpts.max) || isNaN(dimOpts.step)); - } - - function getPrecision(dimOpts) { - var getPrecision = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.number.getPrecisionSafe; - return Math.max( - getPrecision(dimOpts.min), getPrecision(dimOpts.max), getPrecision(dimOpts.step) - ) + 1; - } - - if (!data) { - if (!option.parametric) { - // From surface equation - var equation = option.equation || {}; - var xOpts = equation.x || {}; - var yOpts = equation.y || {}; - - ['x', 'y'].forEach(function (dim) { - if (!validateDimension(equation[dim])) { - if (true) { - console.error('Invalid equation.%s', dim); - } - return; - } - }); - if (typeof equation.z !== 'function') { - if (true) { - console.error('equation.z needs to be function'); - } - return; - } - var xCount = Math.floor((xOpts.max + xOpts.step - xOpts.min) / xOpts.step); - var yCount = Math.floor((yOpts.max + yOpts.step - yOpts.min) / yOpts.step); - data = new Float32Array(xCount * yCount * 3); - - var xPrecision = getPrecision(xOpts); - var yPrecision = getPrecision(yOpts); - - var off = 0; - for (var j = 0; j < yCount; j++) { - for (var i = 0; i < xCount; i++) { - var x = i * xOpts.step + xOpts.min; - var y = j * yOpts.step + yOpts.min; - var x2 = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.number.round(Math.min(x, xOpts.max), xPrecision); - var y2 = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.number.round(Math.min(y, yOpts.max), yPrecision); - var z = equation.z(x2, y2); - data[off++] = x2; - data[off++] = y2; - data[off++] = z; - } - } - } - else { - var parametricEquation = option.parametricEquation || {}; - var uOpts = parametricEquation.u || {}; - var vOpts = parametricEquation.v || {}; - - ['u', 'v'].forEach(function (dim) { - if (!validateDimension(parametricEquation[dim])) { - if (true) { - console.error('Invalid parametricEquation.%s', dim); - } - return; - } - }); - ['x', 'y', 'z'].forEach(function (dim) { - if (typeof parametricEquation[dim] !== 'function') { - if (true) { - console.error('parametricEquation.%s needs to be function', dim); - } - return; - } - }); - - var uCount = Math.floor((uOpts.max + uOpts.step - uOpts.min) / uOpts.step); - var vCount = Math.floor((vOpts.max + vOpts.step - vOpts.min) / vOpts.step); - data = new Float32Array(uCount * vCount * 5); - - - var uPrecision = getPrecision(uOpts); - var vPrecision = getPrecision(vOpts); - var off = 0; - for (var j = 0; j < vCount; j++) { - for (var i = 0; i < uCount; i++) { - var u = i * uOpts.step + uOpts.min; - var v = j * vOpts.step + vOpts.min; - var u2 = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.number.round(Math.min(u, uOpts.max), uPrecision); - var v2 = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.number.round(Math.min(v, vOpts.max), vPrecision); - var x = parametricEquation.x(u2, v2); - var y = parametricEquation.y(u2, v2); - var z = parametricEquation.z(u2, v2); - data[off++] = x; - data[off++] = y; - data[off++] = z; - data[off++] = u2; - data[off++] = v2; - } - } - } - } - - var dims = ['x', 'y', 'z']; - if (option.parametric) { - dims.push('u', 'v'); - } - // PENDING getSource? - var list = Object(__WEBPACK_IMPORTED_MODULE_3__common_createList__["a" /* default */])(this, dims, data); - return list; - }, - - defaultOption: { - coordinateSystem: 'cartesian3D', - zlevel: -10, - - // Cartesian coordinate system - grid3DIndex: 0, - - // Surface needs lambert shading to show the difference - shading: 'lambert', - - // If parametric surface - parametric: false, - - wireframe: { - show: true, - - lineStyle: { - color: 'rgba(0,0,0,0.5)', - width: 1 - } - }, - /** - * Generate surface data from z = f(x, y) equation - */ - equation: { - // [min, max, step] - x: { - min: -1, - max: 1, - step: 0.1 - }, - y: { - min: -1, - max: 1, - step: 0.1 - }, - z: null - }, - - parametricEquation: { - // [min, max, step] - u: { - min: -1, - max: 1, - step: 0.1 - }, - v: { - min: -1, - max: 1, - step: 0.1 - }, - // [x, y, z] = f(x, y) - x: null, - y: null, - z: null - }, - - itemStyle: { - // Color - }, - - animationDurationUpdate: 500 - } -}); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(SurfaceSeries.prototype, __WEBPACK_IMPORTED_MODULE_1__component_common_componentShadingMixin__["a" /* default */]); - -/* unused harmony default export */ var _unused_webpack_default_export = (SurfaceSeries); - -/***/ }), -/* 254 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_retrieve__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_claygl_src_dep_glmatrix__ = __webpack_require__(6); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_geometry_trianglesSortMixin__ = __webpack_require__(65); - - - - - - -var vec3 = __WEBPACK_IMPORTED_MODULE_3_claygl_src_dep_glmatrix__["a" /* default */].vec3; - -function isPointsNaN(pt) { - return isNaN(pt[0]) || isNaN(pt[1]) || isNaN(pt[2]); -} - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendChartView({ - - type: 'surface', - - __ecgl__: true, - - init: function (ecModel, api) { - - this.groupGL = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Node(); - }, - - render: function (seriesModel, ecModel, api) { - // Swap surfaceMesh - var tmp = this._prevSurfaceMesh; - this._prevSurfaceMesh = this._surfaceMesh; - this._surfaceMesh = tmp; - - if (!this._surfaceMesh) { - this._surfaceMesh = this._createSurfaceMesh(); - } - - this.groupGL.remove(this._prevSurfaceMesh); - this.groupGL.add(this._surfaceMesh); - - var coordSys = seriesModel.coordinateSystem; - var shading = seriesModel.get('shading'); - var data = seriesModel.getData(); - - var shadingPrefix = 'ecgl.' + shading; - if (!this._surfaceMesh.material || this._surfaceMesh.material.shader.name !== shadingPrefix) { - this._surfaceMesh.material = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].createMaterial(shadingPrefix, ['VERTEX_COLOR', 'DOUBLE_SIDED']); - } - - __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].setMaterialFromModel( - shading, this._surfaceMesh.material, seriesModel, api - ); - - if (coordSys && coordSys.viewGL) { - coordSys.viewGL.add(this.groupGL); - var methodName = coordSys.viewGL.isLinearSpace() ? 'define' : 'undefine'; - this._surfaceMesh.material[methodName]('fragment', 'SRGB_DECODE'); - } - - var isParametric = seriesModel.get('parametric'); - - var dataShape = this._getDataShape(data, isParametric); - - var wireframeModel = seriesModel.getModel('wireframe'); - var wireframeLineWidth = wireframeModel.get('lineStyle.width'); - var showWireframe = wireframeModel.get('show') && wireframeLineWidth > 0; - this._updateSurfaceMesh(this._surfaceMesh, seriesModel, dataShape, showWireframe); - - var material = this._surfaceMesh.material; - if (showWireframe) { - material.define('WIREFRAME_QUAD'); - material.set('wireframeLineWidth', wireframeLineWidth); - material.set('wireframeLineColor', __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor(wireframeModel.get('lineStyle.color'))); - } - else { - material.undefine('WIREFRAME_QUAD'); - } - - this._initHandler(seriesModel, api); - - this._updateAnimation(seriesModel); - }, - - _updateAnimation: function (seriesModel) { - __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].updateVertexAnimation( - [['prevPosition', 'position'], - ['prevNormal', 'normal']], - this._prevSurfaceMesh, - this._surfaceMesh, - seriesModel - ); - }, - - _createSurfaceMesh: function () { - var mesh = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Mesh({ - geometry: new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Geometry({ - dynamic: true, - sortTriangles: true - }), - shadowDepthMaterial: new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Material({ - shader: new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Shader(__WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Shader.source('ecgl.sm.depth.vertex'), __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Shader.source('ecgl.sm.depth.fragment')) - }), - culling: false, - // Render after axes - renderOrder: 10, - // Render normal in normal pass - renderNormal: true - }); - mesh.geometry.createAttribute('barycentric', 'float', 4); - mesh.geometry.createAttribute('prevPosition', 'float', 3); - mesh.geometry.createAttribute('prevNormal', 'float', 3); - - __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.extend(mesh.geometry, __WEBPACK_IMPORTED_MODULE_4__util_geometry_trianglesSortMixin__["a" /* default */]); - - return mesh; - }, - - _initHandler: function (seriesModel, api) { - var data = seriesModel.getData(); - var surfaceMesh = this._surfaceMesh; - - var coordSys = seriesModel.coordinateSystem; - - function getNearestPointIdx(triangle, point) { - var nearestDist = Infinity; - var nearestIdx = -1; - var pos = []; - for (var i = 0; i < triangle.length; i++) { - surfaceMesh.geometry.attributes.position.get(triangle[i], pos); - var dist = vec3.dist(point.array, pos); - if (dist < nearestDist) { - nearestDist = dist; - nearestIdx = triangle[i]; - } - } - return nearestIdx; - } - - surfaceMesh.seriesIndex = seriesModel.seriesIndex; - - var lastDataIndex = -1; - - surfaceMesh.off('mousemove'); - surfaceMesh.off('mouseout'); - surfaceMesh.on('mousemove', function (e) { - var idx = getNearestPointIdx(e.triangle, e.point); - if (idx >= 0) { - var point = []; - surfaceMesh.geometry.attributes.position.get(idx, point); - var value = coordSys.pointToData(point); - - var minDist = Infinity; - var dataIndex = -1; - var item = []; - for (var i = 0; i < data.count(); i++) { - item[0] = data.get('x', i); - item[1] = data.get('y', i); - item[2] = data.get('z', i); - var dist = vec3.squaredDistance(item, value); - if (dist < minDist) { - dataIndex = i; - minDist = dist; - } - } - - if (dataIndex !== lastDataIndex) { - api.dispatchAction({ - type: 'grid3DShowAxisPointer', - value: value - }); - } - - lastDataIndex = dataIndex; - surfaceMesh.dataIndex = dataIndex; - } - else { - surfaceMesh.dataIndex = -1; - } - }, this); - surfaceMesh.on('mouseout', function (e) { - lastDataIndex = -1; - surfaceMesh.dataIndex = -1; - - api.dispatchAction({ - type: 'grid3DHideAxisPointer' - }); - }, this); - }, - - _updateSurfaceMesh: function (surfaceMesh, seriesModel, dataShape, showWireframe) { - - var geometry = surfaceMesh.geometry; - var data = seriesModel.getData(); - var pointsArr = data.getLayout('points'); - - var invalidDataCount = 0; - data.each(function (idx) { - if (!data.hasValue(idx)) { - invalidDataCount++; - } - }); - var needsSplitQuad = invalidDataCount || showWireframe; - - var positionAttr = geometry.attributes.position; - var normalAttr = geometry.attributes.normal; - var texcoordAttr = geometry.attributes.texcoord0; - var barycentricAttr = geometry.attributes.barycentric; - var colorAttr = geometry.attributes.color; - var row = dataShape.row; - var column = dataShape.column; - var shading = seriesModel.get('shading'); - var needsNormal = shading !== 'color'; - - if (needsSplitQuad) { - // TODO, If needs remove the invalid points, or set color transparent. - var vertexCount = (row - 1) * (column - 1) * 4; - positionAttr.init(vertexCount); - if (showWireframe) { - barycentricAttr.init(vertexCount); - } - } - else { - positionAttr.value = new Float32Array(pointsArr); - } - colorAttr.init(geometry.vertexCount); - texcoordAttr.init(geometry.vertexCount); - - var quadToTriangle = [0, 3, 1, 1, 3, 2]; - // 3----2 - // 0----1 - // Make sure pixels on 1---3 edge will not have channel 0. - // And pixels on four edges have at least one channel 0. - var quadBarycentric = [ - [1, 1, 0, 0], - [0, 1, 0, 1], - [1, 0, 0, 1], - [1, 0, 1, 0] - ]; - - var indices = geometry.indices = new (geometry.vertexCount > 0xffff ? Uint32Array : Uint16Array)((row - 1) * (column - 1) * 6); - var getQuadIndices = function (i, j, out) { - out[1] = i * column + j; - out[0] = i * column + j + 1; - out[3] = (i + 1) * column + j + 1; - out[2] = (i + 1) * column + j; - }; - - var isTransparent = false; - - if (needsSplitQuad) { - var quadIndices = []; - var pos = []; - var faceOffset = 0; - - if (needsNormal) { - normalAttr.init(geometry.vertexCount); - } - else { - normalAttr.value = null; - } - - var pts = [[], [], []]; - var v21 = [], v32 = []; - var normal = vec3.create(); - - var getFromArray = function (arr, idx, out) { - var idx3 = idx * 3; - out[0] = arr[idx3]; - out[1] = arr[idx3 + 1]; - out[2] = arr[idx3 + 2]; - return out; - }; - var vertexNormals = new Float32Array(pointsArr.length); - var vertexColors = new Float32Array(pointsArr.length / 3 * 4); - - for (var i = 0; i < data.count(); i++) { - if (data.hasValue(i)) { - var rgbaArr = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor(data.getItemVisual(i, 'color')); - var opacity = data.getItemVisual(i, 'opacity'); - rgbaArr[3] *= opacity; - if (rgbaArr[3] < 0.99) { - isTransparent = true; - } - for (var k = 0; k < 4; k++) { - vertexColors[i * 4 + k] = rgbaArr[k]; - } - } - } - var farPoints = [1e7, 1e7, 1e7]; - for (var i = 0; i < row - 1; i++) { - for (var j = 0; j < column - 1; j++) { - var dataIndex = i * (column - 1) + j; - var vertexOffset = dataIndex * 4; - - getQuadIndices(i, j, quadIndices); - - var invisibleQuad = false; - for (var k = 0; k < 4; k++) { - getFromArray(pointsArr, quadIndices[k], pos); - if (isPointsNaN(pos)) { - // Quad is invisible if any point is NaN - invisibleQuad = true; - } - } - - for (var k = 0; k < 4; k++) { - if (invisibleQuad) { - // Move point far away - positionAttr.set(vertexOffset + k, farPoints); - } - else { - getFromArray(pointsArr, quadIndices[k], pos); - positionAttr.set(vertexOffset + k, pos); - } - if (showWireframe) { - barycentricAttr.set(vertexOffset + k, quadBarycentric[k]); - } - } - for (var k = 0; k < 6; k++) { - indices[faceOffset++] = quadToTriangle[k] + vertexOffset; - } - // Vertex normals - if (needsNormal && !invisibleQuad) { - for (var k = 0; k < 2; k++) { - var k3 = k * 3; - - for (var m = 0; m < 3; m++) { - var idx = quadIndices[quadToTriangle[k3] + m]; - getFromArray(pointsArr, idx, pts[m]); - } - - vec3.sub(v21, pts[0], pts[1]); - vec3.sub(v32, pts[1], pts[2]); - vec3.cross(normal, v21, v32); - // Weighted by the triangle area - for (var m = 0; m < 3; m++) { - var idx3 = quadIndices[quadToTriangle[k3] + m] * 3; - vertexNormals[idx3] = vertexNormals[idx3] + normal[0]; - vertexNormals[idx3 + 1] = vertexNormals[idx3 + 1] + normal[1]; - vertexNormals[idx3 + 2] = vertexNormals[idx3 + 2] + normal[2]; - } - } - } - - } - } - if (needsNormal) { - for (var i = 0; i < vertexNormals.length / 3; i++) { - getFromArray(vertexNormals, i, normal); - vec3.normalize(normal, normal); - vertexNormals[i * 3] = normal[0]; - vertexNormals[i * 3 + 1] = normal[1]; - vertexNormals[i * 3 + 2] = normal[2]; - } - } - // Split normal and colors, write to the attributes. - var rgbaArr = []; - var uvArr = []; - for (var i = 0; i < row - 1; i++) { - for (var j = 0; j < column - 1; j++) { - var dataIndex = i * (column - 1) + j; - var vertexOffset = dataIndex * 4; - - getQuadIndices(i, j, quadIndices); - for (var k = 0; k < 4; k++) { - for (var m = 0; m < 4; m++) { - rgbaArr[m] = vertexColors[quadIndices[k] * 4 + m]; - } - colorAttr.set(vertexOffset + k, rgbaArr); - - if (needsNormal) { - getFromArray(vertexNormals, quadIndices[k], normal); - normalAttr.set(vertexOffset + k, normal); - } - - var idx = quadIndices[k]; - uvArr[0] = (idx % column) / (column - 1); - uvArr[1] = Math.floor(idx / column) / (row - 1); - texcoordAttr.set(vertexOffset + k, uvArr); - } - dataIndex++; - } - } - } - else { - var uvArr = []; - for (var i = 0; i < data.count(); i++) { - uvArr[0] = (i % column) / (column - 1); - uvArr[1] = Math.floor(i / column) / (row - 1); - var rgbaArr = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor(data.getItemVisual(i, 'color')); - var opacity = data.getItemVisual(i, 'opacity'); - rgbaArr[3] *= opacity; - if (rgbaArr[3] < 0.99) { - isTransparent = true; - } - colorAttr.set(i, rgbaArr); - texcoordAttr.set(i, uvArr); - } - var quadIndices = []; - // Triangles - var cursor = 0; - for (var i = 0; i < row - 1; i++) { - for (var j = 0; j < column - 1; j++) { - - getQuadIndices(i, j, quadIndices); - - for (var k = 0; k < 6; k++) { - indices[cursor++] = quadIndices[quadToTriangle[k]]; - } - } - } - if (needsNormal) { - geometry.generateVertexNormals(); - } - else { - normalAttr.value = null; - } - } - if (surfaceMesh.material.get('normalMap')) { - geometry.generateTangents(); - } - - - geometry.updateBoundingBox(); - geometry.dirty(); - - surfaceMesh.material.transparent = isTransparent; - surfaceMesh.material.depthMask = !isTransparent; - }, - - _getDataShape: function (data, isParametric) { - - var prevX = -Infinity; - var rowCount = 0; - var columnCount = 0; - var prevColumnCount = 0; - - var rowDim = isParametric ? 'u' : 'x'; - - // Check data format - for (var i = 0; i < data.count(); i++) { - var x = data.get(rowDim, i); - if (x < prevX) { - if (prevColumnCount && prevColumnCount !== columnCount) { - if (true) { - throw new Error('Invalid data. data should be a row major 2d array.') - } - } - // A new row. - prevColumnCount = columnCount; - columnCount = 0; - rowCount++; - } - prevX = x; - columnCount++; - } - - return { - row: rowCount + 1, - column: columnCount - }; - }, - - dispose: function () { - this.groupGL.removeAll(); - }, - - remove: function () { - this.groupGL.removeAll(); - } -}); - -/***/ }), -/* 255 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); - - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerLayout(function (ecModel, api) { - ecModel.eachSeriesByType('surface', function (surfaceModel) { - var cartesian = surfaceModel.coordinateSystem; - if (!cartesian || cartesian.type !== 'cartesian3D') { - if (true) { - console.error('Surface chart only support cartesian3D coordinateSystem'); - } - } - var data = surfaceModel.getData(); - var points = new Float32Array(3 * data.count()); - var nanPoint = [NaN, NaN, NaN]; - - if (cartesian && cartesian.type === 'cartesian3D') { - var coordDims = cartesian.dimensions; - var dims = coordDims.map(function (coordDim) { - return surfaceModel.coordDimToDataDim(coordDim)[0]; - }); - data.each(dims, function (x, y, z, idx) { - var pt; - if (!data.hasValue(idx)) { - pt = nanPoint; - } - else { - pt = cartesian.dataToPoint([x, y, z]); - } - points[idx * 3] = pt[0]; - points[idx * 3 + 1] = pt[1]; - points[idx * 3 + 2] = pt[2]; - }); - } - data.setLayout('points', points); - }); -}); - -/***/ }), -/* 256 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__coord_geo3D_Geo3D__ = __webpack_require__(99); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__map3D_Map3DSeries__ = __webpack_require__(257); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__map3D_Map3DView__ = __webpack_require__(258); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_opacityVisual__ = __webpack_require__(17); - - - - - - - - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerVisual(Object(__WEBPACK_IMPORTED_MODULE_4__common_opacityVisual__["a" /* default */])('map3D')); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerAction({ - type: 'map3DChangeCamera', - event: 'map3dcamerachanged', - update: 'series:updateCamera' -}, function (payload, ecModel) { - ecModel.eachComponent({ - mainType: 'series', subType: 'map3D', query: payload - }, function (componentModel) { - componentModel.setView(payload); - }); -}); - -/***/ }), -/* 257 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__component_common_componentViewControlMixin__ = __webpack_require__(44); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__component_common_componentPostEffectMixin__ = __webpack_require__(28); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__component_common_componentLightMixin__ = __webpack_require__(29); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__component_common_componentShadingMixin__ = __webpack_require__(31); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__coord_geo3D_geo3DModelMixin__ = __webpack_require__(96); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__util_format__ = __webpack_require__(32); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__common_formatTooltip__ = __webpack_require__(39); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__coord_geo3DCreator__ = __webpack_require__(98); - - - - - - - - - - -function transformPolygon(mapbox3DCoordSys, poly) { - var newPoly = []; - for (var k = 0; k < poly.length; k++) { - newPoly.push(mapbox3DCoordSys.dataToPoint(poly[k])); - } - return newPoly; -} - -var Map3DSeries = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendSeriesModel({ - - type: 'series.map3D', - - layoutMode: 'box', - - coordinateSystem: null, - - visualColorAccessPath: 'itemStyle.color', - - optionUpdated: function (newOpt) { - newOpt = newOpt || {}; - var coordSysType = this.get('coordinateSystem'); - if (coordSysType == null || coordSysType === 'geo3D') { - return; - } - - if (true) { - var propsNeedToCheck = [ - 'left', 'top', 'width', 'height', - 'boxWidth', 'boxDepth', 'boxHeight', - 'light', 'viewControl', 'postEffect', 'temporalSuperSampling', - 'environment', 'groundPlane' - ]; - var ignoredProperties = []; - propsNeedToCheck.forEach(function (propName) { - if (newOpt[propName] != null) { - ignoredProperties.push(propName); - } - }); - if (ignoredProperties.length) { - console.warn( - 'Property %s in map3D series will be ignored if coordinate system is %s', - ignoredProperties.join(', '), coordSysType - ); - } - } - - if (this.get('groundPlane.show')) { - // Force disable groundPlane if map3D has other coordinate systems. - this.option.groundPlane.show = false; - } - - // Reset geo. - this._geo = null; - }, - - getInitialData: function (option) { - option.data = this.getFilledRegions(option.data, option.map); - - var dimensions = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.helper.completeDimensions(['value'], option.data); - var list = new __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.List(dimensions, this); - list.initData(option.data); - - var regionModelMap = {}; - list.each(function (idx) { - var name = list.getName(idx); - var itemModel = list.getItemModel(idx); - regionModelMap[name] = itemModel; - }); - - this._regionModelMap = regionModelMap; - - return list; - }, - - formatTooltip: function (dataIndex) { - return Object(__WEBPACK_IMPORTED_MODULE_7__common_formatTooltip__["a" /* default */])(this, dataIndex); - }, - - getRegionModel: function (idx) { - var name = this.getData().getName(idx); - return this._regionModelMap[name] || new __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.Model(null, this); - }, - - getRegionPolygonCoords: function (idx) { - var coordSys = this.coordinateSystem; - var name = this.getData().getName(idx); - if (coordSys.transform) { - var region = coordSys.getRegion(name); - return region ? region.geometries : []; - } - else { - if (!this._geo) { - this._geo = __WEBPACK_IMPORTED_MODULE_8__coord_geo3DCreator__["a" /* default */].createGeo3D(this); - } - var region = this._geo.getRegion(name); - var ret = []; - for (var k = 0; k < region.geometries.length; k++) { - var geo = region.geometries[k]; - var interiors = []; - var exterior = transformPolygon(coordSys, geo.exterior); - if (interiors && interiors.length) { - for (var m = 0; m < geo.interiors.length; m++) { - interiors.push(transformPolygon(coordSys, interiors[m])); - } - } - ret.push({ - interiors: interiors, - exterior: exterior - }); - } - return ret; - } - }, - - /** - * Format label - * @param {string} name Region name - * @param {string} [status='normal'] 'normal' or 'emphasis' - * @return {string} - */ - getFormattedLabel: function (dataIndex, status) { - var text = __WEBPACK_IMPORTED_MODULE_6__util_format__["a" /* default */].getFormattedLabel(this, dataIndex, status); - if (text == null) { - text = this.getData().getName(dataIndex); - } - return text; - }, - - defaultOption: { - // Support geo3D, mapbox, maptalks3D - coordinateSystem: 'geo3D', - // itemStyle: {}, - // height, - // label: {} - data: null - } -}); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(Map3DSeries.prototype, __WEBPACK_IMPORTED_MODULE_5__coord_geo3D_geo3DModelMixin__["a" /* default */]); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(Map3DSeries.prototype, __WEBPACK_IMPORTED_MODULE_1__component_common_componentViewControlMixin__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(Map3DSeries.prototype, __WEBPACK_IMPORTED_MODULE_2__component_common_componentPostEffectMixin__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(Map3DSeries.prototype, __WEBPACK_IMPORTED_MODULE_3__component_common_componentLightMixin__["a" /* default */]); -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.merge(Map3DSeries.prototype, __WEBPACK_IMPORTED_MODULE_4__component_common_componentShadingMixin__["a" /* default */]); - -/* unused harmony default export */ var _unused_webpack_default_export = (Map3DSeries); - -/***/ }), -/* 258 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_OrbitControl__ = __webpack_require__(45); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__component_common_SceneHelper__ = __webpack_require__(30); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__component_common_Geo3DBuilder__ = __webpack_require__(64); - - - - - - - -/* unused harmony default export */ var _unused_webpack_default_export = (__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendChartView({ - - type: 'map3D', - - __ecgl__: true, - - init: function (ecModel, api) { - this._geo3DBuilder = new __WEBPACK_IMPORTED_MODULE_4__component_common_Geo3DBuilder__["a" /* default */](api); - this.groupGL = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Node(); - }, - - render: function (map3DModel, ecModel, api) { - - var coordSys = map3DModel.coordinateSystem; - - if (!coordSys || !coordSys.viewGL) { - return; - } - - this.groupGL.add(this._geo3DBuilder.rootNode); - coordSys.viewGL.add(this.groupGL); - - var geo3D; - if (coordSys.type === 'geo3D') { - geo3D = coordSys; - - if (!this._sceneHelper) { - this._sceneHelper = new __WEBPACK_IMPORTED_MODULE_3__component_common_SceneHelper__["a" /* default */](); - this._sceneHelper.initLight(this.groupGL); - } - - this._sceneHelper.setScene(coordSys.viewGL.scene); - this._sceneHelper.updateLight(map3DModel); - - // Set post effect - coordSys.viewGL.setPostEffect(map3DModel.getModel('postEffect'), api); - coordSys.viewGL.setTemporalSuperSampling(map3DModel.getModel('temporalSuperSampling')); - - var control = this._control; - if (!control) { - control = this._control = new __WEBPACK_IMPORTED_MODULE_2__util_OrbitControl__["a" /* default */]({ - zr: api.getZr() - }); - this._control.init(); - } - var viewControlModel = map3DModel.getModel('viewControl'); - control.setViewGL(coordSys.viewGL); - control.setFromViewControlModel(viewControlModel, 0); - - control.off('update'); - control.on('update', function () { - api.dispatchAction({ - type: 'map3DChangeCamera', - alpha: control.getAlpha(), - beta: control.getBeta(), - distance: control.getDistance(), - from: this.uid, - map3DId: map3DModel.id - }); - }); - - this._geo3DBuilder.extrudeY = true; - } - else { - if (this._control) { - this._control.dispose(); - this._control = null; - } - if (this._sceneHelper) { - this._sceneHelper.dispose(); - this._sceneHelper = null; - } - geo3D = map3DModel.getData().getLayout('geo3D'); - - this._geo3DBuilder.extrudeY = false; - } - - this._geo3DBuilder.update(map3DModel, ecModel, api, 0, map3DModel.getData().count()); - - - // Must update after geo3D.viewGL.setPostEffect to determine linear space - var srgbDefineMethod = coordSys.viewGL.isLinearSpace() ? 'define' : 'undefine'; - this._geo3DBuilder.rootNode.traverse(function (mesh) { - if (mesh.material) { - mesh.material[srgbDefineMethod]('fragment', 'SRGB_DECODE'); - } - }); - }, - - afterRender: function (map3DModel, ecModel, api, layerGL) { - var renderer = layerGL.renderer; - var coordSys = map3DModel.coordinateSystem; - if (coordSys && coordSys.type === 'geo3D') { - this._sceneHelper.updateAmbientCubemap(renderer, map3DModel, api); - this._sceneHelper.updateSkybox(renderer, map3DModel, api); - } - }, - - dispose: function () { - this.groupGL.removeAll(); - this._control.dispose(); - } -})); - -/***/ }), -/* 259 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__scatterGL_ScatterGLSeries__ = __webpack_require__(260); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__scatterGL_ScatterGLView__ = __webpack_require__(261); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_echarts_lib_visual_symbol__ = __webpack_require__(51); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_echarts_lib_visual_symbol___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_echarts_lib_visual_symbol__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_opacityVisual__ = __webpack_require__(17); - - - - - - - - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerVisual(__WEBPACK_IMPORTED_MODULE_3_echarts_lib_visual_symbol___default()('scatterGL', 'circle', null)); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerVisual(Object(__WEBPACK_IMPORTED_MODULE_4__common_opacityVisual__["a" /* default */])('scatterGL')); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerLayout({ - seriesType: 'scatterGL', - reset: function (seriesModel) { - var coordSys = seriesModel.coordinateSystem; - - var progress; - if (coordSys) { - var dims = coordSys.dimensions; - var pt = []; - if (dims.length === 1) { - progress = function (params, data) { - var points = new Float32Array((params.end - params.start) * 2); - for (var idx = params.start; idx < params.end; idx++) { - var offset = (idx - params.start) * 2; - var x = data.get(dims[0], idx); - var pt = coordSys.dataToPoint(x); - points[offset] = pt[0]; - points[offset + 1] = pt[1]; - } - data.setLayout('points', points); - }; - } - else if (dims.length === 2) { - progress = function (params, data) { - var points = new Float32Array((params.end - params.start) * 2); - for (var idx = params.start; idx < params.end; idx++) { - var offset = (idx - params.start) * 2; - var x = data.get(dims[0], idx); - var y = data.get(dims[1], idx); - pt[0] = x; - pt[1] = y; - - pt = coordSys.dataToPoint(pt); - points[offset] = pt[0]; - points[offset + 1] = pt[1]; - } - data.setLayout('points', points); - }; - } - } - - return { progress: progress }; - } -}); - -/***/ }), -/* 260 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); - - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendSeriesModel({ - - type: 'series.scatterGL', - - dependencies: ['grid', 'polar', 'geo', 'singleAxis'], - - visualColorAccessPath: 'itemStyle.color', - - getInitialData: function () { - return __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.helper.createList(this); - }, - - defaultOption: { - coordinateSystem: 'cartesian2d', - zlevel: 10, - - progressive: 1e5, - progressiveThreshold: 1e5, - - // Cartesian coordinate system - // xAxisIndex: 0, - // yAxisIndex: 0, - - // Polar coordinate system - // polarIndex: 0, - - // Geo coordinate system - // geoIndex: 0, - - large: false, - - symbol: 'circle', - symbolSize: 10, - - // symbolSize scale when zooming. - zoomScale: 0, - - // Support source-over, lighter - blendMode: 'source-over', - - itemStyle: { - opacity: 0.8 - }, - - - postEffect: { - enable: false, - colorCorrection: { - exposure: 0, - brightness: 0, - contrast: 1, - saturation: 1, - enable: true - } - } - - } -}); - -/***/ }), -/* 261 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__core_ViewGL__ = __webpack_require__(22); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_PointsBuilder__ = __webpack_require__(67); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_GLViewHelper__ = __webpack_require__(103); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__util_retrieve__ = __webpack_require__(2); - - - - - - - - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendChartView({ - - type: 'scatterGL', - - __ecgl__: true, - - init: function (ecModel, api) { - - this.groupGL = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Node(); - this.viewGL = new __WEBPACK_IMPORTED_MODULE_2__core_ViewGL__["a" /* default */]('orthographic'); - - this.viewGL.add(this.groupGL); - - this._pointsBuilderList = []; - this._currentStep = 0; - - this._sizeScale = 1; - - this._glViewHelper = new __WEBPACK_IMPORTED_MODULE_4__common_GLViewHelper__["a" /* default */](this.viewGL); - }, - - render: function (seriesModel, ecModel, api) { - this.groupGL.removeAll(); - this._glViewHelper.reset(seriesModel, api); - - if (!seriesModel.getData().count()) { - return; - } - - var pointsBuilder = this._pointsBuilderList[0]; - if (!pointsBuilder) { - pointsBuilder = this._pointsBuilderList[0] = new __WEBPACK_IMPORTED_MODULE_3__common_PointsBuilder__["a" /* default */](true, api); - } - this._pointsBuilderList.length = 1; - - this.groupGL.add(pointsBuilder.rootNode); - - this._removeTransformInPoints(seriesModel.getData().getLayout('points')); - pointsBuilder.update(seriesModel, ecModel, api); - - this.viewGL.setPostEffect(seriesModel.getModel('postEffect'), api); - }, - - incrementalPrepareRender: function (seriesModel, ecModel, api) { - this.groupGL.removeAll(); - this._glViewHelper.reset(seriesModel, api); - - this._currentStep = 0; - - this.viewGL.setPostEffect(seriesModel.getModel('postEffect'), api); - }, - - incrementalRender: function (params, seriesModel, ecModel, api) { - if (params.end <= params.start) { - return; - } - - var pointsBuilder = this._pointsBuilderList[this._currentStep]; - if (!pointsBuilder) { - pointsBuilder = new __WEBPACK_IMPORTED_MODULE_3__common_PointsBuilder__["a" /* default */](true, api); - this._pointsBuilderList[this._currentStep] = pointsBuilder; - } - this.groupGL.add(pointsBuilder.rootNode); - - this._removeTransformInPoints(seriesModel.getData().getLayout('points')); - - pointsBuilder.setSizeScale(this._sizeScale); - pointsBuilder.update(seriesModel, ecModel, api, params.start, params.end); - - api.getZr().refresh(); - - this._currentStep++; - }, - - updateTransform: function (seriesModel, ecModel, api) { - if (seriesModel.coordinateSystem.getRoamTransform) { - this._glViewHelper.updateTransform(seriesModel, api); - - var zoom = this._glViewHelper.getZoom(); - var sizeScale = Math.max((seriesModel.get('zoomScale') || 0) * (zoom - 1) + 1, 0); - this._sizeScale = sizeScale; - - this._pointsBuilderList.forEach(function (pointsBuilder) { - pointsBuilder.setSizeScale(sizeScale); - }); - } - }, - - _removeTransformInPoints: function (points) { - if (!points) { - return; - } - var pt = []; - for (var i = 0; i < points.length; i += 2) { - pt[0] = points[i]; - pt[1] = points[i + 1]; - this._glViewHelper.removeTransformInPoint(pt); - points[i] = pt[0]; - points[i + 1] = pt[1]; - } - }, - - - dispose: function () { - this.groupGL.removeAll(); - }, - - remove: function () { - this.groupGL.removeAll(); - } -}); - -/***/ }), -/* 262 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__graphGL_GraphGLSeries__ = __webpack_require__(263); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__graphGL_GraphGLView__ = __webpack_require__(268); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_echarts_lib_visual_symbol__ = __webpack_require__(51); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_echarts_lib_visual_symbol___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_echarts_lib_visual_symbol__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_opacityVisual__ = __webpack_require__(17); - - - - - - - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerVisual(__WEBPACK_IMPORTED_MODULE_3_echarts_lib_visual_symbol___default()('graphGL', 'circle', null)); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerVisual(Object(__WEBPACK_IMPORTED_MODULE_4__common_opacityVisual__["a" /* default */])('graphGL')); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerVisual(function (ecModel) { - var paletteScope = {}; - ecModel.eachSeriesByType('graphGL', function (seriesModel) { - var categoriesData = seriesModel.getCategoriesData(); - var data = seriesModel.getData(); - - var categoryNameIdxMap = {}; - - categoriesData.each(function (idx) { - var name = categoriesData.getName(idx); - categoryNameIdxMap[name] = idx; - - var itemModel = categoriesData.getItemModel(idx); - var color = itemModel.get('itemStyle.color') - || seriesModel.getColorFromPalette(name, paletteScope); - categoriesData.setItemVisual(idx, 'color', color); - }); - - // Assign category color to visual - if (categoriesData.count()) { - data.each(function (idx) { - var model = data.getItemModel(idx); - var category = model.getShallow('category'); - if (category != null) { - if (typeof category === 'string') { - category = categoryNameIdxMap[category]; - } - if (!data.getItemVisual(idx, 'color', true)) { - data.setItemVisual( - idx, 'color', - categoriesData.getItemVisual(category, 'color') - ); - } - } - }); - } - }); -}); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerVisual(function (ecModel) { - ecModel.eachSeriesByType('graphGL', function (seriesModel) { - var graph = seriesModel.getGraph(); - var edgeData = seriesModel.getEdgeData(); - - var colorQuery = 'lineStyle.color'.split('.'); - var opacityQuery = 'lineStyle.opacity'.split('.'); - - edgeData.setVisual('color', seriesModel.get(colorQuery)); - edgeData.setVisual('opacity', seriesModel.get(opacityQuery)); - - edgeData.each(function (idx) { - var itemModel = edgeData.getItemModel(idx); - var edge = graph.getEdgeByIndex(idx); - // Edge visual must after node visual - var color = itemModel.get(colorQuery); - var opacity = itemModel.get(opacityQuery); - switch (color) { - case 'source': - color = edge.node1.getVisual('color'); - break; - case 'target': - color = edge.node2.getVisual('color'); - break; - } - - edge.setVisual('color', color); - edge.setVisual('opacity', opacity); - }); - }); -}); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerAction({ - type: 'graphGLRoam', - event: 'graphglroam', - update: 'series.graphGL:roam' -}, function (payload, ecModel) { - ecModel.eachComponent({ - mainType: 'series', query: payload - }, function (componentModel) { - componentModel.setView(payload); - }); -}); - -function noop() {} - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerAction({ - type: 'graphGLStartLayout', - event: 'graphgllayoutstarted', - update: 'series.graphGL:startLayout' -}, noop); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerAction({ - type: 'graphGLStopLayout', - event: 'graphgllayoutstopped', - update: 'series.graphGL:stopLayout' -}, noop); - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerAction({ - type: 'graphGLFocusNodeAdjacency', - event: 'graphGLFocusNodeAdjacency', - update: 'series.graphGL:focusNodeAdjacency' -}, noop); - - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerAction({ - type: 'graphGLUnfocusNodeAdjacency', - event: 'graphGLUnfocusNodeAdjacency', - update: 'series.graphGL:unfocusNodeAdjacency' -}, noop); - -/***/ }), -/* 263 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__createGraphFromNodeEdge__ = __webpack_require__(264); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_format__ = __webpack_require__(32); - - - - -var GraphSeries = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendSeriesModel({ - - type: 'series.graphGL', - - visualColorAccessPath: 'itemStyle.color', - - init: function (option) { - GraphSeries.superApply(this, 'init', arguments); - - // Provide data for legend select - this.legendDataProvider = function () { - return this._categoriesData; - }; - - this._updateCategoriesData(); - }, - - mergeOption: function (option) { - GraphSeries.superApply(this, 'mergeOption', arguments); - - this._updateCategoriesData(); - }, - - getFormattedLabel: function (dataIndex, status, dataType, dimIndex) { - var text = __WEBPACK_IMPORTED_MODULE_2__util_format__["a" /* default */].getFormattedLabel(this, dataIndex, status, dataType, dimIndex); - if (text == null) { - var data = this.getData(); - var lastDim = data.dimensions[data.dimensions.length - 1]; - text = data.get(lastDim, dataIndex); - } - return text; - }, - - getInitialData: function (option, ecModel) { - var edges = option.edges || option.links || []; - var nodes = option.data || option.nodes || []; - var self = this; - - if (nodes && edges) { - return Object(__WEBPACK_IMPORTED_MODULE_1__createGraphFromNodeEdge__["a" /* default */])(nodes, edges, this, true, beforeLink).data; - } - - function beforeLink(nodeData, edgeData) { - // Overwrite nodeData.getItemModel to - nodeData.wrapMethod('getItemModel', function (model) { - var categoriesModels = self._categoriesModels; - var categoryIdx = model.getShallow('category'); - var categoryModel = categoriesModels[categoryIdx]; - if (categoryModel) { - categoryModel.parentModel = model.parentModel; - model.parentModel = categoryModel; - } - return model; - }); - - var edgeLabelModel = self.getModel('edgeLabel'); - // For option `edgeLabel` can be found by label.xxx.xxx on item mode. - var fakeSeriesModel = new __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.Model( - { label: edgeLabelModel.option }, - edgeLabelModel.parentModel, - ecModel - ); - - edgeData.wrapMethod('getItemModel', function (model) { - model.customizeGetParent(edgeGetParent); - return model; - }); - - function edgeGetParent(path) { - path = this.parsePath(path); - return (path && path[0] === 'label') - ? fakeSeriesModel - : this.parentModel; - } - } - }, - - /** - * @return {module:echarts/data/Graph} - */ - getGraph: function () { - return this.getData().graph; - }, - - /** - * @return {module:echarts/data/List} - */ - getEdgeData: function () { - return this.getGraph().edgeData; - }, - - /** - * @return {module:echarts/data/List} - */ - getCategoriesData: function () { - return this._categoriesData; - }, - - /** - * @override - */ - formatTooltip: function (dataIndex, multipleSeries, dataType) { - if (dataType === 'edge') { - var nodeData = this.getData(); - var params = this.getDataParams(dataIndex, dataType); - var edge = nodeData.graph.getEdgeByIndex(dataIndex); - var sourceName = nodeData.getName(edge.node1.dataIndex); - var targetName = nodeData.getName(edge.node2.dataIndex); - - var html = []; - sourceName != null && html.push(sourceName); - targetName != null && html.push(targetName); - html = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.format.encodeHTML(html.join(' > ')); - - if (params.value) { - html += ' : ' + __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.format.encodeHTML(params.value); - } - return html; - } - else { // dataType === 'node' or empty - return GraphSeries.superApply(this, 'formatTooltip', arguments); - } - }, - - _updateCategoriesData: function () { - var categories = (this.option.categories || []).map(function (category) { - // Data must has value - return category.value != null ? category : __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.extend({ - value: 0 - }, category); - }); - var categoriesData = new __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.List(['value'], this); - categoriesData.initData(categories); - - this._categoriesData = categoriesData; - - this._categoriesModels = categoriesData.mapArray(function (idx) { - return categoriesData.getItemModel(idx, true); - }); - }, - - setView: function (payload) { - if (payload.zoom != null) { - this.option.zoom = payload.zoom; - } - if (payload.offset != null) { - this.option.offset = payload.offset; - } - }, - - setNodePosition: function (points) { - for (var i = 0; i < points.length / 2; i++) { - var x = points[i * 2]; - var y = points[i * 2 + 1]; - - var opt = this.getData().getRawDataItem(i); - opt.x = x; - opt.y = y; - } - }, - - isAnimationEnabled: function () { - return GraphSeries.superCall(this, 'isAnimationEnabled') - // Not enable animation when do force layout - && !(this.get('layout') === 'force' && this.get('force.layoutAnimation')); - }, - - defaultOption: { - zlevel: 10, - z: 2, - - legendHoverLink: true, - - // Only support forceAtlas2 - layout: 'forceAtlas2', - - // Configuration of force directed layout - forceAtlas2: { - initLayout: null, - - GPU: true, - - steps: 1, - - // barnesHutOptimize - - // Maxp layout steps. - maxSteps: 1000, - - repulsionByDegree: true, - linLogMode: false, - strongGravityMode: false, - gravity: 1.0, - // scaling: 1.0, - - edgeWeightInfluence: 1.0, - - // Edge weight range. - edgeWeight: [1, 4], - // Node weight range. - nodeWeight: [1, 4], - - // jitterTolerence: 0.1, - preventOverlap: false, - gravityCenter: null - }, - - focusNodeAdjacency: true, - - focusNodeAdjacencyOn: 'mouseover', - - left: 'center', - top: 'center', - // right: null, - // bottom: null, - // width: '80%', - // height: '80%', - - symbol: 'circle', - symbolSize: 5, - - roam: false, - - // Default on center of graph - center: null, - - zoom: 1, - - // categories: [], - - // data: [] - // Or - // nodes: [] - // - // links: [] - // Or - // edges: [] - - label: { - show: false, - formatter: '{b}', - position: 'right', - distance: 5, - textStyle: { - fontSize: 14 - } - }, - - itemStyle: {}, - - lineStyle: { - color: '#aaa', - width: 1, - opacity: 0.5 - }, - - emphasis: { - label: { - show: true - } - }, - - animation: false - } -}); - -/* unused harmony default export */ var _unused_webpack_default_export = (GraphSeries); - -/***/ }), -/* 264 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_echarts_lib_data_Graph__ = __webpack_require__(265); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_echarts_lib_data_Graph___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_echarts_lib_data_Graph__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_echarts_lib_data_helper_linkList__ = __webpack_require__(267); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_echarts_lib_data_helper_linkList___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_echarts_lib_data_helper_linkList__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_retrieve__ = __webpack_require__(2); - - - - - -/* harmony default export */ __webpack_exports__["a"] = (function (nodes, edges, hostModel, directed, beforeLink) { - var graph = new __WEBPACK_IMPORTED_MODULE_1_echarts_lib_data_Graph___default.a(directed); - for (var i = 0; i < nodes.length; i++) { - graph.addNode(__WEBPACK_IMPORTED_MODULE_3__util_retrieve__["a" /* default */].firstNotNull( - // Id, name, dataIndex - nodes[i].id, nodes[i].name, i - ), i); - } - - var linkNameList = []; - var validEdges = []; - var linkCount = 0; - for (var i = 0; i < edges.length; i++) { - var link = edges[i]; - var source = link.source; - var target = link.target; - // addEdge may fail when source or target not exists - if (graph.addEdge(source, target, linkCount)) { - validEdges.push(link); - linkNameList.push(__WEBPACK_IMPORTED_MODULE_3__util_retrieve__["a" /* default */].firstNotNull(link.id, source + ' > ' + target)); - linkCount++; - } - } - - var nodeData; - - // FIXME, support more coordinate systems. - var dimensionNames = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.helper.completeDimensions( - ['value'], nodes - ); - nodeData = new __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.List(dimensionNames, hostModel); - nodeData.initData(nodes); - - var edgeData = new __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.List(['value'], hostModel); - edgeData.initData(validEdges, linkNameList); - - beforeLink && beforeLink(nodeData, edgeData); - - __WEBPACK_IMPORTED_MODULE_2_echarts_lib_data_helper_linkList___default()({ - mainData: nodeData, - struct: graph, - structAttr: 'graph', - datas: {node: nodeData, edge: edgeData}, - datasAttr: {node: 'data', edge: 'edgeData'} - }); - - // Update dataIndex of nodes and edges because invalid edge may be removed - graph.update(); - - return graph; -});; - -/***/ }), -/* 265 */ -/***/ (function(module, exports, __webpack_require__) { - -var _config = __webpack_require__(104); - -var __DEV__ = _config.__DEV__; - -var zrUtil = __webpack_require__(13); - -var _clazz = __webpack_require__(266); - -var enableClassCheck = _clazz.enableClassCheck; - -/* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -*/ - -/** - * Graph data structure - * - * @module echarts/data/Graph - * @author Yi Shen(https://www.github.com/pissang) - */ -// id may be function name of Object, add a prefix to avoid this problem. -function generateNodeKey(id) { - return '_EC_' + id; -} -/** - * @alias module:echarts/data/Graph - * @constructor - * @param {boolean} directed - */ - - -var Graph = function (directed) { - /** - * 是否是有向图 - * @type {boolean} - * @private - */ - this._directed = directed || false; - /** - * @type {Array.} - * @readOnly - */ - - this.nodes = []; - /** - * @type {Array.} - * @readOnly - */ - - this.edges = []; - /** - * @type {Object.} - * @private - */ - - this._nodesMap = {}; - /** - * @type {Object.} - * @private - */ - - this._edgesMap = {}; - /** - * @type {module:echarts/data/List} - * @readOnly - */ - - this.data; - /** - * @type {module:echarts/data/List} - * @readOnly - */ - - this.edgeData; -}; - -var graphProto = Graph.prototype; -/** - * @type {string} - */ - -graphProto.type = 'graph'; -/** - * If is directed graph - * @return {boolean} - */ - -graphProto.isDirected = function () { - return this._directed; -}; -/** - * Add a new node - * @param {string} id - * @param {number} [dataIndex] - */ - - -graphProto.addNode = function (id, dataIndex) { - id = id || '' + dataIndex; - var nodesMap = this._nodesMap; - - if (nodesMap[generateNodeKey(id)]) { - return; - } - - var node = new Node(id, dataIndex); - node.hostGraph = this; - this.nodes.push(node); - nodesMap[generateNodeKey(id)] = node; - return node; -}; -/** - * Get node by data index - * @param {number} dataIndex - * @return {module:echarts/data/Graph~Node} - */ - - -graphProto.getNodeByIndex = function (dataIndex) { - var rawIdx = this.data.getRawIndex(dataIndex); - return this.nodes[rawIdx]; -}; -/** - * Get node by id - * @param {string} id - * @return {module:echarts/data/Graph.Node} - */ - - -graphProto.getNodeById = function (id) { - return this._nodesMap[generateNodeKey(id)]; -}; -/** - * Add a new edge - * @param {number|string|module:echarts/data/Graph.Node} n1 - * @param {number|string|module:echarts/data/Graph.Node} n2 - * @param {number} [dataIndex=-1] - * @return {module:echarts/data/Graph.Edge} - */ - - -graphProto.addEdge = function (n1, n2, dataIndex) { - var nodesMap = this._nodesMap; - var edgesMap = this._edgesMap; // PNEDING - - if (typeof n1 === 'number') { - n1 = this.nodes[n1]; - } - - if (typeof n2 === 'number') { - n2 = this.nodes[n2]; - } - - if (!Node.isInstance(n1)) { - n1 = nodesMap[generateNodeKey(n1)]; - } - - if (!Node.isInstance(n2)) { - n2 = nodesMap[generateNodeKey(n2)]; - } - - if (!n1 || !n2) { - return; - } - - var key = n1.id + '-' + n2.id; // PENDING - - if (edgesMap[key]) { - return; - } - - var edge = new Edge(n1, n2, dataIndex); - edge.hostGraph = this; - - if (this._directed) { - n1.outEdges.push(edge); - n2.inEdges.push(edge); - } - - n1.edges.push(edge); - - if (n1 !== n2) { - n2.edges.push(edge); - } - - this.edges.push(edge); - edgesMap[key] = edge; - return edge; -}; -/** - * Get edge by data index - * @param {number} dataIndex - * @return {module:echarts/data/Graph~Node} - */ - - -graphProto.getEdgeByIndex = function (dataIndex) { - var rawIdx = this.edgeData.getRawIndex(dataIndex); - return this.edges[rawIdx]; -}; -/** - * Get edge by two linked nodes - * @param {module:echarts/data/Graph.Node|string} n1 - * @param {module:echarts/data/Graph.Node|string} n2 - * @return {module:echarts/data/Graph.Edge} - */ - - -graphProto.getEdge = function (n1, n2) { - if (Node.isInstance(n1)) { - n1 = n1.id; - } - - if (Node.isInstance(n2)) { - n2 = n2.id; - } - - var edgesMap = this._edgesMap; - - if (this._directed) { - return edgesMap[n1 + '-' + n2]; - } else { - return edgesMap[n1 + '-' + n2] || edgesMap[n2 + '-' + n1]; - } -}; -/** - * Iterate all nodes - * @param {Function} cb - * @param {*} [context] - */ - - -graphProto.eachNode = function (cb, context) { - var nodes = this.nodes; - var len = nodes.length; - - for (var i = 0; i < len; i++) { - if (nodes[i].dataIndex >= 0) { - cb.call(context, nodes[i], i); - } - } -}; -/** - * Iterate all edges - * @param {Function} cb - * @param {*} [context] - */ - - -graphProto.eachEdge = function (cb, context) { - var edges = this.edges; - var len = edges.length; - - for (var i = 0; i < len; i++) { - if (edges[i].dataIndex >= 0 && edges[i].node1.dataIndex >= 0 && edges[i].node2.dataIndex >= 0) { - cb.call(context, edges[i], i); - } - } -}; -/** - * Breadth first traverse - * @param {Function} cb - * @param {module:echarts/data/Graph.Node} startNode - * @param {string} [direction='none'] 'none'|'in'|'out' - * @param {*} [context] - */ - - -graphProto.breadthFirstTraverse = function (cb, startNode, direction, context) { - if (!Node.isInstance(startNode)) { - startNode = this._nodesMap[generateNodeKey(startNode)]; - } - - if (!startNode) { - return; - } - - var edgeType = direction === 'out' ? 'outEdges' : direction === 'in' ? 'inEdges' : 'edges'; - - for (var i = 0; i < this.nodes.length; i++) { - this.nodes[i].__visited = false; - } - - if (cb.call(context, startNode, null)) { - return; - } - - var queue = [startNode]; - - while (queue.length) { - var currentNode = queue.shift(); - var edges = currentNode[edgeType]; - - for (var i = 0; i < edges.length; i++) { - var e = edges[i]; - var otherNode = e.node1 === currentNode ? e.node2 : e.node1; - - if (!otherNode.__visited) { - if (cb.call(context, otherNode, currentNode)) { - // Stop traversing - return; - } - - queue.push(otherNode); - otherNode.__visited = true; - } - } - } -}; // TODO -// graphProto.depthFirstTraverse = function ( -// cb, startNode, direction, context -// ) { -// }; -// Filter update - - -graphProto.update = function () { - var data = this.data; - var edgeData = this.edgeData; - var nodes = this.nodes; - var edges = this.edges; - - for (var i = 0, len = nodes.length; i < len; i++) { - nodes[i].dataIndex = -1; - } - - for (var i = 0, len = data.count(); i < len; i++) { - nodes[data.getRawIndex(i)].dataIndex = i; - } - - edgeData.filterSelf(function (idx) { - var edge = edges[edgeData.getRawIndex(idx)]; - return edge.node1.dataIndex >= 0 && edge.node2.dataIndex >= 0; - }); // Update edge - - for (var i = 0, len = edges.length; i < len; i++) { - edges[i].dataIndex = -1; - } - - for (var i = 0, len = edgeData.count(); i < len; i++) { - edges[edgeData.getRawIndex(i)].dataIndex = i; - } -}; -/** - * @return {module:echarts/data/Graph} - */ - - -graphProto.clone = function () { - var graph = new Graph(this._directed); - var nodes = this.nodes; - var edges = this.edges; - - for (var i = 0; i < nodes.length; i++) { - graph.addNode(nodes[i].id, nodes[i].dataIndex); - } - - for (var i = 0; i < edges.length; i++) { - var e = edges[i]; - graph.addEdge(e.node1.id, e.node2.id, e.dataIndex); - } - - return graph; -}; -/** - * @alias module:echarts/data/Graph.Node - */ - - -function Node(id, dataIndex) { - /** - * @type {string} - */ - this.id = id == null ? '' : id; - /** - * @type {Array.} - */ - - this.inEdges = []; - /** - * @type {Array.} - */ - - this.outEdges = []; - /** - * @type {Array.} - */ - - this.edges = []; - /** - * @type {module:echarts/data/Graph} - */ - - this.hostGraph; - /** - * @type {number} - */ - - this.dataIndex = dataIndex == null ? -1 : dataIndex; -} - -Node.prototype = { - constructor: Node, - - /** - * @return {number} - */ - degree: function () { - return this.edges.length; - }, - - /** - * @return {number} - */ - inDegree: function () { - return this.inEdges.length; - }, - - /** - * @return {number} - */ - outDegree: function () { - return this.outEdges.length; - }, - - /** - * @param {string} [path] - * @return {module:echarts/model/Model} - */ - getModel: function (path) { - if (this.dataIndex < 0) { - return; - } - - var graph = this.hostGraph; - var itemModel = graph.data.getItemModel(this.dataIndex); - return itemModel.getModel(path); - } -}; -/** - * 图边 - * @alias module:echarts/data/Graph.Edge - * @param {module:echarts/data/Graph.Node} n1 - * @param {module:echarts/data/Graph.Node} n2 - * @param {number} [dataIndex=-1] - */ - -function Edge(n1, n2, dataIndex) { - /** - * 节点1,如果是有向图则为源节点 - * @type {module:echarts/data/Graph.Node} - */ - this.node1 = n1; - /** - * 节点2,如果是有向图则为目标节点 - * @type {module:echarts/data/Graph.Node} - */ - - this.node2 = n2; - this.dataIndex = dataIndex == null ? -1 : dataIndex; -} -/** - * @param {string} [path] - * @return {module:echarts/model/Model} - */ - - -Edge.prototype.getModel = function (path) { - if (this.dataIndex < 0) { - return; - } - - var graph = this.hostGraph; - var itemModel = graph.edgeData.getItemModel(this.dataIndex); - return itemModel.getModel(path); -}; - -var createGraphDataProxyMixin = function (hostName, dataName) { - return { - /** - * @param {string=} [dimension='value'] Default 'value'. can be 'a', 'b', 'c', 'd', 'e'. - * @return {number} - */ - getValue: function (dimension) { - var data = this[hostName][dataName]; - return data.get(data.getDimension(dimension || 'value'), this.dataIndex); - }, - - /** - * @param {Object|string} key - * @param {*} [value] - */ - setVisual: function (key, value) { - this.dataIndex >= 0 && this[hostName][dataName].setItemVisual(this.dataIndex, key, value); - }, - - /** - * @param {string} key - * @return {boolean} - */ - getVisual: function (key, ignoreParent) { - return this[hostName][dataName].getItemVisual(this.dataIndex, key, ignoreParent); - }, - - /** - * @param {Object} layout - * @return {boolean} [merge=false] - */ - setLayout: function (layout, merge) { - this.dataIndex >= 0 && this[hostName][dataName].setItemLayout(this.dataIndex, layout, merge); - }, - - /** - * @return {Object} - */ - getLayout: function () { - return this[hostName][dataName].getItemLayout(this.dataIndex); - }, - - /** - * @return {module:zrender/Element} - */ - getGraphicEl: function () { - return this[hostName][dataName].getItemGraphicEl(this.dataIndex); - }, - - /** - * @return {number} - */ - getRawIndex: function () { - return this[hostName][dataName].getRawIndex(this.dataIndex); - } - }; -}; - -zrUtil.mixin(Node, createGraphDataProxyMixin('hostGraph', 'data')); -zrUtil.mixin(Edge, createGraphDataProxyMixin('hostGraph', 'edgeData')); -Graph.Node = Node; -Graph.Edge = Edge; -enableClassCheck(Node); -enableClassCheck(Edge); -var _default = Graph; -module.exports = _default; - -/***/ }), -/* 266 */ -/***/ (function(module, exports, __webpack_require__) { - -var _config = __webpack_require__(104); - -var __DEV__ = _config.__DEV__; - -var zrUtil = __webpack_require__(13); - -/* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -*/ -var TYPE_DELIMITER = '.'; -var IS_CONTAINER = '___EC__COMPONENT__CONTAINER___'; -/** - * Notice, parseClassType('') should returns {main: '', sub: ''} - * @public - */ - -function parseClassType(componentType) { - var ret = { - main: '', - sub: '' - }; - - if (componentType) { - componentType = componentType.split(TYPE_DELIMITER); - ret.main = componentType[0] || ''; - ret.sub = componentType[1] || ''; - } - - return ret; -} -/** - * @public - */ - - -function checkClassType(componentType) { - zrUtil.assert(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(componentType), 'componentType "' + componentType + '" illegal'); -} -/** - * @public - */ - - -function enableClassExtend(RootClass, mandatoryMethods) { - RootClass.$constructor = RootClass; - - RootClass.extend = function (proto) { - var superClass = this; - - var ExtendedClass = function () { - if (!proto.$constructor) { - superClass.apply(this, arguments); - } else { - proto.$constructor.apply(this, arguments); - } - }; - - zrUtil.extend(ExtendedClass.prototype, proto); - ExtendedClass.extend = this.extend; - ExtendedClass.superCall = superCall; - ExtendedClass.superApply = superApply; - zrUtil.inherits(ExtendedClass, this); - ExtendedClass.superClass = superClass; - return ExtendedClass; - }; -} - -var classBase = 0; -/** - * Can not use instanceof, consider different scope by - * cross domain or es module import in ec extensions. - * Mount a method "isInstance()" to Clz. - */ - -function enableClassCheck(Clz) { - var classAttr = ['__\0is_clz', classBase++, Math.random().toFixed(3)].join('_'); - Clz.prototype[classAttr] = true; - - Clz.isInstance = function (obj) { - return !!(obj && obj[classAttr]); - }; -} // superCall should have class info, which can not be fetch from 'this'. -// Consider this case: -// class A has method f, -// class B inherits class A, overrides method f, f call superApply('f'), -// class C inherits class B, do not overrides method f, -// then when method of class C is called, dead loop occured. - - -function superCall(context, methodName) { - var args = zrUtil.slice(arguments, 2); - return this.superClass.prototype[methodName].apply(context, args); -} - -function superApply(context, methodName, args) { - return this.superClass.prototype[methodName].apply(context, args); -} -/** - * @param {Object} entity - * @param {Object} options - * @param {boolean} [options.registerWhenExtend] - * @public - */ - - -function enableClassManagement(entity, options) { - options = options || {}; - /** - * Component model classes - * key: componentType, - * value: - * componentClass, when componentType is 'xxx' - * or Object., when componentType is 'xxx.yy' - * @type {Object} - */ - - var storage = {}; - - entity.registerClass = function (Clazz, componentType) { - if (componentType) { - checkClassType(componentType); - componentType = parseClassType(componentType); - - if (!componentType.sub) { - storage[componentType.main] = Clazz; - } else if (componentType.sub !== IS_CONTAINER) { - var container = makeContainer(componentType); - container[componentType.sub] = Clazz; - } - } - - return Clazz; - }; - - entity.getClass = function (componentMainType, subType, throwWhenNotFound) { - var Clazz = storage[componentMainType]; - - if (Clazz && Clazz[IS_CONTAINER]) { - Clazz = subType ? Clazz[subType] : null; - } - - if (throwWhenNotFound && !Clazz) { - throw new Error(!subType ? componentMainType + '.' + 'type should be specified.' : 'Component ' + componentMainType + '.' + (subType || '') + ' not exists. Load it first.'); - } - - return Clazz; - }; - - entity.getClassesByMainType = function (componentType) { - componentType = parseClassType(componentType); - var result = []; - var obj = storage[componentType.main]; - - if (obj && obj[IS_CONTAINER]) { - zrUtil.each(obj, function (o, type) { - type !== IS_CONTAINER && result.push(o); - }); - } else { - result.push(obj); - } - - return result; - }; - - entity.hasClass = function (componentType) { - // Just consider componentType.main. - componentType = parseClassType(componentType); - return !!storage[componentType.main]; - }; - /** - * @return {Array.} Like ['aa', 'bb'], but can not be ['aa.xx'] - */ - - - entity.getAllClassMainTypes = function () { - var types = []; - zrUtil.each(storage, function (obj, type) { - types.push(type); - }); - return types; - }; - /** - * If a main type is container and has sub types - * @param {string} mainType - * @return {boolean} - */ - - - entity.hasSubTypes = function (componentType) { - componentType = parseClassType(componentType); - var obj = storage[componentType.main]; - return obj && obj[IS_CONTAINER]; - }; - - entity.parseClassType = parseClassType; - - function makeContainer(componentType) { - var container = storage[componentType.main]; - - if (!container || !container[IS_CONTAINER]) { - container = storage[componentType.main] = {}; - container[IS_CONTAINER] = true; - } - - return container; - } - - if (options.registerWhenExtend) { - var originalExtend = entity.extend; - - if (originalExtend) { - entity.extend = function (proto) { - var ExtendedClass = originalExtend.call(this, proto); - return entity.registerClass(ExtendedClass, proto.type); - }; - } - } - - return entity; -} -/** - * @param {string|Array.} properties - */ - - -function setReadOnly(obj, properties) {// FIXME It seems broken in IE8 simulation of IE11 - // if (!zrUtil.isArray(properties)) { - // properties = properties != null ? [properties] : []; - // } - // zrUtil.each(properties, function (prop) { - // var value = obj[prop]; - // Object.defineProperty - // && Object.defineProperty(obj, prop, { - // value: value, writable: false - // }); - // zrUtil.isArray(obj[prop]) - // && Object.freeze - // && Object.freeze(obj[prop]); - // }); -} - -exports.parseClassType = parseClassType; -exports.enableClassExtend = enableClassExtend; -exports.enableClassCheck = enableClassCheck; -exports.enableClassManagement = enableClassManagement; -exports.setReadOnly = setReadOnly; - -/***/ }), -/* 267 */ -/***/ (function(module, exports, __webpack_require__) { - -var zrUtil = __webpack_require__(13); - -/* -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -*/ - -/** - * Link lists and struct (graph or tree) - */ -var each = zrUtil.each; -var DATAS = '\0__link_datas'; -var MAIN_DATA = '\0__link_mainData'; // Caution: -// In most case, either list or its shallow clones (see list.cloneShallow) -// is active in echarts process. So considering heap memory consumption, -// we do not clone tree or graph, but share them among list and its shallow clones. -// But in some rare case, we have to keep old list (like do animation in chart). So -// please take care that both the old list and the new list share the same tree/graph. - -/** - * @param {Object} opt - * @param {module:echarts/data/List} opt.mainData - * @param {Object} [opt.struct] For example, instance of Graph or Tree. - * @param {string} [opt.structAttr] designation: list[structAttr] = struct; - * @param {Object} [opt.datas] {dataType: data}, - * like: {node: nodeList, edge: edgeList}. - * Should contain mainData. - * @param {Object} [opt.datasAttr] {dataType: attr}, - * designation: struct[datasAttr[dataType]] = list; - */ - -function linkList(opt) { - var mainData = opt.mainData; - var datas = opt.datas; - - if (!datas) { - datas = { - main: mainData - }; - opt.datasAttr = { - main: 'data' - }; - } - - opt.datas = opt.mainData = null; - linkAll(mainData, datas, opt); // Porxy data original methods. - - each(datas, function (data) { - each(mainData.TRANSFERABLE_METHODS, function (methodName) { - data.wrapMethod(methodName, zrUtil.curry(transferInjection, opt)); - }); - }); // Beyond transfer, additional features should be added to `cloneShallow`. - - mainData.wrapMethod('cloneShallow', zrUtil.curry(cloneShallowInjection, opt)); // Only mainData trigger change, because struct.update may trigger - // another changable methods, which may bring about dead lock. - - each(mainData.CHANGABLE_METHODS, function (methodName) { - mainData.wrapMethod(methodName, zrUtil.curry(changeInjection, opt)); - }); // Make sure datas contains mainData. - - zrUtil.assert(datas[mainData.dataType] === mainData); -} - -function transferInjection(opt, res) { - if (isMainData(this)) { - // Transfer datas to new main data. - var datas = zrUtil.extend({}, this[DATAS]); - datas[this.dataType] = res; - linkAll(res, datas, opt); - } else { - // Modify the reference in main data to point newData. - linkSingle(res, this.dataType, this[MAIN_DATA], opt); - } - - return res; -} - -function changeInjection(opt, res) { - opt.struct && opt.struct.update(this); - return res; -} - -function cloneShallowInjection(opt, res) { - // cloneShallow, which brings about some fragilities, may be inappropriate - // to be exposed as an API. So for implementation simplicity we can make - // the restriction that cloneShallow of not-mainData should not be invoked - // outside, but only be invoked here. - each(res[DATAS], function (data, dataType) { - data !== res && linkSingle(data.cloneShallow(), dataType, res, opt); - }); - return res; -} -/** - * Supplement method to List. - * - * @public - * @param {string} [dataType] If not specified, return mainData. - * @return {module:echarts/data/List} - */ - - -function getLinkedData(dataType) { - var mainData = this[MAIN_DATA]; - return dataType == null || mainData == null ? mainData : mainData[DATAS][dataType]; -} - -function isMainData(data) { - return data[MAIN_DATA] === data; -} - -function linkAll(mainData, datas, opt) { - mainData[DATAS] = {}; - each(datas, function (data, dataType) { - linkSingle(data, dataType, mainData, opt); - }); -} - -function linkSingle(data, dataType, mainData, opt) { - mainData[DATAS][dataType] = data; - data[MAIN_DATA] = mainData; - data.dataType = dataType; - - if (opt.struct) { - data[opt.structAttr] = opt.struct; - opt.struct[opt.datasAttr[dataType]] = data; - } // Supplement method. - - - data.getLinkedData = getLinkedData; -} - -var _default = linkList; -module.exports = _default; - -/***/ }), -/* 268 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_echarts_lib_util_layout__ = __webpack_require__(47); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_echarts_lib_util_layout___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_echarts_lib_util_layout__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_graphicGL__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__core_ViewGL__ = __webpack_require__(22); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__util_geometry_Lines2D__ = __webpack_require__(105); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__util_retrieve__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__ForceAtlas2GPU__ = __webpack_require__(269); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__ForceAtlas2__ = __webpack_require__(271); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_zrender_lib_animation_requestAnimationFrame__ = __webpack_require__(80); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_zrender_lib_animation_requestAnimationFrame___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_8_zrender_lib_animation_requestAnimationFrame__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_claygl_src_dep_glmatrix__ = __webpack_require__(6); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__util_Roam2DControl__ = __webpack_require__(273); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__common_PointsBuilder__ = __webpack_require__(67); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__util_shader_lines2D_glsl_js__ = __webpack_require__(274); - - - - - - - - - - - -var vec2 = __WEBPACK_IMPORTED_MODULE_9_claygl_src_dep_glmatrix__["a" /* default */].vec2; - - - - - - -__WEBPACK_IMPORTED_MODULE_2__util_graphicGL__["a" /* default */].Shader.import(__WEBPACK_IMPORTED_MODULE_12__util_shader_lines2D_glsl_js__["a" /* default */]); - -var globalLayoutId = 1; - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendChartView({ - - type: 'graphGL', - - __ecgl__: true, - - init: function (ecModel, api) { - - this.groupGL = new __WEBPACK_IMPORTED_MODULE_2__util_graphicGL__["a" /* default */].Node(); - this.viewGL = new __WEBPACK_IMPORTED_MODULE_3__core_ViewGL__["a" /* default */]('orthographic'); - this.viewGL.camera.left = this.viewGL.camera.right = 0; - - this.viewGL.add(this.groupGL); - - this._pointsBuilder = new __WEBPACK_IMPORTED_MODULE_11__common_PointsBuilder__["a" /* default */](true, api); - - // Mesh used during force directed layout. - this._forceEdgesMesh = new __WEBPACK_IMPORTED_MODULE_2__util_graphicGL__["a" /* default */].Mesh({ - material: new __WEBPACK_IMPORTED_MODULE_2__util_graphicGL__["a" /* default */].Material({ - shader: __WEBPACK_IMPORTED_MODULE_2__util_graphicGL__["a" /* default */].createShader('ecgl.forceAtlas2.edges'), - transparent: true, - depthMask: false, - depthTest: false - }), - $ignorePicking: true, - geometry: new __WEBPACK_IMPORTED_MODULE_2__util_graphicGL__["a" /* default */].Geometry({ - attributes: { - node: new __WEBPACK_IMPORTED_MODULE_2__util_graphicGL__["a" /* default */].Geometry.Attribute('node', 'float', 2), - color: new __WEBPACK_IMPORTED_MODULE_2__util_graphicGL__["a" /* default */].Geometry.Attribute('color', 'float', 4, 'COLOR') - }, - dynamic: true, - mainAttribute: 'node' - }), - renderOrder: -1, - mode: __WEBPACK_IMPORTED_MODULE_2__util_graphicGL__["a" /* default */].Mesh.LINES - }); - - // Mesh used after force directed layout. - this._edgesMesh = new __WEBPACK_IMPORTED_MODULE_2__util_graphicGL__["a" /* default */].Mesh({ - material: new __WEBPACK_IMPORTED_MODULE_2__util_graphicGL__["a" /* default */].Material({ - shader: __WEBPACK_IMPORTED_MODULE_2__util_graphicGL__["a" /* default */].createShader('ecgl.meshLines2D'), - transparent: true, - depthMask: false, - depthTest: false - }), - $ignorePicking: true, - geometry: new __WEBPACK_IMPORTED_MODULE_4__util_geometry_Lines2D__["a" /* default */]({ - useNativeLine: false, - dynamic: true - }), - renderOrder: -1, - culling: false - }); - - this._layoutId = 0; - - this._control = new __WEBPACK_IMPORTED_MODULE_10__util_Roam2DControl__["a" /* default */]({ - zr: api.getZr(), - viewGL: this.viewGL - }); - this._control.setTarget(this.groupGL); - this._control.init(); - - - this._clickHandler = this._clickHandler.bind(this); - }, - - render: function (seriesModel, ecModel, api) { - this.groupGL.add(this._pointsBuilder.rootNode); - - this._model = seriesModel; - this._api = api; - - this._initLayout(seriesModel, ecModel, api); - - this._pointsBuilder.update(seriesModel, ecModel, api); - - if (!(this._forceLayoutInstance instanceof __WEBPACK_IMPORTED_MODULE_6__ForceAtlas2GPU__["a" /* default */])) { - this.groupGL.remove(this._forceEdgesMesh); - } - - this._updateCamera(seriesModel, api); - - this._control.off('update'); - this._control.on('update', function () { - api.dispatchAction({ - type: 'graphGLRoam', - seriesId: seriesModel.id, - zoom: this._control.getZoom(), - offset: this._control.getOffset() - }); - - this._pointsBuilder.updateView(this.viewGL.camera); - }, this); - - this._control.setZoom(__WEBPACK_IMPORTED_MODULE_5__util_retrieve__["a" /* default */].firstNotNull(seriesModel.get('zoom'), 1)); - this._control.setOffset(seriesModel.get('offset') || [0, 0]); - - var mesh = this._pointsBuilder.getPointsMesh(); - mesh.off('mousemove', this._mousemoveHandler); - mesh.off('mouseout', this._mouseOutHandler, this); - api.getZr().off('click', this._clickHandler); - - this._pointsBuilder.highlightOnMouseover = true; - if (seriesModel.get('focusNodeAdjacency')) { - var focusNodeAdjacencyOn = seriesModel.get('focusNodeAdjacencyOn'); - if (focusNodeAdjacencyOn === 'click') { - // Remove default emphasis effect - api.getZr().on('click', this._clickHandler); - } - else if (focusNodeAdjacencyOn === 'mouseover') { - mesh.on('mousemove', this._mousemoveHandler, this); - mesh.on('mouseout', this._mouseOutHandler, this); - - this._pointsBuilder.highlightOnMouseover = false; - } - else { - if (true) { - console.warn('Unkown focusNodeAdjacencyOn value \s' + focusNodeAdjacencyOn); - } - } - } - - // Reset - this._lastMouseOverDataIndex = -1; - }, - - _clickHandler: function (e) { - if (this._layouting) { - return; - } - var dataIndex = this._pointsBuilder.getPointsMesh().dataIndex; - if (dataIndex >= 0) { - this._api.dispatchAction({ - type: 'graphGLFocusNodeAdjacency', - seriesId: this._model.id, - dataIndex: dataIndex - }); - } - else { - this._api.dispatchAction({ - type: 'graphGLUnfocusNodeAdjacency', - seriesId: this._model.id - }); - } - }, - - _mousemoveHandler: function (e) { - if (this._layouting) { - return; - } - var dataIndex = this._pointsBuilder.getPointsMesh().dataIndex; - if (dataIndex >= 0) { - if (dataIndex !== this._lastMouseOverDataIndex) { - this._api.dispatchAction({ - type: 'graphGLFocusNodeAdjacency', - seriesId: this._model.id, - dataIndex: dataIndex - }); - } - } - else { - this._mouseOutHandler(e); - } - - this._lastMouseOverDataIndex = dataIndex; - }, - - _mouseOutHandler: function (e) { - if (this._layouting) { - return; - } - - this._api.dispatchAction({ - type: 'graphGLUnfocusNodeAdjacency', - seriesId: this._model.id - }); - - this._lastMouseOverDataIndex = -1; - }, - - _updateForceEdgesGeometry: function (edges, seriesModel) { - var geometry = this._forceEdgesMesh.geometry; - - var edgeData = seriesModel.getEdgeData(); - var offset = 0; - var layoutInstance = this._forceLayoutInstance; - var vertexCount = edgeData.count() * 2; - geometry.attributes.node.init(vertexCount); - geometry.attributes.color.init(vertexCount); - edgeData.each(function (idx) { - var edge = edges[idx]; - geometry.attributes.node.set(offset, layoutInstance.getNodeUV(edge.node1)); - geometry.attributes.node.set(offset + 1, layoutInstance.getNodeUV(edge.node2)); - - var color = edgeData.getItemVisual(edge.dataIndex, 'color'); - var colorArr = __WEBPACK_IMPORTED_MODULE_2__util_graphicGL__["a" /* default */].parseColor(color); - colorArr[3] *= __WEBPACK_IMPORTED_MODULE_5__util_retrieve__["a" /* default */].firstNotNull( - edgeData.getItemVisual(edge.dataIndex, 'opacity'), 1 - ); - geometry.attributes.color.set(offset, colorArr); - geometry.attributes.color.set(offset + 1, colorArr); - - offset += 2; - }); - geometry.dirty(); - }, - - _updateMeshLinesGeometry: function () { - var edgeData = this._model.getEdgeData(); - var geometry = this._edgesMesh.geometry; - var edgeData = this._model.getEdgeData(); - var points = this._model.getData().getLayout('points'); - - geometry.resetOffset(); - geometry.setVertexCount(edgeData.count() * geometry.getLineVertexCount()); - geometry.setTriangleCount(edgeData.count() * geometry.getLineTriangleCount()); - - var p0 = []; - var p1 = []; - - var lineWidthQuery = ['lineStyle', 'width']; - - this._originalEdgeColors = new Float32Array(edgeData.count() * 4); - this._edgeIndicesMap = new Float32Array(edgeData.count()); - edgeData.each(function (idx) { - var edge = edgeData.graph.getEdgeByIndex(idx); - var idx1 = edge.node1.dataIndex * 2; - var idx2 = edge.node2.dataIndex * 2; - p0[0] = points[idx1]; - p0[1] = points[idx1 + 1]; - p1[0] = points[idx2]; - p1[1] = points[idx2 + 1]; - - var color = edgeData.getItemVisual(edge.dataIndex, 'color'); - var colorArr = __WEBPACK_IMPORTED_MODULE_2__util_graphicGL__["a" /* default */].parseColor(color); - colorArr[3] *= __WEBPACK_IMPORTED_MODULE_5__util_retrieve__["a" /* default */].firstNotNull(edgeData.getItemVisual(edge.dataIndex, 'opacity'), 1); - var itemModel = edgeData.getItemModel(edge.dataIndex); - var lineWidth = __WEBPACK_IMPORTED_MODULE_5__util_retrieve__["a" /* default */].firstNotNull(itemModel.get(lineWidthQuery), 1) * this._api.getDevicePixelRatio(); - - geometry.addLine(p0, p1, colorArr, lineWidth); - - for (var k = 0; k < 4; k++) { - this._originalEdgeColors[edge.dataIndex * 4 + k] = colorArr[k]; - } - this._edgeIndicesMap[edge.dataIndex] = idx; - }, this); - - geometry.dirty(); - }, - - _updateForceNodesGeometry: function (nodeData) { - var pointsMesh = this._pointsBuilder.getPointsMesh(); - var pos = []; - for (var i = 0; i < nodeData.count(); i++) { - this._forceLayoutInstance.getNodeUV(i, pos); - pointsMesh.geometry.attributes.position.set(i, pos); - } - pointsMesh.geometry.dirty('position'); - }, - - _initLayout: function (seriesModel, ecModel, api) { - var layout = seriesModel.get('layout'); - var graph = seriesModel.getGraph(); - - var boxLayoutOption = seriesModel.getBoxLayoutParams(); - var viewport = __WEBPACK_IMPORTED_MODULE_1_echarts_lib_util_layout___default.a.getLayoutRect(boxLayoutOption, { - width: api.getWidth(), - height: api.getHeight() - }); - - if (layout === 'force') { - if (true) { - console.warn('Currently only forceAtlas2 layout supported.'); - } - layout = 'forceAtlas2'; - } - // Stop previous layout - this.stopLayout(seriesModel, ecModel, api, { - beforeLayout: true - }); - - var nodeData = seriesModel.getData(); - var edgeData = seriesModel.getData(); - if (layout === 'forceAtlas2') { - var layoutModel = seriesModel.getModel('forceAtlas2'); - var layoutInstance = this._forceLayoutInstance; - var nodes = []; - var edges = []; - - var nodeDataExtent = nodeData.getDataExtent('value'); - var edgeDataExtent = edgeData.getDataExtent('value'); - - var edgeWeightRange = __WEBPACK_IMPORTED_MODULE_5__util_retrieve__["a" /* default */].firstNotNull(layoutModel.get('edgeWeight'), 1.0); - var nodeWeightRange = __WEBPACK_IMPORTED_MODULE_5__util_retrieve__["a" /* default */].firstNotNull(layoutModel.get('nodeWeight'), 1.0); - if (typeof edgeWeightRange === 'number') { - edgeWeightRange = [edgeWeightRange, edgeWeightRange]; - } - if (typeof nodeWeightRange === 'number') { - nodeWeightRange = [nodeWeightRange, nodeWeightRange]; - } - - var offset = 0; - var nodesIndicesMap = {}; - - var layoutPoints = new Float32Array(nodeData.count() * 2); - graph.eachNode(function (node) { - var dataIndex = node.dataIndex; - var value = nodeData.get('value', dataIndex); - var x; - var y; - if (nodeData.hasItemOption) { - var itemModel = nodeData.getItemModel(dataIndex); - x = itemModel.get('x'); - y = itemModel.get('y'); - } - if (x == null) { - // Random in rectangle - x = viewport.x + Math.random() * viewport.width; - y = viewport.y + Math.random() * viewport.height; - } - layoutPoints[offset * 2] = x; - layoutPoints[offset * 2 + 1] = y; - - nodesIndicesMap[node.id] = offset++; - var mass = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.number.linearMap(value, nodeDataExtent, nodeWeightRange); - if (isNaN(mass)) { - if (!isNaN(nodeWeightRange[0])) { - mass = nodeWeightRange[0]; - } - else { - mass = 1; - } - } - nodes.push({ - x: x, y: y, mass: mass, size: nodeData.getItemVisual(dataIndex, 'symbolSize') - }); - }); - nodeData.setLayout('points', layoutPoints); - - graph.eachEdge(function (edge) { - var dataIndex = edge.dataIndex; - var value = nodeData.get('value', dataIndex); - var weight = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.number.linearMap(value, edgeDataExtent, edgeWeightRange); - if (isNaN(weight)) { - if (!isNaN(edgeWeightRange[0])) { - weight = edgeWeightRange[0]; - } - else { - weight = 1; - } - } - edges.push({ - node1: nodesIndicesMap[edge.node1.id], - node2: nodesIndicesMap[edge.node2.id], - weight: weight, - dataIndex: dataIndex - }); - }); - if (!layoutInstance) { - var isGPU = layoutModel.get('GPU'); - if (this._forceLayoutInstance) { - if ((isGPU && !(this._forceLayoutInstance instanceof __WEBPACK_IMPORTED_MODULE_6__ForceAtlas2GPU__["a" /* default */])) - || (!isGPU && !(this._forceLayoutInstance instanceof __WEBPACK_IMPORTED_MODULE_7__ForceAtlas2__["a" /* default */])) - ) { - // Mark to dispose - this._forceLayoutInstanceToDispose = this._forceLayoutInstance; - } - } - layoutInstance = this._forceLayoutInstance = isGPU - ? new __WEBPACK_IMPORTED_MODULE_6__ForceAtlas2GPU__["a" /* default */]() - : new __WEBPACK_IMPORTED_MODULE_7__ForceAtlas2__["a" /* default */](); - } - layoutInstance.initData(nodes, edges); - layoutInstance.updateOption(layoutModel.option); - - // Update lines geometry after first layout; - this._updateForceEdgesGeometry(layoutInstance.getEdges(), seriesModel); - this._updatePositionTexture(); - - api.dispatchAction({ - type: 'graphGLStartLayout', - from: this.uid - }); - } - else { - var layoutPoints = new Float32Array(nodeData.count() * 2); - var offset = 0; - graph.eachNode(function (node) { - var dataIndex = node.dataIndex; - var x; - var y; - if (nodeData.hasItemOption) { - var itemModel = nodeData.getItemModel(dataIndex); - x = itemModel.get('x'); - y = itemModel.get('y'); - } - layoutPoints[offset++] = x; - layoutPoints[offset++] = y; - }); - nodeData.setLayout('points', layoutPoints); - - this._updateAfterLayout(seriesModel, ecModel, api); - } - }, - - _updatePositionTexture: function () { - var positionTex = this._forceLayoutInstance.getNodePositionTexture(); - this._pointsBuilder.setPositionTexture(positionTex); - this._forceEdgesMesh.material.set('positionTex', positionTex); - }, - - startLayout: function (seriesModel, ecModel, api, payload) { - if (payload && payload.from != null && payload.from !== this.uid) { - return; - } - - var viewGL = this.viewGL; - var api = this._api; - var layoutInstance = this._forceLayoutInstance; - var data = this._model.getData(); - var layoutModel = this._model.getModel('forceAtlas2'); - - if (!layoutInstance) { - if (true) { - console.error('None layout don\'t have startLayout action'); - } - return; - } - - this.groupGL.remove(this._edgesMesh); - this.groupGL.add(this._forceEdgesMesh); - - if (!this._forceLayoutInstance) { - return; - } - - this._updateForceNodesGeometry(seriesModel.getData()); - this._pointsBuilder.hideLabels(); - - var self = this; - var layoutId = this._layoutId = globalLayoutId++; - var maxSteps = layoutModel.getShallow('maxSteps'); - var steps = layoutModel.getShallow('steps'); - var stepsCount = 0; - var syncStepCount = Math.max(steps * 2, 20); - var doLayout = function (layoutId) { - if (layoutId !== self._layoutId) { - return; - } - if (layoutInstance.isFinished(maxSteps)) { - api.dispatchAction({ - type: 'graphGLStopLayout', - from: self.uid - }); - api.dispatchAction({ - type: 'graphGLFinishLayout', - points: data.getLayout('points'), - from: self.uid - }); - return; - } - - layoutInstance.update(viewGL.layer.renderer, steps, function () { - self._updatePositionTexture(); - // PENDING Performance. - stepsCount += steps; - // Sync posiiton every 20 steps. - if (stepsCount >= syncStepCount) { - self._syncNodePosition(seriesModel); - stepsCount = 0; - } - // Position texture will been swapped. set every time. - api.getZr().refresh(); - - __WEBPACK_IMPORTED_MODULE_8_zrender_lib_animation_requestAnimationFrame___default()(function () { - doLayout(layoutId); - }); - }); - }; - - __WEBPACK_IMPORTED_MODULE_8_zrender_lib_animation_requestAnimationFrame___default()(function () { - if (self._forceLayoutInstanceToDispose) { - self._forceLayoutInstanceToDispose.dispose(viewGL.layer.renderer); - self._forceLayoutInstanceToDispose = null; - } - doLayout(layoutId); - }); - - this._layouting = true; - }, - - stopLayout: function (seriesModel, ecModel, api, payload) { - if (payload && payload.from != null && payload.from !== this.uid) { - return; - } - - this._layoutId = 0; - this.groupGL.remove(this._forceEdgesMesh); - this.groupGL.add(this._edgesMesh); - - if (!this._forceLayoutInstance) { - return; - } - - if (!this.viewGL.layer) { - return; - } - - if (!(payload && payload.beforeLayout)) { - this._syncNodePosition(seriesModel); - this._updateAfterLayout(seriesModel, ecModel, api); - } - - this._api.getZr().refresh(); - - this._layouting = false; - }, - - _syncNodePosition: function (seriesModel) { - var points = this._forceLayoutInstance.getNodePosition(this.viewGL.layer.renderer); - seriesModel.getData().setLayout('points', points); - - seriesModel.setNodePosition(points); - }, - - _updateAfterLayout: function (seriesModel, ecModel, api) { - this._updateMeshLinesGeometry(); - - this._pointsBuilder.removePositionTexture(); - - this._pointsBuilder.updateLayout(seriesModel, ecModel, api); - - this._pointsBuilder.updateView(this.viewGL.camera); - - this._pointsBuilder.updateLabels(); - - this._pointsBuilder.showLabels(); - - }, - - focusNodeAdjacency: function (seriesModel, ecModel, api, payload) { - - var data = this._model.getData(); - - this._downplayAll(); - - var dataIndex = payload.dataIndex; - - var graph = data.graph; - - var focusNodes = []; - var node = graph.getNodeByIndex(dataIndex); - focusNodes.push(node); - node.edges.forEach(function (edge) { - if (edge.dataIndex < 0) { - return; - } - edge.node1 !== node && focusNodes.push(edge.node1); - edge.node2 !== node && focusNodes.push(edge.node2); - }, this); - - this._pointsBuilder.fadeOutAll(0.05); - this._fadeOutEdgesAll(0.05); - - focusNodes.forEach(function (node) { - this._pointsBuilder.highlight(data, node.dataIndex); - }, this); - - this._pointsBuilder.updateLabels(focusNodes.map(function (node) { - return node.dataIndex; - })); - - var focusEdges = []; - node.edges.forEach(function (edge) { - if (edge.dataIndex >= 0) { - this._highlightEdge(edge.dataIndex); - focusEdges.push(edge); - } - }, this); - - this._focusNodes = focusNodes; - this._focusEdges = focusEdges; - }, - - unfocusNodeAdjacency: function (seriesModel, ecModel, api, payload) { - - this._downplayAll(); - - this._pointsBuilder.fadeInAll(); - this._fadeInEdgesAll(); - - this._pointsBuilder.updateLabels(); - }, - - _highlightEdge: function (dataIndex) { - var itemModel = this._model.getEdgeData().getItemModel(dataIndex); - var emphasisColor = __WEBPACK_IMPORTED_MODULE_2__util_graphicGL__["a" /* default */].parseColor(itemModel.get('emphasis.lineStyle.color') || itemModel.get('lineStyle.color')); - var emphasisOpacity = __WEBPACK_IMPORTED_MODULE_5__util_retrieve__["a" /* default */].firstNotNull(itemModel.get('emphasis.lineStyle.opacity'), itemModel.get('lineStyle.opacity'), 1); - emphasisColor[3] *= emphasisOpacity; - - this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[dataIndex], emphasisColor); - }, - - _downplayAll: function () { - if (this._focusNodes) { - this._focusNodes.forEach(function (node) { - this._pointsBuilder.downplay(this._model.getData(), node.dataIndex); - }, this); - } - if (this._focusEdges) { - this._focusEdges.forEach(function (edge) { - this._downplayEdge(edge.dataIndex); - }, this); - } - }, - - _downplayEdge: function (dataIndex) { - var color = this._getColor(dataIndex, []); - this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[dataIndex], color); - }, - - _setEdgeFade: (function () { - var color = []; - return function (dataIndex, percent) { - this._getColor(dataIndex, color); - color[3] *= percent; - this._edgesMesh.geometry.setItemColor(this._edgeIndicesMap[dataIndex], color); - }; - })(), - - _getColor: function (dataIndex, out) { - for (var i = 0; i < 4; i++) { - out[i] = this._originalEdgeColors[dataIndex * 4 + i]; - } - return out; - }, - - _fadeOutEdgesAll: function (percent) { - var graph = this._model.getData().graph; - - graph.eachEdge(function (edge) { - this._setEdgeFade(edge.dataIndex, percent); - }, this); - }, - - _fadeInEdgesAll: function () { - this._fadeOutEdgesAll(1); - }, - - _updateCamera: function (seriesModel, api) { - this.viewGL.setViewport(0, 0, api.getWidth(), api.getHeight(), api.getDevicePixelRatio()); - var camera = this.viewGL.camera; - var nodeData = seriesModel.getData(); - var points = nodeData.getLayout('points'); - var min = vec2.create(Infinity, Infinity); - var max = vec2.create(-Infinity, -Infinity); - var pt = []; - for (var i = 0; i < points.length;) { - pt[0] = points[i++]; - pt[1] = points[i++]; - vec2.min(min, min, pt); - vec2.max(max, max, pt); - } - var cy = (max[1] + min[1]) / 2; - var cx = (max[0] + min[0]) / 2; - // Only fit the camera when graph is not in the center. - // PENDING - if (cx > camera.left && cx < camera.right - && cy < camera.bottom && cy > camera.top - ) { - return; - } - - // Scale a bit - var width = Math.max(max[0] - min[0], 10); - // Keep aspect - var height = width / api.getWidth() * api.getHeight(); - width *= 1.4; - height *= 1.4; - min[0] -= width * 0.2; - - camera.left = min[0]; - camera.top = cy - height / 2; - camera.bottom = cy + height / 2; - camera.right = width + min[0]; - camera.near = 0; - camera.far = 100; - }, - - dispose: function () { - var renderer = this.viewGL.layer.renderer; - if (this._forceLayoutInstance) { - this._forceLayoutInstance.dispose(renderer); - } - this.groupGL.removeAll(); - - // Stop layout. - this._layoutId = -1; - }, - - remove: function () { - this.groupGL.removeAll(); - this._control.dispose(); - } -}); - -/***/ }), -/* 269 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_claygl_src_compositor_Pass__ = __webpack_require__(16); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_claygl_src_FrameBuffer__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__forceAtlas2_glsl_js__ = __webpack_require__(270); - - - - - - -__WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Shader.import(__WEBPACK_IMPORTED_MODULE_4__forceAtlas2_glsl_js__["a" /* default */]); - -var defaultConfigs = { - repulsionByDegree: true, - linLogMode: false, - - strongGravityMode: false, - gravity: 1.0, - - scaling: 1.0, - - edgeWeightInfluence: 1.0, - - jitterTolerence: 0.1, - - preventOverlap: false, - - dissuadeHubs: false, - - gravityCenter: null -}; - -function ForceAtlas2GPU(options) { - - var textureOpt = { - type: __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Texture.FLOAT, - minFilter: __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Texture.NEAREST, - magFilter: __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Texture.NEAREST - }; - - this._positionSourceTex = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Texture2D(textureOpt); - this._positionSourceTex.flipY = false; - - this._positionTex = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Texture2D(textureOpt); - this._positionPrevTex = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Texture2D(textureOpt); - this._forceTex = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Texture2D(textureOpt); - this._forcePrevTex = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Texture2D(textureOpt); - - this._weightedSumTex = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Texture2D(textureOpt); - this._weightedSumTex.width = this._weightedSumTex.height = 1; - - this._globalSpeedTex = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Texture2D(textureOpt); - this._globalSpeedPrevTex = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Texture2D(textureOpt); - this._globalSpeedTex.width = this._globalSpeedTex.height = 1; - this._globalSpeedPrevTex.width = this._globalSpeedPrevTex.height = 1; - - this._nodeRepulsionPass = new __WEBPACK_IMPORTED_MODULE_2_claygl_src_compositor_Pass__["a" /* default */]({ - fragment: __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Shader.source('ecgl.forceAtlas2.updateNodeRepulsion') - }); - this._positionPass = new __WEBPACK_IMPORTED_MODULE_2_claygl_src_compositor_Pass__["a" /* default */]({ - fragment: __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Shader.source('ecgl.forceAtlas2.updatePosition') - }); - this._globalSpeedPass = new __WEBPACK_IMPORTED_MODULE_2_claygl_src_compositor_Pass__["a" /* default */]({ - fragment: __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Shader.source('ecgl.forceAtlas2.calcGlobalSpeed') - }); - this._copyPass = new __WEBPACK_IMPORTED_MODULE_2_claygl_src_compositor_Pass__["a" /* default */]({ - fragment: __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Shader.source('clay.compositor.output') - }); - - var additiveBlend = function (gl) { - gl.blendEquation(gl.FUNC_ADD); - gl.blendFunc(gl.ONE, gl.ONE); - }; - this._edgeForceMesh = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Mesh({ - geometry: new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Geometry({ - attributes: { - node1: new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Geometry.Attribute('node1', 'float', 2), - node2: new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Geometry.Attribute('node2', 'float', 2), - weight: new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Geometry.Attribute('weight', 'float', 1) - }, - dynamic: true, - mainAttribute: 'node1' - }), - material: new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Material({ - transparent: true, - shader: __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].createShader('ecgl.forceAtlas2.updateEdgeAttraction'), - blend: additiveBlend, - depthMask: false, - depthText: false - }), - mode: __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Mesh.POINTS - }); - this._weightedSumMesh = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Mesh({ - geometry: new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Geometry({ - attributes: { - node: new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Geometry.Attribute('node', 'float', 2) - }, - dynamic: true, - mainAttribute: 'node' - }), - material: new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Material({ - transparent: true, - shader: __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].createShader('ecgl.forceAtlas2.calcWeightedSum'), - blend: additiveBlend, - depthMask: false, - depthText: false - }), - mode: __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Mesh.POINTS - }); - - this._framebuffer = new __WEBPACK_IMPORTED_MODULE_3_claygl_src_FrameBuffer__["a" /* default */]({ - depthBuffer: false - }); - - this._dummyCamera = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].OrthographicCamera({ - left: -1, right: 1, - top: 1, bottom: -1, - near: 0, far: 100 - }); - - this._globalSpeed = 0; -} - -ForceAtlas2GPU.prototype.updateOption = function (options) { - - // Default config - for (var name in defaultConfigs) { - this[name] = defaultConfigs[name]; - } - - // Config according to data scale - var nNodes = this._nodes.length; - if (nNodes > 50000) { - this.jitterTolerence = 10; - } - else if (nNodes > 5000) { - this.jitterTolerence = 1; - } - else { - this.jitterTolerence = 0.1; - } - - if (nNodes > 100) { - this.scaling = 2.0; - } - else { - this.scaling = 10.0; - } - - // this.edgeWeightInfluence = 1; - // this.gravity = 1; - // this.strongGravityMode = false; - if (options) { - for (var name in defaultConfigs) { - if (options[name] != null) { - this[name] = options[name]; - } - } - } - - if (this.repulsionByDegree) { - var positionBuffer = this._positionSourceTex.pixels; - - for (var i = 0; i < this._nodes.length; i++) { - positionBuffer[i * 4 + 2] = (this._nodes[i].degree || 0) + 1; - } - } -}; - -ForceAtlas2GPU.prototype._updateGravityCenter = function (options) { - var nodes = this._nodes; - var edges = this._edges; - - if (!this.gravityCenter) { - var min = [Infinity, Infinity]; - var max = [-Infinity, -Infinity]; - for (var i = 0; i < nodes.length; i++) { - min[0] = Math.min(nodes[i].x, min[0]); - min[1] = Math.min(nodes[i].y, min[1]); - max[0] = Math.max(nodes[i].x, max[0]); - max[1] = Math.max(nodes[i].y, max[1]); - } - - this._gravityCenter = [(min[0] + max[0]) * 0.5, (min[1] + max[1]) * 0.5]; - } - else { - this._gravityCenter = this.gravityCenter; - } - // Update inDegree, outDegree - for (var i = 0; i < edges.length; i++) { - var node1 = edges[i].node1; - var node2 = edges[i].node2; - - nodes[node1].degree = (nodes[node1].degree || 0) + 1; - nodes[node2].degree = (nodes[node2].degree || 0) + 1; - } -}; -/** - * @param {Array.} [{ x, y, mass }] nodes - * @param {Array.} [{ node1, node2, weight }] edges - */ -ForceAtlas2GPU.prototype.initData = function (nodes, edges) { - - this._nodes = nodes; - this._edges = edges; - - this._updateGravityCenter(); - - var textureWidth = Math.ceil(Math.sqrt(nodes.length)); - var textureHeight = textureWidth; - var positionBuffer = new Float32Array(textureWidth * textureHeight * 4); - - this._resize(textureWidth, textureHeight); - - var offset = 0; - for (var i = 0; i < nodes.length; i++) { - var node = nodes[i]; - positionBuffer[offset++] = node.x || 0; - positionBuffer[offset++] = node.y || 0; - positionBuffer[offset++] = node.mass || 1; - positionBuffer[offset++] = node.size || 1; - } - this._positionSourceTex.pixels = positionBuffer; - - var edgeGeometry = this._edgeForceMesh.geometry; - var edgeLen = edges.length; - edgeGeometry.attributes.node1.init(edgeLen * 2); - edgeGeometry.attributes.node2.init(edgeLen * 2); - edgeGeometry.attributes.weight.init(edgeLen * 2); - - var uv = []; - - for (var i = 0; i < edges.length; i++) { - var attributes = edgeGeometry.attributes; - var weight = edges[i].weight; - if (weight == null) { - weight = 1; - } - // Two way. - attributes.node1.set(i, this.getNodeUV(edges[i].node1, uv)); - attributes.node2.set(i, this.getNodeUV(edges[i].node2, uv)); - attributes.weight.set(i, weight); - - attributes.node1.set(i + edgeLen, this.getNodeUV(edges[i].node2, uv)); - attributes.node2.set(i + edgeLen, this.getNodeUV(edges[i].node1, uv)); - attributes.weight.set(i + edgeLen, weight); - } - - var weigtedSumGeo = this._weightedSumMesh.geometry; - weigtedSumGeo.attributes.node.init(nodes.length); - for (var i = 0; i < nodes.length; i++) { - weigtedSumGeo.attributes.node.set(i, this.getNodeUV(i, uv)); - } - - edgeGeometry.dirty(); - weigtedSumGeo.dirty(); - - this._nodeRepulsionPass.material.define('fragment', 'NODE_COUNT', nodes.length); - this._nodeRepulsionPass.material.setUniform('textureSize', [textureWidth, textureHeight]); - - this._inited = false; - - this._frame = 0; -}; - -ForceAtlas2GPU.prototype.getNodes = function () { - return this._nodes; -}; -ForceAtlas2GPU.prototype.getEdges = function () { - return this._edges; -}; - -ForceAtlas2GPU.prototype.step = function (renderer) { - if (!this._inited) { - this._initFromSource(renderer); - this._inited = true; - } - - this._frame++; - - this._framebuffer.attach(this._forceTex); - this._framebuffer.bind(renderer); - var nodeRepulsionPass = this._nodeRepulsionPass; - // Calc node repulsion, gravity - nodeRepulsionPass.setUniform('strongGravityMode', this.strongGravityMode); - nodeRepulsionPass.setUniform('gravity', this.gravity); - nodeRepulsionPass.setUniform('gravityCenter', this._gravityCenter); - nodeRepulsionPass.setUniform('scaling', this.scaling); - nodeRepulsionPass.setUniform('preventOverlap', this.preventOverlap); - nodeRepulsionPass.setUniform('positionTex', this._positionPrevTex); - nodeRepulsionPass.render(renderer); - - // Calc edge attraction force - var edgeForceMesh = this._edgeForceMesh; - edgeForceMesh.material.set('linLogMode', this.linLogMode); - edgeForceMesh.material.set('edgeWeightInfluence', this.edgeWeightInfluence); - edgeForceMesh.material.set('preventOverlap', this.preventOverlap); - edgeForceMesh.material.set('positionTex', this._positionPrevTex); - renderer.gl.enable(renderer.gl.BLEND); - renderer.renderPass([edgeForceMesh], this._dummyCamera); - - // Calc weighted sum. - this._framebuffer.attach(this._weightedSumTex); - renderer.gl.clearColor(0, 0, 0, 0); - renderer.gl.clear(renderer.gl.COLOR_BUFFER_BIT); - renderer.gl.enable(renderer.gl.BLEND); - var weightedSumMesh = this._weightedSumMesh; - weightedSumMesh.material.set('positionTex', this._positionPrevTex); - weightedSumMesh.material.set('forceTex', this._forceTex); - weightedSumMesh.material.set('forcePrevTex', this._forcePrevTex); - renderer.renderPass([weightedSumMesh], this._dummyCamera); - - // Calc global speed. - this._framebuffer.attach(this._globalSpeedTex); - var globalSpeedPass = this._globalSpeedPass; - globalSpeedPass.setUniform('globalSpeedPrevTex', this._globalSpeedPrevTex); - globalSpeedPass.setUniform('weightedSumTex', this._weightedSumTex); - globalSpeedPass.setUniform('jitterTolerence', this.jitterTolerence); - renderer.gl.disable(renderer.gl.BLEND); - globalSpeedPass.render(renderer); - - // Update position. - var positionPass = this._positionPass; - this._framebuffer.attach(this._positionTex); - positionPass.setUniform('globalSpeedTex', this._globalSpeedTex); - positionPass.setUniform('positionTex', this._positionPrevTex); - positionPass.setUniform('forceTex', this._forceTex); - positionPass.setUniform('forcePrevTex', this._forcePrevTex); - positionPass.render(renderer); - - this._framebuffer.unbind(renderer); - - this._swapTexture(); -}; - -ForceAtlas2GPU.prototype.update = function (renderer, steps, cb) { - if (steps == null) { - steps = 1; - } - steps = Math.max(steps, 1); - - for (var i = 0; i < steps; i++) { - this.step(renderer); - } - - cb && cb(); -}; - -ForceAtlas2GPU.prototype.getNodePositionTexture = function () { - return this._inited - // Texture already been swapped. - ? this._positionPrevTex - : this._positionSourceTex; -}; - -ForceAtlas2GPU.prototype.getNodeUV = function (nodeIndex, uv) { - uv = uv || []; - var textureWidth = this._positionTex.width; - var textureHeight = this._positionTex.height; - uv[0] = (nodeIndex % textureWidth) / (textureWidth - 1); - uv[1] = Math.floor(nodeIndex / textureWidth) / (textureHeight - 1) || 0; - return uv; -}; - -ForceAtlas2GPU.prototype.getNodePosition = function (renderer, out) { - var positionArr = this._positionArr; - var width = this._positionTex.width; - var height = this._positionTex.height; - var size = width * height; - if (!positionArr || positionArr.length !== size * 4) { - positionArr = this._positionArr = new Float32Array(size * 4); - } - this._framebuffer.bind(renderer); - this._framebuffer.attach(this._positionPrevTex); - renderer.gl.readPixels( - 0, 0, width, height, - renderer.gl.RGBA, renderer.gl.FLOAT, - positionArr - ); - this._framebuffer.unbind(renderer); - if (!out) { - out = new Float32Array(this._nodes.length * 2); - } - for (var i = 0; i < this._nodes.length; i++) { - out[i * 2] = positionArr[i * 4]; - out[i * 2 + 1] = positionArr[i * 4 + 1]; - } - return out; -}; - -ForceAtlas2GPU.prototype.getTextureData = function (renderer, textureName) { - var tex = this['_' + textureName + 'Tex']; - var width = tex.width; - var height = tex.height; - this._framebuffer.bind(renderer); - this._framebuffer.attach(tex); - var arr = new Float32Array(width * height * 4); - renderer.gl.readPixels(0, 0, width, height, renderer.gl.RGBA, renderer.gl.FLOAT, arr); - this._framebuffer.unbind(renderer); - return arr; -}; - -ForceAtlas2GPU.prototype.getTextureSize = function () { - return { - width: this._positionTex.width, - height: this._positionTex.height - }; -}; - -ForceAtlas2GPU.prototype.isFinished = function (maxSteps) { - return this._frame > maxSteps; -}; - -ForceAtlas2GPU.prototype._swapTexture = function () { - var tmp = this._positionPrevTex; - this._positionPrevTex = this._positionTex; - this._positionTex = tmp; - - var tmp = this._forcePrevTex; - this._forcePrevTex = this._forceTex; - this._forceTex = tmp; - - var tmp = this._globalSpeedPrevTex; - this._globalSpeedPrevTex = this._globalSpeedTex; - this._globalSpeedTex = tmp; -}; - -ForceAtlas2GPU.prototype._initFromSource = function (renderer) { - this._framebuffer.attach(this._positionPrevTex); - this._framebuffer.bind(renderer); - this._copyPass.setUniform('texture', this._positionSourceTex); - this._copyPass.render(renderer); - - renderer.gl.clearColor(0, 0, 0, 0); - this._framebuffer.attach(this._forcePrevTex); - renderer.gl.clear(renderer.gl.COLOR_BUFFER_BIT); - this._framebuffer.attach(this._globalSpeedPrevTex); - renderer.gl.clear(renderer.gl.COLOR_BUFFER_BIT); - - this._framebuffer.unbind(renderer); -}; - -ForceAtlas2GPU.prototype._resize = function (width, height) { - ['_positionSourceTex', '_positionTex', '_positionPrevTex', '_forceTex', '_forcePrevTex'].forEach(function (texName) { - this[texName].width = width; - this[texName].height = height; - this[texName].dirty(); - }, this); -}; - -ForceAtlas2GPU.prototype.dispose = function (renderer) { - this._framebuffer.dispose(renderer); - - this._copyPass.dispose(renderer); - this._nodeRepulsionPass.dispose(renderer); - this._positionPass.dispose(renderer); - this._globalSpeedPass.dispose(renderer); - - this._edgeForceMesh.geometry.dispose(renderer); - this._weightedSumMesh.geometry.dispose(renderer); - - this._positionSourceTex.dispose(renderer); - this._positionTex.dispose(renderer); - this._positionPrevTex.dispose(renderer); - this._forceTex.dispose(renderer); - this._forcePrevTex.dispose(renderer); - this._weightedSumTex.dispose(renderer); - this._globalSpeedTex.dispose(renderer); - this._globalSpeedPrevTex.dispose(renderer); -}; - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.ForceAtlas2GPU = ForceAtlas2GPU; - -/* harmony default export */ __webpack_exports__["a"] = (ForceAtlas2GPU); - -/***/ }), -/* 270 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export ecgl.forceAtlas2.updateNodeRepulsion\n\n#define NODE_COUNT 0\n\nuniform sampler2D positionTex;\n\nuniform vec2 textureSize;\nuniform float gravity;\nuniform float scaling;\nuniform vec2 gravityCenter;\n\nuniform bool strongGravityMode;\nuniform bool preventOverlap;\n\nvarying vec2 v_Texcoord;\n\nvoid main() {\n\n vec4 n0 = texture2D(positionTex, v_Texcoord);\n\n vec2 force = vec2(0.0);\n for (int i = 0; i < NODE_COUNT; i++) {\n vec2 uv = vec2(\n mod(float(i), textureSize.x) / (textureSize.x - 1.0),\n floor(float(i) / textureSize.x) / (textureSize.y - 1.0)\n );\n vec4 n1 = texture2D(positionTex, uv);\n\n vec2 dir = n0.xy - n1.xy;\n float d2 = dot(dir, dir);\n\n if (d2 > 0.0) {\n float factor = 0.0;\n if (preventOverlap) {\n float d = sqrt(d2);\n d = d - n0.w - n1.w;\n if (d > 0.0) {\n factor = scaling * n0.z * n1.z / (d * d);\n }\n else if (d < 0.0) {\n factor = scaling * 100.0 * n0.z * n1.z;\n }\n }\n else {\n factor = scaling * n0.z * n1.z / d2;\n }\n force += dir * factor;\n }\n }\n\n vec2 dir = gravityCenter - n0.xy;\n float d = 1.0;\n if (!strongGravityMode) {\n d = length(dir);\n }\n\n force += dir * n0.z * gravity / (d + 1.0);\n\n gl_FragColor = vec4(force, 0.0, 1.0);\n}\n@end\n\n@export ecgl.forceAtlas2.updateEdgeAttraction.vertex\n\nattribute vec2 node1;\nattribute vec2 node2;\nattribute float weight;\n\nuniform sampler2D positionTex;\nuniform float edgeWeightInfluence;\nuniform bool preventOverlap;\nuniform bool linLogMode;\n\nuniform vec2 windowSize: WINDOW_SIZE;\n\nvarying vec2 v_Force;\n\nvoid main() {\n\n vec4 n0 = texture2D(positionTex, node1);\n vec4 n1 = texture2D(positionTex, node2);\n\n vec2 dir = n1.xy - n0.xy;\n float d = length(dir);\n float w;\n if (edgeWeightInfluence == 0.0) {\n w = 1.0;\n }\n else if (edgeWeightInfluence == 1.0) {\n w = weight;\n }\n else {\n w = pow(weight, edgeWeightInfluence);\n }\n vec2 offset = vec2(1.0 / windowSize.x, 1.0 / windowSize.y);\n vec2 scale = vec2((windowSize.x - 1.0) / windowSize.x, (windowSize.y - 1.0) / windowSize.y);\n vec2 pos = node1 * scale * 2.0 - 1.0;\n gl_Position = vec4(pos + offset, 0.0, 1.0);\n gl_PointSize = 1.0;\n\n float factor;\n if (preventOverlap) {\n d = d - n1.w - n0.w;\n }\n if (d <= 0.0) {\n v_Force = vec2(0.0);\n return;\n }\n\n if (linLogMode) {\n factor = w * log(d) / d;\n }\n else {\n factor = w;\n }\n v_Force = dir * factor;\n}\n@end\n\n@export ecgl.forceAtlas2.updateEdgeAttraction.fragment\n\nvarying vec2 v_Force;\n\nvoid main() {\n gl_FragColor = vec4(v_Force, 0.0, 0.0);\n}\n@end\n\n@export ecgl.forceAtlas2.calcWeightedSum.vertex\n\nattribute vec2 node;\n\nvarying vec2 v_NodeUv;\n\nvoid main() {\n\n v_NodeUv = node;\n gl_Position = vec4(0.0, 0.0, 0.0, 1.0);\n gl_PointSize = 1.0;\n}\n@end\n\n@export ecgl.forceAtlas2.calcWeightedSum.fragment\n\nvarying vec2 v_NodeUv;\n\nuniform sampler2D positionTex;\nuniform sampler2D forceTex;\nuniform sampler2D forcePrevTex;\n\nvoid main() {\n vec2 force = texture2D(forceTex, v_NodeUv).rg;\n vec2 forcePrev = texture2D(forcePrevTex, v_NodeUv).rg;\n\n float mass = texture2D(positionTex, v_NodeUv).z;\n float swing = length(force - forcePrev) * mass;\n float traction = length(force + forcePrev) * 0.5 * mass;\n\n gl_FragColor = vec4(swing, traction, 0.0, 0.0);\n}\n@end\n\n@export ecgl.forceAtlas2.calcGlobalSpeed\n\nuniform sampler2D globalSpeedPrevTex;\nuniform sampler2D weightedSumTex;\nuniform float jitterTolerence;\n\nvoid main() {\n vec2 weightedSum = texture2D(weightedSumTex, vec2(0.5)).xy;\n float prevGlobalSpeed = texture2D(globalSpeedPrevTex, vec2(0.5)).x;\n float globalSpeed = jitterTolerence * jitterTolerence\n * weightedSum.y / weightedSum.x;\n if (prevGlobalSpeed > 0.0) {\n globalSpeed = min(globalSpeed / prevGlobalSpeed, 1.5) * prevGlobalSpeed;\n }\n gl_FragColor = vec4(globalSpeed, 0.0, 0.0, 1.0);\n}\n@end\n\n@export ecgl.forceAtlas2.updatePosition\n\nuniform sampler2D forceTex;\nuniform sampler2D forcePrevTex;\nuniform sampler2D positionTex;\nuniform sampler2D globalSpeedTex;\n\nvarying vec2 v_Texcoord;\n\nvoid main() {\n vec2 force = texture2D(forceTex, v_Texcoord).xy;\n vec2 forcePrev = texture2D(forcePrevTex, v_Texcoord).xy;\n vec4 node = texture2D(positionTex, v_Texcoord);\n\n float globalSpeed = texture2D(globalSpeedTex, vec2(0.5)).r;\n float swing = length(force - forcePrev);\n float speed = 0.1 * globalSpeed / (0.1 + globalSpeed * sqrt(swing));\n\n float df = length(force);\n if (df > 0.0) {\n speed = min(df * speed, 10.0) / df;\n\n gl_FragColor = vec4(node.xy + speed * force, node.zw);\n }\n else {\n gl_FragColor = node;\n }\n}\n@end\n\n@export ecgl.forceAtlas2.edges.vertex\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec2 node;\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n\nuniform sampler2D positionTex;\n\nvoid main()\n{\n gl_Position = worldViewProjection * vec4(\n texture2D(positionTex, node).xy, -10.0, 1.0\n );\n v_Color = a_Color;\n}\n@end\n\n@export ecgl.forceAtlas2.edges.fragment\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nvarying vec4 v_Color;\nvoid main() {\n gl_FragColor = color * v_Color;\n}\n@end"); - - -/***/ }), -/* 271 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_claygl_src_Texture2D__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_claygl_src_Texture__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__forceAtlas2Worker_js__ = __webpack_require__(272); - - - -var workerUrl = __WEBPACK_IMPORTED_MODULE_2__forceAtlas2Worker_js__["a" /* default */].toString(); -workerUrl = workerUrl.slice(workerUrl.indexOf('{') + 1, workerUrl.lastIndexOf('}')); - -var defaultConfigs = { - - barnesHutOptimize: true, - barnesHutTheta: 1.5, - - repulsionByDegree: true, - linLogMode: false, - - strongGravityMode: false, - gravity: 1.0, - - scaling: 1.0, - - edgeWeightInfluence: 1.0, - - jitterTolerence: 0.1, - - preventOverlap: false, - - dissuadeHubs: false, - - gravityCenter: null -}; - -var ForceAtlas2 = function (options) { - - for (var name in defaultConfigs) { - this[name] = defaultConfigs[name]; - } - - if (options) { - for (var name in options) { - this[name] = options[name]; - } - } - - this._nodes = []; - this._edges = []; - - this._disposed = false; - - this._positionTex = new __WEBPACK_IMPORTED_MODULE_0_claygl_src_Texture2D__["a" /* default */]({ - type: __WEBPACK_IMPORTED_MODULE_1_claygl_src_Texture__["a" /* default */].FLOAT, - flipY: false, - minFilter: __WEBPACK_IMPORTED_MODULE_1_claygl_src_Texture__["a" /* default */].NEAREST, - magFilter: __WEBPACK_IMPORTED_MODULE_1_claygl_src_Texture__["a" /* default */].NEAREST - }); -}; - -ForceAtlas2.prototype.initData = function (nodes, edges) { - - var bb = new Blob([workerUrl]); - var blobURL = window.URL.createObjectURL(bb); - - this._worker = new Worker(blobURL); - - this._worker.onmessage = this._$onupdate.bind(this); - - this._nodes = nodes; - this._edges = edges; - this._frame = 0; - - var nNodes = nodes.length; - var nEdges = edges.length; - - var positionArr = new Float32Array(nNodes * 2); - var massArr = new Float32Array(nNodes); - var sizeArr = new Float32Array(nNodes); - - var edgeArr = new Float32Array(nEdges * 2); - var edgeWeightArr = new Float32Array(nEdges); - - for (var i = 0; i < nodes.length; i++) { - var node = nodes[i]; - - positionArr[i * 2] = node.x; - positionArr[i * 2 + 1] = node.y; - - massArr[i] = node.mass == null ? 1 : node.mass; - sizeArr[i] = node.size == null ? 1 : node.size; - } - - for (var i = 0; i < edges.length; i++) { - var edge = edges[i]; - - var source = edge.node1; - var target = edge.node2; - - edgeArr[i * 2] = source; - edgeArr[i * 2 + 1] = target; - - edgeWeightArr[i] = edge.weight == null ? 1 : edge.weight; - } - - - var textureWidth = Math.ceil(Math.sqrt(nodes.length)); - var textureHeight = textureWidth; - var pixels = new Float32Array(textureWidth * textureHeight * 4); - var positionTex = this._positionTex; - positionTex.width = textureWidth; - positionTex.height = textureHeight; - positionTex.pixels = pixels; - - this._worker.postMessage({ - cmd: 'init', - nodesPosition: positionArr, - nodesMass: massArr, - nodesSize: sizeArr, - edges: edgeArr, - edgesWeight: edgeWeightArr - }); - - this._globalSpeed = Infinity; -}; - -ForceAtlas2.prototype.updateOption = function (options) { - var config = {}; - // Default config - for (var name in defaultConfigs) { - config[name] = defaultConfigs[name]; - } - - var nodes = this._nodes; - var edges = this._edges; - - // Config according to data scale - var nNodes = nodes.length; - if (nNodes > 50000) { - config.jitterTolerence = 10; - } - else if (nNodes > 5000) { - config.jitterTolerence = 1; - } - else { - config.jitterTolerence = 0.1; - } - - if (nNodes > 100) { - config.scaling = 2.0; - } - else { - config.scaling = 10.0; - } - if (nNodes > 1000) { - config.barnesHutOptimize = true; - } - else { - config.barnesHutOptimize = false; - } - - if (options) { - for (var name in defaultConfigs) { - if (options[name] != null) { - config[name] = options[name]; - } - } - } - - if (!config.gravityCenter) { - var min = [Infinity, Infinity]; - var max = [-Infinity, -Infinity]; - for (var i = 0; i < nodes.length; i++) { - min[0] = Math.min(nodes[i].x, min[0]); - min[1] = Math.min(nodes[i].y, min[1]); - max[0] = Math.max(nodes[i].x, max[0]); - max[1] = Math.max(nodes[i].y, max[1]); - } - - config.gravityCenter = [(min[0] + max[0]) * 0.5, (min[1] + max[1]) * 0.5]; - } - - // Update inDegree, outDegree - for (var i = 0; i < edges.length; i++) { - var node1 = edges[i].node1; - var node2 = edges[i].node2; - - nodes[node1].degree = (nodes[node1].degree || 0) + 1; - nodes[node2].degree = (nodes[node2].degree || 0) + 1; - } - - if (this._worker) { - this._worker.postMessage({ - cmd: 'updateConfig', - config: config - }); - } -}; - -// Steps per call, to keep sync with rendering -ForceAtlas2.prototype.update = function (renderer, steps, cb) { - if (steps == null) { - steps = 1; - } - steps = Math.max(steps, 1); - - this._frame += steps; - this._onupdate = cb; - - if (this._worker) { - this._worker.postMessage({ - cmd: 'update', - steps: Math.round(steps) - }); - } -}; - -ForceAtlas2.prototype._$onupdate = function (e) { - // Incase the worker keep postMessage of last frame after it is disposed - if (this._disposed) { - return; - } - - var positionArr = new Float32Array(e.data.buffer); - this._globalSpeed = e.data.globalSpeed; - - this._positionArr = positionArr; - - this._updateTexture(positionArr); - - this._onupdate && this._onupdate(); -}; - -ForceAtlas2.prototype.getNodePositionTexture = function () { - return this._positionTex; -}; - -ForceAtlas2.prototype.getNodeUV = function (nodeIndex, uv) { - uv = uv || []; - var textureWidth = this._positionTex.width; - var textureHeight = this._positionTex.height; - uv[0] = (nodeIndex % textureWidth) / (textureWidth - 1); - uv[1] = Math.floor(nodeIndex / textureWidth) / (textureHeight - 1); - return uv; -}; - -ForceAtlas2.prototype.getNodes = function () { - return this._nodes; -}; -ForceAtlas2.prototype.getEdges = function () { - return this._edges; -}; -ForceAtlas2.prototype.isFinished = function (maxSteps) { - return this._frame > maxSteps; -}; - -ForceAtlas2.prototype.getNodePosition = function (renderer, out) { - if (!out) { - out = new Float32Array(this._nodes.length * 2); - } - if (this._positionArr) { - for (var i = 0; i < this._positionArr.length; i++) { - out[i] = this._positionArr[i]; - } - } - return out; -}; - -ForceAtlas2.prototype._updateTexture = function (positionArr) { - var pixels = this._positionTex.pixels; - var offset = 0; - for (var i = 0; i < positionArr.length;){ - pixels[offset++] = positionArr[i++]; - pixels[offset++] = positionArr[i++]; - pixels[offset++] = 1; - pixels[offset++] = 1; - } - this._positionTex.dirty(); -}; - -ForceAtlas2.prototype.dispose = function (renderer) { - this._disposed = true; - this._worker = null; -}; - -/* harmony default export */ __webpack_exports__["a"] = (ForceAtlas2); - -/***/ }), -/* 272 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/**************************** - * Vector2 math functions - ***************************/ - -function forceAtlas2Worker() { - var vec2 = { - create: function() { - return new Float32Array(2); - }, - dist: function(a, b) { - var x = b[0] - a[0]; - var y = b[1] - a[1]; - return Math.sqrt(x*x + y*y); - }, - len: function(a) { - var x = a[0]; - var y = a[1]; - return Math.sqrt(x*x + y*y); - }, - scaleAndAdd: function(out, a, b, scale) { - out[0] = a[0] + b[0] * scale; - out[1] = a[1] + b[1] * scale; - return out; - }, - scale: function(out, a, b) { - out[0] = a[0] * b; - out[1] = a[1] * b; - return out; - }, - add: function(out, a, b) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - return out; - }, - sub: function(out, a, b) { - out[0] = a[0] - b[0]; - out[1] = a[1] - b[1]; - return out; - }, - normalize: function(out, a) { - var x = a[0]; - var y = a[1]; - var len = x*x + y*y; - if (len > 0) { - //TODO: evaluate use of glm_invsqrt here? - len = 1 / Math.sqrt(len); - out[0] = a[0] * len; - out[1] = a[1] * len; - } - return out; - }, - negate: function(out, a) { - out[0] = -a[0]; - out[1] = -a[1]; - return out; - }, - copy: function(out, a) { - out[0] = a[0]; - out[1] = a[1]; - return out; - }, - set: function(out, x, y) { - out[0] = x; - out[1] = y; - return out; - } - } - - /**************************** - * Class: Region - ***************************/ - - function Region() { - - this.subRegions = []; - - this.nSubRegions = 0; - - this.node = null; - - this.mass = 0; - - this.centerOfMass = null; - - this.bbox = new Float32Array(4); - - this.size = 0; - } - - var regionProto = Region.prototype; - - // Reset before update - regionProto.beforeUpdate = function() { - for (var i = 0; i < this.nSubRegions; i++) { - this.subRegions[i].beforeUpdate(); - } - this.mass = 0; - if (this.centerOfMass) { - this.centerOfMass[0] = 0; - this.centerOfMass[1] = 0; - } - this.nSubRegions = 0; - this.node = null; - }; - // Clear after update - regionProto.afterUpdate = function() { - this.subRegions.length = this.nSubRegions; - for (var i = 0; i < this.nSubRegions; i++) { - this.subRegions[i].afterUpdate(); - } - }; - - regionProto.addNode = function(node) { - if (this.nSubRegions === 0) { - if (this.node == null) { - this.node = node; - return; - } - // Already have node, subdivide self. - else { - this._addNodeToSubRegion(this.node); - this.node = null; - } - } - this._addNodeToSubRegion(node); - - this._updateCenterOfMass(node); - }; - - regionProto.findSubRegion = function(x, y) { - for (var i = 0; i < this.nSubRegions; i++) { - var region = this.subRegions[i]; - if (region.contain(x, y)) { - return region; - } - } - }; - - regionProto.contain = function(x, y) { - return this.bbox[0] <= x - && this.bbox[2] >= x - && this.bbox[1] <= y - && this.bbox[3] >= y; - }; - - regionProto.setBBox = function(minX, minY, maxX, maxY) { - // Min - this.bbox[0] = minX; - this.bbox[1] = minY; - // Max - this.bbox[2] = maxX; - this.bbox[3] = maxY; - - this.size = (maxX - minX + maxY - minY) / 2; - }; - - regionProto._newSubRegion = function() { - var subRegion = this.subRegions[this.nSubRegions]; - if (!subRegion) { - subRegion = new Region(); - this.subRegions[this.nSubRegions] = subRegion; - } - this.nSubRegions++; - return subRegion; - }; - - regionProto._addNodeToSubRegion = function(node) { - var subRegion = this.findSubRegion(node.position[0], node.position[1]); - var bbox = this.bbox; - if (!subRegion) { - var cx = (bbox[0] + bbox[2]) / 2; - var cy = (bbox[1] + bbox[3]) / 2; - var w = (bbox[2] - bbox[0]) / 2; - var h = (bbox[3] - bbox[1]) / 2; - - var xi = node.position[0] >= cx ? 1 : 0; - var yi = node.position[1] >= cy ? 1 : 0; - - var subRegion = this._newSubRegion(); - // Min - subRegion.setBBox( - // Min - xi * w + bbox[0], - yi * h + bbox[1], - // Max - (xi + 1) * w + bbox[0], - (yi + 1) * h + bbox[1] - ); - } - - subRegion.addNode(node); - }; - - regionProto._updateCenterOfMass = function(node) { - // Incrementally update - if (this.centerOfMass == null) { - this.centerOfMass = new Float32Array(2); - } - var x = this.centerOfMass[0] * this.mass; - var y = this.centerOfMass[1] * this.mass; - x += node.position[0] * node.mass; - y += node.position[1] * node.mass; - this.mass += node.mass; - this.centerOfMass[0] = x / this.mass; - this.centerOfMass[1] = y / this.mass; - }; - - /**************************** - * Class: Graph Node - ***************************/ - function GraphNode() { - this.position = new Float32Array(2); - - this.force = vec2.create(); - this.forcePrev = vec2.create(); - - // If repulsionByDegree is true - // mass = inDegree + outDegree + 1 - // Else - // mass is manually set - this.mass = 1; - - this.inDegree = 0; - this.outDegree = 0; - - // Optional - // this.size = 1; - } - - /**************************** - * Class: Graph Edge - ***************************/ - function GraphEdge(source, target) { - this.source = source; - this.target = target; - - this.weight = 1; - } - - /**************************** - * Class: ForceStlas2 - ***************************/ - function ForceAtlas2() { - //------------- - // Configs - - // If auto settings is true - // barnesHutOptimize, - // barnesHutTheta, - // scaling, - // jitterTolerence - // Will be set by the system automatically - // preventOverlap will be set false - // if node size is not given - this.autoSettings = true; - - // Barnes Hut - // http://arborjs.org/docs/barnes-hut - this.barnesHutOptimize = true; - this.barnesHutTheta = 1.5; - - // Force Atlas2 Configs - this.repulsionByDegree = true; - - this.linLogMode = false; - - this.strongGravityMode = false; - this.gravity = 1.0; - - this.scaling = 1.0; - - this.edgeWeightInfluence = 1.0; - this.jitterTolerence = 0.1; - - // TODO - this.preventOverlap = false; - this.dissuadeHubs = false; - - // - this.rootRegion = new Region(); - this.rootRegion.centerOfMass = vec2.create(); - - this.nodes = []; - - this.edges = []; - - this.bbox = new Float32Array(4); - - this.gravityCenter = null; - - this._massArr = null; - - this._swingingArr = null; - - this._sizeArr = null; - - this._globalSpeed = 0; - } - - var forceAtlas2Proto = ForceAtlas2.prototype; - - forceAtlas2Proto.initNodes = function(positionArr, massArr, sizeArr) { - var nNodes = massArr.length; - this.nodes.length = 0; - var haveSize = typeof(sizeArr) != 'undefined'; - for (var i = 0; i < nNodes; i++) { - var node = new GraphNode(); - node.position[0] = positionArr[i * 2]; - node.position[1] = positionArr[i * 2 + 1]; - node.mass = massArr[i]; - if (haveSize) { - node.size = sizeArr[i]; - } - this.nodes.push(node); - } - - this._massArr = massArr; - this._swingingArr = new Float32Array(nNodes); - - if (haveSize) { - this._sizeArr = sizeArr; - } - }; - - forceAtlas2Proto.initEdges = function(edgeArr, edgeWeightArr) { - var nEdges = edgeArr.length / 2; - this.edges.length = 0; - for (var i = 0; i < nEdges; i++) { - var sIdx = edgeArr[i * 2]; - var tIdx = edgeArr[i * 2 + 1]; - var sNode = this.nodes[sIdx]; - var tNode = this.nodes[tIdx]; - - if (!sNode || !tNode) { - console.error('Node not exists, try initNodes before initEdges'); - return; - } - sNode.outDegree++; - tNode.inDegree++; - var edge = new GraphEdge(sNode, tNode); - - if (edgeWeightArr) { - edge.weight = edgeWeightArr[i]; - } - - this.edges.push(edge); - } - } - - forceAtlas2Proto.updateSettings = function() { - if (this.repulsionByDegree) { - for (var i = 0; i < this.nodes.length; i++) { - var node = this.nodes[i]; - node.mass = node.inDegree + node.outDegree + 1; - } - } - else { - for (var i = 0; i < this.nodes.length; i++) { - var node = this.nodes[i]; - node.mass = this._massArr[i]; - } - } - }; - - forceAtlas2Proto.update = function() { - var nNodes = this.nodes.length; - - this.updateSettings(); - - this.updateBBox(); - - // Update region - if (this.barnesHutOptimize) { - this.rootRegion.setBBox( - this.bbox[0], this.bbox[1], - this.bbox[2], this.bbox[3] - ); - - this.rootRegion.beforeUpdate(); - for (var i = 0; i < nNodes; i++) { - this.rootRegion.addNode(this.nodes[i]); - } - this.rootRegion.afterUpdate(); - } - - // Reset forces - for (var i = 0; i < nNodes; i++) { - var node = this.nodes[i]; - vec2.copy(node.forcePrev, node.force); - vec2.set(node.force, 0, 0); - } - - // Compute forces - // Repulsion - for (var i = 0; i < nNodes; i++) { - var na = this.nodes[i]; - if (this.barnesHutOptimize) { - this.applyRegionToNodeRepulsion(this.rootRegion, na); - } - else { - for (var j = i + 1; j < nNodes; j++) { - var nb = this.nodes[j]; - this.applyNodeToNodeRepulsion(na, nb, false); - } - } - - // Gravity - if (this.gravity > 0) { - if (this.strongGravityMode) { - this.applyNodeStrongGravity(na); - } - else { - this.applyNodeGravity(na); - } - } - } - - // Attraction - for (var i = 0; i < this.edges.length; i++) { - this.applyEdgeAttraction(this.edges[i]); - } - - // Handle swinging - var swingWeightedSum = 0; - var tractionWeightedSum = 0; - var tmp = vec2.create(); - for (var i = 0; i < nNodes; i++) { - var node = this.nodes[i]; - var swing = vec2.dist(node.force, node.forcePrev); - swingWeightedSum += swing * node.mass; - - vec2.add(tmp, node.force, node.forcePrev); - var traction = vec2.len(tmp) * 0.5; - tractionWeightedSum += traction * node.mass; - - // Save the value for using later - this._swingingArr[i] = swing; - } - var globalSpeed = this.jitterTolerence * this.jitterTolerence - * tractionWeightedSum / swingWeightedSum; - // NB: During our tests we observed that an excessive rise of the global speed could have a negative impact. - // That’s why we limited the increase of global speed s(t)(G) to 50% of the previous step s(t−1)(G). - if (this._globalSpeed > 0) { - globalSpeed = Math.min(globalSpeed / this._globalSpeed, 1.5) * this._globalSpeed; - } - this._globalSpeed = globalSpeed; - - // Apply forces - for (var i = 0; i < nNodes; i++) { - var node = this.nodes[i]; - var swing = this._swingingArr[i]; - - var speed = 0.1 * globalSpeed / (1 + globalSpeed * Math.sqrt(swing)); - - // Additional constraint to prevent local speed gets too high - var df = vec2.len(node.force); - if (df > 0) { - speed = Math.min(df * speed, 10) / df; - vec2.scaleAndAdd(node.position, node.position, node.force, speed); - } - } - }; - - forceAtlas2Proto.applyRegionToNodeRepulsion = (function() { - var v = vec2.create(); - return function applyRegionToNodeRepulsion(region, node) { - if (region.node) { // Region is a leaf - this.applyNodeToNodeRepulsion(region.node, node, true); - } - else { - vec2.sub(v, node.position, region.centerOfMass); - var d2 = v[0] * v[0] + v[1] * v[1]; - if (d2 > this.barnesHutTheta * region.size * region.size) { - var factor = this.scaling * node.mass * region.mass / d2; - vec2.scaleAndAdd(node.force, node.force, v, factor); - } - else { - for (var i = 0; i < region.nSubRegions; i++) { - this.applyRegionToNodeRepulsion(region.subRegions[i], node); - } - } - } - } - })(); - - forceAtlas2Proto.applyNodeToNodeRepulsion = (function() { - var v = vec2.create(); - return function applyNodeToNodeRepulsion(na, nb, oneWay) { - if (na == nb) { - return; - } - vec2.sub(v, na.position, nb.position); - var d2 = v[0] * v[0] + v[1] * v[1]; - - // PENDING - if (d2 === 0) { - return; - } - - var factor; - if (this.preventOverlap) { - var d = Math.sqrt(d2); - d = d - na.size - nb.size; - if (d > 0) { - factor = this.scaling * na.mass * nb.mass / (d * d); - } - else if (d < 0) { - // A stronger repulsion if overlap - factor = this.scaling * 100 * na.mass * nb.mass; - } - else { - // No repulsion - return; - } - } - else { - // Divide factor by an extra `d` to normalize the `v` - factor = this.scaling * na.mass * nb.mass / d2; - } - - vec2.scaleAndAdd(na.force, na.force, v, factor); - vec2.scaleAndAdd(nb.force, nb.force, v, -factor); - } - })(); - - forceAtlas2Proto.applyEdgeAttraction = (function() { - var v = vec2.create(); - return function applyEdgeAttraction(edge) { - var na = edge.source; - var nb = edge.target; - - vec2.sub(v, na.position, nb.position); - var d = vec2.len(v); - - var w; - if (this.edgeWeightInfluence === 0) { - w = 1; - } - else if (this.edgeWeightInfluence === 1) { - w = edge.weight; - } - else { - w = Math.pow(edge.weight, this.edgeWeightInfluence); - } - - var factor; - - if (this.preventOverlap) { - d = d - na.size - nb.size; - if (d <= 0) { - // No attraction - return; - } - } - - if (this.linLogMode) { - // Divide factor by an extra `d` to normalize the `v` - factor = - w * Math.log(d + 1) / (d + 1); - } - else { - factor = - w; - } - vec2.scaleAndAdd(na.force, na.force, v, factor); - vec2.scaleAndAdd(nb.force, nb.force, v, -factor); - } - })(); - - forceAtlas2Proto.applyNodeGravity = (function() { - var v = vec2.create(); - return function(node) { - vec2.sub(v, this.gravityCenter, node.position); - var d = vec2.len(v); - vec2.scaleAndAdd(node.force, node.force, v, this.gravity * node.mass / (d + 1)); - } - })(); - - forceAtlas2Proto.applyNodeStrongGravity = (function() { - var v = vec2.create(); - return function(node) { - vec2.sub(v, this.gravityCenter, node.position); - vec2.scaleAndAdd(node.force, node.force, v, this.gravity * node.mass); - } - })(); - - forceAtlas2Proto.updateBBox = function() { - var minX = Infinity; - var minY = Infinity; - var maxX = -Infinity; - var maxY = -Infinity; - for (var i = 0; i < this.nodes.length; i++) { - var pos = this.nodes[i].position; - minX = Math.min(minX, pos[0]); - minY = Math.min(minY, pos[1]); - maxX = Math.max(maxX, pos[0]); - maxY = Math.max(maxY, pos[1]); - } - this.bbox[0] = minX; - this.bbox[1] = minY; - this.bbox[2] = maxX; - this.bbox[3] = maxY; - }; - - forceAtlas2Proto.getGlobalSpeed = function () { - return this._globalSpeed; - } - - /**************************** - * Main process - ***************************/ - - var forceAtlas2 = null; - - self.onmessage = function(e) { - switch(e.data.cmd) { - case 'init': - forceAtlas2 = new ForceAtlas2(); - forceAtlas2.initNodes(e.data.nodesPosition, e.data.nodesMass, e.data.nodesSize); - forceAtlas2.initEdges(e.data.edges, e.data.edgesWeight); - break; - case 'updateConfig': - if (forceAtlas2) { - for (var name in e.data.config) { - forceAtlas2[name] = e.data.config[name]; - } - } - break; - case 'update': - var steps = e.data.steps; - if (forceAtlas2) { - for (var i = 0; i < steps; i++) { - forceAtlas2.update(); - } - - var nNodes = forceAtlas2.nodes.length; - var positionArr = new Float32Array(nNodes * 2); - // Callback - for (var i = 0; i < nNodes; i++) { - var node = forceAtlas2.nodes[i]; - positionArr[i * 2] = node.position[0]; - positionArr[i * 2 + 1] = node.position[1]; - } - self.postMessage({ - buffer: positionArr.buffer, - globalSpeed: forceAtlas2.getGlobalSpeed() - }, [positionArr.buffer]); - } - else { - // Not initialzied yet - var emptyArr = new Float32Array(); - // Post transfer object - self.postMessage({ - buffer: emptyArr.buffer, - globalSpeed: forceAtlas2.getGlobalSpeed() - }, [emptyArr.buffer]); - } - break; - } - } -} - -/* harmony default export */ __webpack_exports__["a"] = (forceAtlas2Worker); - -/***/ }), -/* 273 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_claygl_src_core_Base__ = __webpack_require__(7); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__retrieve__ = __webpack_require__(2); - - - - -/** - * @alias module:echarts-gl/util/Roam2DControl - */ -var Roam2DControl = __WEBPACK_IMPORTED_MODULE_0_claygl_src_core_Base__["a" /* default */].extend(function () { - - return { - /** - * @type {module:zrender~ZRender} - */ - zr: null, - - /** - * @type {module:echarts-gl/core/ViewGL} - */ - viewGL: null, - - minZoom: 0.2, - - maxZoom: 5, - - _needsUpdate: false, - - _dx: 0, - _dy: 0, - - _zoom: 1 - }; -}, function () { - // Each Roam2DControl has it's own handler - this._mouseDownHandler = this._mouseDownHandler.bind(this); - this._mouseWheelHandler = this._mouseWheelHandler.bind(this); - this._mouseMoveHandler = this._mouseMoveHandler.bind(this); - this._mouseUpHandler = this._mouseUpHandler.bind(this); - this._update = this._update.bind(this); -}, { - - init: function () { - var zr = this.zr; - - zr.on('mousedown', this._mouseDownHandler); - zr.on('mousewheel', this._mouseWheelHandler); - zr.on('globalout', this._mouseUpHandler); - - zr.animation.on('frame', this._update); - }, - - setTarget: function (target) { - this._target = target; - }, - - setZoom: function (zoom) { - this._zoom = Math.max(Math.min( - zoom, this.maxZoom - ), this.minZoom); - this._needsUpdate = true; - }, - - setOffset: function (offset) { - this._dx = offset[0]; - this._dy = offset[1]; - - this._needsUpdate = true; - }, - - getZoom: function () { - return this._zoom; - }, - - getOffset: function () { - return [this._dx, this._dy]; - }, - - _update: function () { - if (!this._target) { - return; - } - if (!this._needsUpdate) { - return; - } - - var target = this._target; - - var scale = this._zoom; - - target.position.x = this._dx; - target.position.y = this._dy; - - target.scale.set(scale, scale, scale); - - this.zr.refresh(); - - this._needsUpdate = false; - - this.trigger('update'); - }, - - _mouseDownHandler: function (e) { - if (e.target) { - return; - } - - var x = e.offsetX; - var y = e.offsetY; - if (this.viewGL && !this.viewGL.containPoint(x, y)) { - return; - } - - this.zr.on('mousemove', this._mouseMoveHandler); - this.zr.on('mouseup', this._mouseUpHandler); - - var pos = this._convertPos(x, y); - - this._x = pos.x; - this._y = pos.y; - }, - - // Convert pos from screen space to viewspace. - _convertPos: function (x, y) { - - var camera = this.viewGL.camera; - var viewport = this.viewGL.viewport; - // PENDING - return { - x: (x - viewport.x) / viewport.width * (camera.right - camera.left) + camera.left, - y: (y - viewport.y) / viewport.height * (camera.bottom - camera.top) + camera.top - }; - }, - - _mouseMoveHandler: function (e) { - - var pos = this._convertPos(e.offsetX, e.offsetY); - - this._dx += pos.x - this._x; - this._dy += pos.y - this._y; - - this._x = pos.x; - this._y = pos.y; - - this._needsUpdate = true; - }, - - _mouseUpHandler: function (e) { - this.zr.off('mousemove', this._mouseMoveHandler); - this.zr.off('mouseup', this._mouseUpHandler); - }, - - _mouseWheelHandler: function (e) { - e = e.event; - var delta = e.wheelDelta // Webkit - || -e.detail; // Firefox - if (delta === 0) { - return; - } - - var x = e.offsetX; - var y = e.offsetY; - if (this.viewGL && !this.viewGL.containPoint(x, y)) { - return; - } - - var zoomScale = delta > 0 ? 1.1 : 0.9; - var newZoom = Math.max(Math.min( - this._zoom * zoomScale, this.maxZoom - ), this.minZoom); - zoomScale = newZoom / this._zoom; - - var pos = this._convertPos(x, y); - - var fixX = (pos.x - this._dx) * (zoomScale - 1); - var fixY = (pos.y - this._dy) * (zoomScale - 1); - - this._dx -= fixX; - this._dy -= fixY; - - this._zoom = newZoom; - - this._needsUpdate = true; - }, - - dispose: function () { - - var zr = this.zr; - zr.off('mousedown', this._mouseDownHandler); - zr.off('mousemove', this._mouseMoveHandler); - zr.off('mouseup', this._mouseUpHandler); - zr.off('mousewheel', this._mouseWheelHandler); - zr.off('globalout', this._mouseUpHandler); - - zr.animation.off('frame', this._update); - } -}); - -/* harmony default export */ __webpack_exports__["a"] = (Roam2DControl); - -/***/ }), -/* 274 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export ecgl.lines2D.vertex\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nattribute vec2 position: POSITION;\nattribute vec4 a_Color : COLOR;\nvarying vec4 v_Color;\n\n#ifdef POSITIONTEXTURE_ENABLED\nuniform sampler2D positionTexture;\n#endif\n\nvoid main()\n{\n gl_Position = worldViewProjection * vec4(position, -10.0, 1.0);\n\n v_Color = a_Color;\n}\n\n@end\n\n@export ecgl.lines2D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\n\nvoid main()\n{\n gl_FragColor = color * v_Color;\n}\n@end\n\n\n@export ecgl.meshLines2D.vertex\n\nattribute vec2 position: POSITION;\nattribute vec2 normal;\nattribute float offset;\nattribute vec4 a_Color : COLOR;\n\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\nuniform vec4 viewport : VIEWPORT;\n\nvarying vec4 v_Color;\nvarying float v_Miter;\n\nvoid main()\n{\n vec4 p2 = worldViewProjection * vec4(position + normal, -10.0, 1.0);\n gl_Position = worldViewProjection * vec4(position, -10.0, 1.0);\n\n p2.xy /= p2.w;\n gl_Position.xy /= gl_Position.w;\n\n vec2 N = normalize(p2.xy - gl_Position.xy);\n gl_Position.xy += N * offset / viewport.zw * 2.0;\n\n gl_Position.xy *= gl_Position.w;\n\n v_Color = a_Color;\n}\n@end\n\n\n@export ecgl.meshLines2D.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\n\nvarying vec4 v_Color;\nvarying float v_Miter;\n\nvoid main()\n{\n gl_FragColor = color * v_Color;\n}\n\n@end"); - - -/***/ }), -/* 275 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__flowGL_FlowGLView__ = __webpack_require__(276); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__flowGL_FlowGLSeries__ = __webpack_require__(280); - - - - - - -/***/ }), -/* 276 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__util_retrieve__ = __webpack_require__(2); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__core_ViewGL__ = __webpack_require__(22); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__VectorFieldParticleSurface__ = __webpack_require__(277); - - - - - - - - -// TODO 百度地图不是 linear 的 -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendChartView({ - - type: 'flowGL', - - __ecgl__: true, - - init: function (ecModel, api) { - this.viewGL = new __WEBPACK_IMPORTED_MODULE_3__core_ViewGL__["a" /* default */]('orthographic'); - this.groupGL = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Node(); - this.viewGL.add(this.groupGL); - - this._particleSurface = new __WEBPACK_IMPORTED_MODULE_4__VectorFieldParticleSurface__["a" /* default */](); - - var planeMesh = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Mesh({ - geometry: new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].PlaneGeometry(), - material: new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Material({ - shader: new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Shader({ - vertex: __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Shader.source('ecgl.color.vertex'), - fragment: __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Shader.source('ecgl.color.fragment') - }), - // Must enable blending and multiply alpha. - // Or premultipliedAlpha will let the alpha useless. - transparent: true - }) - }); - planeMesh.material.enableTexture('diffuseMap'); - - this.groupGL.add(planeMesh); - - this._planeMesh = planeMesh; - - }, - - render: function (seriesModel, ecModel, api) { - var particleSurface = this._particleSurface; - // Set particleType before set others. - particleSurface.setParticleType(seriesModel.get('particleType')); - particleSurface.setSupersampling(seriesModel.get('supersampling')); - - this._updateData(seriesModel, api); - this._updateCamera(api.getWidth(), api.getHeight(), api.getDevicePixelRatio()); - - var particleDensity = __WEBPACK_IMPORTED_MODULE_2__util_retrieve__["a" /* default */].firstNotNull(seriesModel.get('particleDensity'), 128); - particleSurface.setParticleDensity(particleDensity, particleDensity); - - var planeMesh = this._planeMesh; - - var time = +(new Date()); - var self = this; - var firstFrame = true; - planeMesh.__percent = 0; - planeMesh.stopAnimation(); - planeMesh.animate('', { loop: true }) - .when(100000, { - __percent: 1 - }) - .during(function () { - var timeNow = + (new Date()); - var dTime = Math.min(timeNow - time, 20); - time = time + dTime; - if (self._renderer) { - particleSurface.update(self._renderer, api, dTime / 1000, firstFrame); - planeMesh.material.set('diffuseMap', particleSurface.getSurfaceTexture()); - // planeMesh.material.set('diffuseMap', self._particleSurface.vectorFieldTexture); - } - firstFrame = false; - }) - .start(); - - var itemStyleModel = seriesModel.getModel('itemStyle'); - var color = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor(itemStyleModel.get('color')); - color[3] *= __WEBPACK_IMPORTED_MODULE_2__util_retrieve__["a" /* default */].firstNotNull(itemStyleModel.get('opacity'), 1); - planeMesh.material.set('color', color); - - particleSurface.setColorTextureImage(seriesModel.get('colorTexture'), api); - particleSurface.setParticleSize(seriesModel.get('particleSize')); - particleSurface.particleSpeedScaling = seriesModel.get('particleSpeed'); - particleSurface.motionBlurFactor = 1.0 - Math.pow(0.1, seriesModel.get('particleTrail')); - }, - - updateTransform: function (seriesModel, ecModel, api) { - this._updateData(seriesModel, api); - }, - - afterRender: function (globeModel, ecModel, api, layerGL) { - var renderer = layerGL.renderer; - this._renderer = renderer; - }, - - _updateData: function (seriesModel, api) { - var coordSys = seriesModel.coordinateSystem; - var dims = coordSys.dimensions.map(function (coordDim) { - return seriesModel.coordDimToDataDim(coordDim)[0]; - }); - - var data = seriesModel.getData(); - var xExtent = data.getDataExtent(dims[0]); - var yExtent = data.getDataExtent(dims[1]); - - var gridWidth = seriesModel.get('gridWidth'); - var gridHeight = seriesModel.get('gridHeight'); - - if (gridWidth == null || gridWidth === 'auto') { - // TODO not accurate. - var aspect = (xExtent[1] - xExtent[0]) / (yExtent[1] - yExtent[0]); - gridWidth = Math.round(Math.sqrt(aspect * data.count())); - } - if (gridHeight == null || gridHeight === 'auto') { - gridHeight = Math.ceil(data.count() / gridWidth); - } - - var vectorFieldTexture = this._particleSurface.vectorFieldTexture; - - // Half Float needs Uint16Array - var pixels = vectorFieldTexture.pixels; - if (!pixels || pixels.length !== gridHeight * gridWidth * 4) { - pixels = vectorFieldTexture.pixels = new Float32Array(gridWidth * gridHeight * 4); - } - else { - for (var i = 0; i < pixels.length; i++) { - pixels[i] = 0; - } - } - - var maxMag = 0; - var minMag = Infinity; - - var points = new Float32Array(data.count() * 2); - var offset = 0; - var bbox = [[Infinity, Infinity], [-Infinity, -Infinity]]; - - data.each([dims[0], dims[1], 'vx', 'vy'], function (x, y, vx, vy) { - var pt = coordSys.dataToPoint([x, y]); - points[offset++] = pt[0]; - points[offset++] = pt[1]; - bbox[0][0] = Math.min(pt[0], bbox[0][0]); - bbox[0][1] = Math.min(pt[1], bbox[0][1]); - bbox[1][0] = Math.max(pt[0], bbox[1][0]); - bbox[1][1] = Math.max(pt[1], bbox[1][1]); - - var mag = Math.sqrt(vx * vx + vy * vy); - maxMag = Math.max(maxMag, mag); - minMag = Math.min(minMag, mag); - }); - - data.each(['vx', 'vy'], function (vx, vy, i) { - var xPix = Math.round((points[i * 2] - bbox[0][0]) / (bbox[1][0] - bbox[0][0]) * (gridWidth - 1)); - var yPix = gridHeight - 1 - Math.round((points[i * 2 + 1] - bbox[0][1]) / (bbox[1][1] - bbox[0][1]) * (gridHeight - 1)); - - var idx = (yPix * gridWidth + xPix) * 4; - - pixels[idx] = (vx / maxMag * 0.5 + 0.5); - pixels[idx + 1] = (vy / maxMag * 0.5 + 0.5); - pixels[idx + 3] = 1; - }); - - vectorFieldTexture.width = gridWidth; - vectorFieldTexture.height = gridHeight; - - if (seriesModel.get('coordinateSystem') === 'bmap') { - this._fillEmptyPixels(vectorFieldTexture); - } - - vectorFieldTexture.dirty(); - - this._updatePlanePosition(bbox[0], bbox[1], seriesModel,api); - this._updateGradientTexture(data.getVisual('visualMeta'), [minMag, maxMag]); - - }, - // PENDING Use grid mesh ? or delaunay triangulation? - _fillEmptyPixels: function (texture) { - var pixels = texture.pixels; - var width = texture.width; - var height = texture.height; - - function fetchPixel(x, y, rg) { - x = Math.max(Math.min(x, width - 1), 0); - y = Math.max(Math.min(y, height - 1), 0); - var idx = (y * (width - 1) + x) * 4; - if (pixels[idx + 3] === 0) { - return false; - } - rg[0] = pixels[idx]; - rg[1] = pixels[idx + 1]; - return true; - } - - function addPixel(a, b, out) { - out[0] = a[0] + b[0]; - out[1] = a[1] + b[1]; - } - - var center = [], left = [], right = [], top = [], bottom = []; - var weight = 0; - for (var y = 0; y < height; y++) { - for (var x = 0; x < width; x++) { - var idx = (y * (width - 1) + x) * 4; - if (pixels[idx + 3] === 0) { - weight = center[0] = center[1] = 0; - if (fetchPixel(x - 1, y, left)) { - weight++; addPixel(left, center, center); - } - if (fetchPixel(x + 1, y, right)) { - weight++; addPixel(right, center, center); - } - if (fetchPixel(x, y - 1, top)) { - weight++; addPixel(top, center, center); - } - if (fetchPixel(x, y + 1, bottom)) { - weight++; addPixel(bottom, center, center); - } - center[0] /= weight; - center[1] /= weight; - // PENDING If overwrite. bilinear interpolation. - pixels[idx] = center[0]; - pixels[idx + 1] = center[1]; - } - pixels[idx + 3] = 1; - } - } - }, - - _updateGradientTexture: function (visualMeta, magExtent) { - if (!visualMeta || !visualMeta.length) { - this._particleSurface.setGradientTexture(null); - return; - } - // TODO Different dimensions - this._gradientTexture = this._gradientTexture || new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Texture2D({ - image: document.createElement('canvas') - }); - var gradientTexture = this._gradientTexture; - var canvas = gradientTexture.image; - canvas.width = 200; - canvas.height = 1; - var ctx = canvas.getContext('2d'); - var gradient = ctx.createLinearGradient(0, 0.5, canvas.width, 0.5); - visualMeta[0].stops.forEach(function (stop) { - var offset; - if (magExtent[1] === magExtent[0]) { - offset = 0; - } - else { - offset = stop.value / magExtent[1]; - offset = Math.min(Math.max(offset, 0), 1); - } - - gradient.addColorStop(offset, stop.color); - }); - ctx.fillStyle = gradient; - ctx.fillRect(0, 0, canvas.width, canvas.height); - gradientTexture.dirty(); - - this._particleSurface.setGradientTexture(this._gradientTexture); - }, - - _updatePlanePosition: function (leftTop, rightBottom, seriesModel, api) { - var limitedResult = this._limitInViewportAndFullFill(leftTop, rightBottom, seriesModel, api); - leftTop = limitedResult.leftTop; - rightBottom = limitedResult.rightBottom; - this._particleSurface.setRegion(limitedResult.region); - - this._planeMesh.position.set( - (leftTop[0] + rightBottom[0]) / 2, - api.getHeight() - (leftTop[1] + rightBottom[1]) / 2, - 0 - ); - - var width = rightBottom[0] - leftTop[0]; - var height = rightBottom[1] - leftTop[1]; - this._planeMesh.scale.set(width / 2, height / 2, 1); - - this._particleSurface.resize( - Math.max(Math.min(width, 2048), 1), - Math.max(Math.min(height, 2048), 1) - ); - - if (this._renderer) { - this._particleSurface.clearFrame(this._renderer); - } - }, - - _limitInViewportAndFullFill: function (leftTop, rightBottom, seriesModel, api) { - var newLeftTop = [ - Math.max(leftTop[0], 0), - Math.max(leftTop[1], 0) - ]; - var newRightBottom = [ - Math.min(rightBottom[0], api.getWidth()), - Math.min(rightBottom[1], api.getHeight()) - ]; - // Tiliing in lng orientation. - if (seriesModel.get('coordinateSystem') === 'bmap') { - var lngRange = seriesModel.getData().getDataExtent(seriesModel.coordDimToDataDim('lng')[0]); - // PENDING, consider grid density - var isContinuous = Math.floor(lngRange[1] - lngRange[0]) >= 359; - if (isContinuous) { - if (newLeftTop[0] > 0) { - newLeftTop[0] = 0; - } - if (newRightBottom[0] < api.getWidth()) { - newRightBottom[0] = api.getWidth(); - } - } - } - - var width = rightBottom[0] - leftTop[0]; - var height = rightBottom[1] - leftTop[1]; - var newWidth = newRightBottom[0] - newLeftTop[0]; - var newHeight = newRightBottom[1] - newLeftTop[1]; - - var region = [ - (newLeftTop[0] - leftTop[0]) / width, - 1.0 - newHeight / height - (newLeftTop[1] - leftTop[1]) / height, - newWidth / width, - newHeight / height - ]; - - return { - leftTop: newLeftTop, - rightBottom: newRightBottom, - region: region - }; - }, - - _updateCamera: function (width, height, dpr) { - this.viewGL.setViewport(0, 0, width, height, dpr); - var camera = this.viewGL.camera; - // FIXME bottom can't be larger than top - camera.left = camera.bottom = 0; - camera.top = height; - camera.right = width; - camera.near = 0; - camera.far = 100; - camera.position.z = 10; - }, - - remove: function () { - this._planeMesh.stopAnimation(); - this.groupGL.removeAll(); - }, - - dispose: function () { - if (this._renderer) { - this._particleSurface.dispose(this._renderer); - } - this.groupGL.removeAll(); - } -}); - - -/***/ }), -/* 277 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_claygl_src_compositor_Pass__ = __webpack_require__(16); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_claygl_src_Geometry__ = __webpack_require__(15); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_claygl_src_Mesh__ = __webpack_require__(40); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_claygl_src_Material__ = __webpack_require__(19); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__ = __webpack_require__(8); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_claygl_src_Texture2D__ = __webpack_require__(5); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_claygl_src_Texture__ = __webpack_require__(4); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_claygl_src_camera_Orthographic__ = __webpack_require__(37); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_claygl_src_geometry_Plane__ = __webpack_require__(43); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_claygl_src_FrameBuffer__ = __webpack_require__(10); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__Line2D__ = __webpack_require__(278); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__vectorFieldParticle_glsl_js__ = __webpack_require__(279); - - - - - - - - - - - - -// import TemporalSS from '../../effect/TemporalSuperSampling'; - - - -__WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */]['import'](__WEBPACK_IMPORTED_MODULE_11__vectorFieldParticle_glsl_js__["a" /* default */]); - -function createSpriteCanvas(size) { - var canvas = document.createElement('canvas'); - canvas.width = canvas.height = size; - var ctx = canvas.getContext('2d'); - ctx.fillStyle = '#fff'; - ctx.arc(size / 2, size / 2, size / 2, 0, Math.PI * 2); - ctx.fill(); - return canvas; -} - -// import spriteUtil from '../../util/sprite'; - -var VectorFieldParticleSurface = function () { - - /** - * @type {number} - */ - this.motionBlurFactor = 0.99; - /** - * Vector field lookup image - * @type {clay.Texture2D} - */ - this.vectorFieldTexture = new __WEBPACK_IMPORTED_MODULE_5_claygl_src_Texture2D__["a" /* default */]({ - type: __WEBPACK_IMPORTED_MODULE_6_claygl_src_Texture__["a" /* default */].FLOAT, - // minFilter: Texture.NEAREST, - // magFilter: Texture.NEAREST, - flipY: false - }); - - /** - * Particle life range - * @type {Array.} - */ - this.particleLife = [5, 20]; - - this._particleType = 'point'; - - /** - * @type {number} - */ - this._particleSize = 1; - - /** - * @type {Array.} - */ - this.particleColor = [1, 1, 1, 1]; - - /** - * @type {number} - */ - this.particleSpeedScaling = 1.0; - - /** - * @type {clay.Texture2D} - */ - this._thisFrameTexture = null; - - this._particlePass = null; - this._spawnTexture = null; - this._particleTexture0 = null; - this._particleTexture1 = null; - - this._particlePointsMesh = null; - - this._surfaceFrameBuffer = null; - - this._elapsedTime = 0.0; - - this._scene = null; - this._camera = null; - - this._lastFrameTexture = null; - - // this._temporalSS = new TemporalSS(50); - - // this._antialising = false; - - this._supersampling = 1; - - this._downsampleTextures = []; - - this._width = 512; - this._height = 512; - - this.init(); -}; - -VectorFieldParticleSurface.prototype = { - - constructor: VectorFieldParticleSurface, - - init: function () { - var parameters = { - type: __WEBPACK_IMPORTED_MODULE_6_claygl_src_Texture__["a" /* default */].FLOAT, - minFilter: __WEBPACK_IMPORTED_MODULE_6_claygl_src_Texture__["a" /* default */].NEAREST, - magFilter: __WEBPACK_IMPORTED_MODULE_6_claygl_src_Texture__["a" /* default */].NEAREST, - useMipmap: false - }; - this._spawnTexture = new __WEBPACK_IMPORTED_MODULE_5_claygl_src_Texture2D__["a" /* default */](parameters); - - this._particleTexture0 = new __WEBPACK_IMPORTED_MODULE_5_claygl_src_Texture2D__["a" /* default */](parameters); - this._particleTexture1 = new __WEBPACK_IMPORTED_MODULE_5_claygl_src_Texture2D__["a" /* default */](parameters); - - this._frameBuffer = new __WEBPACK_IMPORTED_MODULE_9_claygl_src_FrameBuffer__["a" /* default */]({ - depthBuffer: false - }); - this._particlePass = new __WEBPACK_IMPORTED_MODULE_0_claygl_src_compositor_Pass__["a" /* default */]({ - fragment: __WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].source('ecgl.vfParticle.particle.fragment') - }); - this._particlePass.setUniform('velocityTexture', this.vectorFieldTexture); - this._particlePass.setUniform('spawnTexture', this._spawnTexture); - - this._downsamplePass = new __WEBPACK_IMPORTED_MODULE_0_claygl_src_compositor_Pass__["a" /* default */]({ - fragment: __WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].source('clay.compositor.downsample') - }); - - var particlePointsMesh = new __WEBPACK_IMPORTED_MODULE_2_claygl_src_Mesh__["a" /* default */]({ - // Render after last frame full quad - renderOrder: 10, - material: new __WEBPACK_IMPORTED_MODULE_3_claygl_src_Material__["a" /* default */]({ - shader: new __WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */]( - __WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].source('ecgl.vfParticle.renderPoints.vertex'), - __WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].source('ecgl.vfParticle.renderPoints.fragment') - ) - }), - mode: __WEBPACK_IMPORTED_MODULE_2_claygl_src_Mesh__["a" /* default */].POINTS, - geometry: new __WEBPACK_IMPORTED_MODULE_1_claygl_src_Geometry__["a" /* default */]({ - dynamic: true, - mainAttribute: 'texcoord0' - }) - }); - var particleLinesMesh = new __WEBPACK_IMPORTED_MODULE_2_claygl_src_Mesh__["a" /* default */]({ - // Render after last frame full quad - renderOrder: 10, - material: new __WEBPACK_IMPORTED_MODULE_3_claygl_src_Material__["a" /* default */]({ - shader: new __WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */]( - __WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].source('ecgl.vfParticle.renderLines.vertex'), - __WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].source('ecgl.vfParticle.renderLines.fragment') - ) - }), - geometry: new __WEBPACK_IMPORTED_MODULE_10__Line2D__["a" /* default */](), - culling: false - }); - var lastFrameFullQuad = new __WEBPACK_IMPORTED_MODULE_2_claygl_src_Mesh__["a" /* default */]({ - material: new __WEBPACK_IMPORTED_MODULE_3_claygl_src_Material__["a" /* default */]({ - shader: new __WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */]( - __WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].source('ecgl.color.vertex'), - __WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].source('ecgl.color.fragment') - ) - // DO NOT BLEND Blend will multiply alpha - // transparent: true - }), - geometry: new __WEBPACK_IMPORTED_MODULE_8_claygl_src_geometry_Plane__["a" /* default */]() - }); - lastFrameFullQuad.material.enableTexture('diffuseMap'); - - this._particlePointsMesh = particlePointsMesh; - this._particleLinesMesh = particleLinesMesh; - this._lastFrameFullQuadMesh = lastFrameFullQuad; - - this._camera = new __WEBPACK_IMPORTED_MODULE_7_claygl_src_camera_Orthographic__["a" /* default */](); - this._thisFrameTexture = new __WEBPACK_IMPORTED_MODULE_5_claygl_src_Texture2D__["a" /* default */](); - this._lastFrameTexture = new __WEBPACK_IMPORTED_MODULE_5_claygl_src_Texture2D__["a" /* default */](); - }, - - setParticleDensity: function (width, height) { - var nVertex = width * height; - - var spawnTextureData = new Float32Array(nVertex * 4); - var off = 0; - var lifeRange = this.particleLife; - for (var i = 0; i < width; i++) { - for (var j = 0; j < height; j++, off++) { - // x position, range [0 - 1] - spawnTextureData[off * 4] = Math.random(); - // y position, range [0 - 1] - spawnTextureData[off * 4 + 1] = Math.random(); - // Some property - spawnTextureData[off * 4 + 2] = Math.random(); - var life = (lifeRange[1] - lifeRange[0]) * Math.random() + lifeRange[0]; - // Particle life - spawnTextureData[off * 4 + 3] = life; - } - } - - if (this._particleType === 'line') { - this._setLineGeometry(width, height); - } - else { - this._setPointsGeometry(width, height); - } - - this._spawnTexture.width = width; - this._spawnTexture.height = height; - this._spawnTexture.pixels = spawnTextureData; - - this._particleTexture0.width = this._particleTexture1.width = width; - this._particleTexture0.height = this._particleTexture1.height = height; - - this._particlePass.setUniform('textureSize', [width, height]); - }, - - _setPointsGeometry: function (width, height) { - var nVertex = width * height; - var geometry = this._particlePointsMesh.geometry; - var attributes = geometry.attributes; - attributes.texcoord0.init(nVertex); - - var off = 0; - for (var i = 0; i < width; i++) { - for (var j = 0; j < height; j++, off++) { - attributes.texcoord0.value[off * 2] = i / width; - attributes.texcoord0.value[off * 2 + 1] = j / height; - } - } - geometry.dirty(); - }, - - _setLineGeometry: function (width, height) { - var nLine = width * height; - var geometry = this._getParticleMesh().geometry; - geometry.setLineCount(nLine); - geometry.resetOffset(); - for (var i = 0; i < width; i++) { - for (var j = 0; j < height; j++) { - geometry.addLine([i / width, j / height]); - } - } - geometry.dirty(); - }, - - _getParticleMesh: function () { - return this._particleType === 'line' ? this._particleLinesMesh : this._particlePointsMesh; - }, - - update: function (renderer, api, deltaTime, firstFrame) { - var particleMesh = this._getParticleMesh(); - var frameBuffer = this._frameBuffer; - var particlePass = this._particlePass; - - if (firstFrame) { - this._updateDownsampleTextures(renderer, api); - } - - particleMesh.material.set('size', this._particleSize * this._supersampling); - particleMesh.material.set('color', this.particleColor); - particlePass.setUniform('speedScaling', this.particleSpeedScaling); - - frameBuffer.attach(this._particleTexture1); - particlePass.setUniform('firstFrameTime', firstFrame ? (this.particleLife[1] + this.particleLife[0]) / 2 : 0); - particlePass.setUniform('particleTexture', this._particleTexture0); - particlePass.setUniform('deltaTime', deltaTime); - particlePass.setUniform('elapsedTime', this._elapsedTime); - particlePass.render(renderer, frameBuffer); - - particleMesh.material.set('particleTexture', this._particleTexture1); - particleMesh.material.set('prevParticleTexture', this._particleTexture0); - - frameBuffer.attach(this._thisFrameTexture); - frameBuffer.bind(renderer); - renderer.gl.clear(renderer.gl.DEPTH_BUFFER_BIT | renderer.gl.COLOR_BUFFER_BIT); - var lastFrameFullQuad = this._lastFrameFullQuadMesh; - lastFrameFullQuad.material.set('diffuseMap', this._lastFrameTexture); - lastFrameFullQuad.material.set('color', [1, 1, 1, this.motionBlurFactor]); - - this._camera.update(true); - renderer.renderPass([lastFrameFullQuad, particleMesh], this._camera); - frameBuffer.unbind(renderer); - - this._downsample(renderer); - - this._swapTexture(); - - this._elapsedTime += deltaTime; - }, - - _downsample: function (renderer) { - var downsampleTextures = this._downsampleTextures; - if (downsampleTextures.length === 0) { - return; - } - var current = 0; - var sourceTexture = this._thisFrameTexture; - var targetTexture = downsampleTextures[current]; - - while (targetTexture) { - this._frameBuffer.attach(targetTexture); - this._downsamplePass.setUniform('texture', sourceTexture); - this._downsamplePass.setUniform('textureSize', [sourceTexture.width, sourceTexture.height]); - this._downsamplePass.render(renderer, this._frameBuffer); - - sourceTexture = targetTexture; - targetTexture = downsampleTextures[++current]; - } - }, - - getSurfaceTexture: function () { - var downsampleTextures = this._downsampleTextures; - return downsampleTextures.length > 0 - ? downsampleTextures[downsampleTextures.length - 1] - : this._lastFrameTexture; - }, - - setRegion: function (region) { - this._particlePass.setUniform('region', region); - }, - - resize: function (width, height) { - this._lastFrameTexture.width = width * this._supersampling; - this._lastFrameTexture.height = height * this._supersampling; - this._thisFrameTexture.width = width * this._supersampling; - this._thisFrameTexture.height = height * this._supersampling; - - this._width = width; - this._height = height; - }, - - setParticleSize: function (size) { - var particleMesh = this._getParticleMesh(); - if (size <= 2) { - particleMesh.material.disableTexture('spriteTexture'); - particleMesh.material.transparent = false; - return; - } - if (!this._spriteTexture) { - this._spriteTexture = new __WEBPACK_IMPORTED_MODULE_5_claygl_src_Texture2D__["a" /* default */](); - } - if (!this._spriteTexture.image || this._spriteTexture.image.width !== size) { - this._spriteTexture.image = createSpriteCanvas(size); - this._spriteTexture.dirty(); - } - particleMesh.material.transparent = true; - particleMesh.material.enableTexture('spriteTexture'); - particleMesh.material.set('spriteTexture', this._spriteTexture); - - this._particleSize = size; - }, - - setGradientTexture: function (gradientTexture) { - var material = this._getParticleMesh().material; - material[gradientTexture ? 'enableTexture' : 'disableTexture']('gradientTexture'); - material.setUniform('gradientTexture', gradientTexture); - }, - - setColorTextureImage: function (colorTextureImg, api) { - var material = this._getParticleMesh().material; - material.setTextureImage('colorTexture', colorTextureImg, api, { - flipY: true - }); - }, - - setParticleType: function (type) { - this._particleType = type; - }, - - clearFrame: function (renderer) { - var frameBuffer = this._frameBuffer; - frameBuffer.attach(this._lastFrameTexture); - frameBuffer.bind(renderer); - renderer.gl.clear(renderer.gl.DEPTH_BUFFER_BIT | renderer.gl.COLOR_BUFFER_BIT); - frameBuffer.unbind(renderer); - }, - - setSupersampling: function (supersampling) { - this._supersampling = supersampling; - this.resize(this._width, this._height); - }, - - _updateDownsampleTextures: function (renderer, api) { - var downsampleTextures = this._downsampleTextures; - var upScale = Math.max(Math.floor(Math.log(this._supersampling / api.getDevicePixelRatio()) / Math.log(2)), 0); - var scale = 2; - var width = this._width * this._supersampling; - var height = this._height * this._supersampling; - for (var i = 0; i < upScale; i++) { - downsampleTextures[i] = downsampleTextures[i] || new __WEBPACK_IMPORTED_MODULE_5_claygl_src_Texture2D__["a" /* default */](); - downsampleTextures[i].width = width / scale; - downsampleTextures[i].height = height / scale; - scale *= 2; - } - for (;i < downsampleTextures.length; i++) { - downsampleTextures[i].dispose(renderer); - } - downsampleTextures.length = upScale; - }, - - _swapTexture: function () { - var tmp = this._particleTexture0; - this._particleTexture0 = this._particleTexture1; - this._particleTexture1 = tmp; - - var tmp = this._thisFrameTexture; - this._thisFrameTexture = this._lastFrameTexture; - this._lastFrameTexture = tmp; - }, - - dispose: function (renderer) { - renderer.disposeFrameBuffer(this._frameBuffer); - // Dispose textures - renderer.disposeTexture(this.vectorFieldTexture); - renderer.disposeTexture(this._spawnTexture); - renderer.disposeTexture(this._particleTexture0); - renderer.disposeTexture(this._particleTexture1); - renderer.disposeTexture(this._thisFrameTexture); - renderer.disposeTexture(this._lastFrameTexture); - - renderer.disposeGeometry(this._particleLinesMesh.geometry); - renderer.disposeGeometry(this._particlePointsMesh.geometry); - renderer.disposeGeometry(this._lastFrameFullQuadMesh.geometry); - - if (this._spriteTexture) { - renderer.disposeTexture(this._spriteTexture); - } - - this._particlePass.dispose(renderer); - this._downsamplePass.dispose(renderer); - - this._downsampleTextures.forEach(function (texture) { - texture.dispose(renderer); - }); - } -}; - -/* harmony default export */ __webpack_exports__["a"] = (VectorFieldParticleSurface); - -/***/ }), -/* 278 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_claygl_src_Geometry__ = __webpack_require__(15); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_echarts_lib_echarts__); -/** - * Lines geometry - * Use screen space projected lines lineWidth > MAX_LINE_WIDTH - * https://mattdesl.svbtle.com/drawing-lines-is-hard - * @module echarts-gl/util/geometry/LinesGeometry - * @author Yi Shen(http://github.com/pissang) - */ - - - - -/** - * @constructor - * @alias module:echarts-gl/chart/flowGL/Line2D - * @extends clay.Geometry - */ - -var LinesGeometry = __WEBPACK_IMPORTED_MODULE_0_claygl_src_Geometry__["a" /* default */].extend(function () { - return { - - dynamic: true, - - attributes: { - position: new __WEBPACK_IMPORTED_MODULE_0_claygl_src_Geometry__["a" /* default */].Attribute('position', 'float', 3, 'POSITION') - } - }; -}, -/** @lends module: echarts-gl/util/geometry/LinesGeometry.prototype */ -{ - - /** - * Reset offset - */ - resetOffset: function () { - this._vertexOffset = 0; - this._faceOffset = 0; - }, - - /** - * @param {number} nVertex - */ - setLineCount: function (nLine) { - var attributes = this.attributes; - var nVertex = 4 * nLine; - var nTriangle = 2 * nLine; - if (this.vertexCount !== nVertex) { - attributes.position.init(nVertex); - } - if (this.triangleCount !== nTriangle) { - if (nTriangle === 0) { - this.indices = null; - } - else { - this.indices = this.vertexCount > 0xffff ? new Uint32Array(nTriangle * 3) : new Uint16Array(nTriangle * 3); - } - } - }, - - addLine: function (p) { - var vertexOffset = this._vertexOffset; - this.attributes.position.set(vertexOffset, [p[0], p[1], 1]); - this.attributes.position.set(vertexOffset + 1, [p[0], p[1], -1]); - this.attributes.position.set(vertexOffset + 2, [p[0], p[1], 2]); - this.attributes.position.set(vertexOffset + 3, [p[0], p[1], -2]); - - this.setTriangleIndices( - this._faceOffset++, [ - vertexOffset, vertexOffset + 1, vertexOffset + 2 - ] - ); - this.setTriangleIndices( - this._faceOffset++, [ - vertexOffset + 1, vertexOffset + 2, vertexOffset + 3 - ] - ); - - this._vertexOffset += 4; - } -}); - -/* harmony default export */ __webpack_exports__["a"] = (LinesGeometry); - -/***/ }), -/* 279 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony default export */ __webpack_exports__["a"] = ("@export ecgl.vfParticle.particle.fragment\n\nuniform sampler2D particleTexture;\nuniform sampler2D spawnTexture;\nuniform sampler2D velocityTexture;\n\nuniform float deltaTime;\nuniform float elapsedTime;\n\nuniform float speedScaling : 1.0;\n\nuniform vec2 textureSize;\nuniform vec4 region : [0, 0, 1, 1];\nuniform float firstFrameTime;\n\nvarying vec2 v_Texcoord;\n\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, v_Texcoord);\n bool spawn = false;\n if (p.w <= 0.0) {\n p = texture2D(spawnTexture, fract(v_Texcoord + elapsedTime / 10.0));\n p.w -= firstFrameTime;\n spawn = true;\n }\n vec2 v = texture2D(velocityTexture, fract(p.xy * region.zw + region.xy)).xy;\n v = (v - 0.5) * 2.0;\n p.z = length(v);\n p.xy += v * deltaTime / 10.0 * speedScaling;\n p.w -= deltaTime;\n\n if (spawn || p.xy != fract(p.xy)) {\n p.z = 0.0;\n }\n p.xy = fract(p.xy);\n\n gl_FragColor = p;\n}\n@end\n\n@export ecgl.vfParticle.renderPoints.vertex\n\n#define PI 3.1415926\n\nattribute vec2 texcoord : TEXCOORD_0;\n\nuniform sampler2D particleTexture;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nuniform float size : 1.0;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, texcoord);\n\n if (p.w > 0.0 && p.z > 1e-5) {\n gl_Position = worldViewProjection * vec4(p.xy * 2.0 - 1.0, 0.0, 1.0);\n }\n else {\n gl_Position = vec4(100000.0, 100000.0, 100000.0, 1.0);\n }\n\n v_Mag = p.z;\n v_Uv = p.xy;\n\n gl_PointSize = size;\n}\n\n@end\n\n@export ecgl.vfParticle.renderPoints.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nuniform sampler2D gradientTexture;\nuniform sampler2D colorTexture;\nuniform sampler2D spriteTexture;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n gl_FragColor = color;\n#ifdef SPRITETEXTURE_ENABLED\n gl_FragColor *= texture2D(spriteTexture, gl_PointCoord);\n if (color.a == 0.0) {\n discard;\n }\n#endif\n#ifdef GRADIENTTEXTURE_ENABLED\n gl_FragColor *= texture2D(gradientTexture, vec2(v_Mag, 0.5));\n#endif\n#ifdef COLORTEXTURE_ENABLED\n gl_FragColor *= texture2D(colorTexture, v_Uv);\n#endif\n}\n\n@end\n\n@export ecgl.vfParticle.renderLines.vertex\n\n#define PI 3.1415926\n\nattribute vec3 position : POSITION;\n\nuniform sampler2D particleTexture;\nuniform sampler2D prevParticleTexture;\n\nuniform float size : 1.0;\nuniform vec4 vp: VIEWPORT;\nuniform mat4 worldViewProjection : WORLDVIEWPROJECTION;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\n@import clay.util.rand\n\nvoid main()\n{\n vec4 p = texture2D(particleTexture, position.xy);\n vec4 p2 = texture2D(prevParticleTexture, position.xy);\n\n p.xy = p.xy * 2.0 - 1.0;\n p2.xy = p2.xy * 2.0 - 1.0;\n\n if (p.w > 0.0 && p.z > 1e-5) {\n vec2 dir = normalize(p.xy - p2.xy);\n vec2 norm = vec2(dir.y / vp.z, -dir.x / vp.w) * sign(position.z) * size;\n if (abs(position.z) == 2.0) {\n gl_Position = vec4(p.xy + norm, 0.0, 1.0);\n v_Uv = p.xy;\n v_Mag = p.z;\n }\n else {\n gl_Position = vec4(p2.xy + norm, 0.0, 1.0);\n v_Mag = p2.z;\n v_Uv = p2.xy;\n }\n gl_Position = worldViewProjection * gl_Position;\n }\n else {\n gl_Position = vec4(100000.0, 100000.0, 100000.0, 1.0);\n }\n}\n\n@end\n\n@export ecgl.vfParticle.renderLines.fragment\n\nuniform vec4 color : [1.0, 1.0, 1.0, 1.0];\nuniform sampler2D gradientTexture;\nuniform sampler2D colorTexture;\n\nvarying float v_Mag;\nvarying vec2 v_Uv;\n\nvoid main()\n{\n gl_FragColor = color;\n #ifdef GRADIENTTEXTURE_ENABLED\n gl_FragColor *= texture2D(gradientTexture, vec2(v_Mag, 0.5));\n#endif\n#ifdef COLORTEXTURE_ENABLED\n gl_FragColor *= texture2D(colorTexture, v_Uv);\n#endif\n}\n\n@end\n"); - - -/***/ }), -/* 280 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); - - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendSeriesModel({ - - type: 'series.flowGL', - - dependencies: ['geo', 'grid', 'bmap'], - - visualColorAccessPath: 'itemStyle.color', - - getInitialData: function (option, ecModel) { - var coordSysDimensions = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.getCoordinateSystemDimensions(this.get('coordinateSystem')) || ['x', 'y']; - if (true) { - if (coordSysDimensions.length > 2) { - throw new Error('flowGL can only be used on 2d coordinate systems.') - } - } - coordSysDimensions.push('vx', 'vy'); - var dimensions = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.helper.completeDimensions(coordSysDimensions, this.getSource(), { - encodeDef: this.get('encode'), - dimsDef: this.get('dimensions') - }); - var data = new __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.List(dimensions, this); - data.initData(this.getSource()); - return data; - }, - - defaultOption: { - coordinateSystem: 'cartesian2d', - zlevel: 10, - - supersampling: 1, - // 128x128 particles - particleType: 'point', - - particleDensity: 128, - particleSize: 1, - particleSpeed: 1, - - particleTrail: 2, - - colorTexture: null, - - gridWidth: 'auto', - gridHeight: 'auto', - - itemStyle: { - color: '#fff', - opacity: 0.8 - } - } -}); - -/***/ }), -/* 281 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__linesGL_LinesGLSeries__ = __webpack_require__(282); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__linesGL_LinesGLView__ = __webpack_require__(283); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__common_opacityVisual__ = __webpack_require__(17); - - - - - - - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.registerVisual(Object(__WEBPACK_IMPORTED_MODULE_3__common_opacityVisual__["a" /* default */])('linesGL')); - -/***/ }), -/* 282 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_zrender_lib_core_util__ = __webpack_require__(13); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_zrender_lib_core_util___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_zrender_lib_core_util__); - - - -var LinesSeries = __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendSeriesModel({ - - type: 'series.linesGL', - - dependencies: ['grid', 'geo'], - - visualColorAccessPath: 'lineStyle.color', - - streamEnabled: true, - - init: function (option) { - var result = this._processFlatCoordsArray(option.data); - this._flatCoords = result.flatCoords; - this._flatCoordsOffset = result.flatCoordsOffset; - if (result.flatCoords) { - option.data = new Float32Array(result.count); - } - - LinesSeries.superApply(this, 'init', arguments); - }, - - mergeOption: function (option) { - var result = this._processFlatCoordsArray(option.data); - this._flatCoords = result.flatCoords; - this._flatCoordsOffset = result.flatCoordsOffset; - if (result.flatCoords) { - option.data = new Float32Array(result.count); - } - - LinesSeries.superApply(this, 'mergeOption', arguments); - }, - - appendData: function (params) { - var result = this._processFlatCoordsArray(params.data); - if (result.flatCoords) { - if (!this._flatCoords) { - this._flatCoords = result.flatCoords; - this._flatCoordsOffset = result.flatCoordsOffset; - } - else { - this._flatCoords = Object(__WEBPACK_IMPORTED_MODULE_1_zrender_lib_core_util__["concatArray"])(this._flatCoords, result.flatCoords); - this._flatCoordsOffset = Object(__WEBPACK_IMPORTED_MODULE_1_zrender_lib_core_util__["concatArray"])(this._flatCoordsOffset, result.flatCoordsOffset); - } - params.data = new Float32Array(result.count); - } - - this.getRawData().appendData(params.data); - }, - - _getCoordsFromItemModel: function (idx) { - var itemModel = this.getData().getItemModel(idx); - var coords = (itemModel.option instanceof Array) - ? itemModel.option : itemModel.getShallow('coords'); - - if (true) { - if (!(coords instanceof Array && coords.length > 0 && coords[0] instanceof Array)) { - throw new Error('Invalid coords ' + JSON.stringify(coords) + '. Lines must have 2d coords array in data item.'); - } - } - return coords; - }, - - getLineCoordsCount: function (idx) { - if (this._flatCoordsOffset) { - return this._flatCoordsOffset[idx * 2 + 1]; - } - else { - return this._getCoordsFromItemModel(idx).length; - } - }, - - getLineCoords: function (idx, out) { - if (this._flatCoordsOffset) { - var offset = this._flatCoordsOffset[idx * 2]; - var len = this._flatCoordsOffset[idx * 2 + 1]; - for (var i = 0; i < len; i++) { - out[i] = out[i] || []; - out[i][0] = this._flatCoords[offset + i * 2]; - out[i][1] = this._flatCoords[offset + i * 2 + 1]; - } - return len; - } - else { - var coords = this._getCoordsFromItemModel(idx); - for (var i = 0; i < coords.length; i++) { - out[i] = out[i] || []; - out[i][0] = coords[i][0]; - out[i][1] = coords[i][1]; - } - return coords.length; - } - }, - - _processFlatCoordsArray: function (data) { - var startOffset = 0; - if (this._flatCoords) { - startOffset = this._flatCoords.length; - } - // Stored as a typed array. In format - // Points Count(2) | x | y | x | y | Points Count(3) | x | y | x | y | x | y | - if (typeof data[0] === 'number') { - var len = data.length; - // Store offset and len of each segment - var coordsOffsetAndLenStorage = new Uint32Array(len); - var coordsStorage = new Float64Array(len); - var coordsCursor = 0; - var offsetCursor = 0; - var dataCount = 0; - for (var i = 0; i < len;) { - dataCount++; - var count = data[i++]; - // Offset - coordsOffsetAndLenStorage[offsetCursor++] = coordsCursor + startOffset; - // Len - coordsOffsetAndLenStorage[offsetCursor++] = count; - for (var k = 0; k < count; k++) { - var x = data[i++]; - var y = data[i++]; - coordsStorage[coordsCursor++] = x; - coordsStorage[coordsCursor++] = y; - - if (i > len) { - if (true) { - throw new Error('Invalid data format.'); - } - } - } - } - - return { - flatCoordsOffset: new Uint32Array(coordsOffsetAndLenStorage.buffer, 0, offsetCursor), - flatCoords: coordsStorage, - count: dataCount - }; - } - - return { - flatCoordsOffset: null, - flatCoords: null, - count: data.length - }; - }, - - getInitialData: function (option, ecModel) { - var lineData = new __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.List(['value'], this); - lineData.hasItemOption = false; - - lineData.initData(option.data, [], function (dataItem, dimName, dataIndex, dimIndex) { - // dataItem is simply coords - if (dataItem instanceof Array) { - return NaN; - } - else { - lineData.hasItemOption = true; - var value = dataItem.value; - if (value != null) { - return value instanceof Array ? value[dimIndex] : value; - } - } - }); - - return lineData; - }, - - defaultOption: { - coordinateSystem: 'geo', - zlevel: 10, - - progressive: 1e4, - progressiveThreshold: 5e4, - - // Cartesian coordinate system - // xAxisIndex: 0, - // yAxisIndex: 0, - - // Geo coordinate system - // geoIndex: 0, - - // Support source-over, lighter - blendMode: 'source-over', - - lineStyle: { - opacity: 0.8 - }, - - postEffect: { - enable: false, - colorCorrection: { - exposure: 0, - brightness: 0, - contrast: 1, - saturation: 1, - enable: true - } - } - } -}); - -/***/ }), -/* 283 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__ = __webpack_require__(1); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__core_ViewGL__ = __webpack_require__(22); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util_geometry_Lines2D__ = __webpack_require__(105); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__common_GLViewHelper__ = __webpack_require__(103); -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__util_retrieve__ = __webpack_require__(2); - - - - - - - - -__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.extendChartView({ - - type: 'linesGL', - - __ecgl__: true, - - init: function (ecModel, api) { - this.groupGL = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Node(); - this.viewGL = new __WEBPACK_IMPORTED_MODULE_2__core_ViewGL__["a" /* default */]('orthographic'); - this.viewGL.add(this.groupGL); - - this._glViewHelper = new __WEBPACK_IMPORTED_MODULE_4__common_GLViewHelper__["a" /* default */](this.viewGL); - - this._nativeLinesShader = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].createShader('ecgl.lines3D'); - this._meshLinesShader = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].createShader('ecgl.meshLines3D'); - - this._linesMeshes = []; - this._currentStep = 0; - }, - - render: function (seriesModel, ecModel, api) { - this.groupGL.removeAll(); - this._glViewHelper.reset(seriesModel, api); - - var linesMesh = this._linesMeshes[0]; - if (!linesMesh) { - linesMesh = this._linesMeshes[0] = this._createLinesMesh(seriesModel); - } - this._linesMeshes.length = 1; - - this.groupGL.add(linesMesh); - this._updateLinesMesh(seriesModel, linesMesh, 0, seriesModel.getData().count()); - - this.viewGL.setPostEffect(seriesModel.getModel('postEffect'), api); - }, - - incrementalPrepareRender: function (seriesModel, ecModel, api) { - this.groupGL.removeAll(); - this._glViewHelper.reset(seriesModel, api); - - this._currentStep = 0; - - this.viewGL.setPostEffect(seriesModel.getModel('postEffect'), api); - }, - - incrementalRender: function (params, seriesModel, ecModel, api) { - var linesMesh = this._linesMeshes[this._currentStep]; - if (!linesMesh) { - linesMesh = this._createLinesMesh(seriesModel); - this._linesMeshes[this._currentStep] = linesMesh; - } - this._updateLinesMesh(seriesModel, linesMesh, params.start, params.end); - this.groupGL.add(linesMesh); - api.getZr().refresh(); - - this._currentStep++; - }, - - updateTransform: function (seriesModel, ecModel, api) { - if (seriesModel.coordinateSystem.getRoamTransform) { - this._glViewHelper.updateTransform(seriesModel, api); - } - }, - - _createLinesMesh: function (seriesModel) { - var linesMesh = new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Mesh({ - $ignorePicking: true, - material: new __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Material({ - shader: __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].createShader('ecgl.lines3D'), - transparent: true, - depthMask: false, - depthTest: false - }), - geometry: new __WEBPACK_IMPORTED_MODULE_3__util_geometry_Lines2D__["a" /* default */]({ - segmentScale: 10, - useNativeLine: true, - dynamic: false - }), - mode: __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Mesh.LINES, - culling: false - }); - - return linesMesh; - }, - - _updateLinesMesh: function (seriesModel, linesMesh, start, end) { - var data = seriesModel.getData(); - linesMesh.material.blend = seriesModel.get('blendMode') === 'lighter' - ? __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].additiveBlend : null; - var curveness = seriesModel.get('lineStyle.curveness') || 0; - var isPolyline = seriesModel.get('polyline'); - var geometry = linesMesh.geometry; - var coordSys = seriesModel.coordinateSystem; - - var lineWidth = __WEBPACK_IMPORTED_MODULE_5__util_retrieve__["a" /* default */].firstNotNull(seriesModel.get('lineStyle.width'), 1); - - if (lineWidth > 1) { - if (linesMesh.material.shader !== this._meshLinesShader) { - linesMesh.material.attachShader(this._meshLinesShader); - } - linesMesh.mode = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Mesh.TRIANGLES; - } - else { - if (linesMesh.material.shader !== this._nativeLinesShader) { - linesMesh.material.attachShader(this._nativeLinesShader); - } - linesMesh.mode = __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].Mesh.LINES; - } - - start = start || 0; - end = end || data.count(); - - geometry.resetOffset(); - var vertexCount = 0; - var triangleCount = 0; - var p0 = []; - var p1 = []; - var p2 = []; - var p3 = []; - - var lineCoords = []; - - var t = 0.3; - var t2 = 0.7; - - function updateBezierControlPoints() { - p1[0] = (p0[0] * t2 + p3[0] * t) - (p0[1] - p3[1]) * curveness; - p1[1] = (p0[1] * t2 + p3[1] * t) - (p3[0] - p0[0]) * curveness; - p2[0] = (p0[0] * t + p3[0] * t2) - (p0[1] - p3[1]) * curveness; - p2[1] = (p0[1] * t + p3[1] * t2) - (p3[0] - p0[0]) * curveness; - } - if (isPolyline || curveness !== 0) { - for (var idx = start; idx < end; idx++) { - if (isPolyline) { - var count = seriesModel.getLineCoordsCount(idx); - vertexCount += geometry.getPolylineVertexCount(count); - triangleCount += geometry.getPolylineTriangleCount(count); - } - else { - seriesModel.getLineCoords(idx, lineCoords); - this._glViewHelper.dataToPoint(coordSys, lineCoords[0], p0); - this._glViewHelper.dataToPoint(coordSys, lineCoords[1], p3); - updateBezierControlPoints(); - - vertexCount += geometry.getCubicCurveVertexCount(p0, p1, p2, p3); - triangleCount += geometry.getCubicCurveTriangleCount(p0, p1, p2, p3); - } - } - } - else { - var lineCount = end - start; - vertexCount += lineCount * geometry.getLineVertexCount(); - triangleCount += lineCount * geometry.getLineVertexCount(); - } - geometry.setVertexCount(vertexCount); - geometry.setTriangleCount(triangleCount); - - var dataIndex = start; - var colorArr = []; - for (var idx = start; idx < end; idx++) { - __WEBPACK_IMPORTED_MODULE_1__util_graphicGL__["a" /* default */].parseColor(data.getItemVisual(dataIndex, 'color'), colorArr); - var opacity = __WEBPACK_IMPORTED_MODULE_5__util_retrieve__["a" /* default */].firstNotNull(data.getItemVisual(dataIndex, 'opacity'), 1); - colorArr[3] *= opacity; - - var count = seriesModel.getLineCoords(idx, lineCoords); - for (var k = 0; k < count; k++) { - this._glViewHelper.dataToPoint(coordSys, lineCoords[k], lineCoords[k]); - } - - if (isPolyline) { - geometry.addPolyline(lineCoords, colorArr, lineWidth, 0, count); - } - else if (curveness !== 0) { - p0 = lineCoords[0]; - p3 = lineCoords[1]; - updateBezierControlPoints(); - geometry.addCubicCurve(p0, p1, p2, p3, colorArr, lineWidth); - } - else { - geometry.addPolyline(lineCoords, colorArr, lineWidth, 0, 2); - } - dataIndex++; - } - }, - - dispose: function () { - this.groupGL.removeAll(); - }, - - remove: function () { - this.groupGL.removeAll(); - } -}); - -/***/ }) -/******/ ]); -}); \ No newline at end of file diff --git a/public/static/xadmin/css/font.css b/public/static/xadmin/css/font.css deleted file mode 100644 index b83e5b4b..00000000 --- a/public/static/xadmin/css/font.css +++ /dev/null @@ -1,16 +0,0 @@ -@font-face { - font-family: 'iconfont'; - src: url('../fonts/iconfont.eot'); - src: url('../fonts/iconfont.eot?#iefix') format('embedded-opentype'), - url('../fonts/iconfont.woff') format('woff'), - url('../fonts/iconfont.ttf') format('truetype'), - url('../fonts/iconfont.svg#iconfont') format('svg'); -} -.iconfont{ - font-family:"iconfont" !important; - font-size:16px;font-style:normal; - -webkit-font-smoothing: antialiased; - -webkit-text-stroke-width: 0.2px; - -moz-osx-font-smoothing: grayscale; -} - diff --git a/public/static/xadmin/css/login.css b/public/static/xadmin/css/login.css deleted file mode 100644 index 10b8f33d..00000000 --- a/public/static/xadmin/css/login.css +++ /dev/null @@ -1,105 +0,0 @@ -/* -* @Author: xuebingsi -* @Date: 2019-04-01 13:37:17 -* @Last Modified by: zhibinm -* @Last Modified time: 2019-04-01 13:37:19 -*/ -.login-bg{ - /*background: #eeeeee url() 0 0 no-repeat;*/ - background:url(../images/bg.png) no-repeat center; - background-size: cover; - overflow: hidden; -} -.login{ - margin: 120px auto 0 auto; - min-height: 420px; - max-width: 420px; - padding: 40px; - background-color: #ffffff; - margin-left: auto; - margin-right: auto; - border-radius: 4px; - /* overflow-x: hidden; */ - box-sizing: border-box; -} -.login a.logo{ - display: block; - height: 58px; - width: 167px; - margin: 0 auto 30px auto; - background-size: 167px 42px; -} -.login .message { - margin: 10px 0 0 -58px; - padding: 18px 10px 18px 60px; - background: #189F92; - position: relative; - color: #fff; - font-size: 16px; -} -.login #darkbannerwrap { - background: url(../images/aiwrap.png); - width: 18px; - height: 10px; - margin: 0 0 20px -58px; - position: relative; -} - -.login input[type=text], -.login input[type=file], -.login input[type=password], -.login input[type=email], select { - border: 1px solid #DCDEE0; - vertical-align: middle; - border-radius: 3px; - height: 50px; - padding: 0px 16px; - font-size: 14px; - color: #555555; - outline:none; - width:100%; - box-sizing: border-box; -} -.login input[type=text]:focus, -.login input[type=file]:focus, -.login input[type=password]:focus, -.login input[type=email]:focus, select:focus { - border: 1px solid #27A9E3; -} -.login input[type=submit], -.login input[type=button]{ - display: inline-block; - vertical-align: middle; - padding: 12px 24px; - margin: 0px; - font-size: 18px; - line-height: 24px; - text-align: center; - white-space: nowrap; - vertical-align: middle; - cursor: pointer; - color: #ffffff; - background-color: #189F92; - border-radius: 3px; - border: none; - -webkit-appearance: none; - outline:none; - width:100%; -} -.login hr { - background: #fff url() 0 0 no-repeat; -} -.login hr.hr15 { - height: 15px; - border: none; - margin: 0px; - padding: 0px; - width: 100%; -} -.login hr.hr20 { - height: 20px; - border: none; - margin: 0px; - padding: 0px; - width: 100%; -} \ No newline at end of file diff --git a/public/static/xadmin/css/theme1.css b/public/static/xadmin/css/theme1.css deleted file mode 100644 index 79b2dc8e..00000000 --- a/public/static/xadmin/css/theme1.css +++ /dev/null @@ -1,21 +0,0 @@ -body{ - background:#F2F1F2; -} -.container{ - background:#1A1B20; -} -.left-nav{ - background:#1A1B20; -} - -.left-nav a{ - color:rgba(255,255,255,.7); -} -..left-nav a.active{ - background: #009688 !important; - color: #fff; -} -.left-nav a:hover{ - background: #009688 !important; - color: #fff; -} \ No newline at end of file diff --git a/public/static/xadmin/css/theme2.css b/public/static/xadmin/css/theme2.css deleted file mode 100644 index 04e91717..00000000 --- a/public/static/xadmin/css/theme2.css +++ /dev/null @@ -1,21 +0,0 @@ -body{ - background:#EEF5F9; -} -.container{ - background:#323640; -} -.left-nav{ - background:#fff; -} - -.left-nav a{ - color:#686a76; -} -.left-nav a.active{ - background: #786AED !important; - color: #fff; -} -.left-nav a:hover{ - background: #786AED !important; - color: #fff; -} diff --git a/public/static/xadmin/css/theme3.css b/public/static/xadmin/css/theme3.css deleted file mode 100644 index d5919c57..00000000 --- a/public/static/xadmin/css/theme3.css +++ /dev/null @@ -1,22 +0,0 @@ -body{ - background:#E8E8E8; -} -.container{ - background:#F34743; -} - -.left-nav{ - background:#F4F4F4; -} - -.left-nav a{ - color:#686a76; -} -.left-nav a.active{ - background: #FEFEFE !important; - color: #F34743; -} -.left-nav a:hover{ - background: #FEFEFE !important; - color: #F34743; -} \ No newline at end of file diff --git a/public/static/xadmin/css/theme4.css b/public/static/xadmin/css/theme4.css deleted file mode 100644 index 0a0ff61d..00000000 --- a/public/static/xadmin/css/theme4.css +++ /dev/null @@ -1,21 +0,0 @@ -body{ - background:#E4E4E4; -} -.container{ - background:#019587; -} -.left-nav{ - background:#263035; -} - -.left-nav a{ - color:#fff; -} -.left-nav a.active{ - background: #212525 !important; - color: #fff !important; -} -.left-nav a:hover{ - background: #212525 !important; - color: #fff !important; -} \ No newline at end of file diff --git a/public/static/xadmin/css/theme5.css b/public/static/xadmin/css/theme5.css deleted file mode 100644 index 92c9a06d..00000000 --- a/public/static/xadmin/css/theme5.css +++ /dev/null @@ -1,27 +0,0 @@ -body{ - background:#EEF5F9 !important; -} -.container{ - background:linear-gradient(to left, #7b4397, #2196f3); -} - -.left-nav{ - background:#fff !important; -} - -.left-nav a{ - color:#686a76 !important; -} -.left-nav a.active{ - background: linear-gradient(to left, #7c8ce4, #2196f3) !important; - color: #fff !important; - border-color: #7b4397 !important; -} -.left-nav a:hover{ - background: linear-gradient(to left, #7c8ce4, #2196f3) !important; - color: #fff !important; - border-color: #7b4397 !important; -} -.container .logo a{ - background: rgba(0,0,0,0) !important; -} \ No newline at end of file diff --git a/public/static/xadmin/css/xadmin.css b/public/static/xadmin/css/xadmin.css deleted file mode 100644 index 99260ead..00000000 --- a/public/static/xadmin/css/xadmin.css +++ /dev/null @@ -1,659 +0,0 @@ -@charset "utf-8"; -@import url(../lib/layui/css/layui.css); -*{ - margin: 0px; - padding: 0px; - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; -} -a{ - text-decoration: none; -} -html{ - width: 100%; - height: 100%; - overflow-x:hidden; - overflow-y:auto; -} -body{ - width: 100%; - min-height: 100%; -} -.login-bg{ - /*background: #eeeeee url() 0 0 no-repeat;*/ - background:url(../images/bg.png) no-repeat center; - background-size: cover; - overflow: hidden; -} -.login{ - margin: 120px auto 0 auto; - min-height: 420px; - max-width: 420px; - padding: 40px; - background-color: #ffffff; - margin-left: auto; - margin-right: auto; - border-radius: 4px; - /* overflow-x: hidden; */ - box-sizing: border-box; -} -.login a.logo{ - display: block; - height: 58px; - width: 167px; - margin: 0 auto 30px auto; - background-size: 167px 42px; -} -.login .message { - margin: 10px 0 0 -58px; - padding: 18px 10px 18px 60px; - background: #189F92; - position: relative; - color: #fff; - font-size: 16px; -} -.login #darkbannerwrap { - background: url(../images/aiwrap.png); - width: 18px; - height: 10px; - margin: 0 0 20px -58px; - position: relative; -} - -.login input[type=text], -.login input[type=file], -.login input[type=password], -.login input[type=email], select { - border: 1px solid #DCDEE0; - vertical-align: middle; - border-radius: 3px; - height: 50px; - padding: 0px 16px; - font-size: 14px; - color: #555555; - outline:none; - width:100%; - box-sizing: border-box; -} -.login input[type=text]:focus, -.login input[type=file]:focus, -.login input[type=password]:focus, -.login input[type=email]:focus, select:focus { - border: 1px solid #27A9E3; -} -.login input[type=submit], -.login input[type=button]{ - display: inline-block; - vertical-align: middle; - padding: 12px 24px; - margin: 0px; - font-size: 18px; - line-height: 24px; - text-align: center; - white-space: nowrap; - vertical-align: middle; - cursor: pointer; - color: #ffffff; - background-color: #189F92; - border-radius: 3px; - border: none; - -webkit-appearance: none; - outline:none; - width:100%; -} -.login hr { - background: #fff url() 0 0 no-repeat; -} -.login hr.hr15 { - height: 15px; - border: none; - margin: 0px; - padding: 0px; - width: 100%; -} -.login hr.hr20 { - height: 20px; - border: none; - margin: 0px; - padding: 0px; - width: 100%; -} -.x-body{ - padding: 20px; -} -.x-nav{ - padding: 0 20px; - position: relative; - z-index: 99; - border-bottom: 1px solid #e5e5e5; - line-height: 39px; - height: 39px; - overflow: hidden; -} -xblock{ - display: block; - margin-bottom: 10px; - padding: 5px; - line-height: 22px; - /* border-left: 5px solid #009688; */ - border-radius: 0 2px 2px 0; - background-color: #f2f2f2; -} -.x-right{ - float: right; -} -.x-so{ - /*text-align: center;*/ - /*background: #f2f2f2 url() 0 0 no-repeat;*/ - margin-bottom: 20px; -} -.x-so input.layui-input{ - width: 150px; -} -.x-so .layui-form-label{ - display: inline-block; -} -.x-so input.layui-input,.x-so input.layui-btn{ - display: inline-block; -} -.x-red{ - color: red; -} -.x-a{ - color: #1AA093; -} -.x-a:hover{ - color: #127F74; -} -.x-sort{ - height: 30px; -} -.x-show{ - cursor: pointer; -} -.layui-form-switch{ - margin-top: 0px; -} -.layui-input:focus, .layui-textarea:focus { - border-color: #189f92!important; -} - -.page{ - margin-top: 20px; - text-align: center; - -} -.page a{ - display: inline-block; - background: #fff url() 0 0 no-repeat; - color: #888; - padding: 10px; - min-width: 15px; - border: 1px solid #E2E2E2; - -} -.page span{ - display: inline-block; - padding: 10px; - min-width: 15px; - border: 1px solid #E2E2E2; -} -.page span.current{ - display: inline-block; - background: #009688 url() 0 0 no-repeat; - color: #fff; - padding: 10px; - min-width: 15px; - border: 1px solid #009688; -} -.page .pagination li{ - display: inline-block; - margin-right: 5px; - text-align: center; -} -.page .pagination li.active span{ - background: #009688 url() 0 0 no-repeat; - color: #fff; - border: 1px solid #009688; - -} - -/*登录样式*/ -/*头部*/ -.container{ - width: 100%; - height: 45px; - background-color: #222; - border-bottom: 1px solid rgba(255, 255, 255, 0.2); -} -.container .logo a{ - float: left; - color: #fff; - font-size: 18px; - padding-left: 20px; - line-height: 45px; - width: 200px; -} -.container .right{ - background-color:rgba(0,0,0,0); - float: right; - -} -.container .left_open{ - height: 45px; - float: left; -} -.container .left_open i{ - display: block; - background: rgba(255,255,255,0.1) url() 0 0 no-repeat; - color: #fff; - width: 32px; - height: 32px; - line-height: 32px; - border-radius: 3px; - text-align: center; - margin-top: 7px; - cursor: pointer; -} -.container .left_open i:hover{ - background: rgba(255,255,255,0.3) url() 0 0 no-repeat; -} - -.container .left{ - background-color:rgba(0,0,0,0); - float: left; - -} -.container .layui-nav-item{ - line-height: 45px; -} -.container .layui-nav-more{ - top: 20px; -} -.container .layui-nav-child{ - top: 50px; -} -.container .layui-nav-child i{ - margin-right: 10px; -} -.layui-nav .layui-nav-item a{ - color: #fff; - cursor: pointer; -} -.layui-nav .layui-nav-child a{ - color: #333; - cursor: pointer; -} -.left-nav{ - position: absolute; - top: 46px; - bottom: 42px; - left: 0; - z-index: 2; - padding-top: 10px; - background-color: #EEEEEE; - width: 220px; - max-width: 220px; - overflow: auto; - overflow-x:hidden; - border-right: 1px solid #e5e5e5; - - /*width: 0px;*/ -} -.left-nav #nav li{ - border-bottom: 1px solid #e5e5e5; -} -.left-nav #nav li:hover > a{ - /*color: blue;*/ -} -.left-nav #nav .current{ - background-color: rgba(0, 0, 0, 0.3); -} -.left-nav #nav li a{ - font-size: 14px; - padding: 10px 15px 10px 20px; - display: block; - cursor: pointer; -} -.left-nav #nav li a cite{ - font-size: 14px; -} - -.left-nav #nav li .sub-menu{ - display: none; -} -.left-nav #nav li .opened{ - display: block; -} -.left-nav #nav li .opened:hover{ - /*background: #fff url() 0 0 no-repeat;*/ -} -.left-nav #nav li .opened .current{ - -} -.left-nav #nav li .sub-menu li:hover{ - /*color: blue;*/ - /*background: #fff url() 0 0 no-repeat;*/ -} -.left-nav #nav li .sub-menu li a{ - padding: 12px 15px 12px 30px; - font-size: 14px; - cursor: pointer; -} -.left-nav #nav li .sub-menu li .sub-menu li a{ - padding-left: 45px; -} -.left-nav #nav li .sub-menu li a:hover{ - color: #148cf1; -} -.left-nav #nav li .sub-menu li a i{ - font-size: 12px; -} -.left-nav #nav li a i{ - padding-right: 10px; - line-height: 14px; -} -.left-nav #nav li .nav_right{ - float: right; - font-size: 16px; -} -.x-slide_left { - width: 17px; - height: 61px; - background: url(../images/icon.png) 0 0 no-repeat; - position: absolute; - top: 200px; - left: 221px; - cursor: pointer; - z-index: 3; -} -.page-content{ - position: absolute; - top: 46px; - right: 0; - bottom: 42px; - left: 221px; - overflow: hidden; - z-index: 1; -} -.page-content-bg{ - position: absolute; - top: 46px; - right: 0; - bottom: 42px; - left: 221px; - background: rgba(0,0,0,0.5); url() 0 0 no-repeat; - overflow: hidden; - z-index: 100; - display: none; -} - -.page-content .tab{ - height: 100%; - width: 100%; - background: #EFEEF0 url() 0 0 no-repeat; - margin: 0px; -} -.page-content .layui-tab-title{ - /*padding-top: 5px;*/ - height: 35px; - background: #EFEEF0 url() 0 0 no-repeat; - position: relative; - z-index: 100; -} -.page-content .layui-tab-title li.home i{ - padding-right: 5px; -} -.page-content .layui-tab-title li.home .layui-tab-close{ - display: none; -} -.page-content .layui-tab-title li{ - line-height: 35px; -} -.page-content .layui-tab-title .layui-this:after{ - height: 36px; -} -.page-content .layui-tab-title li .layui-tab-close{ - border-radius: 50%; -} -.page-content .layui-tab-title .layui-this{ - background: #fff url() 0 0 no-repeat; -} -.page-content .layui-tab-bar{ - height:34px; - line-height: 35px; -} -.page-content .layui-tab-content{ - position: absolute; - top: 36px; - bottom: 0px; - width: 100%; - background: #fff url() 0 0 no-repeat; - padding: 0px; - overflow: hidden; -} -.page-content .layui-tab-content .layui-tab-item{ - width: 100%; - height: 100%; - -} -.page-content .layui-tab-content .layui-tab-item iframe{ - width: 100%; - height: 100%; - -} -.x-admin-carousel,.layui-carousel,.x-admin-carousel>[carousel-item]>* { - background-color:#fff -} - -.x-admin-backlog .x-admin-backlog-body { - display:block; - padding:10px 15px; - background-color:#f8f8f8; - color:#999; - border-radius:2px; - transition:all .3s; - -webkit-transition:all .3s -} -.x-admin-backlog-body h3 { - padding-bottom:10px; - font-size:12px -} -.x-admin-backlog-body p cite { - font-style:normal; - font-size:30px; - font-weight:300; - color:#009688 -} -.x-admin-backlog-body:hover { - background-color:#CFCFCF; - color:#888 -} - -.welcome-footer{padding: 30px 0; line-height: 30px; text-align: center; background-color: #eee; color: #666; font-weight: 300;} -body .layui-layout-admin .footer-demo{height: auto; padding: 15px 0; line-height: 26px;} -.welcome-footer a{padding: 0 5px;} - -table th, table td { - word-break: break-all; -} - -.footer{ - position: fixed; - bottom: 0px; - width: 100%; - background-color: #222; - border-top: 1px solid rgba(255, 255, 255, 0.2); - line-height: 41px; - color: #fff; - /*padding-left: 10px;*/ -} -.footer .copyright{ - margin-left: 10px; -} - -/*404页面样式*/ -.fly-panel { - margin-bottom: 15px; - border-radius: 2px; - background-color: #fff; - box-shadow: 0 1px 2px 0 rgba(0,0,0,.05); -} -.fly-none { - min-height: 600px; - text-align: center; - padding-top: 50px; - color: #999; -} -.fly-none .layui-icon { - line-height: 300px; - font-size: 300px; - color: #393D49; -} -.fly-none p { - margin-top: 50px; - padding: 0 15px; - font-size: 20px; - color: #999; - font-weight: 300; -} -#tab_right{ - display: none; - width: 80px; - position: absolute; - top: 35px; - left: 0px; -} -#tab_right dl{ - top: 0px; -} -#tab_show{ - position: absolute; - top: 36px; - bottom: 0px; - width: 100%; - background:rgb(255, 255, 255,0); - padding: 0px; - overflow: hidden; - display: none; -} - - -@media screen and (max-width: 768px){ - .fast-add{ - display: none; - } - .layui-nav .to-index{ - display: none; - } - .container .logo a{ - width: 140px; - } - .container .left_open { - /*float: right;*/ - } - .left-nav{ - left: -221px; - } - .page-content{ - left: 0px; - } - .page-content .layui-tab-content .layui-tab-item{ - -webkit-overflow-scrolling: touch; - overflow-y: scroll; - } - .x-so input.layui-input{ - width: 100%; - margin: 10px; - } -} - - -/*精细版样式*/ - -.x-admin-sm{ - font-size: 12px; -} -.x-admin-sm body{ - font-size: 12px; -} -/*登录页面样式*/ -.x-admin-sm .login input[type=submit],.x-admin-sm .login input[type=button]{ - font-size: 14px; -} -.x-admin-sm .login input[type=text], -.x-admin-sm .login input[type=file], -.x-admin-sm .login input[type=password], -.x-admin-sm .login input[type=email], .x-admin-sm select { - font-size: 12px; -} -.x-admin-sm .login .message{ - font-size: 14px; -} - -.x-admin-sm .layui-table td, .x-admin-sm .layui-table th{ - font-size: 12px; -} -.x-admin-sm .layui-elem-field legend{ - font-size: 18px; -} - -.x-admin-sm .x-admin-backlog-body p cite{ - font-size: 24px; -} -.x-admin-sm .left-nav #nav li a cite{ - font-size: 12px; -} -.x-admin-sm .iconfont{ - font-size: 14px; -} -.x-admin-sm .layui-tab-title li{ - font-size: 12px; -} -.x-admin-sm .layui-icon{ - font-size: 14px; -} -.x-admin-sm .layui-nav *{ - font-size: 12px; -} -.x-admin-sm .layui-breadcrumb>*{ - font-size: 12px; -} -.x-admin-sm .layui-btn,.x-admin-sm .layui-btn-xs,.x-admin-sm .layui-btn-sm{ - font-size: 12px; -} - -.x-admin-sm .layui-laydate{ - font-size: 12px; -} -.x-admin-sm .layui-btn{ - height: 30px; - line-height: 30px; - padding: 0 10px; -} - -.x-admin-sm .layui-btn-lg{ - height: 38px; - line-height: 38px; - padding: 0 18px; - font-size: 14px; -} -.x-admin-sm .layui-layer-title,.x-admin-sm .layui-layer-dialog .layui-layer-content{ - font-size: 12px; -} -.x-admin-sm .layui-input,.x-admin-sm .layui-select,.x-admin-sm .layui-textarea{ - height: 30px; -} - -.x-admin-sm .layui-form-pane .layui-form-label{ - height: 30px; - line-height: 14px; -} -.x-admin-sm .layui-form-checkbox span{ - font-size: 12px; -} -.x-admin-sm .fly-none .layui-icon { - line-height: 300px; - font-size: 300px; - color: #393D49; -} - diff --git a/public/static/xadmin/fonts/iconfont.eot b/public/static/xadmin/fonts/iconfont.eot deleted file mode 100644 index df5334af..00000000 Binary files a/public/static/xadmin/fonts/iconfont.eot and /dev/null differ diff --git a/public/static/xadmin/fonts/iconfont.svg b/public/static/xadmin/fonts/iconfont.svg deleted file mode 100644 index f6f082eb..00000000 --- a/public/static/xadmin/fonts/iconfont.svg +++ /dev/null @@ -1,477 +0,0 @@ - - - - - -Created by iconfont - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/public/static/xadmin/fonts/iconfont.ttf b/public/static/xadmin/fonts/iconfont.ttf deleted file mode 100644 index ccf533ec..00000000 Binary files a/public/static/xadmin/fonts/iconfont.ttf and /dev/null differ diff --git a/public/static/xadmin/fonts/iconfont.woff b/public/static/xadmin/fonts/iconfont.woff deleted file mode 100644 index d06756ca..00000000 Binary files a/public/static/xadmin/fonts/iconfont.woff and /dev/null differ diff --git a/public/static/xadmin/images/aiwrap.png b/public/static/xadmin/images/aiwrap.png deleted file mode 100644 index 36fd481b..00000000 Binary files a/public/static/xadmin/images/aiwrap.png and /dev/null differ diff --git a/public/static/xadmin/images/bg.png b/public/static/xadmin/images/bg.png deleted file mode 100644 index c518e9d6..00000000 Binary files a/public/static/xadmin/images/bg.png and /dev/null differ diff --git a/public/static/xadmin/js/cjgl.js b/public/static/xadmin/js/cjgl.js deleted file mode 100644 index e8966c21..00000000 --- a/public/static/xadmin/js/cjgl.js +++ /dev/null @@ -1,248 +0,0 @@ -/** - 扩展cjgl模块 - **/ - -layui.define(['table'],function(exports){ //提示:模块也可以依赖其它模块,如:layui.define('layer', callback); - var table = layui.table; - var obj = { - // 新建弹窗 - add: function(title,url,width,height,max=false){ - x_admin_show(title,url,width,height,max); - }, - del:function(obj,url){ - layer.confirm('确认要删除吗?',function(index){ - $.ajax({ - url:url+'/m', - type:'DELETE', - data:{ - ids:obj.data.id - }, - success:function(result){ - if(result.val == 1) - { - obj.del(); - layer.msg('已删除!'); - }else{ - layer.msg('数据处理错误!',function(){}); - } - }, - error:function(result){ - layer.msg('数据扔半道啦。',function(){}); - }, - }); - }); - }, - delAll:function(obj,url,tableid){ - //判断是否选择数据 - if(obj.data.length==0){ - parent.layer.msg('请先选择要删除的数据行!',function(){}); - return ; - } - - layer.confirm('确认要删除吗?',function(index){ - // 捉一下所有被选中的数据 - var ids = ""; - for(var i=0;i
请选择
'); - // 声明变量 - var mydl = srcInput.next().children('dl'); - - // 获取数据 - $.post( - "/srcteacher", - { - "str":val, - }, - function(data,status){ - - if($.isEmptyObject(data)) - { - return true; - } - - for (var i = data.length - 1; i >= 0; i--) { - mydl.append('
'+data[i].xingming+' '+data[i].js_danwei.jiancheng+' '+data[i].shengri+'
'); - } - - } - ); - - - }, - // 添加教师 - addTeacher:function(myobj){ - var myId = $(myobj).attr('id') - ,teachername = $(myobj).attr('teachername') - ,addname = $(myobj).attr('addname') - ,myTitle = $(myobj).text() - ,myList = $(myobj).parent().parent() - ,myBut = $(myList).parent().parent(); - - if(myId){ - $(myBut).append('
'+teachername+'
'); - } - - $(myList).prev().val(''); - $(myList).remove(); - }, - // 删除教师 - delTeacher:function(myobj){ - $(myobj).parent().remove(); - } - }; - - //输出test接口 - exports('cjgl', obj); -}); \ No newline at end of file diff --git a/public/static/xadmin/js/cookie.js b/public/static/xadmin/js/cookie.js deleted file mode 100644 index 79b05ac7..00000000 --- a/public/static/xadmin/js/cookie.js +++ /dev/null @@ -1,38 +0,0 @@ -function setCookie(name, value, expires, path, domain, secure) { - if(typeof is_remember!="undefined") - return false; - var today = new Date(); - today.setTime( today.getTime() ); - var expires_date = new Date( today.getTime() + (expires) ); - document.cookie= name + "=" + escape(value) + - ((expires) ? "; expires=" + expires_date.toGMTString() : "") + - ((path) ? "; path=" + path : "") + - ((domain) ? "; domain=" + domain : "") + - ((secure) ? "; secure" : ""); -} -function getCookie(name) { - var dc = document.cookie; - var prefix = name + "="; - var begin = dc.indexOf("; " + prefix); - if (begin == -1) { - begin = dc.indexOf(prefix); - if (begin != 0) return null; - } else { - begin += 2; - } - var end = document.cookie.indexOf(";", begin); - if (end == -1) { - end = dc.length; - } - return unescape(dc.substring(begin + prefix.length, end)); -} -function deleteCookie(name, path, domain) { - if (getCookie(name)) { - document.cookie = name + "=" + - ((path) ? "; path=" + path : "") + - ((domain) ? "; domain=" + domain : "") + - "; expires=Thu, 01-Jan-70 00:00:01 GMT"; - } -} - - diff --git a/public/static/xadmin/js/jquery.min.js b/public/static/xadmin/js/jquery.min.js deleted file mode 100644 index 644d35e2..00000000 --- a/public/static/xadmin/js/jquery.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! jQuery v3.2.1 | (c) JS Foundation and other contributors | jquery.org/license */ -!function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.2.1",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null==a?f.call(this):a<0?this[a+this.length]:this[a]},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ca=function(a,b){return b?"\0"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0&&("form"in a||"label"in a)},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"form"in b?b.parentNode&&b.disabled===!1?"label"in b?"label"in b.parentNode?b.parentNode.disabled===a:b.disabled===a:b.isDisabled===a||b.isDisabled!==!a&&ea(b)===a:b.disabled===a:"label"in b&&b.disabled===a}}function pa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}}):(d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}},d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c,d,e,f=b.getElementById(a);if(f){if(c=f.getAttributeNode("id"),c&&c.value===a)return[f];e=b.getElementsByName(a),d=0;while(f=e[d++])if(c=f.getAttributeNode("id"),c&&c.value===a)return[f]}return[]}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){if("undefined"!=typeof b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:!b||(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(O," ")+" ").indexOf(c)>-1:"|="===b&&(e===c||e.slice(0,c.length+1)===c+"-"))}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c<0?c+b:c]}),even:pa(function(a,b){for(var c=0;c=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c<0?c+b:c;++d1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;d-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];i1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,i0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,c,e){var f,i,j,k,l,m="function"==typeof a&&a,n=!e&&g(a=m.selector||a);if(c=c||[],1===n.length){if(i=n[0]=n[0].slice(0),i.length>2&&"ID"===(j=i[0]).type&&9===b.nodeType&&p&&d.relative[i[1].type]){if(b=(d.find.ID(j.matches[0].replace(_,aa),b)||[])[0],!b)return c;m&&(b=b.parentNode),a=a.slice(i.shift().value.length)}f=V.needsContext.test(a)?0:i.length;while(f--){if(j=i[f],d.relative[k=j.type])break;if((l=d.find[k])&&(e=l(j.matches[0].replace(_,aa),$.test(i[0].type)&&qa(b.parentNode)||b))){if(i.splice(f,1),a=e.length&&sa(i),!a)return G.apply(c,e),c;break}}}return(m||h(a,n))(e,b,!p,c,!b||$.test(a)&&qa(b.parentNode)||b),c},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){if(!c&&"input"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext;function B(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()}var C=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,D=/^.[^:#\[\.,]*$/;function E(a,b,c){return r.isFunction(b)?r.grep(a,function(a,d){return!!b.call(a,d,a)!==c}):b.nodeType?r.grep(a,function(a){return a===b!==c}):"string"!=typeof b?r.grep(a,function(a){return i.call(b,a)>-1!==c}):D.test(b)?r.filter(b,a,c):(b=r.filter(b,a),r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType}))}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(E(this,a||[],!1))},not:function(a){return this.pushStack(E(this,a||[],!0))},is:function(a){return!!E(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var F,G=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,H=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||F,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:G.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),C.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};H.prototype=r.fn,F=r(d);var I=/^(?:parents|prev(?:Until|All))/,J={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function K(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return K(a,"nextSibling")},prev:function(a){return K(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return B(a,"iframe")?a.contentDocument:(B(a,"template")&&(a=a.content||a),r.merge([],a.childNodes))}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(J[a]||r.uniqueSort(e),I.test(a)&&e.reverse()),this.pushStack(e)}});var L=/[^\x20\t\r\n\f]+/g;function M(a){var b={};return r.each(a.match(L)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?M(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=e||a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function N(a){return a}function O(a){throw a}function P(a,b,c,d){var e;try{a&&r.isFunction(e=a.promise)?e.call(a).done(b).fail(c):a&&r.isFunction(e=a.then)?e.call(a,b,c):b.apply(void 0,[a].slice(d))}catch(a){c.apply(void 0,[a])}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b=f&&(d!==O&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:N,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:N)),c[2][3].add(g(0,a,r.isFunction(d)?d:O))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b<=1&&(P(a,g.done(h(c)).resolve,g.reject,!b),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)P(e[c],h(c),g.reject);return g.promise()}});var Q=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&Q.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var R=r.Deferred();r.fn.ready=function(a){return R.then(a)["catch"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1,ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||R.resolveWith(d,[r]))}}),r.ready.then=R.then;function S(){d.removeEventListener("DOMContentLoaded",S), -a.removeEventListener("load",S),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",S),a.addEventListener("load",S));var T=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)T(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h1,null,!0)},removeData:function(a){return this.each(function(){X.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=W.get(a,b),c&&(!d||Array.isArray(c)?d=W.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return W.get(a,c)||W.access(a,c,{empty:r.Callbacks("once memory").add(function(){W.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length\x20\t\r\n\f]+)/i,la=/^$|\/(?:java|ecma)script/i,ma={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};ma.optgroup=ma.option,ma.tbody=ma.tfoot=ma.colgroup=ma.caption=ma.thead,ma.th=ma.td;function na(a,b){var c;return c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[],void 0===b||b&&B(a,b)?r.merge([a],c):c}function oa(a,b){for(var c=0,d=a.length;c-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=na(l.appendChild(f),"script"),j&&oa(g),c){k=0;while(f=g[k++])la.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var ra=d.documentElement,sa=/^key/,ta=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ua=/^([^.]*)(?:\.(.+)|)/;function va(){return!0}function wa(){return!1}function xa(){try{return d.activeElement}catch(a){}}function ya(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)ya(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=wa;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=W.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(ra,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(L)||[""],j=b.length;while(j--)h=ua.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=W.hasData(a)&&W.get(a);if(q&&(i=q.events)){b=(b||"").match(L)||[""],j=b.length;while(j--)if(h=ua.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&W.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(W.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c=1))for(;j!==this;j=j.parentNode||this)if(1===j.nodeType&&("click"!==a.type||j.disabled!==!0)){for(f=[],g={},c=0;c-1:r.find(e,this,null,[j]).length),g[e]&&f.push(d);f.length&&h.push({elem:j,handlers:f})}return j=this,i\x20\t\r\n\f]*)[^>]*)\/>/gi,Aa=/\s*$/g;function Ea(a,b){return B(a,"table")&&B(11!==b.nodeType?b:b.firstChild,"tr")?r(">tbody",a)[0]||a:a}function Fa(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Ga(a){var b=Ca.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Ha(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(W.hasData(a)&&(f=W.access(a),g=W.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;c1&&"string"==typeof q&&!o.checkClone&&Ba.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ja(f,b,c,d)});if(m&&(e=qa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(na(e,"script"),Fa),i=h.length;l")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=na(h),f=na(a),d=0,e=f.length;d0&&oa(g,!i&&na(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(U(c)){if(b=c[W.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[W.expando]=void 0}c[X.expando]&&(c[X.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ka(this,a,!0)},remove:function(a){return Ka(this,a)},text:function(a){return T(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ja(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ea(this,a);b.appendChild(a)}})},prepend:function(){return Ja(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ea(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ja(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ja(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(na(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return T(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!Aa.test(a)&&!ma[(ka.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;c1)}});function _a(a,b,c,d,e){return new _a.prototype.init(a,b,c,d,e)}r.Tween=_a,_a.prototype={constructor:_a,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||r.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(r.cssNumber[c]?"":"px")},cur:function(){var a=_a.propHooks[this.prop];return a&&a.get?a.get(this):_a.propHooks._default.get(this)},run:function(a){var b,c=_a.propHooks[this.prop];return this.options.duration?this.pos=b=r.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):_a.propHooks._default.set(this),this}},_a.prototype.init.prototype=_a.prototype,_a.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=r.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){r.fx.step[a.prop]?r.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[r.cssProps[a.prop]]&&!r.cssHooks[a.prop]?a.elem[a.prop]=a.now:r.style(a.elem,a.prop,a.now+a.unit)}}},_a.propHooks.scrollTop=_a.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},r.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},r.fx=_a.prototype.init,r.fx.step={};var ab,bb,cb=/^(?:toggle|show|hide)$/,db=/queueHooks$/;function eb(){bb&&(d.hidden===!1&&a.requestAnimationFrame?a.requestAnimationFrame(eb):a.setTimeout(eb,r.fx.interval),r.fx.tick())}function fb(){return a.setTimeout(function(){ab=void 0}),ab=r.now()}function gb(a,b){var c,d=0,e={height:a};for(b=b?1:0;d<4;d+=2-b)c=ca[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function hb(a,b,c){for(var d,e=(kb.tweeners[b]||[]).concat(kb.tweeners["*"]),f=0,g=e.length;f1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?lb:void 0)),void 0!==c?null===c?void r.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b), -null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&B(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(L);if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),lb={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=mb[b]||r.find.attr;mb[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=mb[g],mb[g]=e,e=null!=c(a,b,d)?g:null,mb[g]=f),e}});var nb=/^(?:input|select|textarea|button)$/i,ob=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return T(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):nb.test(a.nodeName)||ob.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});function pb(a){var b=a.match(L)||[];return b.join(" ")}function qb(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,qb(this)))});if("string"==typeof a&&a){b=a.match(L)||[];while(c=this[i++])if(e=qb(c),d=1===c.nodeType&&" "+pb(e)+" "){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=pb(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,qb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(L)||[];while(c=this[i++])if(e=qb(c),d=1===c.nodeType&&" "+pb(e)+" "){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=pb(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,qb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(L)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=qb(this),b&&W.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":W.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+pb(qb(c))+" ").indexOf(b)>-1)return!0;return!1}});var rb=/\r/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":Array.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(rb,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:pb(r.text(a))}},select:{get:function(a){var b,c,d,e=a.options,f=a.selectedIndex,g="select-one"===a.type,h=g?null:[],i=g?f+1:e.length;for(d=f<0?i:g?f:0;d-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){if(Array.isArray(b))return a.checked=r.inArray(r(a).val(),b)>-1}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var sb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!sb.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,sb.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(W.get(h,"events")||{})[b.type]&&W.get(h,"handle"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&U(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!U(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return r.event.trigger(a,b,c,!0)}}),r.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=W.access(d,b);e||d.addEventListener(a,c,!0),W.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=W.access(d,b)-1;e?W.access(d,b,e):(d.removeEventListener(a,c,!0),W.remove(d,b))}}});var tb=a.location,ub=r.now(),vb=/\?/;r.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||r.error("Invalid XML: "+b),c};var wb=/\[\]$/,xb=/\r?\n/g,yb=/^(?:submit|button|image|reset|file)$/i,zb=/^(?:input|select|textarea|keygen)/i;function Ab(a,b,c,d){var e;if(Array.isArray(b))r.each(b,function(b,e){c||wb.test(a)?d(a,e):Ab(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(e in b)Ab(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(Array.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)Ab(c,a[c],b,e);return d.join("&")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(":disabled")&&zb.test(this.nodeName)&&!yb.test(a)&&(this.checked||!ja.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:Array.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(xb,"\r\n")}}):{name:b.name,value:c.replace(xb,"\r\n")}}).get()}});var Bb=/%20/g,Cb=/#.*$/,Db=/([?&])_=[^&]*/,Eb=/^(.*?):[ \t]*([^\r\n]*)$/gm,Fb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Gb=/^(?:GET|HEAD)$/,Hb=/^\/\//,Ib={},Jb={},Kb="*/".concat("*"),Lb=d.createElement("a");Lb.href=tb.href;function Mb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(L)||[];if(r.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Nb(a,b,c,d){var e={},f=a===Jb;function g(h){var i;return e[h]=!0,r.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Ob(a,b){var c,d,e=r.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&r.extend(!0,a,d),a}function Pb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}if(f)return f!==i[0]&&i.unshift(f),c[f]}function Qb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}r.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:tb.href,type:"GET",isLocal:Fb.test(tb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Kb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":r.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Ob(Ob(a,r.ajaxSettings),b):Ob(r.ajaxSettings,a)},ajaxPrefilter:Mb(Ib),ajaxTransport:Mb(Jb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m,n,o=r.ajaxSetup({},c),p=o.context||o,q=o.context&&(p.nodeType||p.jquery)?r(p):r.event,s=r.Deferred(),t=r.Callbacks("once memory"),u=o.statusCode||{},v={},w={},x="canceled",y={readyState:0,getResponseHeader:function(a){var b;if(k){if(!h){h={};while(b=Eb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return k?g:null},setRequestHeader:function(a,b){return null==k&&(a=w[a.toLowerCase()]=w[a.toLowerCase()]||a,v[a]=b),this},overrideMimeType:function(a){return null==k&&(o.mimeType=a),this},statusCode:function(a){var b;if(a)if(k)y.always(a[y.status]);else for(b in a)u[b]=[u[b],a[b]];return this},abort:function(a){var b=a||x;return e&&e.abort(b),A(0,b),this}};if(s.promise(y),o.url=((b||o.url||tb.href)+"").replace(Hb,tb.protocol+"//"),o.type=c.method||c.type||o.method||o.type,o.dataTypes=(o.dataType||"*").toLowerCase().match(L)||[""],null==o.crossDomain){j=d.createElement("a");try{j.href=o.url,j.href=j.href,o.crossDomain=Lb.protocol+"//"+Lb.host!=j.protocol+"//"+j.host}catch(z){o.crossDomain=!0}}if(o.data&&o.processData&&"string"!=typeof o.data&&(o.data=r.param(o.data,o.traditional)),Nb(Ib,o,c,y),k)return y;l=r.event&&o.global,l&&0===r.active++&&r.event.trigger("ajaxStart"),o.type=o.type.toUpperCase(),o.hasContent=!Gb.test(o.type),f=o.url.replace(Cb,""),o.hasContent?o.data&&o.processData&&0===(o.contentType||"").indexOf("application/x-www-form-urlencoded")&&(o.data=o.data.replace(Bb,"+")):(n=o.url.slice(f.length),o.data&&(f+=(vb.test(f)?"&":"?")+o.data,delete o.data),o.cache===!1&&(f=f.replace(Db,"$1"),n=(vb.test(f)?"&":"?")+"_="+ub++ +n),o.url=f+n),o.ifModified&&(r.lastModified[f]&&y.setRequestHeader("If-Modified-Since",r.lastModified[f]),r.etag[f]&&y.setRequestHeader("If-None-Match",r.etag[f])),(o.data&&o.hasContent&&o.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",o.contentType),y.setRequestHeader("Accept",o.dataTypes[0]&&o.accepts[o.dataTypes[0]]?o.accepts[o.dataTypes[0]]+("*"!==o.dataTypes[0]?", "+Kb+"; q=0.01":""):o.accepts["*"]);for(m in o.headers)y.setRequestHeader(m,o.headers[m]);if(o.beforeSend&&(o.beforeSend.call(p,y,o)===!1||k))return y.abort();if(x="abort",t.add(o.complete),y.done(o.success),y.fail(o.error),e=Nb(Jb,o,c,y)){if(y.readyState=1,l&&q.trigger("ajaxSend",[y,o]),k)return y;o.async&&o.timeout>0&&(i=a.setTimeout(function(){y.abort("timeout")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,"No Transport");function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&&a.clearTimeout(i),e=void 0,g=h||"",y.readyState=b>0?4:0,j=b>=200&&b<300||304===b,d&&(v=Pb(o,y,d)),v=Qb(o,v,y,j),j?(o.ifModified&&(w=y.getResponseHeader("Last-Modified"),w&&(r.lastModified[f]=w),w=y.getResponseHeader("etag"),w&&(r.etag[f]=w)),204===b||"HEAD"===o.type?x="nocontent":304===b?x="notmodified":(x=v.state,m=v.data,n=v.error,j=!n)):(n=x,!b&&x||(x="error",b<0&&(b=0))),y.status=b,y.statusText=(c||x)+"",j?s.resolveWith(p,[m,x,y]):s.rejectWith(p,[y,x,n]),y.statusCode(u),u=void 0,l&&q.trigger(j?"ajaxSuccess":"ajaxError",[y,o,j?m:n]),t.fireWith(p,[y,x]),l&&(q.trigger("ajaxComplete",[y,o]),--r.active||r.event.trigger("ajaxStop")))}return y},getJSON:function(a,b,c){return r.get(a,b,c,"json")},getScript:function(a,b){return r.get(a,void 0,b,"script")}}),r.each(["get","post"],function(a,b){r[b]=function(a,c,d,e){return r.isFunction(c)&&(e=e||d,d=c,c=void 0),r.ajax(r.extend({url:a,type:b,dataType:e,data:c,success:d},r.isPlainObject(a)&&a))}}),r._evalUrl=function(a){return r.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},r.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Rb={0:200,1223:204},Sb=r.ajaxSettings.xhr();o.cors=!!Sb&&"withCredentials"in Sb,o.ajax=Sb=!!Sb,r.ajaxTransport(function(b){var c,d;if(o.cors||Sb&&!b.crossDomain)return{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Rb[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}}),r.ajaxPrefilter(function(a){a.crossDomain&&(a.contents.script=!1)}),r.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return r.globalEval(a),a}}}),r.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),r.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=r(" -JS; - return $js; - } - - protected function console($type, $msg) - { - $type = strtolower($type); - $trace_tabs = array_values($this->config['tabs']); - $line[] = ($type == $trace_tabs[0] || '调试' == $type || '错误' == $type) - ? "console.group('{$type}');" - : "console.groupCollapsed('{$type}');"; - - foreach ((array) $msg as $key => $m) { - switch ($type) { - case '调试': - $var_type = gettype($m); - if (in_array($var_type, ['array', 'string'])) { - $line[] = "console.log(" . json_encode($m) . ");"; - } else { - $line[] = "console.log(" . json_encode(var_export($m, 1)) . ");"; - } - break; - case '错误': - $msg = str_replace("\n", '\n', addslashes(is_scalar($m) ? $m : json_encode($m))); - $style = 'color:#F4006B;font-size:14px;'; - $line[] = "console.error(\"%c{$msg}\", \"{$style}\");"; - break; - case 'sql': - $msg = str_replace("\n", '\n', addslashes($m)); - $style = "color:#009bb4;"; - $line[] = "console.log(\"%c{$msg}\", \"{$style}\");"; - break; - default: - $m = is_string($key) ? $key . ' ' . $m : $key + 1 . ' ' . $m; - $msg = json_encode($m); - $line[] = "console.log({$msg});"; - break; - } - } - $line[] = "console.groupEnd();"; - return implode(PHP_EOL, $line); - } - -} diff --git a/thinkphp/library/think/debug/Html.php b/thinkphp/library/think/debug/Html.php deleted file mode 100644 index a123762e..00000000 --- a/thinkphp/library/think/debug/Html.php +++ /dev/null @@ -1,106 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\debug; - -use think\Container; -use think\Db; -use think\Response; - -/** - * 页面Trace调试 - */ -class Html -{ - protected $config = [ - 'file' => '', - 'tabs' => ['base' => '基本', 'file' => '文件', 'info' => '流程', 'notice|error' => '错误', 'sql' => 'SQL', 'debug|log' => '调试'], - ]; - - // 实例化并传入参数 - public function __construct(array $config = []) - { - $this->config = array_merge($this->config, $config); - } - - /** - * 调试输出接口 - * @access public - * @param Response $response Response对象 - * @param array $log 日志信息 - * @return bool - */ - public function output(Response $response, array $log = []) - { - $request = Container::get('request'); - $contentType = $response->getHeader('Content-Type'); - $accept = $request->header('accept'); - if (strpos($accept, 'application/json') === 0 || $request->isAjax()) { - return false; - } elseif (!empty($contentType) && strpos($contentType, 'html') === false) { - return false; - } - // 获取基本信息 - $runtime = number_format(microtime(true) - Container::get('app')->getBeginTime(), 10, '.', ''); - $reqs = $runtime > 0 ? number_format(1 / $runtime, 2) : '∞'; - $mem = number_format((memory_get_usage() - Container::get('app')->getBeginMem()) / 1024, 2); - - // 页面Trace信息 - if ($request->host()) { - $uri = $request->protocol() . ' ' . $request->method() . ' : ' . $request->url(true); - } else { - $uri = 'cmd:' . implode(' ', $_SERVER['argv']); - } - $base = [ - '请求信息' => date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME']) . ' ' . $uri, - '运行时间' => number_format($runtime, 6) . 's [ 吞吐率:' . $reqs . 'req/s ] 内存消耗:' . $mem . 'kb 文件加载:' . count(get_included_files()), - '查询信息' => Db::$queryTimes . ' queries ' . Db::$executeTimes . ' writes ', - '缓存信息' => Container::get('cache')->getReadTimes() . ' reads,' . Container::get('cache')->getWriteTimes() . ' writes', - ]; - - if (session_id()) { - $base['会话信息'] = 'SESSION_ID=' . session_id(); - } - - $info = Container::get('debug')->getFile(true); - - // 页面Trace信息 - $trace = []; - foreach ($this->config['tabs'] as $name => $title) { - $name = strtolower($name); - switch ($name) { - case 'base': // 基本信息 - $trace[$title] = $base; - break; - case 'file': // 文件信息 - $trace[$title] = $info; - break; - default: // 调试信息 - if (strpos($name, '|')) { - // 多组信息 - $names = explode('|', $name); - $result = []; - foreach ($names as $name) { - $result = array_merge($result, isset($log[$name]) ? $log[$name] : []); - } - $trace[$title] = $result; - } else { - $trace[$title] = isset($log[$name]) ? $log[$name] : ''; - } - } - } - // 调用Trace页面模板 - ob_start(); - include $this->config['file']; - return ob_get_clean(); - } - -} diff --git a/thinkphp/library/think/exception/ClassNotFoundException.php b/thinkphp/library/think/exception/ClassNotFoundException.php deleted file mode 100644 index eb22e730..00000000 --- a/thinkphp/library/think/exception/ClassNotFoundException.php +++ /dev/null @@ -1,32 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\exception; - -class ClassNotFoundException extends \RuntimeException -{ - protected $class; - public function __construct($message, $class = '') - { - $this->message = $message; - $this->class = $class; - } - - /** - * 获取类名 - * @access public - * @return string - */ - public function getClass() - { - return $this->class; - } -} diff --git a/thinkphp/library/think/exception/DbException.php b/thinkphp/library/think/exception/DbException.php deleted file mode 100644 index 6baafb51..00000000 --- a/thinkphp/library/think/exception/DbException.php +++ /dev/null @@ -1,44 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\exception; - -use think\Exception; - -/** - * Database相关异常处理类 - */ -class DbException extends Exception -{ - /** - * DbException constructor. - * @access public - * @param string $message - * @param array $config - * @param string $sql - * @param int $code - */ - public function __construct($message, array $config = [], $sql = '', $code = 10500) - { - $this->message = $message; - $this->code = $code; - - $this->setData('Database Status', [ - 'Error Code' => $code, - 'Error Message' => $message, - 'Error SQL' => $sql, - ]); - - unset($config['username'], $config['password']); - $this->setData('Database Config', $config); - } - -} diff --git a/thinkphp/library/think/exception/ErrorException.php b/thinkphp/library/think/exception/ErrorException.php deleted file mode 100644 index 3143b8f7..00000000 --- a/thinkphp/library/think/exception/ErrorException.php +++ /dev/null @@ -1,56 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\exception; - -use think\Exception; - -/** - * ThinkPHP错误异常 - * 主要用于封装 set_error_handler 和 register_shutdown_function 得到的错误 - * 除开从 think\Exception 继承的功能 - * 其他和PHP系统\ErrorException功能基本一样 - */ -class ErrorException extends Exception -{ - /** - * 用于保存错误级别 - * @var integer - */ - protected $severity; - - /** - * 错误异常构造函数 - * @access public - * @param integer $severity 错误级别 - * @param string $message 错误详细信息 - * @param string $file 出错文件路径 - * @param integer $line 出错行号 - */ - public function __construct($severity, $message, $file, $line) - { - $this->severity = $severity; - $this->message = $message; - $this->file = $file; - $this->line = $line; - $this->code = 0; - } - - /** - * 获取错误级别 - * @access public - * @return integer 错误级别 - */ - final public function getSeverity() - { - return $this->severity; - } -} diff --git a/thinkphp/library/think/exception/Handle.php b/thinkphp/library/think/exception/Handle.php deleted file mode 100644 index 02c85ec1..00000000 --- a/thinkphp/library/think/exception/Handle.php +++ /dev/null @@ -1,306 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\exception; - -use Exception; -use think\console\Output; -use think\Container; -use think\Response; - -class Handle -{ - protected $render; - protected $ignoreReport = [ - '\\think\\exception\\HttpException', - ]; - - public function setRender($render) - { - $this->render = $render; - } - - /** - * Report or log an exception. - * - * @access public - * @param \Exception $exception - * @return void - */ - public function report(Exception $exception) - { - if (!$this->isIgnoreReport($exception)) { - // 收集异常数据 - if (Container::get('app')->isDebug()) { - $data = [ - 'file' => $exception->getFile(), - 'line' => $exception->getLine(), - 'message' => $this->getMessage($exception), - 'code' => $this->getCode($exception), - ]; - $log = "[{$data['code']}]{$data['message']}[{$data['file']}:{$data['line']}]"; - } else { - $data = [ - 'code' => $this->getCode($exception), - 'message' => $this->getMessage($exception), - ]; - $log = "[{$data['code']}]{$data['message']}"; - } - - if (Container::get('app')->config('log.record_trace')) { - $log .= "\r\n" . $exception->getTraceAsString(); - } - - Container::get('log')->record($log, 'error'); - } - } - - protected function isIgnoreReport(Exception $exception) - { - foreach ($this->ignoreReport as $class) { - if ($exception instanceof $class) { - return true; - } - } - - return false; - } - - /** - * Render an exception into an HTTP response. - * - * @access public - * @param \Exception $e - * @return Response - */ - public function render(Exception $e) - { - if ($this->render && $this->render instanceof \Closure) { - $result = call_user_func_array($this->render, [$e]); - - if ($result) { - return $result; - } - } - - if ($e instanceof HttpException) { - return $this->renderHttpException($e); - } else { - return $this->convertExceptionToResponse($e); - } - } - - /** - * @access public - * @param Output $output - * @param Exception $e - */ - public function renderForConsole(Output $output, Exception $e) - { - if (Container::get('app')->isDebug()) { - $output->setVerbosity(Output::VERBOSITY_DEBUG); - } - - $output->renderException($e); - } - - /** - * @access protected - * @param HttpException $e - * @return Response - */ - protected function renderHttpException(HttpException $e) - { - $status = $e->getStatusCode(); - $template = Container::get('app')->config('http_exception_template'); - - if (!Container::get('app')->isDebug() && !empty($template[$status])) { - return Response::create($template[$status], 'view', $status)->assign(['e' => $e]); - } else { - return $this->convertExceptionToResponse($e); - } - } - - /** - * @access protected - * @param Exception $exception - * @return Response - */ - protected function convertExceptionToResponse(Exception $exception) - { - // 收集异常数据 - if (Container::get('app')->isDebug()) { - // 调试模式,获取详细的错误信息 - $data = [ - 'name' => get_class($exception), - 'file' => $exception->getFile(), - 'line' => $exception->getLine(), - 'message' => $this->getMessage($exception), - 'trace' => $exception->getTrace(), - 'code' => $this->getCode($exception), - 'source' => $this->getSourceCode($exception), - 'datas' => $this->getExtendData($exception), - 'tables' => [ - 'GET Data' => $_GET, - 'POST Data' => $_POST, - 'Files' => $_FILES, - 'Cookies' => $_COOKIE, - 'Session' => isset($_SESSION) ? $_SESSION : [], - 'Server/Request Data' => $_SERVER, - 'Environment Variables' => $_ENV, - 'ThinkPHP Constants' => $this->getConst(), - ], - ]; - } else { - // 部署模式仅显示 Code 和 Message - $data = [ - 'code' => $this->getCode($exception), - 'message' => $this->getMessage($exception), - ]; - - if (!Container::get('app')->config('show_error_msg')) { - // 不显示详细错误信息 - $data['message'] = Container::get('app')->config('error_message'); - } - } - - //保留一层 - while (ob_get_level() > 1) { - ob_end_clean(); - } - - $data['echo'] = ob_get_clean(); - - ob_start(); - extract($data); - include Container::get('app')->config('exception_tmpl'); - - // 获取并清空缓存 - $content = ob_get_clean(); - $response = Response::create($content, 'html'); - - if ($exception instanceof HttpException) { - $statusCode = $exception->getStatusCode(); - $response->header($exception->getHeaders()); - } - - if (!isset($statusCode)) { - $statusCode = 500; - } - $response->code($statusCode); - - return $response; - } - - /** - * 获取错误编码 - * ErrorException则使用错误级别作为错误编码 - * @access protected - * @param \Exception $exception - * @return integer 错误编码 - */ - protected function getCode(Exception $exception) - { - $code = $exception->getCode(); - - if (!$code && $exception instanceof ErrorException) { - $code = $exception->getSeverity(); - } - - return $code; - } - - /** - * 获取错误信息 - * ErrorException则使用错误级别作为错误编码 - * @access protected - * @param \Exception $exception - * @return string 错误信息 - */ - protected function getMessage(Exception $exception) - { - $message = $exception->getMessage(); - - if (PHP_SAPI == 'cli') { - return $message; - } - - $lang = Container::get('lang'); - - if (strpos($message, ':')) { - $name = strstr($message, ':', true); - $message = $lang->has($name) ? $lang->get($name) . strstr($message, ':') : $message; - } elseif (strpos($message, ',')) { - $name = strstr($message, ',', true); - $message = $lang->has($name) ? $lang->get($name) . ':' . substr(strstr($message, ','), 1) : $message; - } elseif ($lang->has($message)) { - $message = $lang->get($message); - } - - return $message; - } - - /** - * 获取出错文件内容 - * 获取错误的前9行和后9行 - * @access protected - * @param \Exception $exception - * @return array 错误文件内容 - */ - protected function getSourceCode(Exception $exception) - { - // 读取前9行和后9行 - $line = $exception->getLine(); - $first = ($line - 9 > 0) ? $line - 9 : 1; - - try { - $contents = file($exception->getFile()); - $source = [ - 'first' => $first, - 'source' => array_slice($contents, $first - 1, 19), - ]; - } catch (Exception $e) { - $source = []; - } - - return $source; - } - - /** - * 获取异常扩展信息 - * 用于非调试模式html返回类型显示 - * @access protected - * @param \Exception $exception - * @return array 异常类定义的扩展数据 - */ - protected function getExtendData(Exception $exception) - { - $data = []; - - if ($exception instanceof \think\Exception) { - $data = $exception->getData(); - } - - return $data; - } - - /** - * 获取常量列表 - * @access private - * @return array 常量列表 - */ - private static function getConst() - { - $const = get_defined_constants(true); - - return isset($const['user']) ? $const['user'] : []; - } -} diff --git a/thinkphp/library/think/exception/HttpException.php b/thinkphp/library/think/exception/HttpException.php deleted file mode 100644 index 01a27fc2..00000000 --- a/thinkphp/library/think/exception/HttpException.php +++ /dev/null @@ -1,36 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\exception; - -class HttpException extends \RuntimeException -{ - private $statusCode; - private $headers; - - public function __construct($statusCode, $message = null, \Exception $previous = null, array $headers = [], $code = 0) - { - $this->statusCode = $statusCode; - $this->headers = $headers; - - parent::__construct($message, $code, $previous); - } - - public function getStatusCode() - { - return $this->statusCode; - } - - public function getHeaders() - { - return $this->headers; - } -} diff --git a/thinkphp/library/think/exception/HttpResponseException.php b/thinkphp/library/think/exception/HttpResponseException.php deleted file mode 100644 index 52972867..00000000 --- a/thinkphp/library/think/exception/HttpResponseException.php +++ /dev/null @@ -1,33 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\exception; - -use think\Response; - -class HttpResponseException extends \RuntimeException -{ - /** - * @var Response - */ - protected $response; - - public function __construct(Response $response) - { - $this->response = $response; - } - - public function getResponse() - { - return $this->response; - } - -} diff --git a/thinkphp/library/think/exception/PDOException.php b/thinkphp/library/think/exception/PDOException.php deleted file mode 100644 index 25240b68..00000000 --- a/thinkphp/library/think/exception/PDOException.php +++ /dev/null @@ -1,40 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\exception; - -/** - * PDO异常处理类 - * 重新封装了系统的\PDOException类 - */ -class PDOException extends DbException -{ - /** - * PDOException constructor. - * @access public - * @param \PDOException $exception - * @param array $config - * @param string $sql - * @param int $code - */ - public function __construct(\PDOException $exception, array $config, $sql, $code = 10501) - { - $error = $exception->errorInfo; - - $this->setData('PDO Error Info', [ - 'SQLSTATE' => $error[0], - 'Driver Error Code' => isset($error[1]) ? $error[1] : 0, - 'Driver Error Message' => isset($error[2]) ? $error[2] : '', - ]); - - parent::__construct($exception->getMessage(), $config, $sql, $code); - } -} diff --git a/thinkphp/library/think/exception/RouteNotFoundException.php b/thinkphp/library/think/exception/RouteNotFoundException.php deleted file mode 100644 index d22e3a63..00000000 --- a/thinkphp/library/think/exception/RouteNotFoundException.php +++ /dev/null @@ -1,22 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\exception; - -class RouteNotFoundException extends HttpException -{ - - public function __construct() - { - parent::__construct(404, 'Route Not Found'); - } - -} diff --git a/thinkphp/library/think/exception/TemplateNotFoundException.php b/thinkphp/library/think/exception/TemplateNotFoundException.php deleted file mode 100644 index 42020693..00000000 --- a/thinkphp/library/think/exception/TemplateNotFoundException.php +++ /dev/null @@ -1,33 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\exception; - -class TemplateNotFoundException extends \RuntimeException -{ - protected $template; - - public function __construct($message, $template = '') - { - $this->message = $message; - $this->template = $template; - } - - /** - * 获取模板文件 - * @access public - * @return string - */ - public function getTemplate() - { - return $this->template; - } -} diff --git a/thinkphp/library/think/exception/ThrowableError.php b/thinkphp/library/think/exception/ThrowableError.php deleted file mode 100644 index 87b6b9d7..00000000 --- a/thinkphp/library/think/exception/ThrowableError.php +++ /dev/null @@ -1,47 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\exception; - -class ThrowableError extends \ErrorException -{ - public function __construct(\Throwable $e) - { - - if ($e instanceof \ParseError) { - $message = 'Parse error: ' . $e->getMessage(); - $severity = E_PARSE; - } elseif ($e instanceof \TypeError) { - $message = 'Type error: ' . $e->getMessage(); - $severity = E_RECOVERABLE_ERROR; - } else { - $message = 'Fatal error: ' . $e->getMessage(); - $severity = E_ERROR; - } - - parent::__construct( - $message, - $e->getCode(), - $severity, - $e->getFile(), - $e->getLine() - ); - - $this->setTrace($e->getTrace()); - } - - protected function setTrace($trace) - { - $traceReflector = new \ReflectionProperty('Exception', 'trace'); - $traceReflector->setAccessible(true); - $traceReflector->setValue($this, $trace); - } -} diff --git a/thinkphp/library/think/exception/ValidateException.php b/thinkphp/library/think/exception/ValidateException.php deleted file mode 100644 index 81ddfe21..00000000 --- a/thinkphp/library/think/exception/ValidateException.php +++ /dev/null @@ -1,34 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\exception; - -class ValidateException extends \RuntimeException -{ - protected $error; - - public function __construct($error, $code = 0) - { - $this->error = $error; - $this->message = is_array($error) ? implode(PHP_EOL, $error) : $error; - $this->code = $code; - } - - /** - * 获取验证错误信息 - * @access public - * @return array|string - */ - public function getError() - { - return $this->error; - } -} diff --git a/thinkphp/library/think/facade/App.php b/thinkphp/library/think/facade/App.php deleted file mode 100644 index b375aa09..00000000 --- a/thinkphp/library/think/facade/App.php +++ /dev/null @@ -1,63 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\App - * @mixin \think\App - * @method \think\App bind(string $bind) static 绑定模块或者控制器 - * @method void initialize() static 初始化应用 - * @method void init(string $module='') static 初始化模块 - * @method \think\Response run() static 执行应用 - * @method \think\App dispatch(\think\route\Dispatch $dispatch) static 设置当前请求的调度信息 - * @method void log(mixed $log, string $type = 'info') static 记录调试信息 - * @method mixed config(string $name='') static 获取配置参数 - * @method \think\route\Dispatch routeCheck() static URL路由检测(根据PATH_INFO) - * @method \think\App routeMust(bool $must = false) static 设置应用的路由检测机制 - * @method \think\Model model(string $name = '', string $layer = 'model', bool $appendSuffix = false, string $common = 'common') static 实例化模型 - * @method object controller(string $name, string $layer = 'controller', bool $appendSuffix = false, string $empty = '') static 实例化控制器 - * @method \think\Validate validate(string $name = '', string $layer = 'validate', bool $appendSuffix = false, string $common = 'common') static 实例化验证器类 - * @method \think\db\Query db(mixed $config = [], mixed $name = false) static 数据库初始化 - * @method mixed action(string $url, $vars = [], $layer = 'controller', $appendSuffix = false) static 调用模块的操作方法 - * @method string parseClass(string $module, string $layer, string $name, bool $appendSuffix = false) static 解析应用类的类名 - * @method string version() static 获取框架版本 - * @method bool isDebug() static 是否为调试模式 - * @method string getModulePath() static 获取当前模块路径 - * @method void setModulePath(string $path) static 设置当前模块路径 - * @method string getRootPath() static 获取应用根目录 - * @method string getAppPath() static 获取应用类库目录 - * @method string getRuntimePath() static 获取应用运行时目录 - * @method string getThinkPath() static 获取核心框架目录 - * @method string getRoutePath() static 获取路由目录 - * @method string getConfigPath() static 获取应用配置目录 - * @method string getConfigExt() static 获取配置后缀 - * @method string setNamespace(string $namespace) static 设置应用类库命名空间 - * @method string getNamespace() static 获取应用类库命名空间 - * @method string getSuffix() static 是否启用类库后缀 - * @method float getBeginTime() static 获取应用开启时间 - * @method integer getBeginMem() static 获取应用初始内存占用 - * @method \think\Container container() static 获取容器实例 - */ -class App extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'app'; - } -} diff --git a/thinkphp/library/think/facade/Build.php b/thinkphp/library/think/facade/Build.php deleted file mode 100644 index c051bea1..00000000 --- a/thinkphp/library/think/facade/Build.php +++ /dev/null @@ -1,33 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\Build - * @mixin \think\Build - * @method void run(array $build = [], string $namespace = 'app', bool $suffix = false) static 根据传入的build资料创建目录和文件 - * @method void module(string $module = '', array $list = [], string $namespace = 'app', bool $suffix = false) static 创建模块 - */ -class Build extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'build'; - } -} diff --git a/thinkphp/library/think/facade/Cache.php b/thinkphp/library/think/facade/Cache.php deleted file mode 100644 index 9743486e..00000000 --- a/thinkphp/library/think/facade/Cache.php +++ /dev/null @@ -1,45 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\Cache - * @mixin \think\Cache - * @method \think\cache\Driver connect(array $options = [], mixed $name = false) static 连接缓存 - * @method \think\cache\Driver init(array $options = []) static 初始化缓存 - * @method \think\cache\Driver store(string $name = '') static 切换缓存类型 - * @method bool has(string $name) static 判断缓存是否存在 - * @method mixed get(string $name, mixed $default = false) static 读取缓存 - * @method mixed pull(string $name) static 读取缓存并删除 - * @method mixed set(string $name, mixed $value, int $expire = null) static 设置缓存 - * @method mixed remember(string $name, mixed $value, int $expire = null) static 如果不存在则写入缓存 - * @method mixed inc(string $name, int $step = 1) static 自增缓存(针对数值缓存) - * @method mixed dec(string $name, int $step = 1) static 自减缓存(针对数值缓存) - * @method bool rm(string $name) static 删除缓存 - * @method bool clear(string $tag = null) static 清除缓存 - * @method mixed tag(string $name, mixed $keys = null, bool $overlay = false) static 缓存标签 - * @method object handler() static 返回句柄对象,可执行其它高级方法 - */ -class Cache extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'cache'; - } -} diff --git a/thinkphp/library/think/facade/Config.php b/thinkphp/library/think/facade/Config.php deleted file mode 100644 index 824d2b6a..00000000 --- a/thinkphp/library/think/facade/Config.php +++ /dev/null @@ -1,39 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\Config - * @mixin \think\Config - * @method array load(string $file, string $name = '') static 加载配置文件 - * @method bool has(string $name) static 检测配置是否存在 - * @method array pull(string $name) static 获取一级配置参数 - * @method mixed get(string $name,mixed $default = null) static 获取配置参数 - * @method array set(mixed $name, mixed $value = null) static 设置配置参数 - * @method array reset(string $name ='') static 重置配置参数 - * @method void remove(string $name = '') static 移除配置 - * @method void setYaconf(mixed $yaconf) static 设置开启Yaconf 或者指定配置文件名 - */ -class Config extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'config'; - } -} diff --git a/thinkphp/library/think/facade/Cookie.php b/thinkphp/library/think/facade/Cookie.php deleted file mode 100644 index 4d7cea25..00000000 --- a/thinkphp/library/think/facade/Cookie.php +++ /dev/null @@ -1,39 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\Cookie - * @mixin \think\Cookie - * @method void init(array $config = []) static 初始化 - * @method bool has(string $name,string $prefix = null) static 判断Cookie数据 - * @method mixed prefix(string $prefix = '') static 设置或者获取cookie作用域(前缀) - * @method mixed get(string $name,string $prefix = null) static Cookie获取 - * @method mixed set(string $name, mixed $value = null, mixed $option = null) static 设置Cookie - * @method void forever(string $name, mixed $value = null, mixed $option = null) static 永久保存Cookie数据 - * @method void delete(string $name, string $prefix = null) static Cookie删除 - * @method void clear($prefix = null) static Cookie清空 - */ -class Cookie extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'cookie'; - } -} diff --git a/thinkphp/library/think/facade/Debug.php b/thinkphp/library/think/facade/Debug.php deleted file mode 100644 index df20086d..00000000 --- a/thinkphp/library/think/facade/Debug.php +++ /dev/null @@ -1,40 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\Debug - * @mixin \think\Debug - * @method void remark(string $name, mixed $value = '') static 记录时间(微秒)和内存使用情况 - * @method int getRangeTime(string $start, string $end, mixed $dec = 6) static 统计某个区间的时间(微秒)使用情况 - * @method int getUseTime(int $dec = 6) static 统计从开始到统计时的时间(微秒)使用情况 - * @method string getThroughputRate(string $start, string $end, mixed $dec = 6) static 获取当前访问的吞吐率情况 - * @method string getRangeMem(string $start, string $end, mixed $dec = 2) static 记录区间的内存使用情况 - * @method int getUseMem(int $dec = 2) static 统计从开始到统计时的内存使用情况 - * @method string getMemPeak(string $start, string $end, mixed $dec = 2) static 统计区间的内存峰值情况 - * @method mixed getFile(bool $detail = false) static 获取文件加载信息 - * @method mixed dump(mixed $var, bool $echo = true, string $label = null, int $flags = ENT_SUBSTITUTE) static 浏览器友好的变量输出 - */ -class Debug extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'debug'; - } -} diff --git a/thinkphp/library/think/facade/Env.php b/thinkphp/library/think/facade/Env.php deleted file mode 100644 index 5d047244..00000000 --- a/thinkphp/library/think/facade/Env.php +++ /dev/null @@ -1,34 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\Env - * @mixin \think\Env - * @method void load(string $file) static 读取环境变量定义文件 - * @method mixed get(string $name = null, mixed $default = null) static 获取环境变量值 - * @method void set(mixed $env, string $value = null) static 设置环境变量值 - */ -class Env extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'env'; - } -} diff --git a/thinkphp/library/think/facade/Hook.php b/thinkphp/library/think/facade/Hook.php deleted file mode 100644 index e9e12083..00000000 --- a/thinkphp/library/think/facade/Hook.php +++ /dev/null @@ -1,37 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\Hook - * @mixin \think\Hook - * @method \think\Hook alias(mixed $name, mixed $behavior = null) static 指定行为标识 - * @method void add(string $tag, mixed $behavior, bool $first = false) static 动态添加行为扩展到某个标签 - * @method void import(array $tags, bool $recursive = true) static 批量导入插件 - * @method array get(string $tag = '') static 获取插件信息 - * @method mixed listen(string $tag, mixed $params = null, bool $once = false) static 监听标签的行为 - * @method mixed exec(mixed $class, mixed $params = null) static 执行行为 - */ -class Hook extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'hook'; - } -} diff --git a/thinkphp/library/think/facade/Lang.php b/thinkphp/library/think/facade/Lang.php deleted file mode 100644 index 56c4777d..00000000 --- a/thinkphp/library/think/facade/Lang.php +++ /dev/null @@ -1,41 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\Lang - * @mixin \think\Lang - * @method mixed range($range = '') static 设定当前的语言 - * @method mixed set(mixed $name, string $value = null, string $range = '') static 设置语言定义 - * @method array load(mixed $file, string $range = '') static 加载语言定义 - * @method mixed get(string $name = null, array $vars = [], string $range = '') static 获取语言定义 - * @method mixed has(string $name, string $range = '') static 获取语言定义 - * @method string detect() static 自动侦测设置获取语言选择 - * @method void saveToCookie(string $lang = null) static 设置当前语言到Cookie - * @method void setLangDetectVar(string $var) static 设置语言自动侦测的变量 - * @method void setLangCookieVar(string $var) static 设置语言的cookie保存变量 - * @method void setAllowLangList(array $list) static 设置允许的语言列表 - */ -class Lang extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'lang'; - } -} diff --git a/thinkphp/library/think/facade/Log.php b/thinkphp/library/think/facade/Log.php deleted file mode 100644 index ae627a5c..00000000 --- a/thinkphp/library/think/facade/Log.php +++ /dev/null @@ -1,50 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\Log - * @mixin \think\Log - * @method \think\Log init(array $config = []) static 日志初始化 - * @method mixed getLog(string $type = '') static 获取日志信息 - * @method \think\Log record(mixed $msg, string $type = 'info', array $context = []) static 记录日志信息 - * @method \think\Log clear() static 清空日志信息 - * @method \think\Log key(string $key) static 当前日志记录的授权key - * @method \think\Log close() static 关闭本次请求日志写入 - * @method bool check(array $config) static 检查日志写入权限 - * @method bool save() static 保存调试信息 - * @method void write(mixed $msg, string $type = 'info', bool $force = false) static 实时写入日志信息 - * @method void log(string $level,mixed $message, array $context = []) static 记录日志信息 - * @method void emergency(mixed $message, array $context = []) static 记录emergency信息 - * @method void alert(mixed $message, array $context = []) static 记录alert信息 - * @method void critical(mixed $message, array $context = []) static 记录critical信息 - * @method void error(mixed $message, array $context = []) static 记录error信息 - * @method void warning(mixed $message, array $context = []) static 记录warning信息 - * @method void notice(mixed $message, array $context = []) static 记录notice信息 - * @method void info(mixed $message, array $context = []) static 记录info信息 - * @method void debug(mixed $message, array $context = []) static 记录debug信息 - * @method void sql(mixed $message, array $context = []) static 记录sql信息 - */ -class Log extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'log'; - } -} diff --git a/thinkphp/library/think/facade/Middleware.php b/thinkphp/library/think/facade/Middleware.php deleted file mode 100644 index 5e4cac74..00000000 --- a/thinkphp/library/think/facade/Middleware.php +++ /dev/null @@ -1,36 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\Middleware - * @mixin \think\Middleware - * @method void import(array $middlewares = []) static 批量设置中间件 - * @method void add(mixed $middleware) static 添加中间件到队列 - * @method void unshift(mixed $middleware) static 添加中间件到队列开头 - * @method array all() static 获取中间件队列 - * @method \think\Response dispatch(\think\Request $request) static 执行中间件调度 - */ -class Middleware extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'middleware'; - } -} diff --git a/thinkphp/library/think/facade/Request.php b/thinkphp/library/think/facade/Request.php deleted file mode 100644 index 0989253f..00000000 --- a/thinkphp/library/think/facade/Request.php +++ /dev/null @@ -1,97 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\Request - * @mixin \think\Request - * @method void hook(mixed $method, mixed $callback = null) static Hook 方法注入 - * @method \think\Request create(string $uri, string $method = 'GET', array $params = [], array $cookie = [], array $files = [], array $server = [], string $content = null) static 创建一个URL请求 - * @method mixed domain(bool $port = false) static 获取当前包含协议、端口的域名 - * @method mixed url(bool $domain = false) static 获取当前完整URL - * @method mixed baseUrl(bool $domain = false) static 获取当前URL - * @method mixed baseFile(bool $domain = false) static 获取当前执行的文件 - * @method mixed root(bool $domain = false) static 获取URL访问根地址 - * @method string rootUrl() static 获取URL访问根目录 - * @method string pathinfo() static 获取当前请求URL的pathinfo信息(含URL后缀) - * @method string path() static 获取当前请求URL的pathinfo信息(不含URL后缀) - * @method string ext() static 当前URL的访问后缀 - * @method float time(bool $float = false) static 获取当前请求的时间 - * @method mixed type() static 当前请求的资源类型 - * @method void mimeType(mixed $type, string $val = '') static 设置资源类型 - * @method string method(bool $method = false) static 当前的请求类型 - * @method bool isGet() static 是否为GET请求 - * @method bool isPost() static 是否为POST请求 - * @method bool isPut() static 是否为PUT请求 - * @method bool isDelete() static 是否为DELTE请求 - * @method bool isHead() static 是否为HEAD请求 - * @method bool isPatch() static 是否为PATCH请求 - * @method bool isOptions() static 是否为OPTIONS请求 - * @method bool isCli() static 是否为cli - * @method bool isCgi() static 是否为cgi - * @method mixed param(string $name = '', mixed $default = null, mixed $filter = '') static 获取当前请求的参数 - * @method mixed route(string $name = '', mixed $default = null, mixed $filter = '') static 设置获取路由参数 - * @method mixed get(string $name = '', mixed $default = null, mixed $filter = '') static 设置获取GET参数 - * @method mixed post(string $name = '', mixed $default = null, mixed $filter = '') static 设置获取POST参数 - * @method mixed put(string $name = '', mixed $default = null, mixed $filter = '') static 设置获取PUT参数 - * @method mixed delete(string $name = '', mixed $default = null, mixed $filter = '') static 设置获取DELETE参数 - * @method mixed patch(string $name = '', mixed $default = null, mixed $filter = '') static 设置获取PATCH参数 - * @method mixed request(string $name = '', mixed $default = null, mixed $filter = '') static 获取request变量 - * @method mixed session(string $name = '', mixed $default = null, mixed $filter = '') static 获取session数据 - * @method mixed cookie(string $name = '', mixed $default = null, mixed $filter = '') static 获取cookie参数 - * @method mixed server(string $name = '', mixed $default = null, mixed $filter = '') static 获取server参数 - * @method mixed env(string $name = '', mixed $default = null, mixed $filter = '') static 获取环境变量 - * @method mixed file(string $name = '') static 获取上传的文件信息 - * @method mixed header(string $name = '', mixed $default = null) static 设置或者获取当前的Header - * @method mixed input(array $data,mixed $name = '', mixed $default = null, mixed $filter = '') static 获取变量 支持过滤和默认值 - * @method mixed filter(mixed $filter = null) static 设置或获取当前的过滤规则 - * @method mixed has(string $name, string $type = 'param', bool $checkEmpty = false) static 是否存在某个请求参数 - * @method mixed only(mixed $name, string $type = 'param') static 获取指定的参数 - * @method mixed except(mixed $name, string $type = 'param') static 排除指定参数获取 - * @method bool isSsl() static 当前是否ssl - * @method bool isAjax(bool $ajax = false) static 当前是否Ajax请求 - * @method bool isPjax(bool $pjax = false) static 当前是否Pjax请求 - * @method mixed ip(int $type = 0, bool $adv = true) static 获取客户端IP地址 - * @method bool isMobile() static 检测是否使用手机访问 - * @method string scheme() static 当前URL地址中的scheme参数 - * @method string query() static 当前请求URL地址中的query参数 - * @method string host(bool $stric = false) static 当前请求的host - * @method string port() static 当前请求URL地址中的port参数 - * @method string protocol() static 当前请求 SERVER_PROTOCOL - * @method string remotePort() static 当前请求 REMOTE_PORT - * @method string contentType() static 当前请求 HTTP_CONTENT_TYPE - * @method array routeInfo() static 获取当前请求的路由信息 - * @method array dispatch() static 获取当前请求的调度信息 - * @method string module() static 获取当前的模块名 - * @method string controller(bool $convert = false) static 获取当前的控制器名 - * @method string action(bool $convert = false) static 获取当前的操作名 - * @method string langset() static 获取当前的语言 - * @method string getContent() static 设置或者获取当前请求的content - * @method string getInput() static 获取当前请求的php://input - * @method string token(string $name = '__token__', mixed $type = 'md5') static 生成请求令牌 - * @method string cache(string $key, mixed $expire = null, array $except = [], string $tag = null) static 设置当前地址的请求缓存 - * @method string getCache() static 读取请求缓存设置 - */ -class Request extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'request'; - } -} diff --git a/thinkphp/library/think/facade/Response.php b/thinkphp/library/think/facade/Response.php deleted file mode 100644 index d7de142f..00000000 --- a/thinkphp/library/think/facade/Response.php +++ /dev/null @@ -1,47 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\Response - * @mixin \think\Response - * @method \think\response create(mixed $data = '', string $type = '', int $code = 200, array $header = [], array $options = []) static 创建Response对象 - * @method void send() static 发送数据到客户端 - * @method \think\Response options(mixed $options = []) static 输出的参数 - * @method \think\Response data(mixed $data) static 输出数据设置 - * @method \think\Response header(mixed $name, string $value = null) static 设置响应头 - * @method \think\Response content(mixed $content) static 设置页面输出内容 - * @method \think\Response code(int $code) static 发送HTTP状态 - * @method \think\Response lastModified(string $time) static LastModified - * @method \think\Response expires(string $time) static expires - * @method \think\Response eTag(string $eTag) static eTag - * @method \think\Response cacheControl(string $cache) static 页面缓存控制 - * @method \think\Response contentType(string $contentType, string $charset = 'utf-8') static 页面输出类型 - * @method mixed getHeader(string $name) static 获取头部信息 - * @method mixed getData() static 获取原始数据 - * @method mixed getContent() static 获取输出数据 - * @method int getCode() static 获取状态码 - */ -class Response extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'response'; - } -} diff --git a/thinkphp/library/think/facade/Route.php b/thinkphp/library/think/facade/Route.php deleted file mode 100644 index 77196dfe..00000000 --- a/thinkphp/library/think/facade/Route.php +++ /dev/null @@ -1,57 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\Route - * @mixin \think\Route - * @method \think\route\Domain domain(mixed $name, mixed $rule = '', array $option = [], array $pattern = []) static 注册域名路由 - * @method \think\Route pattern(mixed $name, string $rule = '') static 注册变量规则 - * @method \think\Route option(mixed $name, mixed $value = '') static 注册路由参数 - * @method \think\Route bind(string $bind) static 设置路由绑定 - * @method mixed getBind(string $bind) static 读取路由绑定 - * @method \think\Route name(string $name) static 设置当前路由标识 - * @method mixed getName(string $name) static 读取路由标识 - * @method void setName(string $name) static 批量导入路由标识 - * @method void import(array $rules, string $type = '*') static 导入配置文件的路由规则 - * @method \think\route\RuleItem rule(string $rule, mixed $route, string $method = '*', array $option = [], array $pattern = []) static 注册路由规则 - * @method void rules(array $rules, string $method = '*', array $option = [], array $pattern = []) static 批量注册路由规则 - * @method \think\route\RuleGroup group(string|array $name, mixed $route, string $method = '*', array $option = [], array $pattern = []) static 注册路由分组 - * @method \think\route\RuleItem any(string $rule, mixed $route, array $option = [], array $pattern = []) static 注册路由 - * @method \think\route\RuleItem get(string $rule, mixed $route, array $option = [], array $pattern = []) static 注册路由 - * @method \think\route\RuleItem post(string $rule, mixed $route, array $option = [], array $pattern = []) static 注册路由 - * @method \think\route\RuleItem put(string $rule, mixed $route, array $option = [], array $pattern = []) static 注册路由 - * @method \think\route\RuleItem delete(string $rule, mixed $route, array $option = [], array $pattern = []) static 注册路由 - * @method \think\route\RuleItem patch(string $rule, mixed $route, array $option = [], array $pattern = []) static 注册路由 - * @method \think\route\Resource resource(string $rule, mixed $route, array $option = [], array $pattern = []) static 注册资源路由 - * @method \think\Route controller(string $rule, mixed $route, array $option = [], array $pattern = []) static 注册控制器路由 - * @method \think\Route alias(string $rule, mixed $route, array $option = [], array $pattern = []) static 注册别名路由 - * @method \think\Route setMethodPrefix(mixed $method, string $prefix = '') static 设置不同请求类型下面的方法前缀 - * @method \think\Route rest(string $name, array $resource = []) static rest方法定义和修改 - * @method \think\Route\RuleItem miss(string $route, string $method = '*', array $option = []) static 注册未匹配路由规则后的处理 - * @method \think\Route\RuleItem auto(string $route) static 注册一个自动解析的URL路由 - * @method \think\Route\Dispatch check(string $url, string $depr = '/', bool $must = false, bool $completeMatch = false) static 检测URL路由 - */ -class Route extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'route'; - } -} diff --git a/thinkphp/library/think/facade/Session.php b/thinkphp/library/think/facade/Session.php deleted file mode 100644 index fb9206af..00000000 --- a/thinkphp/library/think/facade/Session.php +++ /dev/null @@ -1,46 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\Session - * @mixin \think\Session - * @method void init(array $config = []) static session初始化 - * @method bool has(string $name,string $prefix = null) static 判断session数据 - * @method mixed prefix(string $prefix = '') static 设置或者获取session作用域(前缀) - * @method mixed get(string $name = '',string $prefix = null) static session获取 - * @method mixed pull(string $name,string $prefix = null) static session获取并删除 - * @method void push(string $key, mixed $value) static 添加数据到一个session数组 - * @method void set(string $name, mixed $value , string $prefix = null) static 设置session数据 - * @method void flash(string $name, mixed $value = null) static session设置 下一次请求有效 - * @method void flush() static 清空当前请求的session数据 - * @method void delete(string $name, string $prefix = null) static 删除session数据 - * @method void clear($prefix = null) static 清空session数据 - * @method void start() static 启动session - * @method void destroy() static 销毁session - * @method void pause() static 暂停session - * @method void regenerate(bool $delete = false) static 重新生成session_id - */ -class Session extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'session'; - } -} diff --git a/thinkphp/library/think/facade/Template.php b/thinkphp/library/think/facade/Template.php deleted file mode 100644 index f91b1182..00000000 --- a/thinkphp/library/think/facade/Template.php +++ /dev/null @@ -1,36 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\Template - * @mixin \think\Template - * @method void assign(mixed $name, mixed $value = '') static 模板变量赋值 - * @method mixed get(string $name = '') static 获取模板变量 - * @method void fetch(string $template, array $vars = [], array $config = []) static 渲染模板文件 - * @method void display(string $content, array $vars = [], array $config = []) static 渲染模板内容 - * @method mixed layout(string $name, string $replace = '') static 设置模板布局 - */ -class Template extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'template'; - } -} diff --git a/thinkphp/library/think/facade/Url.php b/thinkphp/library/think/facade/Url.php deleted file mode 100644 index 639591ac..00000000 --- a/thinkphp/library/think/facade/Url.php +++ /dev/null @@ -1,33 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\Url - * @mixin \think\Url - * @method string build(string $url = '', mixed $vars = '', mixed $suffix = true, mixed $domain = false) static URL生成 支持路由反射 - * @method void root(string $root) static 指定当前生成URL地址的root - */ -class Url extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'url'; - } -} diff --git a/thinkphp/library/think/facade/Validate.php b/thinkphp/library/think/facade/Validate.php deleted file mode 100644 index a6eec23e..00000000 --- a/thinkphp/library/think/facade/Validate.php +++ /dev/null @@ -1,75 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\Validate - * @mixin \think\Validate - * @method \think\Validate make(array $rules = [], array $message = [], array $field = []) static 创建一个验证器类 - * @method \think\Validate rule(mixed $name, mixed $rule = '') static 添加字段验证规则 - * @method void extend(string $type, mixed $callback = null) static 注册扩展验证(类型)规则 - * @method void setTypeMsg(mixed $type, string $msg = null) static 设置验证规则的默认提示信息 - * @method \think\Validate message(mixed $name, string $message = '') static 设置提示信息 - * @method \think\Validate scene(string $name) static 设置验证场景 - * @method bool hasScene(string $name) static 判断是否存在某个验证场景 - * @method \think\Validate batch(bool $batch = true) static 设置批量验证 - * @method \think\Validate only(array $fields) static 指定需要验证的字段列表 - * @method \think\Validate remove(mixed $field, mixed $rule = true) static 移除某个字段的验证规则 - * @method \think\Validate append(mixed $field, mixed $rule = null) static 追加某个字段的验证规则 - * @method bool confirm(mixed $value, mixed $rule, array $data = [], string $field = '') static 验证是否和某个字段的值一致 - * @method bool different(mixed $value, mixed $rule, array $data = []) static 验证是否和某个字段的值是否不同 - * @method bool egt(mixed $value, mixed $rule, array $data = []) static 验证是否大于等于某个值 - * @method bool gt(mixed $value, mixed $rule, array $data = []) static 验证是否大于某个值 - * @method bool elt(mixed $value, mixed $rule, array $data = []) static 验证是否小于等于某个值 - * @method bool lt(mixed $value, mixed $rule, array $data = []) static 验证是否小于某个值 - * @method bool eq(mixed $value, mixed $rule) static 验证是否等于某个值 - * @method bool must(mixed $value, mixed $rule) static 必须验证 - * @method bool is(mixed $value, mixed $rule, array $data = []) static 验证字段值是否为有效格式 - * @method bool ip(mixed $value, mixed $rule) static 验证是否有效IP - * @method bool requireIf(mixed $value, mixed $rule) static 验证某个字段等于某个值的时候必须 - * @method bool requireCallback(mixed $value, mixed $rule,array $data) static 通过回调方法验证某个字段是否必须 - * @method bool requireWith(mixed $value, mixed $rule, array $data) static 验证某个字段有值的情况下必须 - * @method bool filter(mixed $value, mixed $rule) static 使用filter_var方式验证 - * @method bool in(mixed $value, mixed $rule) static 验证是否在范围内 - * @method bool notIn(mixed $value, mixed $rule) static 验证是否不在范围内 - * @method bool between(mixed $value, mixed $rule) static between验证数据 - * @method bool notBetween(mixed $value, mixed $rule) static 使用notbetween验证数据 - * @method bool length(mixed $value, mixed $rule) static 验证数据长度 - * @method bool max(mixed $value, mixed $rule) static 验证数据最大长度 - * @method bool min(mixed $value, mixed $rule) static 验证数据最小长度 - * @method bool after(mixed $value, mixed $rule) static 验证日期 - * @method bool before(mixed $value, mixed $rule) static 验证日期 - * @method bool expire(mixed $value, mixed $rule) static 验证有效期 - * @method bool allowIp(mixed $value, mixed $rule) static 验证IP许可 - * @method bool denyIp(mixed $value, mixed $rule) static 验证IP禁用 - * @method bool regex(mixed $value, mixed $rule) static 使用正则验证数据 - * @method bool token(mixed $value, mixed $rule) static 验证表单令牌 - * @method bool dateFormat(mixed $value, mixed $rule) static 验证时间和日期是否符合指定格式 - * @method bool unique(mixed $value, mixed $rule, array $data = [], string $field = '') static 验证是否唯一 - * @method bool check(array $data, mixed $rules = [], string $scene = '') static 数据自动验证 - * @method mixed getError(mixed $value, mixed $rule) static 获取错误信息 - */ -class Validate extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'validate'; - } - -} diff --git a/thinkphp/library/think/facade/View.php b/thinkphp/library/think/facade/View.php deleted file mode 100644 index 08433917..00000000 --- a/thinkphp/library/think/facade/View.php +++ /dev/null @@ -1,40 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\facade; - -use think\Facade; - -/** - * @see \think\View - * @mixin \think\View - * @method \think\View init(mixed $engine = [], array $replace = []) static 初始化 - * @method \think\View share(mixed $name, mixed $value = '') static 模板变量静态赋值 - * @method \think\View assign(mixed $name, mixed $value = '') static 模板变量赋值 - * @method \think\View config(mixed $name, mixed $value = '') static 配置模板引擎 - * @method \think\View exists(mixed $name) static 检查模板是否存在 - * @method \think\View filter(Callable $filter) static 视图内容过滤 - * @method \think\View engine(mixed $engine = []) static 设置当前模板解析的引擎 - * @method string fetch(string $template = '', array $vars = [], array $config = [], bool $renderContent = false) static 解析和获取模板内容 - * @method string display(string $content = '', array $vars = [], array $config = []) static 渲染内容输出 - */ -class View extends Facade -{ - /** - * 获取当前Facade对应类名(或者已经绑定的容器对象标识) - * @access protected - * @return string - */ - protected static function getFacadeClass() - { - return 'view'; - } -} diff --git a/thinkphp/library/think/log/driver/File.php b/thinkphp/library/think/log/driver/File.php deleted file mode 100644 index 3f6522d1..00000000 --- a/thinkphp/library/think/log/driver/File.php +++ /dev/null @@ -1,287 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\log\driver; - -use think\App; - -/** - * 本地化调试输出到文件 - */ -class File -{ - protected $config = [ - 'time_format' => 'c', - 'single' => false, - 'file_size' => 2097152, - 'path' => '', - 'apart_level' => [], - 'max_files' => 0, - 'json' => false, - ]; - - protected $app; - - // 实例化并传入参数 - public function __construct(App $app, $config = []) - { - $this->app = $app; - - if (is_array($config)) { - $this->config = array_merge($this->config, $config); - } - - if (empty($this->config['path'])) { - $this->config['path'] = $this->app->getRuntimePath() . 'log' . DIRECTORY_SEPARATOR; - } elseif (substr($this->config['path'], -1) != DIRECTORY_SEPARATOR) { - $this->config['path'] .= DIRECTORY_SEPARATOR; - } - } - - /** - * 日志写入接口 - * @access public - * @param array $log 日志信息 - * @param bool $append 是否追加请求信息 - * @return bool - */ - public function save(array $log = [], $append = false) - { - $destination = $this->getMasterLogFile(); - - $path = dirname($destination); - !is_dir($path) && mkdir($path, 0755, true); - - $info = []; - - foreach ($log as $type => $val) { - - foreach ($val as $msg) { - if (!is_string($msg)) { - $msg = var_export($msg, true); - } - - $info[$type][] = $this->config['json'] ? $msg : '[ ' . $type . ' ] ' . $msg; - } - - if (!$this->config['json'] && (true === $this->config['apart_level'] || in_array($type, $this->config['apart_level']))) { - // 独立记录的日志级别 - $filename = $this->getApartLevelFile($path, $type); - - $this->write($info[$type], $filename, true, $append); - - unset($info[$type]); - } - } - - if ($info) { - return $this->write($info, $destination, false, $append); - } - - return true; - } - - /** - * 日志写入 - * @access protected - * @param array $message 日志信息 - * @param string $destination 日志文件 - * @param bool $apart 是否独立文件写入 - * @param bool $append 是否追加请求信息 - * @return bool - */ - protected function write($message, $destination, $apart = false, $append = false) - { - // 检测日志文件大小,超过配置大小则备份日志文件重新生成 - $this->checkLogSize($destination); - - // 日志信息封装 - $info['timestamp'] = date($this->config['time_format']); - - foreach ($message as $type => $msg) { - $msg = is_array($msg) ? implode(PHP_EOL, $msg) : $msg; - if (PHP_SAPI == 'cli') { - $info['msg'] = $msg; - $info['type'] = $type; - } else { - $info[$type] = $msg; - } - } - - if (PHP_SAPI == 'cli') { - $message = $this->parseCliLog($info); - } else { - // 添加调试日志 - $this->getDebugLog($info, $append, $apart); - - $message = $this->parseLog($info); - } - - return error_log($message, 3, $destination); - } - - /** - * 获取主日志文件名 - * @access public - * @return string - */ - protected function getMasterLogFile() - { - if ($this->config['max_files']) { - $files = glob($this->config['path'] . '*.log'); - - try { - if (count($files) > $this->config['max_files']) { - unlink($files[0]); - } - } catch (\Exception $e) { - } - } - - $cli = PHP_SAPI == 'cli' ? '_cli' : ''; - - if ($this->config['single']) { - $name = is_string($this->config['single']) ? $this->config['single'] : 'single'; - - $destination = $this->config['path'] . $name . $cli . '.log'; - } else { - if ($this->config['max_files']) { - $filename = date('Ymd') . $cli . '.log'; - } else { - $filename = date('Ym') . DIRECTORY_SEPARATOR . date('d') . $cli . '.log'; - } - - $destination = $this->config['path'] . $filename; - } - - return $destination; - } - - /** - * 获取独立日志文件名 - * @access public - * @param string $path 日志目录 - * @param string $type 日志类型 - * @return string - */ - protected function getApartLevelFile($path, $type) - { - $cli = PHP_SAPI == 'cli' ? '_cli' : ''; - - if ($this->config['single']) { - $name = is_string($this->config['single']) ? $this->config['single'] : 'single'; - } elseif ($this->config['max_files']) { - $name = date('Ymd'); - } else { - $name = date('d'); - } - - return $path . DIRECTORY_SEPARATOR . $name . '_' . $type . $cli . '.log'; - } - - /** - * 检查日志文件大小并自动生成备份文件 - * @access protected - * @param string $destination 日志文件 - * @return void - */ - protected function checkLogSize($destination) - { - if (is_file($destination) && floor($this->config['file_size']) <= filesize($destination)) { - try { - rename($destination, dirname($destination) . DIRECTORY_SEPARATOR . time() . '-' . basename($destination)); - } catch (\Exception $e) { - } - } - } - - /** - * CLI日志解析 - * @access protected - * @param array $info 日志信息 - * @return string - */ - protected function parseCliLog($info) - { - if ($this->config['json']) { - $message = json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . PHP_EOL; - } else { - $now = $info['timestamp']; - unset($info['timestamp']); - - $message = implode(PHP_EOL, $info); - - $message = "[{$now}]" . $message . PHP_EOL; - } - - return $message; - } - - /** - * 解析日志 - * @access protected - * @param array $info 日志信息 - * @return string - */ - protected function parseLog($info) - { - $requestInfo = [ - 'ip' => $this->app['request']->ip(), - 'method' => $this->app['request']->method(), - 'host' => $this->app['request']->host(), - 'uri' => $this->app['request']->url(), - ]; - - if ($this->config['json']) { - $info = $requestInfo + $info; - return json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . PHP_EOL; - } - - array_unshift($info, "---------------------------------------------------------------" . PHP_EOL . "\r\n[{$info['timestamp']}] {$requestInfo['ip']} {$requestInfo['method']} {$requestInfo['host']}{$requestInfo['uri']}"); - unset($info['timestamp']); - - return implode(PHP_EOL, $info) . PHP_EOL; - } - - protected function getDebugLog(&$info, $append, $apart) - { - if ($this->app->isDebug() && $append) { - - if ($this->config['json']) { - // 获取基本信息 - $runtime = round(microtime(true) - $this->app->getBeginTime(), 10); - $reqs = $runtime > 0 ? number_format(1 / $runtime, 2) : '∞'; - - $memory_use = number_format((memory_get_usage() - $this->app->getBeginMem()) / 1024, 2); - - $info = [ - 'runtime' => number_format($runtime, 6) . 's', - 'reqs' => $reqs . 'req/s', - 'memory' => $memory_use . 'kb', - 'file' => count(get_included_files()), - ] + $info; - - } elseif (!$apart) { - // 增加额外的调试信息 - $runtime = round(microtime(true) - $this->app->getBeginTime(), 10); - $reqs = $runtime > 0 ? number_format(1 / $runtime, 2) : '∞'; - - $memory_use = number_format((memory_get_usage() - $this->app->getBeginMem()) / 1024, 2); - - $time_str = '[运行时间:' . number_format($runtime, 6) . 's] [吞吐率:' . $reqs . 'req/s]'; - $memory_str = ' [内存消耗:' . $memory_use . 'kb]'; - $file_load = ' [文件加载:' . count(get_included_files()) . ']'; - - array_unshift($info, $time_str . $memory_str . $file_load); - } - } - } -} diff --git a/thinkphp/library/think/log/driver/Socket.php b/thinkphp/library/think/log/driver/Socket.php deleted file mode 100644 index 5e4f8bfd..00000000 --- a/thinkphp/library/think/log/driver/Socket.php +++ /dev/null @@ -1,279 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\log\driver; - -use think\App; - -/** - * github: https://github.com/luofei614/SocketLog - * @author luofei614 - */ -class Socket -{ - public $port = 1116; //SocketLog 服务的http的端口号 - - protected $config = [ - // socket服务器地址 - 'host' => 'localhost', - // 是否显示加载的文件列表 - 'show_included_files' => false, - // 日志强制记录到配置的client_id - 'force_client_ids' => [], - // 限制允许读取日志的client_id - 'allow_client_ids' => [], - //输出到浏览器默认展开的日志级别 - 'expand_level' => ['debug'], - ]; - - protected $css = [ - 'sql' => 'color:#009bb4;', - 'sql_warn' => 'color:#009bb4;font-size:14px;', - 'error' => 'color:#f4006b;font-size:14px;', - 'page' => 'color:#40e2ff;background:#171717;', - 'big' => 'font-size:20px;color:red;', - ]; - - protected $allowForceClientIds = []; //配置强制推送且被授权的client_id - protected $app; - - /** - * 架构函数 - * @access public - * @param array $config 缓存参数 - */ - public function __construct(App $app, array $config = []) - { - $this->app = $app; - - if (!empty($config)) { - $this->config = array_merge($this->config, $config); - } - } - - /** - * 调试输出接口 - * @access public - * @param array $log 日志信息 - * @return bool - */ - public function save(array $log = [], $append = false) - { - if (!$this->check()) { - return false; - } - - $trace = []; - - if ($this->app->isDebug()) { - $runtime = round(microtime(true) - $this->app->getBeginTime(), 10); - $reqs = $runtime > 0 ? number_format(1 / $runtime, 2) : '∞'; - $time_str = ' [运行时间:' . number_format($runtime, 6) . 's][吞吐率:' . $reqs . 'req/s]'; - $memory_use = number_format((memory_get_usage() - $this->app->getBeginMem()) / 1024, 2); - $memory_str = ' [内存消耗:' . $memory_use . 'kb]'; - $file_load = ' [文件加载:' . count(get_included_files()) . ']'; - - if (isset($_SERVER['HTTP_HOST'])) { - $current_uri = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; - } else { - $current_uri = 'cmd:' . implode(' ', $_SERVER['argv']); - } - - // 基本信息 - $trace[] = [ - 'type' => 'group', - 'msg' => $current_uri . $time_str . $memory_str . $file_load, - 'css' => $this->css['page'], - ]; - } - - foreach ($log as $type => $val) { - $trace[] = [ - 'type' => in_array($type, $this->config['expand_level']) ? 'group' : 'groupCollapsed', - 'msg' => '[ ' . $type . ' ]', - 'css' => isset($this->css[$type]) ? $this->css[$type] : '', - ]; - - foreach ($val as $msg) { - if (!is_string($msg)) { - $msg = var_export($msg, true); - } - $trace[] = [ - 'type' => 'log', - 'msg' => $msg, - 'css' => '', - ]; - } - - $trace[] = [ - 'type' => 'groupEnd', - 'msg' => '', - 'css' => '', - ]; - } - - if ($this->config['show_included_files']) { - $trace[] = [ - 'type' => 'groupCollapsed', - 'msg' => '[ file ]', - 'css' => '', - ]; - - $trace[] = [ - 'type' => 'log', - 'msg' => implode("\n", get_included_files()), - 'css' => '', - ]; - - $trace[] = [ - 'type' => 'groupEnd', - 'msg' => '', - 'css' => '', - ]; - } - - $trace[] = [ - 'type' => 'groupEnd', - 'msg' => '', - 'css' => '', - ]; - - $tabid = $this->getClientArg('tabid'); - - if (!$client_id = $this->getClientArg('client_id')) { - $client_id = ''; - } - - if (!empty($this->allowForceClientIds)) { - //强制推送到多个client_id - foreach ($this->allowForceClientIds as $force_client_id) { - $client_id = $force_client_id; - $this->sendToClient($tabid, $client_id, $trace, $force_client_id); - } - } else { - $this->sendToClient($tabid, $client_id, $trace, ''); - } - - return true; - } - - /** - * 发送给指定客户端 - * @access protected - * @author Zjmainstay - * @param $tabid - * @param $client_id - * @param $logs - * @param $force_client_id - */ - protected function sendToClient($tabid, $client_id, $logs, $force_client_id) - { - $logs = [ - 'tabid' => $tabid, - 'client_id' => $client_id, - 'logs' => $logs, - 'force_client_id' => $force_client_id, - ]; - - $msg = @json_encode($logs); - $address = '/' . $client_id; //将client_id作为地址, server端通过地址判断将日志发布给谁 - - $this->send($this->config['host'], $msg, $address); - } - - protected function check() - { - $tabid = $this->getClientArg('tabid'); - - //是否记录日志的检查 - if (!$tabid && !$this->config['force_client_ids']) { - return false; - } - - //用户认证 - $allow_client_ids = $this->config['allow_client_ids']; - - if (!empty($allow_client_ids)) { - //通过数组交集得出授权强制推送的client_id - $this->allowForceClientIds = array_intersect($allow_client_ids, $this->config['force_client_ids']); - if (!$tabid && count($this->allowForceClientIds)) { - return true; - } - - $client_id = $this->getClientArg('client_id'); - if (!in_array($client_id, $allow_client_ids)) { - return false; - } - } else { - $this->allowForceClientIds = $this->config['force_client_ids']; - } - - return true; - } - - protected function getClientArg($name) - { - static $args = []; - - $key = 'HTTP_USER_AGENT'; - - if (isset($_SERVER['HTTP_SOCKETLOG'])) { - $key = 'HTTP_SOCKETLOG'; - } - - if (!isset($_SERVER[$key])) { - return; - } - - if (empty($args)) { - if (!preg_match('/SocketLog\((.*?)\)/', $_SERVER[$key], $match)) { - $args = ['tabid' => null]; - return; - } - parse_str($match[1], $args); - } - - if (isset($args[$name])) { - return $args[$name]; - } - - return; - } - - /** - * @access protected - * @param string $host - $host of socket server - * @param string $message - 发送的消息 - * @param string $address - 地址 - * @return bool - */ - protected function send($host, $message = '', $address = '/') - { - $url = 'http://' . $host . ':' . $this->port . $address; - $ch = curl_init(); - - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_POST, true); - curl_setopt($ch, CURLOPT_POSTFIELDS, $message); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1); - curl_setopt($ch, CURLOPT_TIMEOUT, 10); - - $headers = [ - "Content-Type: application/json;charset=UTF-8", - ]; - - curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); //设置header - - return curl_exec($ch); - } - -} diff --git a/thinkphp/library/think/model/Collection.php b/thinkphp/library/think/model/Collection.php deleted file mode 100644 index 34ec067e..00000000 --- a/thinkphp/library/think/model/Collection.php +++ /dev/null @@ -1,102 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\model; - -use think\Collection as BaseCollection; -use think\Model; - -class Collection extends BaseCollection -{ - /** - * 延迟预载入关联查询 - * @access public - * @param mixed $relation 关联 - * @return $this - */ - public function load($relation) - { - if (!$this->isEmpty()) { - $item = current($this->items); - $item->eagerlyResultSet($this->items, $relation); - } - - return $this; - } - - /** - * 设置需要隐藏的输出属性 - * @access public - * @param array $hidden 属性列表 - * @param bool $override 是否覆盖 - * @return $this - */ - public function hidden($hidden = [], $override = false) - { - $this->each(function ($model) use ($hidden, $override) { - /** @var Model $model */ - $model->hidden($hidden, $override); - }); - - return $this; - } - - /** - * 设置需要输出的属性 - * @access public - * @param array $visible - * @param bool $override 是否覆盖 - * @return $this - */ - public function visible($visible = [], $override = false) - { - $this->each(function ($model) use ($visible, $override) { - /** @var Model $model */ - $model->visible($visible, $override); - }); - - return $this; - } - - /** - * 设置需要追加的输出属性 - * @access public - * @param array $append 属性列表 - * @param bool $override 是否覆盖 - * @return $this - */ - public function append($append = [], $override = false) - { - $this->each(function ($model) use ($append, $override) { - /** @var Model $model */ - $model && $model->append($append, $override); - }); - - return $this; - } - - /** - * 设置数据字段获取器 - * @access public - * @param string|array $name 字段名 - * @param callable $callback 闭包获取器 - * @return $this - */ - public function withAttr($name, $callback = null) - { - $this->each(function ($model) use ($name, $callback) { - /** @var Model $model */ - $model && $model->withAttribute($name, $callback); - }); - - return $this; - } -} diff --git a/thinkphp/library/think/model/Pivot.php b/thinkphp/library/think/model/Pivot.php deleted file mode 100644 index a3a395e3..00000000 --- a/thinkphp/library/think/model/Pivot.php +++ /dev/null @@ -1,42 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\model; - -use think\Model; - -class Pivot extends Model -{ - - /** @var Model */ - public $parent; - - protected $autoWriteTimestamp = false; - - /** - * 架构函数 - * @access public - * @param array|object $data 数据 - * @param Model $parent 上级模型 - * @param string $table 中间数据表名 - */ - public function __construct($data = [], Model $parent = null, $table = '') - { - $this->parent = $parent; - - if (is_null($this->name)) { - $this->name = $table; - } - - parent::__construct($data); - } - -} diff --git a/thinkphp/library/think/model/Relation.php b/thinkphp/library/think/model/Relation.php deleted file mode 100644 index ac6dd4cf..00000000 --- a/thinkphp/library/think/model/Relation.php +++ /dev/null @@ -1,187 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\model; - -use think\db\Query; -use think\Exception; -use think\Model; - -/** - * Class Relation - * @package think\model - * - * @mixin Query - */ -abstract class Relation -{ - // 父模型对象 - protected $parent; - /** @var Model 当前关联的模型类 */ - protected $model; - /** @var Query 关联模型查询对象 */ - protected $query; - // 关联表外键 - protected $foreignKey; - // 关联表主键 - protected $localKey; - // 基础查询 - protected $baseQuery; - // 是否为自关联 - protected $selfRelation; - - /** - * 获取关联的所属模型 - * @access public - * @return Model - */ - public function getParent() - { - return $this->parent; - } - - /** - * 获取当前的关联模型类的实例 - * @access public - * @return Model - */ - public function getModel() - { - return $this->query->getModel(); - } - - /** - * 获取当前的关联模型类的实例 - * @access public - * @return Query - */ - public function getQuery() - { - return $this->query; - } - - /** - * 设置当前关联为自关联 - * @access public - * @param bool $self 是否自关联 - * @return $this - */ - public function selfRelation($self = true) - { - $this->selfRelation = $self; - return $this; - } - - /** - * 当前关联是否为自关联 - * @access public - * @return bool - */ - public function isSelfRelation() - { - return $this->selfRelation; - } - - /** - * 封装关联数据集 - * @access public - * @param array $resultSet 数据集 - * @return mixed - */ - protected function resultSetBuild($resultSet) - { - return (new $this->model)->toCollection($resultSet); - } - - protected function getQueryFields($model) - { - $fields = $this->query->getOptions('field'); - return $this->getRelationQueryFields($fields, $model); - } - - protected function getRelationQueryFields($fields, $model) - { - if ($fields) { - - if (is_string($fields)) { - $fields = explode(',', $fields); - } - - foreach ($fields as &$field) { - if (false === strpos($field, '.')) { - $field = $model . '.' . $field; - } - } - } else { - $fields = $model . '.*'; - } - - return $fields; - } - - protected function getQueryWhere(&$where, $relation) - { - foreach ($where as $key => &$val) { - if (is_string($key)) { - $where[] = [false === strpos($key, '.') ? $relation . '.' . $key : $key, '=', $val]; - unset($where[$key]); - } elseif (isset($val[0]) && false === strpos($val[0], '.')) { - $val[0] = $relation . '.' . $val[0]; - } - } - } - - /** - * 更新数据 - * @access public - * @param array $data 更新数据 - * @return integer|string - */ - public function update(array $data = []) - { - return $this->query->update($data); - } - - /** - * 删除记录 - * @access public - * @param mixed $data 表达式 true 表示强制删除 - * @return int - * @throws Exception - * @throws PDOException - */ - public function delete($data = null) - { - return $this->query->delete($data); - } - - /** - * 执行基础查询(仅执行一次) - * @access protected - * @return void - */ - protected function baseQuery() - {} - - public function __call($method, $args) - { - if ($this->query) { - // 执行基础查询 - $this->baseQuery(); - - $result = call_user_func_array([$this->query->getModel(), $method], $args); - - return $result === $this->query && !in_array(strtolower($method), ['fetchsql', 'fetchpdo']) ? $this : $result; - } else { - throw new Exception('method not exists:' . __CLASS__ . '->' . $method); - } - } -} diff --git a/thinkphp/library/think/model/concern/Attribute.php b/thinkphp/library/think/model/concern/Attribute.php deleted file mode 100644 index 66627b38..00000000 --- a/thinkphp/library/think/model/concern/Attribute.php +++ /dev/null @@ -1,656 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\model\concern; - -use InvalidArgumentException; -use think\db\Expression; -use think\Exception; -use think\Loader; -use think\model\Relation; - -trait Attribute -{ - /** - * 数据表主键 复合主键使用数组定义 - * @var string|array - */ - protected $pk = 'id'; - - /** - * 数据表字段信息 留空则自动获取 - * @var array - */ - protected $field = []; - - /** - * JSON数据表字段 - * @var array - */ - protected $json = []; - - /** - * JSON数据取出是否需要转换为数组 - * @var bool - */ - protected $jsonAssoc = false; - - /** - * JSON数据表字段类型 - * @var array - */ - protected $jsonType = []; - - /** - * 数据表废弃字段 - * @var array - */ - protected $disuse = []; - - /** - * 数据表只读字段 - * @var array - */ - protected $readonly = []; - - /** - * 数据表字段类型 - * @var array - */ - protected $type = []; - - /** - * 当前模型数据 - * @var array - */ - private $data = []; - - /** - * 修改器执行记录 - * @var array - */ - private $set = []; - - /** - * 原始数据 - * @var array - */ - private $origin = []; - - /** - * 动态获取器 - * @var array - */ - private $withAttr = []; - - /** - * 获取模型对象的主键 - * @access public - * @return string|array - */ - public function getPk() - { - return $this->pk; - } - - /** - * 判断一个字段名是否为主键字段 - * @access public - * @param string $key 名称 - * @return bool - */ - protected function isPk($key) - { - $pk = $this->getPk(); - if (is_string($pk) && $pk == $key) { - return true; - } elseif (is_array($pk) && in_array($key, $pk)) { - return true; - } - - return false; - } - - /** - * 获取模型对象的主键值 - * @access public - * @return integer - */ - public function getKey() - { - $pk = $this->getPk(); - if (is_string($pk) && array_key_exists($pk, $this->data)) { - return $this->data[$pk]; - } - - return; - } - - /** - * 设置允许写入的字段 - * @access public - * @param array|string|true $field 允许写入的字段 如果为true只允许写入数据表字段 - * @return $this - */ - public function allowField($field) - { - if (is_string($field)) { - $field = explode(',', $field); - } - - $this->field = $field; - - return $this; - } - - /** - * 设置只读字段 - * @access public - * @param array|string $field 只读字段 - * @return $this - */ - public function readonly($field) - { - if (is_string($field)) { - $field = explode(',', $field); - } - - $this->readonly = $field; - - return $this; - } - - /** - * 设置数据对象值 - * @access public - * @param mixed $data 数据或者属性名 - * @param mixed $value 值 - * @return $this - */ - public function data($data, $value = null) - { - if (is_string($data)) { - $this->data[$data] = $value; - return $this; - } - - // 清空数据 - $this->data = []; - - if (is_object($data)) { - $data = get_object_vars($data); - } - - if ($this->disuse) { - // 废弃字段 - foreach ((array) $this->disuse as $key) { - if (array_key_exists($key, $data)) { - unset($data[$key]); - } - } - } - - if (true === $value) { - // 数据对象赋值 - foreach ($data as $key => $value) { - $this->setAttr($key, $value, $data); - } - } elseif (is_array($value)) { - foreach ($value as $name) { - if (isset($data[$name])) { - $this->data[$name] = $data[$name]; - } - } - } else { - $this->data = $data; - } - - return $this; - } - - /** - * 批量设置数据对象值 - * @access public - * @param mixed $data 数据 - * @param bool $set 是否需要进行数据处理 - * @return $this - */ - public function appendData($data, $set = false) - { - if ($set) { - // 进行数据处理 - foreach ($data as $key => $value) { - $this->setAttr($key, $value, $data); - } - } else { - if (is_object($data)) { - $data = get_object_vars($data); - } - - $this->data = array_merge($this->data, $data); - } - - return $this; - } - - /** - * 获取对象原始数据 如果不存在指定字段返回null - * @access public - * @param string $name 字段名 留空获取全部 - * @return mixed - */ - public function getOrigin($name = null) - { - if (is_null($name)) { - return $this->origin; - } - return array_key_exists($name, $this->origin) ? $this->origin[$name] : null; - } - - /** - * 获取对象原始数据 如果不存在指定字段返回false - * @access public - * @param string $name 字段名 留空获取全部 - * @return mixed - * @throws InvalidArgumentException - */ - public function getData($name = null) - { - if (is_null($name)) { - return $this->data; - } elseif (array_key_exists($name, $this->data)) { - return $this->data[$name]; - } elseif (array_key_exists($name, $this->relation)) { - return $this->relation[$name]; - } - throw new InvalidArgumentException('property not exists:' . static::class . '->' . $name); - } - - /** - * 获取变化的数据 并排除只读数据 - * @access public - * @return array - */ - public function getChangedData() - { - if ($this->force) { - $data = $this->data; - } else { - $data = array_udiff_assoc($this->data, $this->origin, function ($a, $b) { - if ((empty($a) || empty($b)) && $a !== $b) { - return 1; - } - - return is_object($a) || $a != $b ? 1 : 0; - }); - } - - if (!empty($this->readonly)) { - // 只读字段不允许更新 - foreach ($this->readonly as $key => $field) { - if (isset($data[$field])) { - unset($data[$field]); - } - } - } - - return $data; - } - - /** - * 修改器 设置数据对象值 - * @access public - * @param string $name 属性名 - * @param mixed $value 属性值 - * @param array $data 数据 - * @return void - */ - public function setAttr($name, $value, $data = []) - { - if (isset($this->set[$name])) { - return; - } - - if (is_null($value) && $this->autoWriteTimestamp && in_array($name, [$this->createTime, $this->updateTime])) { - // 自动写入的时间戳字段 - $value = $this->autoWriteTimestamp($name); - } else { - // 检测修改器 - $method = 'set' . Loader::parseName($name, 1) . 'Attr'; - - if (method_exists($this, $method)) { - $origin = $this->data; - $value = $this->$method($value, array_merge($this->data, $data)); - - $this->set[$name] = true; - if (is_null($value) && $origin !== $this->data) { - return; - } - } elseif (isset($this->type[$name])) { - // 类型转换 - $value = $this->writeTransform($value, $this->type[$name]); - } - } - - // 设置数据对象属性 - $this->data[$name] = $value; - } - - /** - * 是否需要自动写入时间字段 - * @access public - * @param bool $auto - * @return $this - */ - public function isAutoWriteTimestamp($auto) - { - $this->autoWriteTimestamp = $auto; - - return $this; - } - - /** - * 自动写入时间戳 - * @access protected - * @param string $name 时间戳字段 - * @return mixed - */ - protected function autoWriteTimestamp($name) - { - if (isset($this->type[$name])) { - $type = $this->type[$name]; - - if (strpos($type, ':')) { - list($type, $param) = explode(':', $type, 2); - } - - switch ($type) { - case 'datetime': - case 'date': - $value = $this->formatDateTime('Y-m-d H:i:s.u'); - break; - case 'timestamp': - case 'integer': - default: - $value = time(); - break; - } - } elseif (is_string($this->autoWriteTimestamp) && in_array(strtolower($this->autoWriteTimestamp), [ - 'datetime', - 'date', - 'timestamp', - ])) { - $value = $this->formatDateTime('Y-m-d H:i:s.u'); - } else { - $value = time(); - } - - return $value; - } - - /** - * 数据写入 类型转换 - * @access protected - * @param mixed $value 值 - * @param string|array $type 要转换的类型 - * @return mixed - */ - protected function writeTransform($value, $type) - { - if (is_null($value)) { - return; - } - - if ($value instanceof Expression) { - return $value; - } - - if (is_array($type)) { - list($type, $param) = $type; - } elseif (strpos($type, ':')) { - list($type, $param) = explode(':', $type, 2); - } - - switch ($type) { - case 'integer': - $value = (int) $value; - break; - case 'float': - if (empty($param)) { - $value = (float) $value; - } else { - $value = (float) number_format($value, $param, '.', ''); - } - break; - case 'boolean': - $value = (bool) $value; - break; - case 'timestamp': - if (!is_numeric($value)) { - $value = strtotime($value); - } - break; - case 'datetime': - $value = is_numeric($value) ? $value : strtotime($value); - $value = $this->formatDateTime('Y-m-d H:i:s.u', $value); - break; - case 'object': - if (is_object($value)) { - $value = json_encode($value, JSON_FORCE_OBJECT); - } - break; - case 'array': - $value = (array) $value; - case 'json': - $option = !empty($param) ? (int) $param : JSON_UNESCAPED_UNICODE; - $value = json_encode($value, $option); - break; - case 'serialize': - $value = serialize($value); - break; - } - - return $value; - } - - /** - * 获取器 获取数据对象的值 - * @access public - * @param string $name 名称 - * @param array $item 数据 - * @return mixed - * @throws InvalidArgumentException - */ - public function getAttr($name, &$item = null) - { - try { - $notFound = false; - $value = $this->getData($name); - } catch (InvalidArgumentException $e) { - $notFound = true; - $value = null; - } - - // 检测属性获取器 - $fieldName = Loader::parseName($name); - $method = 'get' . Loader::parseName($name, 1) . 'Attr'; - - if (isset($this->withAttr[$fieldName])) { - if ($notFound && $relation = $this->isRelationAttr($name)) { - $modelRelation = $this->$relation(); - $value = $this->getRelationData($modelRelation); - } - - $closure = $this->withAttr[$fieldName]; - $value = $closure($value, $this->data); - } elseif (method_exists($this, $method)) { - if ($notFound && $relation = $this->isRelationAttr($name)) { - $modelRelation = $this->$relation(); - $value = $this->getRelationData($modelRelation); - } - - $value = $this->$method($value, $this->data); - } elseif (isset($this->type[$name])) { - // 类型转换 - $value = $this->readTransform($value, $this->type[$name]); - } elseif ($this->autoWriteTimestamp && in_array($name, [$this->createTime, $this->updateTime])) { - if (is_string($this->autoWriteTimestamp) && in_array(strtolower($this->autoWriteTimestamp), [ - 'datetime', - 'date', - 'timestamp', - ])) { - $value = $this->formatDateTime($this->dateFormat, $value); - } else { - $value = $this->formatDateTime($this->dateFormat, $value, true); - } - } elseif ($notFound) { - $value = $this->getRelationAttribute($name, $item); - } - - return $value; - } - - /** - * 获取关联属性值 - * @access protected - * @param string $name 属性名 - * @param array $item 数据 - * @return mixed - */ - protected function getRelationAttribute($name, &$item) - { - $relation = $this->isRelationAttr($name); - - if ($relation) { - $modelRelation = $this->$relation(); - if ($modelRelation instanceof Relation) { - $value = $this->getRelationData($modelRelation); - - if ($item && method_exists($modelRelation, 'getBindAttr') && $bindAttr = $modelRelation->getBindAttr()) { - - foreach ($bindAttr as $key => $attr) { - $key = is_numeric($key) ? $attr : $key; - - if (isset($item[$key])) { - throw new Exception('bind attr has exists:' . $key); - } else { - $item[$key] = $value ? $value->getAttr($attr) : null; - } - } - - return false; - } - - // 保存关联对象值 - $this->relation[$name] = $value; - - return $value; - } - } - - throw new InvalidArgumentException('property not exists:' . static::class . '->' . $name); - } - - /** - * 数据读取 类型转换 - * @access protected - * @param mixed $value 值 - * @param string|array $type 要转换的类型 - * @return mixed - */ - protected function readTransform($value, $type) - { - if (is_null($value)) { - return; - } - - if (is_array($type)) { - list($type, $param) = $type; - } elseif (strpos($type, ':')) { - list($type, $param) = explode(':', $type, 2); - } - - switch ($type) { - case 'integer': - $value = (int) $value; - break; - case 'float': - if (empty($param)) { - $value = (float) $value; - } else { - $value = (float) number_format($value, $param, '.', ''); - } - break; - case 'boolean': - $value = (bool) $value; - break; - case 'timestamp': - if (!is_null($value)) { - $format = !empty($param) ? $param : $this->dateFormat; - $value = $this->formatDateTime($format, $value, true); - } - break; - case 'datetime': - if (!is_null($value)) { - $format = !empty($param) ? $param : $this->dateFormat; - $value = $this->formatDateTime($format, $value); - } - break; - case 'json': - $value = json_decode($value, true); - break; - case 'array': - $value = empty($value) ? [] : json_decode($value, true); - break; - case 'object': - $value = empty($value) ? new \stdClass() : json_decode($value); - break; - case 'serialize': - try { - $value = unserialize($value); - } catch (\Exception $e) { - $value = null; - } - break; - default: - if (false !== strpos($type, '\\')) { - // 对象类型 - $value = new $type($value); - } - } - - return $value; - } - - /** - * 设置数据字段获取器 - * @access public - * @param string|array $name 字段名 - * @param callable $callback 闭包获取器 - * @return $this - */ - public function withAttribute($name, $callback = null) - { - if (is_array($name)) { - foreach ($name as $key => $val) { - $key = Loader::parseName($key); - - $this->withAttr[$key] = $val; - } - } else { - $name = Loader::parseName($name); - - $this->withAttr[$name] = $callback; - } - - return $this; - } -} diff --git a/thinkphp/library/think/model/concern/Conversion.php b/thinkphp/library/think/model/concern/Conversion.php deleted file mode 100644 index 28a6f999..00000000 --- a/thinkphp/library/think/model/concern/Conversion.php +++ /dev/null @@ -1,273 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\model\concern; - -use think\Collection; -use think\Exception; -use think\Loader; -use think\Model; -use think\model\Collection as ModelCollection; - -/** - * 模型数据转换处理 - */ -trait Conversion -{ - /** - * 数据输出显示的属性 - * @var array - */ - protected $visible = []; - - /** - * 数据输出隐藏的属性 - * @var array - */ - protected $hidden = []; - - /** - * 数据输出需要追加的属性 - * @var array - */ - protected $append = []; - - /** - * 数据集对象名 - * @var string - */ - protected $resultSetType; - - /** - * 设置需要附加的输出属性 - * @access public - * @param array $append 属性列表 - * @param bool $override 是否覆盖 - * @return $this - */ - public function append(array $append = [], $override = false) - { - $this->append = $override ? $append : array_merge($this->append, $append); - - return $this; - } - - /** - * 设置附加关联对象的属性 - * @access public - * @param string $attr 关联属性 - * @param string|array $append 追加属性名 - * @return $this - * @throws Exception - */ - public function appendRelationAttr($attr, $append) - { - if (is_string($append)) { - $append = explode(',', $append); - } - - $relation = Loader::parseName($attr, 1, false); - if (isset($this->relation[$relation])) { - $model = $this->relation[$relation]; - } else { - $model = $this->getRelationData($this->$relation()); - } - - if ($model instanceof Model) { - foreach ($append as $key => $attr) { - $key = is_numeric($key) ? $attr : $key; - if (isset($this->data[$key])) { - throw new Exception('bind attr has exists:' . $key); - } else { - $this->data[$key] = $model->$attr; - } - } - } - - return $this; - } - - /** - * 设置需要隐藏的输出属性 - * @access public - * @param array $hidden 属性列表 - * @param bool $override 是否覆盖 - * @return $this - */ - public function hidden(array $hidden = [], $override = false) - { - $this->hidden = $override ? $hidden : array_merge($this->hidden, $hidden); - - return $this; - } - - /** - * 设置需要输出的属性 - * @access public - * @param array $visible - * @param bool $override 是否覆盖 - * @return $this - */ - public function visible(array $visible = [], $override = false) - { - $this->visible = $override ? $visible : array_merge($this->visible, $visible); - - return $this; - } - - /** - * 转换当前模型对象为数组 - * @access public - * @return array - */ - public function toArray() - { - $item = []; - $hasVisible = false; - - foreach ($this->visible as $key => $val) { - if (is_string($val)) { - if (strpos($val, '.')) { - list($relation, $name) = explode('.', $val); - $this->visible[$relation][] = $name; - } else { - $this->visible[$val] = true; - $hasVisible = true; - } - unset($this->visible[$key]); - } - } - - foreach ($this->hidden as $key => $val) { - if (is_string($val)) { - if (strpos($val, '.')) { - list($relation, $name) = explode('.', $val); - $this->hidden[$relation][] = $name; - } else { - $this->hidden[$val] = true; - } - unset($this->hidden[$key]); - } - } - - // 合并关联数据 - $data = array_merge($this->data, $this->relation); - - foreach ($data as $key => $val) { - if ($val instanceof Model || $val instanceof ModelCollection) { - // 关联模型对象 - if (isset($this->visible[$key]) && is_array($this->visible[$key])) { - $val->visible($this->visible[$key]); - } elseif (isset($this->hidden[$key]) && is_array($this->hidden[$key])) { - $val->hidden($this->hidden[$key]); - } - // 关联模型对象 - if (!isset($this->hidden[$key]) || true !== $this->hidden[$key]) { - $item[$key] = $val->toArray(); - } - } elseif (isset($this->visible[$key])) { - $item[$key] = $this->getAttr($key); - } elseif (!isset($this->hidden[$key]) && !$hasVisible) { - $item[$key] = $this->getAttr($key); - } - } - - // 追加属性(必须定义获取器) - if (!empty($this->append)) { - foreach ($this->append as $key => $name) { - if (is_array($name)) { - // 追加关联对象属性 - $relation = $this->getRelation($key); - - if (!$relation) { - $relation = $this->getAttr($key); - if ($relation) { - $relation->visible($name); - } - } - - $item[$key] = $relation ? $relation->append($name)->toArray() : []; - } elseif (strpos($name, '.')) { - list($key, $attr) = explode('.', $name); - // 追加关联对象属性 - $relation = $this->getRelation($key); - - if (!$relation) { - $relation = $this->getAttr($key); - if ($relation) { - $relation->visible([$attr]); - } - } - - $item[$key] = $relation ? $relation->append([$attr])->toArray() : []; - } else { - $item[$name] = $this->getAttr($name, $item); - } - } - } - - return $item; - } - - /** - * 转换当前模型对象为JSON字符串 - * @access public - * @param integer $options json参数 - * @return string - */ - public function toJson($options = JSON_UNESCAPED_UNICODE) - { - return json_encode($this->toArray(), $options); - } - - /** - * 移除当前模型的关联属性 - * @access public - * @return $this - */ - public function removeRelation() - { - $this->relation = []; - return $this; - } - - public function __toString() - { - return $this->toJson(); - } - - // JsonSerializable - public function jsonSerialize() - { - return $this->toArray(); - } - - /** - * 转换数据集为数据集对象 - * @access public - * @param array|Collection $collection 数据集 - * @param string $resultSetType 数据集类 - * @return Collection - */ - public function toCollection($collection, $resultSetType = null) - { - $resultSetType = $resultSetType ?: $this->resultSetType; - - if ($resultSetType && false !== strpos($resultSetType, '\\')) { - $collection = new $resultSetType($collection); - } else { - $collection = new ModelCollection($collection); - } - - return $collection; - } - -} diff --git a/thinkphp/library/think/model/concern/ModelEvent.php b/thinkphp/library/think/model/concern/ModelEvent.php deleted file mode 100644 index 3a874846..00000000 --- a/thinkphp/library/think/model/concern/ModelEvent.php +++ /dev/null @@ -1,238 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\model\concern; - -use think\Container; -use think\Loader; - -/** - * 模型事件处理 - */ -trait ModelEvent -{ - /** - * 模型回调 - * @var array - */ - private static $event = []; - - /** - * 模型事件观察 - * @var array - */ - protected static $observe = ['before_write', 'after_write', 'before_insert', 'after_insert', 'before_update', 'after_update', 'before_delete', 'after_delete', 'before_restore', 'after_restore']; - - /** - * 绑定模型事件观察者类 - * @var array - */ - protected $observerClass; - - /** - * 是否需要事件响应 - * @var bool - */ - private $withEvent = true; - - /** - * 注册回调方法 - * @access public - * @param string $event 事件名 - * @param callable $callback 回调方法 - * @param bool $override 是否覆盖 - * @return void - */ - public static function event($event, $callback, $override = false) - { - $class = static::class; - - if ($override) { - self::$event[$class][$event] = []; - } - - self::$event[$class][$event][] = $callback; - } - - /** - * 清除回调方法 - * @access public - * @return void - */ - public static function flushEvent() - { - self::$event[static::class] = []; - } - - /** - * 注册一个模型观察者 - * - * @param object|string $class - * @return void - */ - public static function observe($class) - { - self::flushEvent(); - - foreach (static::$observe as $event) { - $eventFuncName = Loader::parseName($event, 1, false); - - if (method_exists($class, $eventFuncName)) { - static::event($event, [$class, $eventFuncName]); - } - } - } - - /** - * 当前操作的事件响应 - * @access protected - * @param bool $event 是否需要事件响应 - * @return $this - */ - public function withEvent($event) - { - $this->withEvent = $event; - return $this; - } - - /** - * 触发事件 - * @access protected - * @param string $event 事件名 - * @return bool - */ - protected function trigger($event) - { - $class = static::class; - - if ($this->withEvent && isset(self::$event[$class][$event])) { - foreach (self::$event[$class][$event] as $callback) { - $result = Container::getInstance()->invoke($callback, [$this]); - - if (false === $result) { - return false; - } - } - } - - return true; - } - - /** - * 模型before_insert事件快捷方法 - * @access protected - * @param callable $callback - * @param bool $override - */ - protected static function beforeInsert($callback, $override = false) - { - self::event('before_insert', $callback, $override); - } - - /** - * 模型after_insert事件快捷方法 - * @access protected - * @param callable $callback - * @param bool $override - */ - protected static function afterInsert($callback, $override = false) - { - self::event('after_insert', $callback, $override); - } - - /** - * 模型before_update事件快捷方法 - * @access protected - * @param callable $callback - * @param bool $override - */ - protected static function beforeUpdate($callback, $override = false) - { - self::event('before_update', $callback, $override); - } - - /** - * 模型after_update事件快捷方法 - * @access protected - * @param callable $callback - * @param bool $override - */ - protected static function afterUpdate($callback, $override = false) - { - self::event('after_update', $callback, $override); - } - - /** - * 模型before_write事件快捷方法 - * @access protected - * @param callable $callback - * @param bool $override - */ - protected static function beforeWrite($callback, $override = false) - { - self::event('before_write', $callback, $override); - } - - /** - * 模型after_write事件快捷方法 - * @access protected - * @param callable $callback - * @param bool $override - */ - protected static function afterWrite($callback, $override = false) - { - self::event('after_write', $callback, $override); - } - - /** - * 模型before_delete事件快捷方法 - * @access protected - * @param callable $callback - * @param bool $override - */ - protected static function beforeDelete($callback, $override = false) - { - self::event('before_delete', $callback, $override); - } - - /** - * 模型after_delete事件快捷方法 - * @access protected - * @param callable $callback - * @param bool $override - */ - protected static function afterDelete($callback, $override = false) - { - self::event('after_delete', $callback, $override); - } - - /** - * 模型before_restore事件快捷方法 - * @access protected - * @param callable $callback - * @param bool $override - */ - protected static function beforeRestore($callback, $override = false) - { - self::event('before_restore', $callback, $override); - } - - /** - * 模型after_restore事件快捷方法 - * @access protected - * @param callable $callback - * @param bool $override - */ - protected static function afterRestore($callback, $override = false) - { - self::event('after_restore', $callback, $override); - } -} diff --git a/thinkphp/library/think/model/concern/RelationShip.php b/thinkphp/library/think/model/concern/RelationShip.php deleted file mode 100644 index 9ca709a5..00000000 --- a/thinkphp/library/think/model/concern/RelationShip.php +++ /dev/null @@ -1,670 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\model\concern; - -use think\Collection; -use think\db\Query; -use think\Loader; -use think\Model; -use think\model\Relation; -use think\model\relation\BelongsTo; -use think\model\relation\BelongsToMany; -use think\model\relation\HasMany; -use think\model\relation\HasManyThrough; -use think\model\relation\HasOne; -use think\model\relation\MorphMany; -use think\model\relation\MorphOne; -use think\model\relation\MorphTo; - -/** - * 模型关联处理 - */ -trait RelationShip -{ - /** - * 父关联模型对象 - * @var object - */ - private $parent; - - /** - * 模型关联数据 - * @var array - */ - private $relation = []; - - /** - * 关联写入定义信息 - * @var array - */ - private $together; - - /** - * 关联自动写入信息 - * @var array - */ - protected $relationWrite; - - /** - * 设置父关联对象 - * @access public - * @param Model $model 模型对象 - * @return $this - */ - public function setParent($model) - { - $this->parent = $model; - - return $this; - } - - /** - * 获取父关联对象 - * @access public - * @return Model - */ - public function getParent() - { - return $this->parent; - } - - /** - * 获取当前模型的关联模型数据 - * @access public - * @param string $name 关联方法名 - * @return mixed - */ - public function getRelation($name = null) - { - if (is_null($name)) { - return $this->relation; - } elseif (array_key_exists($name, $this->relation)) { - return $this->relation[$name]; - } - return; - } - - /** - * 设置关联数据对象值 - * @access public - * @param string $name 属性名 - * @param mixed $value 属性值 - * @param array $data 数据 - * @return $this - */ - public function setRelation($name, $value, $data = []) - { - // 检测修改器 - $method = 'set' . Loader::parseName($name, 1) . 'Attr'; - - if (method_exists($this, $method)) { - $value = $this->$method($value, array_merge($this->data, $data)); - } - - $this->relation[$name] = $value; - - return $this; - } - - /** - * 关联数据写入 - * @access public - * @param array|string $relation 关联 - * @return $this - */ - public function together($relation) - { - if (is_string($relation)) { - $relation = explode(',', $relation); - } - - $this->together = $relation; - - $this->checkAutoRelationWrite(); - - return $this; - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param string $relation 关联方法名 - * @param mixed $operator 比较操作符 - * @param integer $count 个数 - * @param string $id 关联表的统计字段 - * @param string $joinType JOIN类型 - * @return Query - */ - public static function has($relation, $operator = '>=', $count = 1, $id = '*', $joinType = 'INNER') - { - $relation = (new static())->$relation(); - - if (is_array($operator) || $operator instanceof \Closure) { - return $relation->hasWhere($operator); - } - - return $relation->has($operator, $count, $id, $joinType); - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param string $relation 关联方法名 - * @param mixed $where 查询条件(数组或者闭包) - * @param mixed $fields 字段 - * @return Query - */ - public static function hasWhere($relation, $where = [], $fields = '*') - { - return (new static())->$relation()->hasWhere($where, $fields); - } - - /** - * 查询当前模型的关联数据 - * @access public - * @param string|array $relations 关联名 - * @param array $withRelationAttr 关联获取器 - * @return $this - */ - public function relationQuery($relations, $withRelationAttr = []) - { - if (is_string($relations)) { - $relations = explode(',', $relations); - } - - foreach ($relations as $key => $relation) { - $subRelation = ''; - $closure = null; - - if ($relation instanceof \Closure) { - // 支持闭包查询过滤关联条件 - $closure = $relation; - $relation = $key; - } - - if (is_array($relation)) { - $subRelation = $relation; - $relation = $key; - } elseif (strpos($relation, '.')) { - list($relation, $subRelation) = explode('.', $relation, 2); - } - - $method = Loader::parseName($relation, 1, false); - $relationName = Loader::parseName($relation); - - $relationResult = $this->$method(); - - if (isset($withRelationAttr[$relationName])) { - $relationResult->getQuery()->withAttr($withRelationAttr[$relationName]); - } - - $this->relation[$relation] = $relationResult->getRelation($subRelation, $closure); - } - - return $this; - } - - /** - * 预载入关联查询 返回数据集 - * @access public - * @param array $resultSet 数据集 - * @param string $relation 关联名 - * @param array $withRelationAttr 关联获取器 - * @param bool $join 是否为JOIN方式 - * @return array - */ - public function eagerlyResultSet(&$resultSet, $relation, $withRelationAttr = [], $join = false) - { - $relations = is_string($relation) ? explode(',', $relation) : $relation; - - foreach ($relations as $key => $relation) { - $subRelation = ''; - $closure = null; - - if ($relation instanceof \Closure) { - $closure = $relation; - $relation = $key; - } - - if (is_array($relation)) { - $subRelation = $relation; - $relation = $key; - } elseif (strpos($relation, '.')) { - list($relation, $subRelation) = explode('.', $relation, 2); - } - - $relation = Loader::parseName($relation, 1, false); - $relationName = Loader::parseName($relation); - - $relationResult = $this->$relation(); - - if (isset($withRelationAttr[$relationName])) { - $relationResult->getQuery()->withAttr($withRelationAttr[$relationName]); - } - - $relationResult->eagerlyResultSet($resultSet, $relation, $subRelation, $closure, $join); - } - } - - /** - * 预载入关联查询 返回模型对象 - * @access public - * @param Model $result 数据对象 - * @param string $relation 关联名 - * @param array $withRelationAttr 关联获取器 - * @param bool $join 是否为JOIN方式 - * @return Model - */ - public function eagerlyResult(&$result, $relation, $withRelationAttr = [], $join = false) - { - $relations = is_string($relation) ? explode(',', $relation) : $relation; - - foreach ($relations as $key => $relation) { - $subRelation = ''; - $closure = null; - - if ($relation instanceof \Closure) { - $closure = $relation; - $relation = $key; - } - - if (is_array($relation)) { - $subRelation = $relation; - $relation = $key; - } elseif (strpos($relation, '.')) { - list($relation, $subRelation) = explode('.', $relation, 2); - } - - $relation = Loader::parseName($relation, 1, false); - $relationName = Loader::parseName($relation); - - $relationResult = $this->$relation(); - - if (isset($withRelationAttr[$relationName])) { - $relationResult->getQuery()->withAttr($withRelationAttr[$relationName]); - } - - $relationResult->eagerlyResult($result, $relation, $subRelation, $closure, $join); - } - } - - /** - * 关联统计 - * @access public - * @param Model $result 数据对象 - * @param array $relations 关联名 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @return void - */ - public function relationCount(&$result, $relations, $aggregate = 'sum', $field = '*') - { - foreach ($relations as $key => $relation) { - $closure = $name = null; - - if ($relation instanceof \Closure) { - $closure = $relation; - $relation = $key; - } elseif (is_string($key)) { - $name = $relation; - $relation = $key; - } - - $relation = Loader::parseName($relation, 1, false); - - $count = $this->$relation()->relationCount($result, $closure, $aggregate, $field, $name); - - if (empty($name)) { - $name = Loader::parseName($relation) . '_' . $aggregate; - } - - $result->setAttr($name, $count); - } - } - - /** - * HAS ONE 关联定义 - * @access public - * @param string $model 模型名 - * @param string $foreignKey 关联外键 - * @param string $localKey 当前主键 - * @return HasOne - */ - public function hasOne($model, $foreignKey = '', $localKey = '') - { - // 记录当前关联信息 - $model = $this->parseModel($model); - $localKey = $localKey ?: $this->getPk(); - $foreignKey = $foreignKey ?: $this->getForeignKey($this->name); - - return new HasOne($this, $model, $foreignKey, $localKey); - } - - /** - * BELONGS TO 关联定义 - * @access public - * @param string $model 模型名 - * @param string $foreignKey 关联外键 - * @param string $localKey 关联主键 - * @return BelongsTo - */ - public function belongsTo($model, $foreignKey = '', $localKey = '') - { - // 记录当前关联信息 - $model = $this->parseModel($model); - $foreignKey = $foreignKey ?: $this->getForeignKey((new $model)->getName()); - $localKey = $localKey ?: (new $model)->getPk(); - $trace = debug_backtrace(false, 2); - $relation = Loader::parseName($trace[1]['function']); - - return new BelongsTo($this, $model, $foreignKey, $localKey, $relation); - } - - /** - * HAS MANY 关联定义 - * @access public - * @param string $model 模型名 - * @param string $foreignKey 关联外键 - * @param string $localKey 当前主键 - * @return HasMany - */ - public function hasMany($model, $foreignKey = '', $localKey = '') - { - // 记录当前关联信息 - $model = $this->parseModel($model); - $localKey = $localKey ?: $this->getPk(); - $foreignKey = $foreignKey ?: $this->getForeignKey($this->name); - - return new HasMany($this, $model, $foreignKey, $localKey); - } - - /** - * HAS MANY 远程关联定义 - * @access public - * @param string $model 模型名 - * @param string $through 中间模型名 - * @param string $foreignKey 关联外键 - * @param string $throughKey 关联外键 - * @param string $localKey 当前主键 - * @return HasManyThrough - */ - public function hasManyThrough($model, $through, $foreignKey = '', $throughKey = '', $localKey = '') - { - // 记录当前关联信息 - $model = $this->parseModel($model); - $through = $this->parseModel($through); - $localKey = $localKey ?: $this->getPk(); - $foreignKey = $foreignKey ?: $this->getForeignKey($this->name); - $throughKey = $throughKey ?: $this->getForeignKey((new $through)->getName()); - - return new HasManyThrough($this, $model, $through, $foreignKey, $throughKey, $localKey); - } - - /** - * BELONGS TO MANY 关联定义 - * @access public - * @param string $model 模型名 - * @param string $table 中间表名 - * @param string $foreignKey 关联外键 - * @param string $localKey 当前模型关联键 - * @return BelongsToMany - */ - public function belongsToMany($model, $table = '', $foreignKey = '', $localKey = '') - { - // 记录当前关联信息 - $model = $this->parseModel($model); - $name = Loader::parseName(basename(str_replace('\\', '/', $model))); - $table = $table ?: Loader::parseName($this->name) . '_' . $name; - $foreignKey = $foreignKey ?: $name . '_id'; - $localKey = $localKey ?: $this->getForeignKey($this->name); - - return new BelongsToMany($this, $model, $table, $foreignKey, $localKey); - } - - /** - * MORPH One 关联定义 - * @access public - * @param string $model 模型名 - * @param string|array $morph 多态字段信息 - * @param string $type 多态类型 - * @return MorphOne - */ - public function morphOne($model, $morph = null, $type = '') - { - // 记录当前关联信息 - $model = $this->parseModel($model); - - if (is_null($morph)) { - $trace = debug_backtrace(false, 2); - $morph = Loader::parseName($trace[1]['function']); - } - - if (is_array($morph)) { - list($morphType, $foreignKey) = $morph; - } else { - $morphType = $morph . '_type'; - $foreignKey = $morph . '_id'; - } - - $type = $type ?: get_class($this); - - return new MorphOne($this, $model, $foreignKey, $morphType, $type); - } - - /** - * MORPH MANY 关联定义 - * @access public - * @param string $model 模型名 - * @param string|array $morph 多态字段信息 - * @param string $type 多态类型 - * @return MorphMany - */ - public function morphMany($model, $morph = null, $type = '') - { - // 记录当前关联信息 - $model = $this->parseModel($model); - - if (is_null($morph)) { - $trace = debug_backtrace(false, 2); - $morph = Loader::parseName($trace[1]['function']); - } - - $type = $type ?: get_class($this); - - if (is_array($morph)) { - list($morphType, $foreignKey) = $morph; - } else { - $morphType = $morph . '_type'; - $foreignKey = $morph . '_id'; - } - - return new MorphMany($this, $model, $foreignKey, $morphType, $type); - } - - /** - * MORPH TO 关联定义 - * @access public - * @param string|array $morph 多态字段信息 - * @param array $alias 多态别名定义 - * @return MorphTo - */ - public function morphTo($morph = null, $alias = []) - { - $trace = debug_backtrace(false, 2); - $relation = Loader::parseName($trace[1]['function']); - - if (is_null($morph)) { - $morph = $relation; - } - - // 记录当前关联信息 - if (is_array($morph)) { - list($morphType, $foreignKey) = $morph; - } else { - $morphType = $morph . '_type'; - $foreignKey = $morph . '_id'; - } - - return new MorphTo($this, $morphType, $foreignKey, $alias, $relation); - } - - /** - * 解析模型的完整命名空间 - * @access protected - * @param string $model 模型名(或者完整类名) - * @return string - */ - protected function parseModel($model) - { - if (false === strpos($model, '\\')) { - $path = explode('\\', static::class); - array_pop($path); - array_push($path, Loader::parseName($model, 1)); - $model = implode('\\', $path); - } - - return $model; - } - - /** - * 获取模型的默认外键名 - * @access protected - * @param string $name 模型名 - * @return string - */ - protected function getForeignKey($name) - { - if (strpos($name, '\\')) { - $name = basename(str_replace('\\', '/', $name)); - } - - return Loader::parseName($name) . '_id'; - } - - /** - * 检查属性是否为关联属性 如果是则返回关联方法名 - * @access protected - * @param string $attr 关联属性名 - * @return string|false - */ - protected function isRelationAttr($attr) - { - $relation = Loader::parseName($attr, 1, false); - - if (method_exists($this, $relation) && !method_exists('think\Model', $relation)) { - return $relation; - } - - return false; - } - - /** - * 智能获取关联模型数据 - * @access protected - * @param Relation $modelRelation 模型关联对象 - * @return mixed - */ - protected function getRelationData(Relation $modelRelation) - { - if ($this->parent && !$modelRelation->isSelfRelation() && get_class($this->parent) == get_class($modelRelation->getModel())) { - $value = $this->parent; - } else { - // 获取关联数据 - $value = $modelRelation->getRelation(); - } - - return $value; - } - - /** - * 关联数据自动写入检查 - * @access protected - * @return void - */ - protected function checkAutoRelationWrite() - { - foreach ($this->together as $key => $name) { - if (is_array($name)) { - if (key($name) === 0) { - $this->relationWrite[$key] = []; - // 绑定关联属性 - foreach ((array) $name as $val) { - if (isset($this->data[$val])) { - $this->relationWrite[$key][$val] = $this->data[$val]; - } - } - } else { - // 直接传入关联数据 - $this->relationWrite[$key] = $name; - } - } elseif (isset($this->relation[$name])) { - $this->relationWrite[$name] = $this->relation[$name]; - } elseif (isset($this->data[$name])) { - $this->relationWrite[$name] = $this->data[$name]; - unset($this->data[$name]); - } - } - } - - /** - * 自动关联数据更新(针对一对一关联) - * @access protected - * @return void - */ - protected function autoRelationUpdate() - { - foreach ($this->relationWrite as $name => $val) { - if ($val instanceof Model) { - $val->isUpdate()->save(); - } else { - $model = $this->getRelation($name); - if ($model instanceof Model) { - $model->isUpdate()->save($val); - } - } - } - } - - /** - * 自动关联数据写入(针对一对一关联) - * @access protected - * @return void - */ - protected function autoRelationInsert() - { - foreach ($this->relationWrite as $name => $val) { - $method = Loader::parseName($name, 1, false); - $this->$method()->save($val); - } - } - - /** - * 自动关联数据删除(支持一对一及一对多关联) - * @access protected - * @return void - */ - protected function autoRelationDelete() - { - foreach ($this->relationWrite as $key => $name) { - $name = is_numeric($key) ? $name : $key; - $result = $this->getRelation($name); - - if ($result instanceof Model) { - $result->delete(); - } elseif ($result instanceof Collection) { - foreach ($result as $model) { - $model->delete(); - } - } - } - } -} diff --git a/thinkphp/library/think/model/concern/SoftDelete.php b/thinkphp/library/think/model/concern/SoftDelete.php deleted file mode 100644 index 679aa34c..00000000 --- a/thinkphp/library/think/model/concern/SoftDelete.php +++ /dev/null @@ -1,242 +0,0 @@ -getDeleteTimeField(); - - if ($field && !empty($this->getOrigin($field))) { - return true; - } - - return false; - } - - /** - * 查询软删除数据 - * @access public - * @return Query - */ - public static function withTrashed() - { - $model = new static(); - - return $model->withTrashedData(true)->db(false); - } - - /** - * 是否包含软删除数据 - * @access protected - * @param bool $withTrashed 是否包含软删除数据 - * @return $this - */ - protected function withTrashedData($withTrashed) - { - $this->withTrashed = $withTrashed; - return $this; - } - - /** - * 只查询软删除数据 - * @access public - * @return Query - */ - public static function onlyTrashed() - { - $model = new static(); - $field = $model->getDeleteTimeField(true); - - if ($field) { - return $model - ->db(false) - ->useSoftDelete($field, $model->getWithTrashedExp()); - } - - return $model->db(false); - } - - /** - * 获取软删除数据的查询条件 - * @access protected - * @return array - */ - protected function getWithTrashedExp() - { - return is_null($this->defaultSoftDelete) ? - ['notnull', ''] : ['<>', $this->defaultSoftDelete]; - } - - /** - * 删除当前的记录 - * @access public - * @return bool - */ - public function delete($force = false) - { - if (!$this->isExists() || false === $this->trigger('before_delete', $this)) { - return false; - } - - $force = $force ?: $this->isForce(); - $name = $this->getDeleteTimeField(); - - if ($name && !$force) { - // 软删除 - $this->data($name, $this->autoWriteTimestamp($name)); - - $result = $this->isUpdate()->withEvent(false)->save(); - - $this->withEvent(true); - } else { - // 读取更新条件 - $where = $this->getWhere(); - - // 删除当前模型数据 - $result = $this->db(false) - ->where($where) - ->removeOption('soft_delete') - ->delete(); - } - - // 关联删除 - if (!empty($this->relationWrite)) { - $this->autoRelationDelete(); - } - - $this->trigger('after_delete', $this); - - $this->exists(false); - - return true; - } - - /** - * 删除记录 - * @access public - * @param mixed $data 主键列表 支持闭包查询条件 - * @param bool $force 是否强制删除 - * @return bool - */ - public static function destroy($data, $force = false) - { - // 包含软删除数据 - $query = (new static())->db(false); - - if (is_array($data) && key($data) !== 0) { - $query->where($data); - $data = null; - } elseif ($data instanceof \Closure) { - call_user_func_array($data, [ & $query]); - $data = null; - } elseif (is_null($data)) { - return false; - } - - $resultSet = $query->select($data); - - if ($resultSet) { - foreach ($resultSet as $data) { - $data->force($force)->delete(); - } - } - - return true; - } - - /** - * 恢复被软删除的记录 - * @access public - * @param array $where 更新条件 - * @return bool - */ - public function restore($where = []) - { - $name = $this->getDeleteTimeField(); - - if ($name) { - if (false === $this->trigger('before_restore')) { - return false; - } - - if (empty($where)) { - $pk = $this->getPk(); - - $where[] = [$pk, '=', $this->getData($pk)]; - } - - // 恢复删除 - $this->db(false) - ->where($where) - ->useSoftDelete($name, $this->getWithTrashedExp()) - ->update([$name => $this->defaultSoftDelete]); - - $this->trigger('after_restore'); - - return true; - } - - return false; - } - - /** - * 获取软删除字段 - * @access protected - * @param bool $read 是否查询操作 写操作的时候会自动去掉表别名 - * @return string|false - */ - protected function getDeleteTimeField($read = false) - { - $field = property_exists($this, 'deleteTime') && isset($this->deleteTime) ? $this->deleteTime : 'delete_time'; - - if (false === $field) { - return false; - } - - if (false === strpos($field, '.')) { - $field = '__TABLE__.' . $field; - } - - if (!$read && strpos($field, '.')) { - $array = explode('.', $field); - $field = array_pop($array); - } - - return $field; - } - - /** - * 查询的时候默认排除软删除数据 - * @access protected - * @param Query $query - * @return void - */ - protected function withNoTrashed($query) - { - $field = $this->getDeleteTimeField(true); - - if ($field) { - $condition = is_null($this->defaultSoftDelete) ? ['null', ''] : ['=', $this->defaultSoftDelete]; - $query->useSoftDelete($field, $condition); - } - } -} diff --git a/thinkphp/library/think/model/concern/TimeStamp.php b/thinkphp/library/think/model/concern/TimeStamp.php deleted file mode 100644 index 99a31fa7..00000000 --- a/thinkphp/library/think/model/concern/TimeStamp.php +++ /dev/null @@ -1,92 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\model\concern; - -use DateTime; - -/** - * 自动时间戳 - */ -trait TimeStamp -{ - /** - * 是否需要自动写入时间戳 如果设置为字符串 则表示时间字段的类型 - * @var bool|string - */ - protected $autoWriteTimestamp; - - /** - * 创建时间字段 false表示关闭 - * @var false|string - */ - protected $createTime = 'create_time'; - - /** - * 更新时间字段 false表示关闭 - * @var false|string - */ - protected $updateTime = 'update_time'; - - /** - * 时间字段显示格式 - * @var string - */ - protected $dateFormat; - - /** - * 时间日期字段格式化处理 - * @access protected - * @param mixed $format 日期格式 - * @param mixed $time 时间日期表达式 - * @param bool $timestamp 是否进行时间戳转换 - * @return mixed - */ - protected function formatDateTime($format, $time = 'now', $timestamp = false) - { - if (empty($time)) { - return; - } - - if (false === $format) { - return $time; - } elseif (false !== strpos($format, '\\')) { - return new $format($time); - } - - if ($timestamp) { - $dateTime = new DateTime(); - $dateTime->setTimestamp($time); - } else { - $dateTime = new DateTime($time); - } - - return $dateTime->format($format); - } - - /** - * 检查时间字段写入 - * @access protected - * @return void - */ - protected function checkTimeStampWrite() - { - // 自动写入创建时间和更新时间 - if ($this->autoWriteTimestamp) { - if ($this->createTime && !isset($this->data[$this->createTime])) { - $this->data[$this->createTime] = $this->autoWriteTimestamp($this->createTime); - } - if ($this->updateTime && !isset($this->data[$this->updateTime])) { - $this->data[$this->updateTime] = $this->autoWriteTimestamp($this->updateTime); - } - } - } -} diff --git a/thinkphp/library/think/model/relation/BelongsTo.php b/thinkphp/library/think/model/relation/BelongsTo.php deleted file mode 100644 index 056c7d76..00000000 --- a/thinkphp/library/think/model/relation/BelongsTo.php +++ /dev/null @@ -1,323 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\model\relation; - -use Closure; -use think\Loader; -use think\Model; - -class BelongsTo extends OneToOne -{ - /** - * 架构函数 - * @access public - * @param Model $parent 上级模型对象 - * @param string $model 模型名 - * @param string $foreignKey 关联外键 - * @param string $localKey 关联主键 - * @param string $relation 关联名 - */ - public function __construct(Model $parent, $model, $foreignKey, $localKey, $relation = null) - { - $this->parent = $parent; - $this->model = $model; - $this->foreignKey = $foreignKey; - $this->localKey = $localKey; - $this->joinType = 'INNER'; - $this->query = (new $model)->db(); - $this->relation = $relation; - - if (get_class($parent) == $model) { - $this->selfRelation = true; - } - } - - /** - * 延迟获取关联数据 - * @access public - * @param string $subRelation 子关联名 - * @param \Closure $closure 闭包查询条件 - * @return Model - */ - public function getRelation($subRelation = '', $closure = null) - { - if ($closure instanceof Closure) { - $closure($this->query); - } - - $foreignKey = $this->foreignKey; - - $relationModel = $this->query - ->removeWhereField($this->localKey) - ->where($this->localKey, $this->parent->$foreignKey) - ->relation($subRelation) - ->find(); - - if ($relationModel) { - $relationModel->setParent(clone $this->parent); - } - - return $relationModel; - } - - /** - * 创建关联统计子查询 - * @access public - * @param \Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param string $aggregateAlias 聚合字段别名 - * @return string - */ - public function getRelationCountQuery($closure, $aggregate = 'count', $field = '*', &$aggregateAlias = '') - { - if ($closure instanceof Closure) { - $return = $closure($this->query); - - if ($return && is_string($return)) { - $aggregateAlias = $return; - } - } - - return $this->query - ->whereExp($this->localKey, '=' . $this->parent->getTable() . '.' . $this->foreignKey) - ->fetchSql() - ->$aggregate($field); - } - - /** - * 关联统计 - * @access public - * @param Model $result 数据对象 - * @param \Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param string $name 统计字段别名 - * @return integer - */ - public function relationCount($result, $closure, $aggregate = 'count', $field = '*', &$name = '') - { - $foreignKey = $this->foreignKey; - - if (!isset($result->$foreignKey)) { - return 0; - } - - if ($closure instanceof Closure) { - $return = $closure($this->query); - - if ($return && is_string($return)) { - $name = $return; - } - } - - return $this->query - ->where($this->localKey, '=', $result->$foreignKey) - ->$aggregate($field); - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param string $operator 比较操作符 - * @param integer $count 个数 - * @param string $id 关联表的统计字段 - * @param string $joinType JOIN类型 - * @return Query - */ - public function has($operator = '>=', $count = 1, $id = '*', $joinType = 'INNER') - { - $table = $this->query->getTable(); - $model = basename(str_replace('\\', '/', get_class($this->parent))); - $relation = basename(str_replace('\\', '/', $this->model)); - $localKey = $this->localKey; - $foreignKey = $this->foreignKey; - $softDelete = $this->query->getOptions('soft_delete'); - - return $this->parent->db() - ->alias($model) - ->whereExists(function ($query) use ($table, $model, $relation, $localKey, $foreignKey) { - $query->table([$table => $relation]) - ->field($relation . '.' . $localKey) - ->whereExp($model . '.' . $foreignKey, '=' . $relation . '.' . $localKey) - ->when($softDelete, function ($query) use ($softDelete, $relation) { - $query->where($relation . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null); - }); - }); - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param mixed $where 查询条件(数组或者闭包) - * @param mixed $fields 字段 - * @return Query - */ - public function hasWhere($where = [], $fields = null) - { - $table = $this->query->getTable(); - $model = basename(str_replace('\\', '/', get_class($this->parent))); - $relation = basename(str_replace('\\', '/', $this->model)); - - if (is_array($where)) { - $this->getQueryWhere($where, $relation); - } - - $fields = $this->getRelationQueryFields($fields, $model); - $softDelete = $this->query->getOptions('soft_delete'); - - return $this->parent->db() - ->alias($model) - ->field($fields) - ->join([$table => $relation], $model . '.' . $this->foreignKey . '=' . $relation . '.' . $this->localKey, $this->joinType) - ->when($softDelete, function ($query) use ($softDelete, $relation) { - $query->where($relation . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null); - }) - ->where($where); - } - - /** - * 预载入关联查询(数据集) - * @access protected - * @param array $resultSet 数据集 - * @param string $relation 当前关联名 - * @param string $subRelation 子关联名 - * @param \Closure $closure 闭包 - * @return void - */ - protected function eagerlySet(&$resultSet, $relation, $subRelation, $closure) - { - $localKey = $this->localKey; - $foreignKey = $this->foreignKey; - - $range = []; - foreach ($resultSet as $result) { - // 获取关联外键列表 - if (isset($result->$foreignKey)) { - $range[] = $result->$foreignKey; - } - } - - if (!empty($range)) { - $this->query->removeWhereField($localKey); - - $data = $this->eagerlyWhere([ - [$localKey, 'in', $range], - ], $localKey, $relation, $subRelation, $closure); - - // 关联属性名 - $attr = Loader::parseName($relation); - - // 关联数据封装 - foreach ($resultSet as $result) { - // 关联模型 - if (!isset($data[$result->$foreignKey])) { - $relationModel = null; - } else { - $relationModel = $data[$result->$foreignKey]; - $relationModel->setParent(clone $result); - $relationModel->isUpdate(true); - } - - if (!empty($this->bindAttr)) { - // 绑定关联属性 - $this->bindAttr($relationModel, $result); - } else { - // 设置关联属性 - $result->setRelation($attr, $relationModel); - } - } - } - } - - /** - * 预载入关联查询(数据) - * @access protected - * @param Model $result 数据对象 - * @param string $relation 当前关联名 - * @param string $subRelation 子关联名 - * @param \Closure $closure 闭包 - * @return void - */ - protected function eagerlyOne(&$result, $relation, $subRelation, $closure) - { - $localKey = $this->localKey; - $foreignKey = $this->foreignKey; - - $this->query->removeWhereField($localKey); - - $data = $this->eagerlyWhere([ - [$localKey, '=', $result->$foreignKey], - ], $localKey, $relation, $subRelation, $closure); - - // 关联模型 - if (!isset($data[$result->$foreignKey])) { - $relationModel = null; - } else { - $relationModel = $data[$result->$foreignKey]; - $relationModel->setParent(clone $result); - $relationModel->isUpdate(true); - } - - if (!empty($this->bindAttr)) { - // 绑定关联属性 - $this->bindAttr($relationModel, $result); - } else { - // 设置关联属性 - $result->setRelation(Loader::parseName($relation), $relationModel); - } - } - - /** - * 添加关联数据 - * @access public - * @param Model $model 关联模型对象 - * @return Model - */ - public function associate($model) - { - $this->parent->setAttr($this->foreignKey, $model->getKey()); - $this->parent->save(); - - return $this->parent->setRelation($this->relation, $model); - } - - /** - * 注销关联数据 - * @access public - * @return Model - */ - public function dissociate() - { - $this->parent->setAttr($this->foreignKey, null); - $this->parent->save(); - - return $this->parent->setRelation($this->relation, null); - } - - /** - * 执行基础查询(仅执行一次) - * @access protected - * @return void - */ - protected function baseQuery() - { - if (empty($this->baseQuery)) { - if (isset($this->parent->{$this->foreignKey})) { - // 关联查询带入关联条件 - $this->query->where($this->localKey, '=', $this->parent->{$this->foreignKey}); - } - - $this->baseQuery = true; - } - } -} diff --git a/thinkphp/library/think/model/relation/BelongsToMany.php b/thinkphp/library/think/model/relation/BelongsToMany.php deleted file mode 100644 index 2d64f683..00000000 --- a/thinkphp/library/think/model/relation/BelongsToMany.php +++ /dev/null @@ -1,711 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\model\relation; - -use Closure; -use think\Collection; -use think\db\Query; -use think\Exception; -use think\Loader; -use think\Model; -use think\model\Pivot; -use think\model\Relation; - -class BelongsToMany extends Relation -{ - // 中间表表名 - protected $middle; - // 中间表模型名称 - protected $pivotName; - // 中间表数据名称 - protected $pivotDataName = 'pivot'; - // 中间表模型对象 - protected $pivot; - - /** - * 架构函数 - * @access public - * @param Model $parent 上级模型对象 - * @param string $model 模型名 - * @param string $table 中间表名 - * @param string $foreignKey 关联模型外键 - * @param string $localKey 当前模型关联键 - */ - public function __construct(Model $parent, $model, $table, $foreignKey, $localKey) - { - $this->parent = $parent; - $this->model = $model; - $this->foreignKey = $foreignKey; - $this->localKey = $localKey; - - if (false !== strpos($table, '\\')) { - $this->pivotName = $table; - $this->middle = basename(str_replace('\\', '/', $table)); - } else { - $this->middle = $table; - } - - $this->query = (new $model)->db(); - $this->pivot = $this->newPivot(); - } - - /** - * 设置中间表模型 - * @access public - * @param $pivot - * @return $this - */ - public function pivot($pivot) - { - $this->pivotName = $pivot; - return $this; - } - - /** - * 设置中间表数据名称 - * @access public - * @param string $name - * @return $this - */ - public function pivotDataName($name) - { - $this->pivotDataName = $name; - return $this; - } - - /** - * 获取中间表更新条件 - * @param $data - * @return array - */ - protected function getUpdateWhere($data) - { - return [ - $this->localKey => $data[$this->localKey], - $this->foreignKey => $data[$this->foreignKey], - ]; - } - - /** - * 实例化中间表模型 - * @access public - * @param array $data - * @param bool $isUpdate - * @return Pivot - * @throws Exception - */ - protected function newPivot($data = [], $isUpdate = false) - { - $class = $this->pivotName ?: '\\think\\model\\Pivot'; - $pivot = new $class($data, $this->parent, $this->middle); - - if ($pivot instanceof Pivot) { - return $isUpdate ? $pivot->isUpdate(true, $this->getUpdateWhere($data)) : $pivot; - } - - throw new Exception('pivot model must extends: \think\model\Pivot'); - } - - /** - * 合成中间表模型 - * @access protected - * @param array|Collection|Paginator $models - */ - protected function hydratePivot($models) - { - foreach ($models as $model) { - $pivot = []; - - foreach ($model->getData() as $key => $val) { - if (strpos($key, '__')) { - list($name, $attr) = explode('__', $key, 2); - - if ('pivot' == $name) { - $pivot[$attr] = $val; - unset($model->$key); - } - } - } - - $model->setRelation($this->pivotDataName, $this->newPivot($pivot, true)); - } - } - - /** - * 创建关联查询Query对象 - * @access protected - * @return Query - */ - protected function buildQuery() - { - $foreignKey = $this->foreignKey; - $localKey = $this->localKey; - - // 关联查询 - $pk = $this->parent->getPk(); - - $condition[] = ['pivot.' . $localKey, '=', $this->parent->$pk]; - - return $this->belongsToManyQuery($foreignKey, $localKey, $condition); - } - - /** - * 延迟获取关联数据 - * @access public - * @param string $subRelation 子关联名 - * @param \Closure $closure 闭包查询条件 - * @return Collection - */ - public function getRelation($subRelation = '', $closure = null) - { - if ($closure instanceof Closure) { - $closure($this->query); - } - - $result = $this->buildQuery()->relation($subRelation)->select(); - $this->hydratePivot($result); - - return $result; - } - - /** - * 重载select方法 - * @access public - * @param mixed $data - * @return Collection - */ - public function select($data = null) - { - $result = $this->buildQuery()->select($data); - $this->hydratePivot($result); - - return $result; - } - - /** - * 重载paginate方法 - * @access public - * @param null $listRows - * @param bool $simple - * @param array $config - * @return Paginator - */ - public function paginate($listRows = null, $simple = false, $config = []) - { - $result = $this->buildQuery()->paginate($listRows, $simple, $config); - $this->hydratePivot($result); - - return $result; - } - - /** - * 重载find方法 - * @access public - * @param mixed $data - * @return Model - */ - public function find($data = null) - { - $result = $this->buildQuery()->find($data); - if ($result) { - $this->hydratePivot([$result]); - } - - return $result; - } - - /** - * 查找多条记录 如果不存在则抛出异常 - * @access public - * @param array|string|Query|\Closure $data - * @return Collection - */ - public function selectOrFail($data = null) - { - return $this->failException(true)->select($data); - } - - /** - * 查找单条记录 如果不存在则抛出异常 - * @access public - * @param array|string|Query|\Closure $data - * @return Model - */ - public function findOrFail($data = null) - { - return $this->failException(true)->find($data); - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param string $operator 比较操作符 - * @param integer $count 个数 - * @param string $id 关联表的统计字段 - * @param string $joinType JOIN类型 - * @return Query - */ - public function has($operator = '>=', $count = 1, $id = '*', $joinType = 'INNER') - { - return $this->parent; - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param mixed $where 查询条件(数组或者闭包) - * @param mixed $fields 字段 - * @return Query - * @throws Exception - */ - public function hasWhere($where = [], $fields = null) - { - throw new Exception('relation not support: hasWhere'); - } - - /** - * 设置中间表的查询条件 - * @access public - * @param string $field - * @param string $op - * @param mixed $condition - * @return $this - */ - public function wherePivot($field, $op = null, $condition = null) - { - $this->query->where('pivot.' . $field, $op, $condition); - return $this; - } - - /** - * 预载入关联查询(数据集) - * @access public - * @param array $resultSet 数据集 - * @param string $relation 当前关联名 - * @param string $subRelation 子关联名 - * @param \Closure $closure 闭包 - * @return void - */ - public function eagerlyResultSet(&$resultSet, $relation, $subRelation, $closure) - { - $localKey = $this->localKey; - $foreignKey = $this->foreignKey; - - $pk = $resultSet[0]->getPk(); - $range = []; - foreach ($resultSet as $result) { - // 获取关联外键列表 - if (isset($result->$pk)) { - $range[] = $result->$pk; - } - } - - if (!empty($range)) { - // 查询关联数据 - $data = $this->eagerlyManyToMany([ - ['pivot.' . $localKey, 'in', $range], - ], $relation, $subRelation, $closure); - - // 关联属性名 - $attr = Loader::parseName($relation); - - // 关联数据封装 - foreach ($resultSet as $result) { - if (!isset($data[$result->$pk])) { - $data[$result->$pk] = []; - } - - $result->setRelation($attr, $this->resultSetBuild($data[$result->$pk])); - } - } - } - - /** - * 预载入关联查询(单个数据) - * @access public - * @param Model $result 数据对象 - * @param string $relation 当前关联名 - * @param string $subRelation 子关联名 - * @param \Closure $closure 闭包 - * @return void - */ - public function eagerlyResult(&$result, $relation, $subRelation, $closure) - { - $pk = $result->getPk(); - - if (isset($result->$pk)) { - $pk = $result->$pk; - // 查询管理数据 - $data = $this->eagerlyManyToMany([ - ['pivot.' . $this->localKey, '=', $pk], - ], $relation, $subRelation, $closure); - - // 关联数据封装 - if (!isset($data[$pk])) { - $data[$pk] = []; - } - - $result->setRelation(Loader::parseName($relation), $this->resultSetBuild($data[$pk])); - } - } - - /** - * 关联统计 - * @access public - * @param Model $result 数据对象 - * @param \Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param string $name 统计字段别名 - * @return integer - */ - public function relationCount($result, $closure, $aggregate = 'count', $field = '*', &$name = '') - { - $pk = $result->getPk(); - - if (!isset($result->$pk)) { - return 0; - } - - $pk = $result->$pk; - - if ($closure instanceof Closure) { - $return = $closure($this->query); - - if ($return && is_string($return)) { - $name = $return; - } - } - - return $this->belongsToManyQuery($this->foreignKey, $this->localKey, [ - ['pivot.' . $this->localKey, '=', $pk], - ])->$aggregate($field); - } - - /** - * 获取关联统计子查询 - * @access public - * @param \Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param string $aggregateAlias 聚合字段别名 - * @return array - */ - public function getRelationCountQuery($closure, $aggregate = 'count', $field = '*', &$aggregateAlias = '') - { - if ($closure instanceof Closure) { - $return = $closure($this->query); - - if ($return && is_string($return)) { - $aggregateAlias = $return; - } - } - - return $this->belongsToManyQuery($this->foreignKey, $this->localKey, [ - [ - 'pivot.' . $this->localKey, 'exp', $this->query->raw('=' . $this->parent->getTable() . '.' . $this->parent->getPk()), - ], - ])->fetchSql()->$aggregate($field); - } - - /** - * 多对多 关联模型预查询 - * @access protected - * @param array $where 关联预查询条件 - * @param string $relation 关联名 - * @param string $subRelation 子关联 - * @param \Closure $closure 闭包 - * @return array - */ - protected function eagerlyManyToMany($where, $relation, $subRelation = '', $closure = null) - { - // 预载入关联查询 支持嵌套预载入 - if ($closure instanceof Closure) { - $closure($this->query); - } - - $list = $this->belongsToManyQuery($this->foreignKey, $this->localKey, $where) - ->with($subRelation) - ->select(); - - // 组装模型数据 - $data = []; - foreach ($list as $set) { - $pivot = []; - foreach ($set->getData() as $key => $val) { - if (strpos($key, '__')) { - list($name, $attr) = explode('__', $key, 2); - if ('pivot' == $name) { - $pivot[$attr] = $val; - unset($set->$key); - } - } - } - - $set->setRelation($this->pivotDataName, $this->newPivot($pivot, true)); - - $data[$pivot[$this->localKey]][] = $set; - } - - return $data; - } - - /** - * BELONGS TO MANY 关联查询 - * @access protected - * @param string $foreignKey 关联模型关联键 - * @param string $localKey 当前模型关联键 - * @param array $condition 关联查询条件 - * @return Query - */ - protected function belongsToManyQuery($foreignKey, $localKey, $condition = []) - { - // 关联查询封装 - $tableName = $this->query->getTable(); - $table = $this->pivot->getTable(); - $fields = $this->getQueryFields($tableName); - - $query = $this->query - ->field($fields) - ->field(true, false, $table, 'pivot', 'pivot__'); - - if (empty($this->baseQuery)) { - $relationFk = $this->query->getPk(); - $query->join([$table => 'pivot'], 'pivot.' . $foreignKey . '=' . $tableName . '.' . $relationFk) - ->where($condition); - } - - return $query; - } - - /** - * 保存(新增)当前关联数据对象 - * @access public - * @param mixed $data 数据 可以使用数组 关联模型对象 和 关联对象的主键 - * @param array $pivot 中间表额外数据 - * @return array|Pivot - */ - public function save($data, array $pivot = []) - { - // 保存关联表/中间表数据 - return $this->attach($data, $pivot); - } - - /** - * 批量保存当前关联数据对象 - * @access public - * @param array $dataSet 数据集 - * @param array $pivot 中间表额外数据 - * @param bool $samePivot 额外数据是否相同 - * @return array|false - */ - public function saveAll(array $dataSet, array $pivot = [], $samePivot = false) - { - $result = []; - - foreach ($dataSet as $key => $data) { - if (!$samePivot) { - $pivotData = isset($pivot[$key]) ? $pivot[$key] : []; - } else { - $pivotData = $pivot; - } - - $result[] = $this->attach($data, $pivotData); - } - - return empty($result) ? false : $result; - } - - /** - * 附加关联的一个中间表数据 - * @access public - * @param mixed $data 数据 可以使用数组、关联模型对象 或者 关联对象的主键 - * @param array $pivot 中间表额外数据 - * @return array|Pivot - * @throws Exception - */ - public function attach($data, $pivot = []) - { - if (is_array($data)) { - if (key($data) === 0) { - $id = $data; - } else { - // 保存关联表数据 - $model = new $this->model; - $id = $model->insertGetId($data); - } - } elseif (is_numeric($data) || is_string($data)) { - // 根据关联表主键直接写入中间表 - $id = $data; - } elseif ($data instanceof Model) { - // 根据关联表主键直接写入中间表 - $relationFk = $data->getPk(); - $id = $data->$relationFk; - } - - if ($id) { - // 保存中间表数据 - $pk = $this->parent->getPk(); - $pivot[$this->localKey] = $this->parent->$pk; - $ids = (array) $id; - - foreach ($ids as $id) { - $pivot[$this->foreignKey] = $id; - $this->pivot->replace() - ->exists(false) - ->data([]) - ->save($pivot); - $result[] = $this->newPivot($pivot, true); - } - - if (count($result) == 1) { - // 返回中间表模型对象 - $result = $result[0]; - } - - return $result; - } else { - throw new Exception('miss relation data'); - } - } - - /** - * 判断是否存在关联数据 - * @access public - * @param mixed $data 数据 可以使用关联模型对象 或者 关联对象的主键 - * @return Pivot - * @throws Exception - */ - public function attached($data) - { - if ($data instanceof Model) { - $id = $data->getKey(); - } else { - $id = $data; - } - - $pivot = $this->pivot - ->where($this->localKey, $this->parent->getKey()) - ->where($this->foreignKey, $id) - ->find(); - - return $pivot ?: false; - } - - /** - * 解除关联的一个中间表数据 - * @access public - * @param integer|array $data 数据 可以使用关联对象的主键 - * @param bool $relationDel 是否同时删除关联表数据 - * @return integer - */ - public function detach($data = null, $relationDel = false) - { - if (is_array($data)) { - $id = $data; - } elseif (is_numeric($data) || is_string($data)) { - // 根据关联表主键直接写入中间表 - $id = $data; - } elseif ($data instanceof Model) { - // 根据关联表主键直接写入中间表 - $relationFk = $data->getPk(); - $id = $data->$relationFk; - } - - // 删除中间表数据 - $pk = $this->parent->getPk(); - $pivot[] = [$this->localKey, '=', $this->parent->$pk]; - - if (isset($id)) { - $pivot[] = [$this->foreignKey, is_array($id) ? 'in' : '=', $id]; - } - - $result = $this->pivot->where($pivot)->delete(); - - // 删除关联表数据 - if (isset($id) && $relationDel) { - $model = $this->model; - $model::destroy($id); - } - - return $result; - } - - /** - * 数据同步 - * @access public - * @param array $ids - * @param bool $detaching - * @return array - */ - public function sync($ids, $detaching = true) - { - $changes = [ - 'attached' => [], - 'detached' => [], - 'updated' => [], - ]; - - $pk = $this->parent->getPk(); - - $current = $this->pivot - ->where($this->localKey, $this->parent->$pk) - ->column($this->foreignKey); - - $records = []; - - foreach ($ids as $key => $value) { - if (!is_array($value)) { - $records[$value] = []; - } else { - $records[$key] = $value; - } - } - - $detach = array_diff($current, array_keys($records)); - - if ($detaching && count($detach) > 0) { - $this->detach($detach); - $changes['detached'] = $detach; - } - - foreach ($records as $id => $attributes) { - if (!in_array($id, $current)) { - $this->attach($id, $attributes); - $changes['attached'][] = $id; - } elseif (count($attributes) > 0 && $this->attach($id, $attributes)) { - $changes['updated'][] = $id; - } - } - - return $changes; - } - - /** - * 执行基础查询(仅执行一次) - * @access protected - * @return void - */ - protected function baseQuery() - { - if (empty($this->baseQuery) && $this->parent->getData()) { - $pk = $this->parent->getPk(); - $table = $this->pivot->getTable(); - - $this->query - ->join([$table => 'pivot'], 'pivot.' . $this->foreignKey . '=' . $this->query->getTable() . '.' . $this->query->getPk()) - ->where('pivot.' . $this->localKey, $this->parent->$pk); - $this->baseQuery = true; - } - } - -} diff --git a/thinkphp/library/think/model/relation/HasMany.php b/thinkphp/library/think/model/relation/HasMany.php deleted file mode 100644 index e4df5c4b..00000000 --- a/thinkphp/library/think/model/relation/HasMany.php +++ /dev/null @@ -1,360 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\model\relation; - -use Closure; -use think\db\Query; -use think\Loader; -use think\Model; -use think\model\Relation; - -class HasMany extends Relation -{ - /** - * 架构函数 - * @access public - * @param Model $parent 上级模型对象 - * @param string $model 模型名 - * @param string $foreignKey 关联外键 - * @param string $localKey 当前模型主键 - */ - public function __construct(Model $parent, $model, $foreignKey, $localKey) - { - $this->parent = $parent; - $this->model = $model; - $this->foreignKey = $foreignKey; - $this->localKey = $localKey; - $this->query = (new $model)->db(); - - if (get_class($parent) == $model) { - $this->selfRelation = true; - } - } - - /** - * 延迟获取关联数据 - * @access public - * @param string $subRelation 子关联名 - * @param \Closure $closure 闭包查询条件 - * @return \think\Collection - */ - public function getRelation($subRelation = '', $closure = null) - { - if ($closure instanceof Closure) { - $closure($this->query); - } - - $list = $this->query - ->where($this->foreignKey, $this->parent->{$this->localKey}) - ->relation($subRelation) - ->select(); - - $parent = clone $this->parent; - - foreach ($list as &$model) { - $model->setParent($parent); - } - - return $list; - } - - /** - * 预载入关联查询 - * @access public - * @param array $resultSet 数据集 - * @param string $relation 当前关联名 - * @param string $subRelation 子关联名 - * @param \Closure $closure 闭包 - * @return void - */ - public function eagerlyResultSet(&$resultSet, $relation, $subRelation, $closure) - { - $localKey = $this->localKey; - $range = []; - - foreach ($resultSet as $result) { - // 获取关联外键列表 - if (isset($result->$localKey)) { - $range[] = $result->$localKey; - } - } - - if (!empty($range)) { - $where = [ - [$this->foreignKey, 'in', $range], - ]; - $data = $this->eagerlyOneToMany($where, $relation, $subRelation, $closure); - - // 关联属性名 - $attr = Loader::parseName($relation); - - // 关联数据封装 - foreach ($resultSet as $result) { - $pk = $result->$localKey; - if (!isset($data[$pk])) { - $data[$pk] = []; - } - - foreach ($data[$pk] as &$relationModel) { - $relationModel->setParent(clone $result); - } - - $result->setRelation($attr, $this->resultSetBuild($data[$pk])); - } - } - } - - /** - * 预载入关联查询 - * @access public - * @param Model $result 数据对象 - * @param string $relation 当前关联名 - * @param string $subRelation 子关联名 - * @param \Closure $closure 闭包 - * @return void - */ - public function eagerlyResult(&$result, $relation, $subRelation, $closure) - { - $localKey = $this->localKey; - - if (isset($result->$localKey)) { - $pk = $result->$localKey; - $where = [ - [$this->foreignKey, '=', $pk], - ]; - $data = $this->eagerlyOneToMany($where, $relation, $subRelation, $closure); - - // 关联数据封装 - if (!isset($data[$pk])) { - $data[$pk] = []; - } - - foreach ($data[$pk] as &$relationModel) { - $relationModel->setParent(clone $result); - } - - $result->setRelation(Loader::parseName($relation), $this->resultSetBuild($data[$pk])); - } - } - - /** - * 关联统计 - * @access public - * @param Model $result 数据对象 - * @param \Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param string $name 统计字段别名 - * @return integer - */ - public function relationCount($result, $closure, $aggregate = 'count', $field = '*', &$name = '') - { - $localKey = $this->localKey; - - if (!isset($result->$localKey)) { - return 0; - } - - if ($closure instanceof Closure) { - $return = $closure($this->query); - if ($return && is_string($return)) { - $name = $return; - } - } - - return $this->query - ->where($this->foreignKey, '=', $result->$localKey) - ->$aggregate($field); - } - - /** - * 创建关联统计子查询 - * @access public - * @param \Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param string $aggregateAlias 聚合字段别名 - * @return string - */ - public function getRelationCountQuery($closure, $aggregate = 'count', $field = '*', &$aggregateAlias = '') - { - if ($closure instanceof Closure) { - $return = $closure($this->query); - - if ($return && is_string($return)) { - $aggregateAlias = $return; - } - } - - return $this->query->alias($aggregate . '_table') - ->whereExp($aggregate . '_table.' . $this->foreignKey, '=' . $this->parent->getTable() . '.' . $this->localKey) - ->fetchSql() - ->$aggregate($field); - } - - /** - * 一对多 关联模型预查询 - * @access public - * @param array $where 关联预查询条件 - * @param string $relation 关联名 - * @param string $subRelation 子关联 - * @param \Closure $closure - * @return array - */ - protected function eagerlyOneToMany($where, $relation, $subRelation = '', $closure = null) - { - $foreignKey = $this->foreignKey; - - $this->query->removeWhereField($this->foreignKey); - - // 预载入关联查询 支持嵌套预载入 - if ($closure instanceof Closure) { - $closure($this->query); - } - - $list = $this->query->where($where)->with($subRelation)->select(); - - // 组装模型数据 - $data = []; - - foreach ($list as $set) { - $data[$set->$foreignKey][] = $set; - } - - return $data; - } - - /** - * 保存(新增)当前关联数据对象 - * @access public - * @param mixed $data 数据 可以使用数组 关联模型对象 和 关联对象的主键 - * @param boolean $replace 是否自动识别更新和写入 - * @return Model|false - */ - public function save($data, $replace = true) - { - $model = $this->make(); - - return $model->replace($replace)->save($data) ? $model : false; - } - - /** - * 创建关联对象实例 - * @param array $data - * @return Model - */ - public function make($data = []) - { - if ($data instanceof Model) { - $data = $data->getData(); - } - - // 保存关联表数据 - $data[$this->foreignKey] = $this->parent->{$this->localKey}; - - return new $this->model($data); - } - - /** - * 批量保存当前关联数据对象 - * @access public - * @param array|\think\Collection $dataSet 数据集 - * @param boolean $replace 是否自动识别更新和写入 - * @return array|false - */ - public function saveAll($dataSet, $replace = true) - { - $result = []; - - foreach ($dataSet as $key => $data) { - $result[] = $this->save($data, $replace); - } - - return empty($result) ? false : $result; - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param string $operator 比较操作符 - * @param integer $count 个数 - * @param string $id 关联表的统计字段 - * @param string $joinType JOIN类型 - * @return Query - */ - public function has($operator = '>=', $count = 1, $id = '*', $joinType = 'INNER') - { - $table = $this->query->getTable(); - $model = basename(str_replace('\\', '/', get_class($this->parent))); - $relation = basename(str_replace('\\', '/', $this->model)); - $softDelete = $this->query->getOptions('soft_delete'); - - return $this->parent->db() - ->alias($model) - ->field($model . '.*') - ->join([$table => $relation], $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey, $joinType) - ->when($softDelete, function ($query) use ($softDelete, $relation) { - $query->where($relation . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null); - }) - ->group($relation . '.' . $this->foreignKey) - ->having('count(' . $id . ')' . $operator . $count); - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param mixed $where 查询条件(数组或者闭包) - * @param mixed $fields 字段 - * @return Query - */ - public function hasWhere($where = [], $fields = null) - { - $table = $this->query->getTable(); - $model = basename(str_replace('\\', '/', get_class($this->parent))); - $relation = basename(str_replace('\\', '/', $this->model)); - - if (is_array($where)) { - $this->getQueryWhere($where, $relation); - } - - $fields = $this->getRelationQueryFields($fields, $model); - $softDelete = $this->query->getOptions('soft_delete'); - - return $this->parent->db() - ->alias($model) - ->group($model . '.' . $this->localKey) - ->field($fields) - ->join([$table => $relation], $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey) - ->when($softDelete, function ($query) use ($softDelete, $relation) { - $query->where($relation . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null); - }) - ->where($where); - } - - /** - * 执行基础查询(仅执行一次) - * @access protected - * @return void - */ - protected function baseQuery() - { - if (empty($this->baseQuery)) { - if (isset($this->parent->{$this->localKey})) { - // 关联查询带入关联条件 - $this->query->where($this->foreignKey, '=', $this->parent->{$this->localKey}); - } - - $this->baseQuery = true; - } - } - -} diff --git a/thinkphp/library/think/model/relation/HasManyThrough.php b/thinkphp/library/think/model/relation/HasManyThrough.php deleted file mode 100644 index 6e39f2ad..00000000 --- a/thinkphp/library/think/model/relation/HasManyThrough.php +++ /dev/null @@ -1,363 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\model\relation; - -use Closure; -use think\db\Query; -use think\Loader; -use think\Model; -use think\model\Relation; - -class HasManyThrough extends Relation -{ - // 中间关联表外键 - protected $throughKey; - // 中间表模型 - protected $through; - - /** - * 中间主键 - * @var string - */ - protected $throughPk; - - /** - * 架构函数 - * @access public - * @param Model $parent 上级模型对象 - * @param string $model 模型名 - * @param string $through 中间模型名 - * @param string $foreignKey 关联外键 - * @param string $throughKey 关联外键 - * @param string $localKey 当前主键 - */ - public function __construct(Model $parent, $model, $through, $foreignKey, $throughKey, $localKey) - { - $this->parent = $parent; - $this->model = $model; - $this->through = (new $through)->db(); - $this->foreignKey = $foreignKey; - $this->throughKey = $throughKey; - $this->throughPk = $this->through->getPk(); - $this->localKey = $localKey; - $this->query = (new $model)->db(); - } - - /** - * 延迟获取关联数据 - * @access public - * @param string $subRelation 子关联名 - * @param \Closure $closure 闭包查询条件 - * @return \think\Collection - */ - public function getRelation($subRelation = '', $closure = null) - { - if ($closure instanceof Closure) { - $closure($this->query); - } - - $this->baseQuery(); - - return $this->query->relation($subRelation)->select(); - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param string $operator 比较操作符 - * @param integer $count 个数 - * @param string $id 关联表的统计字段 - * @param string $joinType JOIN类型 - * @return Query - */ - public function has($operator = '>=', $count = 1, $id = '*', $joinType = 'INNER') - { - $model = App::parseName(App::classBaseName($this->parent)); - $throughTable = $this->through->getTable(); - $pk = $this->throughPk; - $throughKey = $this->throughKey; - $relation = (new $this->model)->db(); - $relationTable = $relation->getTable(); - $softDelete = $this->query->getOptions('soft_delete'); - - if ('*' != $id) { - $id = $relationTable . '.' . $relation->getPk(); - } - - return $this->parent->db() - ->alias($model) - ->field($model . '.*') - ->join($throughTable, $throughTable . '.' . $this->foreignKey . '=' . $model . '.' . $this->localKey) - ->join($relationTable, $relationTable . '.' . $throughKey . '=' . $throughTable . '.' . $this->throughPk) - ->when($softDelete, function ($query) use ($softDelete, $relationTable) { - $query->where($relationTable . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null); - }) - ->group($relationTable . '.' . $this->throughKey) - ->having('count(' . $id . ')' . $operator . $count); - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param mixed $where 查询条件(数组或者闭包) - * @param mixed $fields 字段 - * @return Query - */ - public function hasWhere($where = [], $fields = null) - { - $model = App::parseName(App::classBaseName($this->parent)); - $throughTable = $this->through->getTable(); - $pk = $this->throughPk; - $throughKey = $this->throughKey; - $modelTable = (new $this->model)->db()->getTable(); - - if (is_array($where)) { - $this->getQueryWhere($where, $modelTable); - } - - $fields = $this->getRelationQueryFields($fields, $model); - $softDelete = $this->query->getOptions('soft_delete'); - - return $this->parent->db() - ->alias($model) - ->join($throughTable, $throughTable . '.' . $this->foreignKey . '=' . $model . '.' . $this->localKey) - ->join($modelTable, $modelTable . '.' . $throughKey . '=' . $throughTable . '.' . $this->throughPk) - ->when($softDelete, function ($query) use ($softDelete, $modelTable) { - $query->where($modelTable . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null); - }) - ->group($modelTable . '.' . $this->throughKey) - ->where($where) - ->field($fields); - } - - /** - * 预载入关联查询(数据集) - * @access protected - * @param array $resultSet 数据集 - * @param string $relation 当前关联名 - * @param mixed $subRelation 子关联名 - * @param Closure $closure 闭包 - * @return void - */ - public function eagerlyResultSet(array &$resultSet, $relation, $subRelation = '', $closure = null) - { - $localKey = $this->localKey; - $foreignKey = $this->foreignKey; - - $range = []; - foreach ($resultSet as $result) { - // 获取关联外键列表 - if (isset($result->$localKey)) { - $range[] = $result->$localKey; - } - } - - if (!empty($range)) { - $this->query->removeWhereField($foreignKey); - - $data = $this->eagerlyWhere([ - [$this->foreignKey, 'in', $range], - ], $foreignKey, $relation, $subRelation, $closure); - - // 关联属性名 - $attr = App::parseName($relation); - - // 关联数据封装 - foreach ($resultSet as $result) { - $pk = $result->$localKey; - if (!isset($data[$pk])) { - $data[$pk] = []; - } - - foreach ($data[$pk] as &$relationModel) { - $relationModel->setParent(clone $result); - } - - // 设置关联属性 - $result->setRelation($attr, $this->resultSetBuild($data[$pk])); - } - } - } - - /** - * 预载入关联查询(数据) - * @access protected - * @param Model $result 数据对象 - * @param string $relation 当前关联名 - * @param mixed $subRelation 子关联名 - * @param Closure $closure 闭包 - * @return void - */ - public function eagerlyResult($result, $relation, $subRelation = '', $closure = null) - { - $localKey = $this->localKey; - $foreignKey = $this->foreignKey; - $pk = $result->$localKey; - - $this->query->removeWhereField($foreignKey); - - $data = $this->eagerlyWhere([ - [$foreignKey, '=', $pk], - ], $foreignKey, $relation, $subRelation, $closure); - - // 关联数据封装 - if (!isset($data[$pk])) { - $data[$pk] = []; - } - - foreach ($data[$pk] as &$relationModel) { - $relationModel->setParent(clone $result); - } - - $result->setRelation(App::parseName($relation), $this->resultSetBuild($data[$pk])); - } - - /** - * 关联模型预查询 - * @access public - * @param array $where 关联预查询条件 - * @param string $key 关联键名 - * @param string $relation 关联名 - * @param mixed $subRelation 子关联 - * @param Closure $closure - * @return array - */ - protected function eagerlyWhere(array $where, $key, $relation, $subRelation = '', $closure = null) - { - // 预载入关联查询 支持嵌套预载入 - $throughList = $this->through->where($where)->select(); - $keys = $throughList->column($this->throughPk, $this->throughPk); - - if ($closure instanceof Closure) { - $closure($this->query); - } - - $list = $this->query->where($this->throughKey, 'in', $keys)->select(); - - // 组装模型数据 - $data = []; - $keys = $throughList->column($this->foreignKey, $this->throughPk); - - foreach ($list as $set) { - $data[$keys[$set->{$this->throughKey}]][] = $set; - } - - return $data; - } - - /** - * 关联统计 - * @access public - * @param Model $result 数据对象 - * @param Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param string $name 统计字段别名 - * @return integer - */ - public function relationCount($result, $closure, $aggregate = 'count', $field = '*', &$name = null) - { - $localKey = $this->localKey; - - if (!isset($result->$localKey)) { - return 0; - } - - if ($closure instanceof Closure) { - $return = $closure($this->query); - if ($return && is_string($return)) { - $name = $return; - } - } - - $alias = App::parseName(App::classBaseName($this->model)); - $throughTable = $this->through->getTable(); - $pk = $this->throughPk; - $throughKey = $this->throughKey; - $modelTable = $this->parent->getTable(); - - if (false === strpos($field, '.')) { - $field = $alias . '.' . $field; - } - - return $this->query - ->alias($alias) - ->join($throughTable, $throughTable . '.' . $pk . '=' . $alias . '.' . $throughKey) - ->join($modelTable, $modelTable . '.' . $this->localKey . '=' . $throughTable . '.' . $this->foreignKey) - ->where($throughTable . '.' . $this->foreignKey, $result->$localKey) - ->$aggregate($field); - } - - /** - * 创建关联统计子查询 - * @access public - * @param Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param string $name 统计字段别名 - * @return string - */ - public function getRelationCountQuery($closure = null, $aggregate = 'count', $field = '*', &$name = null) - { - if ($closure instanceof Closure) { - $return = $closure($this->query); - if ($return && is_string($return)) { - $name = $return; - } - } - - $alias = App::parseName(App::classBaseName($this->model)); - $throughTable = $this->through->getTable(); - $pk = $this->throughPk; - $throughKey = $this->throughKey; - $modelTable = $this->parent->getTable(); - - if (false === strpos($field, '.')) { - $field = $alias . '.' . $field; - } - - return $this->query - ->alias($alias) - ->join($throughTable, $throughTable . '.' . $pk . '=' . $alias . '.' . $throughKey) - ->join($modelTable, $modelTable . '.' . $this->localKey . '=' . $throughTable . '.' . $this->foreignKey) - ->whereExp($throughTable . '.' . $this->foreignKey, '=' . $this->parent->getTable() . '.' . $this->localKey) - ->fetchSql() - ->$aggregate($field); - } - - /** - * 执行基础查询(仅执行一次) - * @access protected - * @return void - */ - protected function baseQuery() - { - if (empty($this->baseQuery) && $this->parent->getData()) { - $alias = Loader::parseName(basename(str_replace('\\', '/', $this->model))); - $throughTable = $this->through->getTable(); - $pk = $this->throughPk; - $throughKey = $this->throughKey; - $modelTable = $this->parent->getTable(); - $fields = $this->getQueryFields($alias); - - $this->query - ->field($fields) - ->alias($alias) - ->join($throughTable, $throughTable . '.' . $pk . '=' . $alias . '.' . $throughKey) - ->join($modelTable, $modelTable . '.' . $this->localKey . '=' . $throughTable . '.' . $this->foreignKey) - ->where($throughTable . '.' . $this->foreignKey, $this->parent->{$this->localKey}); - - $this->baseQuery = true; - } - } - -} diff --git a/thinkphp/library/think/model/relation/HasOne.php b/thinkphp/library/think/model/relation/HasOne.php deleted file mode 100644 index e036bba4..00000000 --- a/thinkphp/library/think/model/relation/HasOne.php +++ /dev/null @@ -1,294 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\model\relation; - -use Closure; -use think\db\Query; -use think\Loader; -use think\Model; - -class HasOne extends OneToOne -{ - /** - * 架构函数 - * @access public - * @param Model $parent 上级模型对象 - * @param string $model 模型名 - * @param string $foreignKey 关联外键 - * @param string $localKey 当前模型主键 - */ - public function __construct(Model $parent, $model, $foreignKey, $localKey) - { - $this->parent = $parent; - $this->model = $model; - $this->foreignKey = $foreignKey; - $this->localKey = $localKey; - $this->joinType = 'INNER'; - $this->query = (new $model)->db(); - - if (get_class($parent) == $model) { - $this->selfRelation = true; - } - } - - /** - * 延迟获取关联数据 - * @access public - * @param string $subRelation 子关联名 - * @param \Closure $closure 闭包查询条件 - * @return Model - */ - public function getRelation($subRelation = '', $closure = null) - { - $localKey = $this->localKey; - - if ($closure instanceof Closure) { - $closure($this->query); - } - - // 判断关联类型执行查询 - $relationModel = $this->query - ->removeWhereField($this->foreignKey) - ->where($this->foreignKey, $this->parent->$localKey) - ->relation($subRelation) - ->find(); - - if ($relationModel) { - $relationModel->setParent(clone $this->parent); - } - - return $relationModel; - } - - /** - * 创建关联统计子查询 - * @access public - * @param \Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param string $aggregateAlias 聚合字段别名 - * @return string - */ - public function getRelationCountQuery($closure, $aggregate = 'count', $field = '*', &$aggregateAlias = '') - { - if ($closure instanceof Closure) { - $return = $closure($this->query); - - if ($return && is_string($return)) { - $aggregateAlias = $return; - } - } - - return $this->query - ->whereExp($this->foreignKey, '=' . $this->parent->getTable() . '.' . $this->localKey) - ->fetchSql() - ->$aggregate($field); - } - - /** - * 关联统计 - * @access public - * @param Model $result 数据对象 - * @param \Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param string $name 统计字段别名 - * @return integer - */ - public function relationCount($result, $closure, $aggregate = 'count', $field = '*', &$name = '') - { - $localKey = $this->localKey; - - if (!isset($result->$localKey)) { - return 0; - } - - if ($closure instanceof Closure) { - $return = $closure($this->query); - if ($return && is_string($return)) { - $name = $return; - } - } - - return $this->query - ->where($this->foreignKey, '=', $result->$localKey) - ->$aggregate($field); - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param string $operator 比较操作符 - * @param integer $count 个数 - * @param string $id 关联表的统计字段 - * @param string $joinType JOIN类型 - * @return Query - */ - public function has($operator = '>=', $count = 1, $id = '*', $joinType = 'INNER') - { - $table = $this->query->getTable(); - $model = basename(str_replace('\\', '/', get_class($this->parent))); - $relation = basename(str_replace('\\', '/', $this->model)); - $localKey = $this->localKey; - $foreignKey = $this->foreignKey; - $softDelete = $this->query->getOptions('soft_delete'); - - return $this->parent->db() - ->alias($model) - ->whereExists(function ($query) use ($table, $model, $relation, $localKey, $foreignKey) { - $query->table([$table => $relation]) - ->field($relation . '.' . $foreignKey) - ->whereExp($model . '.' . $localKey, '=' . $relation . '.' . $foreignKey) - ->when($softDelete, function ($query) use ($softDelete, $relation) { - $query->where($relation . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null); - }); - }); - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param mixed $where 查询条件(数组或者闭包) - * @param mixed $fields 字段 - * @return Query - */ - public function hasWhere($where = [], $fields = null) - { - $table = $this->query->getTable(); - $model = basename(str_replace('\\', '/', get_class($this->parent))); - $relation = basename(str_replace('\\', '/', $this->model)); - - if (is_array($where)) { - $this->getQueryWhere($where, $relation); - } - - $fields = $this->getRelationQueryFields($fields, $model); - $softDelete = $this->query->getOptions('soft_delete'); - - return $this->parent->db() - ->alias($model) - ->field($fields) - ->join([$table => $relation], $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey, $this->joinType) - ->when($softDelete, function ($query) use ($softDelete, $relation) { - $query->where($relation . strstr($softDelete[0], '.'), '=' == $softDelete[1][0] ? $softDelete[1][1] : null); - }) - ->where($where); - } - - /** - * 预载入关联查询(数据集) - * @access protected - * @param array $resultSet 数据集 - * @param string $relation 当前关联名 - * @param string $subRelation 子关联名 - * @param \Closure $closure 闭包 - * @return void - */ - protected function eagerlySet(&$resultSet, $relation, $subRelation, $closure) - { - $localKey = $this->localKey; - $foreignKey = $this->foreignKey; - - $range = []; - foreach ($resultSet as $result) { - // 获取关联外键列表 - if (isset($result->$localKey)) { - $range[] = $result->$localKey; - } - } - - if (!empty($range)) { - $this->query->removeWhereField($foreignKey); - - $data = $this->eagerlyWhere([ - [$foreignKey, 'in', $range], - ], $foreignKey, $relation, $subRelation, $closure); - - // 关联属性名 - $attr = Loader::parseName($relation); - - // 关联数据封装 - foreach ($resultSet as $result) { - // 关联模型 - if (!isset($data[$result->$localKey])) { - $relationModel = null; - } else { - $relationModel = $data[$result->$localKey]; - $relationModel->setParent(clone $result); - $relationModel->isUpdate(true); - } - - if (!empty($this->bindAttr)) { - // 绑定关联属性 - $this->bindAttr($relationModel, $result, $this->bindAttr); - } else { - // 设置关联属性 - $result->setRelation($attr, $relationModel); - } - } - } - } - - /** - * 预载入关联查询(数据) - * @access protected - * @param Model $result 数据对象 - * @param string $relation 当前关联名 - * @param string $subRelation 子关联名 - * @param \Closure $closure 闭包 - * @return void - */ - protected function eagerlyOne(&$result, $relation, $subRelation, $closure) - { - $localKey = $this->localKey; - $foreignKey = $this->foreignKey; - - $this->query->removeWhereField($foreignKey); - - $data = $this->eagerlyWhere([ - [$foreignKey, '=', $result->$localKey], - ], $foreignKey, $relation, $subRelation, $closure); - - // 关联模型 - if (!isset($data[$result->$localKey])) { - $relationModel = null; - } else { - $relationModel = $data[$result->$localKey]; - $relationModel->setParent(clone $result); - $relationModel->isUpdate(true); - } - - if (!empty($this->bindAttr)) { - // 绑定关联属性 - $this->bindAttr($relationModel, $result, $this->bindAttr); - } else { - $result->setRelation(Loader::parseName($relation), $relationModel); - } - } - - /** - * 执行基础查询(仅执行一次) - * @access protected - * @return void - */ - protected function baseQuery() - { - if (empty($this->baseQuery)) { - if (isset($this->parent->{$this->localKey})) { - // 关联查询带入关联条件 - $this->query->where($this->foreignKey, '=', $this->parent->{$this->localKey}); - } - - $this->baseQuery = true; - } - } -} diff --git a/thinkphp/library/think/model/relation/MorphMany.php b/thinkphp/library/think/model/relation/MorphMany.php deleted file mode 100644 index d2af66e9..00000000 --- a/thinkphp/library/think/model/relation/MorphMany.php +++ /dev/null @@ -1,342 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\model\relation; - -use Closure; -use think\db\Query; -use think\Exception; -use think\Loader; -use think\Model; -use think\model\Relation; - -class MorphMany extends Relation -{ - // 多态字段 - protected $morphKey; - protected $morphType; - // 多态类型 - protected $type; - - /** - * 架构函数 - * @access public - * @param Model $parent 上级模型对象 - * @param string $model 模型名 - * @param string $morphKey 关联外键 - * @param string $morphType 多态字段名 - * @param string $type 多态类型 - */ - public function __construct(Model $parent, $model, $morphKey, $morphType, $type) - { - $this->parent = $parent; - $this->model = $model; - $this->type = $type; - $this->morphKey = $morphKey; - $this->morphType = $morphType; - $this->query = (new $model)->db(); - } - - /** - * 延迟获取关联数据 - * @access public - * @param string $subRelation 子关联名 - * @param \Closure $closure 闭包查询条件 - * @return \think\Collection - */ - public function getRelation($subRelation = '', $closure = null) - { - if ($closure instanceof Closure) { - $closure($this->query); - } - - $this->baseQuery(); - - $list = $this->query->relation($subRelation)->select(); - $parent = clone $this->parent; - - foreach ($list as &$model) { - $model->setParent($parent); - } - - return $list; - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param string $operator 比较操作符 - * @param integer $count 个数 - * @param string $id 关联表的统计字段 - * @param string $joinType JOIN类型 - * @return Query - */ - public function has($operator = '>=', $count = 1, $id = '*', $joinType = 'INNER') - { - throw new Exception('relation not support: has'); - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param mixed $where 查询条件(数组或者闭包) - * @param mixed $fields 字段 - * @return Query - */ - public function hasWhere($where = [], $fields = null) - { - throw new Exception('relation not support: hasWhere'); - } - - /** - * 预载入关联查询 - * @access public - * @param array $resultSet 数据集 - * @param string $relation 当前关联名 - * @param string $subRelation 子关联名 - * @param \Closure $closure 闭包 - * @return void - */ - public function eagerlyResultSet(&$resultSet, $relation, $subRelation, $closure) - { - $morphType = $this->morphType; - $morphKey = $this->morphKey; - $type = $this->type; - $range = []; - - foreach ($resultSet as $result) { - $pk = $result->getPk(); - // 获取关联外键列表 - if (isset($result->$pk)) { - $range[] = $result->$pk; - } - } - - if (!empty($range)) { - $where = [ - [$morphKey, 'in', $range], - [$morphType, '=', $type], - ]; - $data = $this->eagerlyMorphToMany($where, $relation, $subRelation, $closure); - - // 关联属性名 - $attr = Loader::parseName($relation); - - // 关联数据封装 - foreach ($resultSet as $result) { - if (!isset($data[$result->$pk])) { - $data[$result->$pk] = []; - } - - foreach ($data[$result->$pk] as &$relationModel) { - $relationModel->setParent(clone $result); - $relationModel->isUpdate(true); - } - - $result->setRelation($attr, $this->resultSetBuild($data[$result->$pk])); - } - } - } - - /** - * 预载入关联查询 - * @access public - * @param Model $result 数据对象 - * @param string $relation 当前关联名 - * @param string $subRelation 子关联名 - * @param \Closure $closure 闭包 - * @return void - */ - public function eagerlyResult(&$result, $relation, $subRelation, $closure) - { - $pk = $result->getPk(); - - if (isset($result->$pk)) { - $key = $result->$pk; - $where = [ - [$this->morphKey, '=', $key], - [$this->morphType, '=', $this->type], - ]; - $data = $this->eagerlyMorphToMany($where, $relation, $subRelation, $closure); - - if (!isset($data[$key])) { - $data[$key] = []; - } - - foreach ($data[$key] as &$relationModel) { - $relationModel->setParent(clone $result); - $relationModel->isUpdate(true); - } - - $result->setRelation(Loader::parseName($relation), $this->resultSetBuild($data[$key])); - } - } - - /** - * 关联统计 - * @access public - * @param Model $result 数据对象 - * @param \Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param string $name 统计字段别名 - * @return integer - */ - public function relationCount($result, $closure, $aggregate = 'count', $field = '*', &$name = '') - { - $pk = $result->getPk(); - - if (!isset($result->$pk)) { - return 0; - } - - if ($closure instanceof Closure) { - $return = $closure($this->query); - - if ($return && is_string($return)) { - $name = $return; - } - } - - return $this->query - ->where([ - [$this->morphKey, '=', $result->$pk], - [$this->morphType, '=', $this->type], - ]) - ->$aggregate($field); - } - - /** - * 获取关联统计子查询 - * @access public - * @param \Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param string $aggregateAlias 聚合字段别名 - * @return string - */ - public function getRelationCountQuery($closure, $aggregate = 'count', $field = '*', &$aggregateAlias = '') - { - if ($closure instanceof Closure) { - $return = $closure($this->query); - - if ($return && is_string($return)) { - $aggregateAlias = $return; - } - } - - return $this->query - ->whereExp($this->morphKey, '=' . $this->parent->getTable() . '.' . $this->parent->getPk()) - ->where($this->morphType, '=', $this->type) - ->fetchSql() - ->$aggregate($field); - } - - /** - * 多态一对多 关联模型预查询 - * @access protected - * @param array $where 关联预查询条件 - * @param string $relation 关联名 - * @param string $subRelation 子关联 - * @param \Closure $closure 闭包 - * @return array - */ - protected function eagerlyMorphToMany($where, $relation, $subRelation = '', $closure = null) - { - // 预载入关联查询 支持嵌套预载入 - $this->query->removeOption('where'); - - if ($closure instanceof Closure) { - $closure($this->query); - } - - $list = $this->query->where($where)->with($subRelation)->select(); - $morphKey = $this->morphKey; - - // 组装模型数据 - $data = []; - foreach ($list as $set) { - $data[$set->$morphKey][] = $set; - } - - return $data; - } - - /** - * 保存(新增)当前关联数据对象 - * @access public - * @param mixed $data 数据 - * @return Model|false - */ - public function save($data) - { - $model = $this->make(); - - return $model->save($data) ? $model : false; - } - - /** - * 创建关联对象实例 - * @param array $data - * @return Model - */ - public function make($data = []) - { - if ($data instanceof Model) { - $data = $data->getData(); - } - - // 保存关联表数据 - $pk = $this->parent->getPk(); - - $data[$this->morphKey] = $this->parent->$pk; - $data[$this->morphType] = $this->type; - - return new $this->model($data); - } - - /** - * 批量保存当前关联数据对象 - * @access public - * @param array $dataSet 数据集 - * @return array|false - */ - public function saveAll(array $dataSet) - { - $result = []; - - foreach ($dataSet as $key => $data) { - $result[] = $this->save($data); - } - - return empty($result) ? false : $result; - } - - /** - * 执行基础查询(仅执行一次) - * @access protected - * @return void - */ - protected function baseQuery() - { - if (empty($this->baseQuery) && $this->parent->getData()) { - $pk = $this->parent->getPk(); - - $this->query->where([ - [$this->morphKey, '=', $this->parent->$pk], - [$this->morphType, '=', $this->type], - ]); - - $this->baseQuery = true; - } - } - -} diff --git a/thinkphp/library/think/model/relation/MorphOne.php b/thinkphp/library/think/model/relation/MorphOne.php deleted file mode 100644 index 6bc205c5..00000000 --- a/thinkphp/library/think/model/relation/MorphOne.php +++ /dev/null @@ -1,257 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\model\relation; - -use Closure; -use think\db\Query; -use think\Exception; -use think\Loader; -use think\Model; -use think\model\Relation; - -class MorphOne extends Relation -{ - // 多态字段 - protected $morphKey; - protected $morphType; - // 多态类型 - protected $type; - - /** - * 构造函数 - * @access public - * @param Model $parent 上级模型对象 - * @param string $model 模型名 - * @param string $morphKey 关联外键 - * @param string $morphType 多态字段名 - * @param string $type 多态类型 - */ - public function __construct(Model $parent, $model, $morphKey, $morphType, $type) - { - $this->parent = $parent; - $this->model = $model; - $this->type = $type; - $this->morphKey = $morphKey; - $this->morphType = $morphType; - $this->query = (new $model)->db(); - } - - /** - * 延迟获取关联数据 - * @access public - * @param string $subRelation 子关联名 - * @param \Closure $closure 闭包查询条件 - * @return Model - */ - public function getRelation($subRelation = '', $closure = null) - { - if ($closure instanceof Closure) { - $closure($this->query); - } - - $this->baseQuery(); - - $relationModel = $this->query->relation($subRelation)->find(); - - if ($relationModel) { - $relationModel->setParent(clone $this->parent); - } - - return $relationModel; - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param string $operator 比较操作符 - * @param integer $count 个数 - * @param string $id 关联表的统计字段 - * @param string $joinType JOIN类型 - * @return Query - */ - public function has($operator = '>=', $count = 1, $id = '*', $joinType = 'INNER') - { - return $this->parent; - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param mixed $where 查询条件(数组或者闭包) - * @param mixed $fields 字段 - * @return Query - */ - public function hasWhere($where = [], $fields = null) - { - throw new Exception('relation not support: hasWhere'); - } - - /** - * 预载入关联查询 - * @access public - * @param array $resultSet 数据集 - * @param string $relation 当前关联名 - * @param string $subRelation 子关联名 - * @param \Closure $closure 闭包 - * @return void - */ - public function eagerlyResultSet(&$resultSet, $relation, $subRelation, $closure) - { - $morphType = $this->morphType; - $morphKey = $this->morphKey; - $type = $this->type; - $range = []; - - foreach ($resultSet as $result) { - $pk = $result->getPk(); - // 获取关联外键列表 - if (isset($result->$pk)) { - $range[] = $result->$pk; - } - } - - if (!empty($range)) { - $data = $this->eagerlyMorphToOne([ - [$morphKey, 'in', $range], - [$morphType, '=', $type], - ], $relation, $subRelation, $closure); - - // 关联属性名 - $attr = Loader::parseName($relation); - - // 关联数据封装 - foreach ($resultSet as $result) { - if (!isset($data[$result->$pk])) { - $relationModel = null; - } else { - $relationModel = $data[$result->$pk]; - $relationModel->setParent(clone $result); - $relationModel->isUpdate(true); - } - - $result->setRelation($attr, $relationModel); - } - } - } - - /** - * 预载入关联查询 - * @access public - * @param Model $result 数据对象 - * @param string $relation 当前关联名 - * @param string $subRelation 子关联名 - * @param \Closure $closure 闭包 - * @return void - */ - public function eagerlyResult(&$result, $relation, $subRelation, $closure) - { - $pk = $result->getPk(); - - if (isset($result->$pk)) { - $pk = $result->$pk; - $data = $this->eagerlyMorphToOne([ - [$this->morphKey, '=', $pk], - [$this->morphType, '=', $this->type], - ], $relation, $subRelation, $closure); - - if (isset($data[$pk])) { - $relationModel = $data[$pk]; - $relationModel->setParent(clone $result); - $relationModel->isUpdate(true); - } else { - $relationModel = null; - } - - $result->setRelation(Loader::parseName($relation), $relationModel); - } - } - - /** - * 多态一对一 关联模型预查询 - * @access protected - * @param array $where 关联预查询条件 - * @param string $relation 关联名 - * @param string $subRelation 子关联 - * @param \Closure $closure 闭包 - * @return array - */ - protected function eagerlyMorphToOne($where, $relation, $subRelation = '', $closure = null) - { - // 预载入关联查询 支持嵌套预载入 - if ($closure instanceof Closure) { - $closure($this->query); - } - - $list = $this->query->where($where)->with($subRelation)->select(); - $morphKey = $this->morphKey; - - // 组装模型数据 - $data = []; - - foreach ($list as $set) { - $data[$set->$morphKey] = $set; - } - - return $data; - } - - /** - * 保存(新增)当前关联数据对象 - * @access public - * @param mixed $data 数据 - * @return Model|false - */ - public function save($data) - { - $model = $this->make(); - return $model->save($data) ? $model : false; - } - - /** - * 创建关联对象实例 - * @param array $data - * @return Model - */ - public function make($data = []) - { - if ($data instanceof Model) { - $data = $data->getData(); - } - - // 保存关联表数据 - $pk = $this->parent->getPk(); - - $data[$this->morphKey] = $this->parent->$pk; - $data[$this->morphType] = $this->type; - - return new $this->model($data); - } - - /** - * 执行基础查询(进执行一次) - * @access protected - * @return void - */ - protected function baseQuery() - { - if (empty($this->baseQuery) && $this->parent->getData()) { - $pk = $this->parent->getPk(); - - $this->query->where([ - [$this->morphKey, '=', $this->parent->$pk], - [$this->morphType, '=', $this->type], - ]); - $this->baseQuery = true; - } - } - -} diff --git a/thinkphp/library/think/model/relation/MorphTo.php b/thinkphp/library/think/model/relation/MorphTo.php deleted file mode 100644 index 17771ce8..00000000 --- a/thinkphp/library/think/model/relation/MorphTo.php +++ /dev/null @@ -1,308 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\model\relation; - -use Closure; -use think\Exception; -use think\Loader; -use think\Model; -use think\model\Relation; - -class MorphTo extends Relation -{ - // 多态字段 - protected $morphKey; - protected $morphType; - // 多态别名 - protected $alias; - // 关联名 - protected $relation; - - /** - * 架构函数 - * @access public - * @param Model $parent 上级模型对象 - * @param string $morphType 多态字段名 - * @param string $morphKey 外键名 - * @param array $alias 多态别名定义 - * @param string $relation 关联名 - */ - public function __construct(Model $parent, $morphType, $morphKey, $alias = [], $relation = null) - { - $this->parent = $parent; - $this->morphType = $morphType; - $this->morphKey = $morphKey; - $this->alias = $alias; - $this->relation = $relation; - } - - /** - * 获取当前的关联模型类的实例 - * @access public - * @return Model - */ - public function getModel() - { - $morphType = $this->morphType; - $model = $this->parseModel($this->parent->$morphType); - - return (new $model); - } - - /** - * 延迟获取关联数据 - * @access public - * @param string $subRelation 子关联名 - * @param \Closure $closure 闭包查询条件 - * @return Model - */ - public function getRelation($subRelation = '', $closure = null) - { - $morphKey = $this->morphKey; - $morphType = $this->morphType; - - // 多态模型 - $model = $this->parseModel($this->parent->$morphType); - - // 主键数据 - $pk = $this->parent->$morphKey; - - $relationModel = (new $model)->relation($subRelation)->find($pk); - - if ($relationModel) { - $relationModel->setParent(clone $this->parent); - } - - return $relationModel; - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param string $operator 比较操作符 - * @param integer $count 个数 - * @param string $id 关联表的统计字段 - * @param string $joinType JOIN类型 - * @return Query - */ - public function has($operator = '>=', $count = 1, $id = '*', $joinType = 'INNER') - { - return $this->parent; - } - - /** - * 根据关联条件查询当前模型 - * @access public - * @param mixed $where 查询条件(数组或者闭包) - * @param mixed $fields 字段 - * @return Query - */ - public function hasWhere($where = [], $fields = null) - { - throw new Exception('relation not support: hasWhere'); - } - - /** - * 解析模型的完整命名空间 - * @access protected - * @param string $model 模型名(或者完整类名) - * @return string - */ - protected function parseModel($model) - { - if (isset($this->alias[$model])) { - $model = $this->alias[$model]; - } - - if (false === strpos($model, '\\')) { - $path = explode('\\', get_class($this->parent)); - array_pop($path); - array_push($path, Loader::parseName($model, 1)); - $model = implode('\\', $path); - } - - return $model; - } - - /** - * 设置多态别名 - * @access public - * @param array $alias 别名定义 - * @return $this - */ - public function setAlias($alias) - { - $this->alias = $alias; - - return $this; - } - - /** - * 移除关联查询参数 - * @access public - * @return $this - */ - public function removeOption() - { - return $this; - } - - /** - * 预载入关联查询 - * @access public - * @param array $resultSet 数据集 - * @param string $relation 当前关联名 - * @param string $subRelation 子关联名 - * @param \Closure $closure 闭包 - * @return void - * @throws Exception - */ - public function eagerlyResultSet(&$resultSet, $relation, $subRelation, $closure) - { - $morphKey = $this->morphKey; - $morphType = $this->morphType; - $range = []; - - foreach ($resultSet as $result) { - // 获取关联外键列表 - if (!empty($result->$morphKey)) { - $range[$result->$morphType][] = $result->$morphKey; - } - } - - if (!empty($range)) { - // 关联属性名 - $attr = Loader::parseName($relation); - - foreach ($range as $key => $val) { - // 多态类型映射 - $model = $this->parseModel($key); - $obj = new $model; - $pk = $obj->getPk(); - $list = $obj->all($val, $subRelation); - $data = []; - - foreach ($list as $k => $vo) { - $data[$vo->$pk] = $vo; - } - - foreach ($resultSet as $result) { - if ($key == $result->$morphType) { - // 关联模型 - if (!isset($data[$result->$morphKey])) { - $relationModel = null; - } else { - $relationModel = $data[$result->$morphKey]; - $relationModel->setParent(clone $result); - $relationModel->isUpdate(true); - } - - $result->setRelation($attr, $relationModel); - } - } - } - } - } - - /** - * 预载入关联查询 - * @access public - * @param Model $result 数据对象 - * @param string $relation 当前关联名 - * @param string $subRelation 子关联名 - * @param \Closure $closure 闭包 - * @return void - */ - public function eagerlyResult(&$result, $relation, $subRelation, $closure) - { - $morphKey = $this->morphKey; - $morphType = $this->morphType; - // 多态类型映射 - $model = $this->parseModel($result->{$this->morphType}); - - $this->eagerlyMorphToOne($model, $relation, $result, $subRelation); - } - - /** - * 关联统计 - * @access public - * @param Model $result 数据对象 - * @param \Closure $closure 闭包 - * @param string $aggregate 聚合查询方法 - * @param string $field 字段 - * @param string $name 统计字段别名 - * @return integer - */ - public function relationCount($result, $closure, $aggregate = 'count', $field = '*', &$name = '') - {} - - /** - * 多态MorphTo 关联模型预查询 - * @access protected - * @param string $model 关联模型对象 - * @param string $relation 关联名 - * @param Model $result - * @param string $subRelation 子关联 - * @return void - */ - protected function eagerlyMorphToOne($model, $relation, &$result, $subRelation = '') - { - // 预载入关联查询 支持嵌套预载入 - $pk = $this->parent->{$this->morphKey}; - $data = (new $model)->with($subRelation)->find($pk); - - if ($data) { - $data->setParent(clone $result); - $data->isUpdate(true); - } - - $result->setRelation(Loader::parseName($relation), $data ?: null); - } - - /** - * 添加关联数据 - * @access public - * @param Model $model 关联模型对象 - * @param string $type 多态类型 - * @return Model - */ - public function associate($model, $type = '') - { - $morphKey = $this->morphKey; - $morphType = $this->morphType; - $pk = $model->getPk(); - - $this->parent->setAttr($morphKey, $model->$pk); - $this->parent->setAttr($morphType, $type ?: get_class($model)); - $this->parent->save(); - - return $this->parent->setRelation($this->relation, $model); - } - - /** - * 注销关联数据 - * @access public - * @return Model - */ - public function dissociate() - { - $morphKey = $this->morphKey; - $morphType = $this->morphType; - - $this->parent->setAttr($morphKey, null); - $this->parent->setAttr($morphType, null); - $this->parent->save(); - - return $this->parent->setRelation($this->relation, null); - } - -} diff --git a/thinkphp/library/think/model/relation/OneToOne.php b/thinkphp/library/think/model/relation/OneToOne.php deleted file mode 100644 index a0333c86..00000000 --- a/thinkphp/library/think/model/relation/OneToOne.php +++ /dev/null @@ -1,335 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\model\relation; - -use Closure; -use think\db\Query; -use think\Exception; -use think\Loader; -use think\Model; -use think\model\Relation; - -/** - * Class OneToOne - * @package think\model\relation - * - */ -abstract class OneToOne extends Relation -{ - // 预载入方式 0 -JOIN 1 -IN - protected $eagerlyType = 1; - // 当前关联的JOIN类型 - protected $joinType; - // 要绑定的属性 - protected $bindAttr = []; - // 关联名 - protected $relation; - - /** - * 设置join类型 - * @access public - * @param string $type JOIN类型 - * @return $this - */ - public function joinType($type) - { - $this->joinType = $type; - return $this; - } - - /** - * 预载入关联查询(JOIN方式) - * @access public - * @param Query $query 查询对象 - * @param string $relation 关联名 - * @param mixed $field 关联字段 - * @param string $joinType JOIN方式 - * @param \Closure $closure 闭包条件 - * @param bool $first - * @return void - */ - public function eagerly(Query $query, $relation, $field, $joinType, $closure, $first) - { - $name = Loader::parseName(basename(str_replace('\\', '/', get_class($this->parent)))); - - if ($first) { - $table = $query->getTable(); - $query->table([$table => $name]); - - if ($query->getOptions('field')) { - $masterField = $query->getOptions('field'); - $query->removeOption('field'); - } else { - $masterField = true; - } - - $query->field($masterField, false, $table, $name); - } - - // 预载入封装 - $joinTable = $this->query->getTable(); - $joinAlias = $relation; - $joinType = $joinType ?: $this->joinType; - - $query->via($joinAlias); - - if ($this instanceof BelongsTo) { - $joinOn = $name . '.' . $this->foreignKey . '=' . $joinAlias . '.' . $this->localKey; - } else { - $joinOn = $name . '.' . $this->localKey . '=' . $joinAlias . '.' . $this->foreignKey; - } - - if ($closure instanceof Closure) { - // 执行闭包查询 - $closure($query); - // 使用withField指定获取关联的字段,如 - // $query->where(['id'=>1])->withField('id,name'); - if ($query->getOptions('with_field')) { - $field = $query->getOptions('with_field'); - $query->removeOption('with_field'); - } - } - - $query->join([$joinTable => $joinAlias], $joinOn, $joinType) - ->field($field, false, $joinTable, $joinAlias, $relation . '__'); - } - - /** - * 预载入关联查询(数据集) - * @access protected - * @param array $resultSet - * @param string $relation - * @param string $subRelation - * @param \Closure $closure - * @return mixed - */ - abstract protected function eagerlySet(&$resultSet, $relation, $subRelation, $closure); - - /** - * 预载入关联查询(数据) - * @access protected - * @param Model $result - * @param string $relation - * @param string $subRelation - * @param \Closure $closure - * @return mixed - */ - abstract protected function eagerlyOne(&$result, $relation, $subRelation, $closure); - - /** - * 预载入关联查询(数据集) - * @access public - * @param array $resultSet 数据集 - * @param string $relation 当前关联名 - * @param string $subRelation 子关联名 - * @param \Closure $closure 闭包 - * @param bool $join 是否为JOIN方式 - * @return void - */ - public function eagerlyResultSet(&$resultSet, $relation, $subRelation, $closure, $join = false) - { - if ($join || 0 == $this->eagerlyType) { - // 模型JOIN关联组装 - foreach ($resultSet as $result) { - $this->match($this->model, $relation, $result); - } - } else { - // IN查询 - $this->eagerlySet($resultSet, $relation, $subRelation, $closure); - } - } - - /** - * 预载入关联查询(数据) - * @access public - * @param Model $result 数据对象 - * @param string $relation 当前关联名 - * @param string $subRelation 子关联名 - * @param \Closure $closure 闭包 - * @param bool $join 是否为JOIN方式 - * @return void - */ - public function eagerlyResult(&$result, $relation, $subRelation, $closure, $join = false) - { - if (0 == $this->eagerlyType || $join) { - // 模型JOIN关联组装 - $this->match($this->model, $relation, $result); - } else { - // IN查询 - $this->eagerlyOne($result, $relation, $subRelation, $closure); - } - } - - /** - * 保存(新增)当前关联数据对象 - * @access public - * @param mixed $data 数据 可以使用数组 关联模型对象 和 关联对象的主键 - * @return Model|false - */ - public function save($data) - { - if ($data instanceof Model) { - $data = $data->getData(); - } - - $model = new $this->model; - // 保存关联表数据 - $data[$this->foreignKey] = $this->parent->{$this->localKey}; - - return $model->save($data) ? $model : false; - } - - /** - * 设置预载入方式 - * @access public - * @param integer $type 预载入方式 0 JOIN查询 1 IN查询 - * @return $this - */ - public function setEagerlyType($type) - { - $this->eagerlyType = $type; - - return $this; - } - - /** - * 获取预载入方式 - * @access public - * @return integer - */ - public function getEagerlyType() - { - return $this->eagerlyType; - } - - /** - * 绑定关联表的属性到父模型属性 - * @access public - * @param mixed $attr 要绑定的属性列表 - * @return $this - */ - public function bind($attr) - { - if (is_string($attr)) { - $attr = explode(',', $attr); - } - $this->bindAttr = $attr; - - return $this; - } - - /** - * 获取绑定属性 - * @access public - * @return array - */ - public function getBindAttr() - { - return $this->bindAttr; - } - - /** - * 一对一 关联模型预查询拼装 - * @access public - * @param string $model 模型名称 - * @param string $relation 关联名 - * @param Model $result 模型对象实例 - * @return void - */ - protected function match($model, $relation, &$result) - { - // 重新组装模型数据 - foreach ($result->getData() as $key => $val) { - if (strpos($key, '__')) { - list($name, $attr) = explode('__', $key, 2); - if ($name == $relation) { - $list[$name][$attr] = $val; - unset($result->$key); - } - } - } - - if (isset($list[$relation])) { - $array = array_unique($list[$relation]); - - if (count($array) == 1 && null === current($array)) { - $relationModel = null; - } else { - $relationModel = new $model($list[$relation]); - $relationModel->setParent(clone $result); - $relationModel->isUpdate(true); - } - - if (!empty($this->bindAttr)) { - $this->bindAttr($relationModel, $result, $this->bindAttr); - } - } else { - $relationModel = null; - } - - $result->setRelation(Loader::parseName($relation), $relationModel); - } - - /** - * 绑定关联属性到父模型 - * @access protected - * @param Model $model 关联模型对象 - * @param Model $result 父模型对象 - * @return void - * @throws Exception - */ - protected function bindAttr($model, &$result) - { - foreach ($this->bindAttr as $key => $attr) { - $key = is_numeric($key) ? $attr : $key; - if (isset($result->$key)) { - throw new Exception('bind attr has exists:' . $key); - } else { - $result->setAttr($key, $model ? $model->$attr : null); - } - } - } - - /** - * 一对一 关联模型预查询(IN方式) - * @access public - * @param array $where 关联预查询条件 - * @param string $key 关联键名 - * @param string $relation 关联名 - * @param string $subRelation 子关联 - * @param \Closure $closure - * @return array - */ - protected function eagerlyWhere($where, $key, $relation, $subRelation = '', $closure = null) - { - // 预载入关联查询 支持嵌套预载入 - if ($closure instanceof Closure) { - $closure($this->query); - - if ($field = $this->query->getOptions('with_field')) { - $this->query->field($field)->removeOption('with_field'); - } - } - - $list = $this->query->where($where)->with($subRelation)->select(); - - // 组装模型数据 - $data = []; - - foreach ($list as $set) { - $data[$set->$key] = $set; - } - - return $data; - } - -} diff --git a/thinkphp/library/think/paginator/driver/Bootstrap.php b/thinkphp/library/think/paginator/driver/Bootstrap.php deleted file mode 100644 index ab5315c0..00000000 --- a/thinkphp/library/think/paginator/driver/Bootstrap.php +++ /dev/null @@ -1,206 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\paginator\driver; - -use think\Paginator; - -class Bootstrap extends Paginator -{ - - /** - * 上一页按钮 - * @param string $text - * @return string - */ - protected function getPreviousButton($text = "«") - { - - if ($this->currentPage() <= 1) { - return $this->getDisabledTextWrapper($text); - } - - $url = $this->url( - $this->currentPage() - 1 - ); - - return $this->getPageLinkWrapper($url, $text); - } - - /** - * 下一页按钮 - * @param string $text - * @return string - */ - protected function getNextButton($text = '»') - { - if (!$this->hasMore) { - return $this->getDisabledTextWrapper($text); - } - - $url = $this->url($this->currentPage() + 1); - - return $this->getPageLinkWrapper($url, $text); - } - - /** - * 页码按钮 - * @return string - */ - protected function getLinks() - { - if ($this->simple) { - return ''; - } - - $block = [ - 'first' => null, - 'slider' => null, - 'last' => null, - ]; - - $side = 3; - $window = $side * 2; - - if ($this->lastPage < $window + 6) { - $block['first'] = $this->getUrlRange(1, $this->lastPage); - } elseif ($this->currentPage <= $window) { - $block['first'] = $this->getUrlRange(1, $window + 2); - $block['last'] = $this->getUrlRange($this->lastPage - 1, $this->lastPage); - } elseif ($this->currentPage > ($this->lastPage - $window)) { - $block['first'] = $this->getUrlRange(1, 2); - $block['last'] = $this->getUrlRange($this->lastPage - ($window + 2), $this->lastPage); - } else { - $block['first'] = $this->getUrlRange(1, 2); - $block['slider'] = $this->getUrlRange($this->currentPage - $side, $this->currentPage + $side); - $block['last'] = $this->getUrlRange($this->lastPage - 1, $this->lastPage); - } - - $html = ''; - - if (is_array($block['first'])) { - $html .= $this->getUrlLinks($block['first']); - } - - if (is_array($block['slider'])) { - $html .= $this->getDots(); - $html .= $this->getUrlLinks($block['slider']); - } - - if (is_array($block['last'])) { - $html .= $this->getDots(); - $html .= $this->getUrlLinks($block['last']); - } - - return $html; - } - - /** - * 渲染分页html - * @return mixed - */ - public function render() - { - if ($this->hasPages()) { - if ($this->simple) { - return sprintf( - '
    %s %s
', - $this->getPreviousButton(), - $this->getNextButton() - ); - } else { - return sprintf( - '
    %s %s %s
', - $this->getPreviousButton(), - $this->getLinks(), - $this->getNextButton() - ); - } - } - } - - /** - * 生成一个可点击的按钮 - * - * @param string $url - * @param int $page - * @return string - */ - protected function getAvailablePageWrapper($url, $page) - { - return '
  • ' . $page . '
  • '; - } - - /** - * 生成一个禁用的按钮 - * - * @param string $text - * @return string - */ - protected function getDisabledTextWrapper($text) - { - return '
  • ' . $text . '
  • '; - } - - /** - * 生成一个激活的按钮 - * - * @param string $text - * @return string - */ - protected function getActivePageWrapper($text) - { - return '
  • ' . $text . '
  • '; - } - - /** - * 生成省略号按钮 - * - * @return string - */ - protected function getDots() - { - return $this->getDisabledTextWrapper('...'); - } - - /** - * 批量生成页码按钮. - * - * @param array $urls - * @return string - */ - protected function getUrlLinks(array $urls) - { - $html = ''; - - foreach ($urls as $page => $url) { - $html .= $this->getPageLinkWrapper($url, $page); - } - - return $html; - } - - /** - * 生成普通页码按钮 - * - * @param string $url - * @param int $page - * @return string - */ - protected function getPageLinkWrapper($url, $page) - { - if ($this->currentPage() == $page) { - return $this->getActivePageWrapper($page); - } - - return $this->getAvailablePageWrapper($url, $page); - } -} diff --git a/thinkphp/library/think/process/Builder.php b/thinkphp/library/think/process/Builder.php deleted file mode 100644 index da561639..00000000 --- a/thinkphp/library/think/process/Builder.php +++ /dev/null @@ -1,233 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\process; - -use think\Process; - -class Builder -{ - private $arguments; - private $cwd; - private $env = null; - private $input; - private $timeout = 60; - private $options = []; - private $inheritEnv = true; - private $prefix = []; - private $outputDisabled = false; - - /** - * 构造方法 - * @param string[] $arguments 参数 - */ - public function __construct(array $arguments = []) - { - $this->arguments = $arguments; - } - - /** - * 创建一个实例 - * @param string[] $arguments 参数 - * @return self - */ - public static function create(array $arguments = []) - { - return new static($arguments); - } - - /** - * 添加一个参数 - * @param string $argument 参数 - * @return self - */ - public function add($argument) - { - $this->arguments[] = $argument; - - return $this; - } - - /** - * 添加一个前缀 - * @param string|array $prefix - * @return self - */ - public function setPrefix($prefix) - { - $this->prefix = is_array($prefix) ? $prefix : [$prefix]; - - return $this; - } - - /** - * 设置参数 - * @param string[] $arguments - * @return self - */ - public function setArguments(array $arguments) - { - $this->arguments = $arguments; - - return $this; - } - - /** - * 设置工作目录 - * @param null|string $cwd - * @return self - */ - public function setWorkingDirectory($cwd) - { - $this->cwd = $cwd; - - return $this; - } - - /** - * 是否初始化环境变量 - * @param bool $inheritEnv - * @return self - */ - public function inheritEnvironmentVariables($inheritEnv = true) - { - $this->inheritEnv = $inheritEnv; - - return $this; - } - - /** - * 设置环境变量 - * @param string $name - * @param null|string $value - * @return self - */ - public function setEnv($name, $value) - { - $this->env[$name] = $value; - - return $this; - } - - /** - * 添加环境变量 - * @param array $variables - * @return self - */ - public function addEnvironmentVariables(array $variables) - { - $this->env = array_replace($this->env, $variables); - - return $this; - } - - /** - * 设置输入 - * @param mixed $input - * @return self - */ - public function setInput($input) - { - $this->input = Utils::validateInput(sprintf('%s::%s', __CLASS__, __FUNCTION__), $input); - - return $this; - } - - /** - * 设置超时时间 - * @param float|null $timeout - * @return self - */ - public function setTimeout($timeout) - { - if (null === $timeout) { - $this->timeout = null; - - return $this; - } - - $timeout = (float) $timeout; - - if ($timeout < 0) { - throw new \InvalidArgumentException('The timeout value must be a valid positive integer or float number.'); - } - - $this->timeout = $timeout; - - return $this; - } - - /** - * 设置proc_open选项 - * @param string $name - * @param string $value - * @return self - */ - public function setOption($name, $value) - { - $this->options[$name] = $value; - - return $this; - } - - /** - * 禁止输出 - * @return self - */ - public function disableOutput() - { - $this->outputDisabled = true; - - return $this; - } - - /** - * 开启输出 - * @return self - */ - public function enableOutput() - { - $this->outputDisabled = false; - - return $this; - } - - /** - * 创建一个Process实例 - * @return Process - */ - public function getProcess() - { - if (0 === count($this->prefix) && 0 === count($this->arguments)) { - throw new \LogicException('You must add() command arguments before calling getProcess().'); - } - - $options = $this->options; - - $arguments = array_merge($this->prefix, $this->arguments); - $script = implode(' ', array_map([__NAMESPACE__ . '\\Utils', 'escapeArgument'], $arguments)); - - if ($this->inheritEnv) { - // include $_ENV for BC purposes - $env = array_replace($_ENV, $_SERVER, $this->env); - } else { - $env = $this->env; - } - - $process = new Process($script, $this->cwd, $env, $this->input, $this->timeout, $options); - - if ($this->outputDisabled) { - $process->disableOutput(); - } - - return $process; - } -} diff --git a/thinkphp/library/think/process/Utils.php b/thinkphp/library/think/process/Utils.php deleted file mode 100644 index f94c6488..00000000 --- a/thinkphp/library/think/process/Utils.php +++ /dev/null @@ -1,75 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\process; - -class Utils -{ - - /** - * 转义字符串 - * @param string $argument - * @return string - */ - public static function escapeArgument($argument) - { - - if ('' === $argument) { - return escapeshellarg($argument); - } - $escapedArgument = ''; - $quote = false; - foreach (preg_split('/(")/i', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) { - if ('"' === $part) { - $escapedArgument .= '\\"'; - } elseif (self::isSurroundedBy($part, '%')) { - // Avoid environment variable expansion - $escapedArgument .= '^%"' . substr($part, 1, -1) . '"^%'; - } else { - // escape trailing backslash - if ('\\' === substr($part, -1)) { - $part .= '\\'; - } - $quote = true; - $escapedArgument .= $part; - } - } - if ($quote) { - $escapedArgument = '"' . $escapedArgument . '"'; - } - return $escapedArgument; - } - - /** - * 验证并进行规范化Process输入。 - * @param string $caller - * @param mixed $input - * @return string - * @throws \InvalidArgumentException - */ - public static function validateInput($caller, $input) - { - if (null !== $input) { - if (is_resource($input)) { - return $input; - } - if (is_scalar($input)) { - return (string) $input; - } - throw new \InvalidArgumentException(sprintf('%s only accepts strings or stream resources.', $caller)); - } - return $input; - } - - private static function isSurroundedBy($arg, $char) - { - return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1]; - } - -} diff --git a/thinkphp/library/think/process/exception/Faild.php b/thinkphp/library/think/process/exception/Faild.php deleted file mode 100644 index 38647bc1..00000000 --- a/thinkphp/library/think/process/exception/Faild.php +++ /dev/null @@ -1,42 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\process\exception; - -use think\Process; - -class Faild extends \RuntimeException -{ - - private $process; - - public function __construct(Process $process) - { - if ($process->isSuccessful()) { - throw new \InvalidArgumentException('Expected a failed process, but the given process was successful.'); - } - - $error = sprintf('The command "%s" failed.' . "\nExit Code: %s(%s)", $process->getCommandLine(), $process->getExitCode(), $process->getExitCodeText()); - - if (!$process->isOutputDisabled()) { - $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s", $process->getOutput(), $process->getErrorOutput()); - } - - parent::__construct($error); - - $this->process = $process; - } - - public function getProcess() - { - return $this->process; - } -} diff --git a/thinkphp/library/think/process/exception/Failed.php b/thinkphp/library/think/process/exception/Failed.php deleted file mode 100644 index 52950823..00000000 --- a/thinkphp/library/think/process/exception/Failed.php +++ /dev/null @@ -1,42 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\process\exception; - -use think\Process; - -class Failed extends \RuntimeException -{ - - private $process; - - public function __construct(Process $process) - { - if ($process->isSuccessful()) { - throw new \InvalidArgumentException('Expected a failed process, but the given process was successful.'); - } - - $error = sprintf('The command "%s" failed.' . "\nExit Code: %s(%s)", $process->getCommandLine(), $process->getExitCode(), $process->getExitCodeText()); - - if (!$process->isOutputDisabled()) { - $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s", $process->getOutput(), $process->getErrorOutput()); - } - - parent::__construct($error); - - $this->process = $process; - } - - public function getProcess() - { - return $this->process; - } -} diff --git a/thinkphp/library/think/process/exception/Timeout.php b/thinkphp/library/think/process/exception/Timeout.php deleted file mode 100644 index d5f1162f..00000000 --- a/thinkphp/library/think/process/exception/Timeout.php +++ /dev/null @@ -1,61 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\process\exception; - -use think\Process; - -class Timeout extends \RuntimeException -{ - - const TYPE_GENERAL = 1; - const TYPE_IDLE = 2; - - private $process; - private $timeoutType; - - public function __construct(Process $process, $timeoutType) - { - $this->process = $process; - $this->timeoutType = $timeoutType; - - parent::__construct(sprintf('The process "%s" exceeded the timeout of %s seconds.', $process->getCommandLine(), $this->getExceededTimeout())); - } - - public function getProcess() - { - return $this->process; - } - - public function isGeneralTimeout() - { - return $this->timeoutType === self::TYPE_GENERAL; - } - - public function isIdleTimeout() - { - return $this->timeoutType === self::TYPE_IDLE; - } - - public function getExceededTimeout() - { - switch ($this->timeoutType) { - case self::TYPE_GENERAL: - return $this->process->getTimeout(); - - case self::TYPE_IDLE: - return $this->process->getIdleTimeout(); - - default: - throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType)); - } - } -} diff --git a/thinkphp/library/think/process/pipes/Pipes.php b/thinkphp/library/think/process/pipes/Pipes.php deleted file mode 100644 index 82396b8f..00000000 --- a/thinkphp/library/think/process/pipes/Pipes.php +++ /dev/null @@ -1,93 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\process\pipes; - -abstract class Pipes -{ - - /** @var array */ - public $pipes = []; - - /** @var string */ - protected $inputBuffer = ''; - /** @var resource|null */ - protected $input; - - /** @var bool */ - private $blocked = true; - - const CHUNK_SIZE = 16384; - - /** - * 返回用于 proc_open 描述符的数组 - * @return array - */ - abstract public function getDescriptors(); - - /** - * 返回一个数组的索引由其相关的流,以防这些管道使用的临时文件的文件名。 - * @return string[] - */ - abstract public function getFiles(); - - /** - * 文件句柄和管道中读取数据。 - * @param bool $blocking 是否使用阻塞调用 - * @param bool $close 是否要关闭管道,如果他们已经到达 EOF。 - * @return string[] - */ - abstract public function readAndWrite($blocking, $close = false); - - /** - * 返回当前状态如果有打开的文件句柄或管道。 - * @return bool - */ - abstract public function areOpen(); - - /** - * {@inheritdoc} - */ - public function close() - { - foreach ($this->pipes as $pipe) { - fclose($pipe); - } - $this->pipes = []; - } - - /** - * 检查系统调用已被中断 - * @return bool - */ - protected function hasSystemCallBeenInterrupted() - { - $lastError = error_get_last(); - - return isset($lastError['message']) && false !== stripos($lastError['message'], 'interrupted system call'); - } - - protected function unblock() - { - if (!$this->blocked) { - return; - } - - foreach ($this->pipes as $pipe) { - stream_set_blocking($pipe, 0); - } - if (null !== $this->input) { - stream_set_blocking($this->input, 0); - } - - $this->blocked = false; - } -} diff --git a/thinkphp/library/think/process/pipes/Unix.php b/thinkphp/library/think/process/pipes/Unix.php deleted file mode 100644 index fd99a5d6..00000000 --- a/thinkphp/library/think/process/pipes/Unix.php +++ /dev/null @@ -1,196 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\process\pipes; - -use think\Process; - -class Unix extends Pipes -{ - - /** @var bool */ - private $ttyMode; - /** @var bool */ - private $ptyMode; - /** @var bool */ - private $disableOutput; - - public function __construct($ttyMode, $ptyMode, $input, $disableOutput) - { - $this->ttyMode = (bool) $ttyMode; - $this->ptyMode = (bool) $ptyMode; - $this->disableOutput = (bool) $disableOutput; - - if (is_resource($input)) { - $this->input = $input; - } else { - $this->inputBuffer = (string) $input; - } - } - - public function __destruct() - { - $this->close(); - } - - /** - * {@inheritdoc} - */ - public function getDescriptors() - { - if ($this->disableOutput) { - $nullstream = fopen('/dev/null', 'c'); - - return [ - ['pipe', 'r'], - $nullstream, - $nullstream, - ]; - } - - if ($this->ttyMode) { - return [ - ['file', '/dev/tty', 'r'], - ['file', '/dev/tty', 'w'], - ['file', '/dev/tty', 'w'], - ]; - } - - if ($this->ptyMode && Process::isPtySupported()) { - return [ - ['pty'], - ['pty'], - ['pty'], - ]; - } - - return [ - ['pipe', 'r'], - ['pipe', 'w'], // stdout - ['pipe', 'w'], // stderr - ]; - } - - /** - * {@inheritdoc} - */ - public function getFiles() - { - return []; - } - - /** - * {@inheritdoc} - */ - public function readAndWrite($blocking, $close = false) - { - - if (1 === count($this->pipes) && [0] === array_keys($this->pipes)) { - fclose($this->pipes[0]); - unset($this->pipes[0]); - } - - if (empty($this->pipes)) { - return []; - } - - $this->unblock(); - - $read = []; - - if (null !== $this->input) { - $r = array_merge($this->pipes, ['input' => $this->input]); - } else { - $r = $this->pipes; - } - - unset($r[0]); - - $w = isset($this->pipes[0]) ? [$this->pipes[0]] : null; - $e = null; - - if (false === $n = @stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) { - - if (!$this->hasSystemCallBeenInterrupted()) { - $this->pipes = []; - } - - return $read; - } - - if (0 === $n) { - return $read; - } - - foreach ($r as $pipe) { - - $type = (false !== $found = array_search($pipe, $this->pipes)) ? $found : 'input'; - $data = ''; - while ('' !== $dataread = (string) fread($pipe, self::CHUNK_SIZE)) { - $data .= $dataread; - } - - if ('' !== $data) { - if ('input' === $type) { - $this->inputBuffer .= $data; - } else { - $read[$type] = $data; - } - } - - if (false === $data || (true === $close && feof($pipe) && '' === $data)) { - if ('input' === $type) { - $this->input = null; - } else { - fclose($this->pipes[$type]); - unset($this->pipes[$type]); - } - } - } - - if (null !== $w && 0 < count($w)) { - while (strlen($this->inputBuffer)) { - $written = fwrite($w[0], $this->inputBuffer, 2 << 18); // write 512k - if ($written > 0) { - $this->inputBuffer = (string) substr($this->inputBuffer, $written); - } else { - break; - } - } - } - - if ('' === $this->inputBuffer && null === $this->input && isset($this->pipes[0])) { - fclose($this->pipes[0]); - unset($this->pipes[0]); - } - - return $read; - } - - /** - * {@inheritdoc} - */ - public function areOpen() - { - return (bool) $this->pipes; - } - - /** - * 创建一个新的 UnixPipes 实例 - * @param Process $process - * @param string|resource $input - * @return self - */ - public static function create(Process $process, $input) - { - return new static($process->isTty(), $process->isPty(), $input, $process->isOutputDisabled()); - } -} diff --git a/thinkphp/library/think/process/pipes/Windows.php b/thinkphp/library/think/process/pipes/Windows.php deleted file mode 100644 index 1b8b0d4f..00000000 --- a/thinkphp/library/think/process/pipes/Windows.php +++ /dev/null @@ -1,228 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\process\pipes; - -use think\Process; - -class Windows extends Pipes -{ - - /** @var array */ - private $files = []; - /** @var array */ - private $fileHandles = []; - /** @var array */ - private $readBytes = [ - Process::STDOUT => 0, - Process::STDERR => 0, - ]; - /** @var bool */ - private $disableOutput; - - public function __construct($disableOutput, $input) - { - $this->disableOutput = (bool) $disableOutput; - - if (!$this->disableOutput) { - - $this->files = [ - Process::STDOUT => tempnam(sys_get_temp_dir(), 'sf_proc_stdout'), - Process::STDERR => tempnam(sys_get_temp_dir(), 'sf_proc_stderr'), - ]; - foreach ($this->files as $offset => $file) { - $this->fileHandles[$offset] = fopen($this->files[$offset], 'rb'); - if (false === $this->fileHandles[$offset]) { - throw new \RuntimeException('A temporary file could not be opened to write the process output to, verify that your TEMP environment variable is writable'); - } - } - } - - if (is_resource($input)) { - $this->input = $input; - } else { - $this->inputBuffer = $input; - } - } - - public function __destruct() - { - $this->close(); - $this->removeFiles(); - } - - /** - * {@inheritdoc} - */ - public function getDescriptors() - { - if ($this->disableOutput) { - $nullstream = fopen('NUL', 'c'); - - return [ - ['pipe', 'r'], - $nullstream, - $nullstream, - ]; - } - - return [ - ['pipe', 'r'], - ['file', 'NUL', 'w'], - ['file', 'NUL', 'w'], - ]; - } - - /** - * {@inheritdoc} - */ - public function getFiles() - { - return $this->files; - } - - /** - * {@inheritdoc} - */ - public function readAndWrite($blocking, $close = false) - { - $this->write($blocking, $close); - - $read = []; - $fh = $this->fileHandles; - foreach ($fh as $type => $fileHandle) { - if (0 !== fseek($fileHandle, $this->readBytes[$type])) { - continue; - } - $data = ''; - $dataread = null; - while (!feof($fileHandle)) { - if (false !== $dataread = fread($fileHandle, self::CHUNK_SIZE)) { - $data .= $dataread; - } - } - if (0 < $length = strlen($data)) { - $this->readBytes[$type] += $length; - $read[$type] = $data; - } - - if (false === $dataread || (true === $close && feof($fileHandle) && '' === $data)) { - fclose($this->fileHandles[$type]); - unset($this->fileHandles[$type]); - } - } - - return $read; - } - - /** - * {@inheritdoc} - */ - public function areOpen() - { - return (bool) $this->pipes && (bool) $this->fileHandles; - } - - /** - * {@inheritdoc} - */ - public function close() - { - parent::close(); - foreach ($this->fileHandles as $handle) { - fclose($handle); - } - $this->fileHandles = []; - } - - /** - * 创建一个新的 WindowsPipes 实例。 - * @param Process $process - * @param $input - * @return self - */ - public static function create(Process $process, $input) - { - return new static($process->isOutputDisabled(), $input); - } - - /** - * 删除临时文件 - */ - private function removeFiles() - { - foreach ($this->files as $filename) { - if (file_exists($filename)) { - @unlink($filename); - } - } - $this->files = []; - } - - /** - * 写入到 stdin 输入 - * @param bool $blocking - * @param bool $close - */ - private function write($blocking, $close) - { - if (empty($this->pipes)) { - return; - } - - $this->unblock(); - - $r = null !== $this->input ? ['input' => $this->input] : null; - $w = isset($this->pipes[0]) ? [$this->pipes[0]] : null; - $e = null; - - if (false === $n = @stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) { - if (!$this->hasSystemCallBeenInterrupted()) { - $this->pipes = []; - } - - return; - } - - if (0 === $n) { - return; - } - - if (null !== $r && 0 < count($r)) { - $data = ''; - while ($dataread = fread($r['input'], self::CHUNK_SIZE)) { - $data .= $dataread; - } - - $this->inputBuffer .= $data; - - if (false === $data || (true === $close && feof($r['input']) && '' === $data)) { - $this->input = null; - } - } - - if (null !== $w && 0 < count($w)) { - while (strlen($this->inputBuffer)) { - $written = fwrite($w[0], $this->inputBuffer, 2 << 18); - if ($written > 0) { - $this->inputBuffer = (string) substr($this->inputBuffer, $written); - } else { - break; - } - } - } - - if ('' === $this->inputBuffer && null === $this->input && isset($this->pipes[0])) { - fclose($this->pipes[0]); - unset($this->pipes[0]); - } - } -} diff --git a/thinkphp/library/think/response/Download.php b/thinkphp/library/think/response/Download.php deleted file mode 100644 index 5595f9ab..00000000 --- a/thinkphp/library/think/response/Download.php +++ /dev/null @@ -1,148 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\response; - -use think\Exception; -use think\Response; - -class Download extends Response -{ - protected $expire = 360; - protected $name; - protected $mimeType; - protected $isContent = false; - protected $openinBrowser = false; - /** - * 处理数据 - * @access protected - * @param mixed $data 要处理的数据 - * @return mixed - * @throws \Exception - */ - protected function output($data) - { - if (!$this->isContent && !is_file($data)) { - throw new Exception('file not exists:' . $data); - } - - ob_end_clean(); - - if (!empty($this->name)) { - $name = $this->name; - } else { - $name = !$this->isContent ? pathinfo($data, PATHINFO_BASENAME) : ''; - } - - if ($this->isContent) { - $mimeType = $this->mimeType; - $size = strlen($data); - } else { - $mimeType = $this->getMimeType($data); - $size = filesize($data); - } - - $this->header['Pragma'] = 'public'; - $this->header['Content-Type'] = $mimeType ?: 'application/octet-stream'; - $this->header['Cache-control'] = 'max-age=' . $this->expire; - $this->header['Content-Disposition'] = $this->openinBrowser ? 'inline' : 'attachment; filename="' . $name . '"'; - $this->header['Content-Length'] = $size; - $this->header['Content-Transfer-Encoding'] = 'binary'; - $this->header['Expires'] = gmdate("D, d M Y H:i:s", time() + $this->expire) . ' GMT'; - - $this->lastModified(gmdate('D, d M Y H:i:s', time()) . ' GMT'); - - $data = $this->isContent ? $data : file_get_contents($data); - return $data; - } - - /** - * 设置是否为内容 必须配合mimeType方法使用 - * @access public - * @param bool $content - * @return $this - */ - public function isContent($content = true) - { - $this->isContent = $content; - return $this; - } - - /** - * 设置有效期 - * @access public - * @param integer $expire 有效期 - * @return $this - */ - public function expire($expire) - { - $this->expire = $expire; - return $this; - } - - /** - * 设置文件类型 - * @access public - * @param string $filename 文件名 - * @return $this - */ - public function mimeType($mimeType) - { - $this->mimeType = $mimeType; - return $this; - } - - /** - * 获取文件类型信息 - * @access public - * @param string $filename 文件名 - * @return string - */ - protected function getMimeType($filename) - { - if (!empty($this->mimeType)) { - return $this->mimeType; - } - - $finfo = finfo_open(FILEINFO_MIME_TYPE); - - return finfo_file($finfo, $filename); - } - - /** - * 设置下载文件的显示名称 - * @access public - * @param string $filename 文件名 - * @param bool $extension 后缀自动识别 - * @return $this - */ - public function name($filename, $extension = true) - { - $this->name = $filename; - - if ($extension && false === strpos($filename, '.')) { - $this->name .= '.' . pathinfo($this->data, PATHINFO_EXTENSION); - } - - return $this; - } - - /** - * 设置是否在浏览器中显示文件 - * @access public - * @param bool $openinBrowser 是否在浏览器中显示文件 - * @return $this - */ - public function openinBrowser($openinBrowser) { - $this->openinBrowser = $openinBrowser; - return $this; - } -} diff --git a/thinkphp/library/think/response/Json.php b/thinkphp/library/think/response/Json.php deleted file mode 100644 index aa5bbd6f..00000000 --- a/thinkphp/library/think/response/Json.php +++ /dev/null @@ -1,51 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\response; - -use think\Response; - -class Json extends Response -{ - // 输出参数 - protected $options = [ - 'json_encode_param' => JSON_UNESCAPED_UNICODE, - ]; - - protected $contentType = 'application/json'; - - /** - * 处理数据 - * @access protected - * @param mixed $data 要处理的数据 - * @return mixed - * @throws \Exception - */ - protected function output($data) - { - try { - // 返回JSON数据格式到客户端 包含状态信息 - $data = json_encode($data, $this->options['json_encode_param']); - - if (false === $data) { - throw new \InvalidArgumentException(json_last_error_msg()); - } - - return $data; - } catch (\Exception $e) { - if ($e->getPrevious()) { - throw $e->getPrevious(); - } - throw $e; - } - } - -} diff --git a/thinkphp/library/think/response/Jsonp.php b/thinkphp/library/think/response/Jsonp.php deleted file mode 100644 index f69e88e1..00000000 --- a/thinkphp/library/think/response/Jsonp.php +++ /dev/null @@ -1,58 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\response; - -use think\Response; - -class Jsonp extends Response -{ - // 输出参数 - protected $options = [ - 'var_jsonp_handler' => 'callback', - 'default_jsonp_handler' => 'jsonpReturn', - 'json_encode_param' => JSON_UNESCAPED_UNICODE, - ]; - - protected $contentType = 'application/javascript'; - - /** - * 处理数据 - * @access protected - * @param mixed $data 要处理的数据 - * @return mixed - * @throws \Exception - */ - protected function output($data) - { - try { - // 返回JSON数据格式到客户端 包含状态信息 [当url_common_param为false时是无法获取到$_GET的数据的,故使用Request来获取] - $var_jsonp_handler = $this->app['request']->param($this->options['var_jsonp_handler'], ""); - $handler = !empty($var_jsonp_handler) ? $var_jsonp_handler : $this->options['default_jsonp_handler']; - - $data = json_encode($data, $this->options['json_encode_param']); - - if (false === $data) { - throw new \InvalidArgumentException(json_last_error_msg()); - } - - $data = $handler . '(' . $data . ');'; - - return $data; - } catch (\Exception $e) { - if ($e->getPrevious()) { - throw $e->getPrevious(); - } - throw $e; - } - } - -} diff --git a/thinkphp/library/think/response/Jump.php b/thinkphp/library/think/response/Jump.php deleted file mode 100644 index 258448ca..00000000 --- a/thinkphp/library/think/response/Jump.php +++ /dev/null @@ -1,32 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\response; - -use think\Response; - -class Jump extends Response -{ - protected $contentType = 'text/html'; - - /** - * 处理数据 - * @access protected - * @param mixed $data 要处理的数据 - * @return mixed - * @throws \Exception - */ - protected function output($data) - { - $data = $this->app['view']->fetch($this->options['jump_template'], $data); - return $data; - } -} diff --git a/thinkphp/library/think/response/Redirect.php b/thinkphp/library/think/response/Redirect.php deleted file mode 100644 index 6b4f118a..00000000 --- a/thinkphp/library/think/response/Redirect.php +++ /dev/null @@ -1,119 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\response; - -use think\Response; - -class Redirect extends Response -{ - - protected $options = []; - - // URL参数 - protected $params = []; - - public function __construct($data = '', $code = 302, array $header = [], array $options = []) - { - parent::__construct($data, $code, $header, $options); - - $this->cacheControl('no-cache,must-revalidate'); - } - - /** - * 处理数据 - * @access protected - * @param mixed $data 要处理的数据 - * @return mixed - */ - protected function output($data) - { - $this->header['Location'] = $this->getTargetUrl(); - - return; - } - - /** - * 重定向传值(通过Session) - * @access protected - * @param string|array $name 变量名或者数组 - * @param mixed $value 值 - * @return $this - */ - public function with($name, $value = null) - { - $session = $this->app['session']; - - if (is_array($name)) { - foreach ($name as $key => $val) { - $session->flash($key, $val); - } - } else { - $session->flash($name, $value); - } - - return $this; - } - - /** - * 获取跳转地址 - * @access public - * @return string - */ - public function getTargetUrl() - { - if (strpos($this->data, '://') || (0 === strpos($this->data, '/') && empty($this->params))) { - return $this->data; - } else { - return $this->app['url']->build($this->data, $this->params); - } - } - - public function params($params = []) - { - $this->params = $params; - - return $this; - } - - /** - * 记住当前url后跳转 - * @access public - * @param string $url 指定记住的url - * @return $this - */ - public function remember($url = null) - { - $this->app['session']->set('redirect_url', $url ?: $this->app['request']->url()); - - return $this; - } - - /** - * 跳转到上次记住的url - * @access public - * @param string $url 闪存数据不存在时的跳转地址 - * @return $this - */ - public function restore($url = null) - { - $session = $this->app['session']; - - if ($session->has('redirect_url')) { - $this->data = $session->get('redirect_url'); - $session->delete('redirect_url'); - } elseif ($url) { - $this->data = $url; - } - - return $this; - } -} diff --git a/thinkphp/library/think/response/View.php b/thinkphp/library/think/response/View.php deleted file mode 100644 index 3d54c735..00000000 --- a/thinkphp/library/think/response/View.php +++ /dev/null @@ -1,119 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\response; - -use think\Response; - -class View extends Response -{ - // 输出参数 - protected $options = []; - protected $vars = []; - protected $config = []; - protected $filter; - protected $contentType = 'text/html'; - - /** - * 是否内容渲染 - * @var bool - */ - protected $isContent = false; - - /** - * 处理数据 - * @access protected - * @param mixed $data 要处理的数据 - * @return mixed - */ - protected function output($data) - { - // 渲染模板输出 - return $this->app['view'] - ->filter($this->filter) - ->fetch($data, $this->vars, $this->config, $this->isContent); - } - - /** - * 设置是否为内容渲染 - * @access public - * @param bool $content - * @return $this - */ - public function isContent($content = true) - { - $this->isContent = $content; - return $this; - } - - /** - * 获取视图变量 - * @access public - * @param string $name 模板变量 - * @return mixed - */ - public function getVars($name = null) - { - if (is_null($name)) { - return $this->vars; - } else { - return isset($this->vars[$name]) ? $this->vars[$name] : null; - } - } - - /** - * 模板变量赋值 - * @access public - * @param mixed $name 变量名 - * @param mixed $value 变量值 - * @return $this - */ - public function assign($name, $value = '') - { - if (is_array($name)) { - $this->vars = array_merge($this->vars, $name); - } else { - $this->vars[$name] = $value; - } - - return $this; - } - - public function config($config) - { - $this->config = $config; - return $this; - } - - /** - * 视图内容过滤 - * @access public - * @param callable $filter - * @return $this - */ - public function filter($filter) - { - $this->filter = $filter; - return $this; - } - - /** - * 检查模板是否存在 - * @access private - * @param string|array $name 参数名 - * @return bool - */ - public function exists($name) - { - return $this->app['view']->exists($name); - } - -} diff --git a/thinkphp/library/think/response/Xml.php b/thinkphp/library/think/response/Xml.php deleted file mode 100644 index 9c1681a4..00000000 --- a/thinkphp/library/think/response/Xml.php +++ /dev/null @@ -1,116 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\response; - -use think\Collection; -use think\Model; -use think\Response; - -class Xml extends Response -{ - // 输出参数 - protected $options = [ - // 根节点名 - 'root_node' => 'think', - // 根节点属性 - 'root_attr' => '', - //数字索引的子节点名 - 'item_node' => 'item', - // 数字索引子节点key转换的属性名 - 'item_key' => 'id', - // 数据编码 - 'encoding' => 'utf-8', - ]; - - protected $contentType = 'text/xml'; - - /** - * 处理数据 - * @access protected - * @param mixed $data 要处理的数据 - * @return mixed - */ - protected function output($data) - { - if (is_string($data)) { - if (0 !== strpos($data, 'options['encoding']; - $xml = ""; - $data = $xml . $data; - } - return $data; - } - - // XML数据转换 - return $this->xmlEncode($data, $this->options['root_node'], $this->options['item_node'], $this->options['root_attr'], $this->options['item_key'], $this->options['encoding']); - } - - /** - * XML编码 - * @access protected - * @param mixed $data 数据 - * @param string $root 根节点名 - * @param string $item 数字索引的子节点名 - * @param string $attr 根节点属性 - * @param string $id 数字索引子节点key转换的属性名 - * @param string $encoding 数据编码 - * @return string - */ - protected function xmlEncode($data, $root, $item, $attr, $id, $encoding) - { - if (is_array($attr)) { - $array = []; - foreach ($attr as $key => $value) { - $array[] = "{$key}=\"{$value}\""; - } - $attr = implode(' ', $array); - } - - $attr = trim($attr); - $attr = empty($attr) ? '' : " {$attr}"; - $xml = ""; - $xml .= "<{$root}{$attr}>"; - $xml .= $this->dataToXml($data, $item, $id); - $xml .= ""; - - return $xml; - } - - /** - * 数据XML编码 - * @access protected - * @param mixed $data 数据 - * @param string $item 数字索引时的节点名称 - * @param string $id 数字索引key转换为的属性名 - * @return string - */ - protected function dataToXml($data, $item, $id) - { - $xml = $attr = ''; - - if ($data instanceof Collection || $data instanceof Model) { - $data = $data->toArray(); - } - - foreach ($data as $key => $val) { - if (is_numeric($key)) { - $id && $attr = " {$id}=\"{$key}\""; - $key = $item; - } - $xml .= "<{$key}{$attr}>"; - $xml .= (is_array($val) || is_object($val)) ? $this->dataToXml($val, $item, $id) : $val; - $xml .= ""; - } - - return $xml; - } -} diff --git a/thinkphp/library/think/route/AliasRule.php b/thinkphp/library/think/route/AliasRule.php deleted file mode 100644 index 393cb310..00000000 --- a/thinkphp/library/think/route/AliasRule.php +++ /dev/null @@ -1,119 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\route; - -use think\Route; - -class AliasRule extends Domain -{ - /** - * 架构函数 - * @access public - * @param Route $router 路由实例 - * @param RuleGroup $parent 上级对象 - * @param string $name 路由别名 - * @param string $route 路由绑定 - * @param array $option 路由参数 - */ - public function __construct(Route $router, RuleGroup $parent, $name, $route, $option = []) - { - $this->router = $router; - $this->parent = $parent; - $this->name = $name; - $this->route = $route; - $this->option = $option; - } - - /** - * 检测路由别名 - * @access public - * @param Request $request 请求对象 - * @param string $url 访问地址 - * @param bool $completeMatch 路由是否完全匹配 - * @return Dispatch|false - */ - public function check($request, $url, $completeMatch = false) - { - if ($dispatch = $this->checkCrossDomain($request)) { - // 允许跨域 - return $dispatch; - } - - // 检查参数有效性 - if (!$this->checkOption($this->option, $request)) { - return false; - } - - list($action, $bind) = array_pad(explode('|', $url, 2), 2, ''); - - if (isset($this->option['allow']) && !in_array($action, $this->option['allow'])) { - // 允许操作 - return false; - } elseif (isset($this->option['except']) && in_array($action, $this->option['except'])) { - // 排除操作 - return false; - } - - if (isset($this->option['method'][$action])) { - $this->option['method'] = $this->option['method'][$action]; - } - - // 匹配后执行的行为 - $this->afterMatchGroup($request); - - if ($this->parent) { - // 合并分组参数 - $this->mergeGroupOptions(); - } - - if (isset($this->option['ext'])) { - // 路由ext参数 优先于系统配置的URL伪静态后缀参数 - $bind = preg_replace('/\.(' . $request->ext() . ')$/i', '', $bind); - } - - $this->parseBindAppendParam($this->route); - - if (0 === strpos($this->route, '\\')) { - // 路由到类 - return $this->bindToClass($request, $bind, substr($this->route, 1)); - } elseif (0 === strpos($this->route, '@')) { - // 路由到控制器类 - return $this->bindToController($request, $bind, substr($this->route, 1)); - } else { - // 路由到模块/控制器 - return $this->bindToModule($request, $bind, $this->route); - } - } - - /** - * 设置允许的操作方法 - * @access public - * @param array $action 操作方法 - * @return $this - */ - public function allow($action = []) - { - return $this->option('allow', $action); - } - - /** - * 设置排除的操作方法 - * @access public - * @param array $action 操作方法 - * @return $this - */ - public function except($action = []) - { - return $this->option('except', $action); - } - -} diff --git a/thinkphp/library/think/route/Dispatch.php b/thinkphp/library/think/route/Dispatch.php deleted file mode 100644 index 7323c98d..00000000 --- a/thinkphp/library/think/route/Dispatch.php +++ /dev/null @@ -1,366 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\route; - -use think\App; -use think\Container; -use think\exception\ValidateException; -use think\Request; -use think\Response; - -abstract class Dispatch -{ - /** - * 应用对象 - * @var App - */ - protected $app; - - /** - * 请求对象 - * @var Request - */ - protected $request; - - /** - * 路由规则 - * @var Rule - */ - protected $rule; - - /** - * 调度信息 - * @var mixed - */ - protected $dispatch; - - /** - * 调度参数 - * @var array - */ - protected $param; - - /** - * 状态码 - * @var string - */ - protected $code; - - /** - * 是否进行大小写转换 - * @var bool - */ - protected $convert; - - public function __construct(Request $request, Rule $rule, $dispatch, $param = [], $code = null) - { - $this->request = $request; - $this->rule = $rule; - $this->app = Container::get('app'); - $this->dispatch = $dispatch; - $this->param = $param; - $this->code = $code; - - if (isset($param['convert'])) { - $this->convert = $param['convert']; - } - } - - public function init() - { - // 执行路由后置操作 - if ($this->rule->doAfter()) { - // 设置请求的路由信息 - - // 设置当前请求的参数 - $this->request->setRouteVars($this->rule->getVars()); - $this->request->routeInfo([ - 'rule' => $this->rule->getRule(), - 'route' => $this->rule->getRoute(), - 'option' => $this->rule->getOption(), - 'var' => $this->rule->getVars(), - ]); - - $this->doRouteAfter(); - } - - return $this; - } - - /** - * 检查路由后置操作 - * @access protected - * @return void - */ - protected function doRouteAfter() - { - // 记录匹配的路由信息 - $option = $this->rule->getOption(); - $matches = $this->rule->getVars(); - - // 添加中间件 - if (!empty($option['middleware'])) { - $this->app['middleware']->import($option['middleware']); - } - - // 绑定模型数据 - if (!empty($option['model'])) { - $this->createBindModel($option['model'], $matches); - } - - // 指定Header数据 - if (!empty($option['header'])) { - $header = $option['header']; - $this->app['hook']->add('response_send', function ($response) use ($header) { - $response->header($header); - }); - } - - // 指定Response响应数据 - if (!empty($option['response'])) { - foreach ($option['response'] as $response) { - $this->app['hook']->add('response_send', $response); - } - } - - // 开启请求缓存 - if (isset($option['cache']) && $this->request->isGet()) { - $this->parseRequestCache($option['cache']); - } - - if (!empty($option['append'])) { - $this->request->setRouteVars($option['append']); - } - } - - /** - * 执行路由调度 - * @access public - * @return mixed - */ - public function run() - { - $option = $this->rule->getOption(); - - // 检测路由after行为 - if (!empty($option['after'])) { - $dispatch = $this->checkAfter($option['after']); - - if ($dispatch instanceof Response) { - return $dispatch; - } - } - - // 数据自动验证 - if (isset($option['validate'])) { - $this->autoValidate($option['validate']); - } - - $data = $this->exec(); - - return $this->autoResponse($data); - } - - protected function autoResponse($data) - { - if ($data instanceof Response) { - $response = $data; - } elseif (!is_null($data)) { - // 默认自动识别响应输出类型 - $isAjax = $this->request->isAjax(); - $type = $isAjax ? $this->rule->getConfig('default_ajax_return') : $this->rule->getConfig('default_return_type'); - - $response = Response::create($data, $type); - } else { - $data = ob_get_clean(); - $content = false === $data ? '' : $data; - $status = '' === $content && $this->request->isJson() ? 204 : 200; - - $response = Response::create($content, '', $status); - } - - return $response; - } - - /** - * 检查路由后置行为 - * @access protected - * @param mixed $after 后置行为 - * @return mixed - */ - protected function checkAfter($after) - { - $this->app['log']->notice('路由后置行为建议使用中间件替代!'); - - $hook = $this->app['hook']; - - $result = null; - - foreach ((array) $after as $behavior) { - $result = $hook->exec($behavior); - - if (!is_null($result)) { - break; - } - } - - // 路由规则重定向 - if ($result instanceof Response) { - return $result; - } - - return false; - } - - /** - * 验证数据 - * @access protected - * @param array $option - * @return void - * @throws ValidateException - */ - protected function autoValidate($option) - { - list($validate, $scene, $message, $batch) = $option; - - if (is_array($validate)) { - // 指定验证规则 - $v = $this->app->validate(); - $v->rule($validate); - } else { - // 调用验证器 - $v = $this->app->validate($validate); - if (!empty($scene)) { - $v->scene($scene); - } - } - - if (!empty($message)) { - $v->message($message); - } - - // 批量验证 - if ($batch) { - $v->batch(true); - } - - if (!$v->check($this->request->param())) { - throw new ValidateException($v->getError()); - } - } - - /** - * 处理路由请求缓存 - * @access protected - * @param Request $request 请求对象 - * @param string|array $cache 路由缓存 - * @return void - */ - protected function parseRequestCache($cache) - { - if (is_array($cache)) { - list($key, $expire, $tag) = array_pad($cache, 3, null); - } else { - $key = str_replace('|', '/', $this->request->url()); - $expire = $cache; - $tag = null; - } - - $cache = $this->request->cache($key, $expire, $tag); - $this->app->setResponseCache($cache); - } - - /** - * 路由绑定模型实例 - * @access protected - * @param array|\Clousre $bindModel 绑定模型 - * @param array $matches 路由变量 - * @return void - */ - protected function createBindModel($bindModel, $matches) - { - foreach ($bindModel as $key => $val) { - if ($val instanceof \Closure) { - $result = $this->app->invokeFunction($val, $matches); - } else { - $fields = explode('&', $key); - - if (is_array($val)) { - list($model, $exception) = $val; - } else { - $model = $val; - $exception = true; - } - - $where = []; - $match = true; - - foreach ($fields as $field) { - if (!isset($matches[$field])) { - $match = false; - break; - } else { - $where[] = [$field, '=', $matches[$field]]; - } - } - - if ($match) { - $query = strpos($model, '\\') ? $model::where($where) : $this->app->model($model)->where($where); - $result = $query->failException($exception)->find(); - } - } - - if (!empty($result)) { - // 注入容器 - $this->app->instance(get_class($result), $result); - } - } - } - - public function convert($convert) - { - $this->convert = $convert; - - return $this; - } - - public function getDispatch() - { - return $this->dispatch; - } - - public function getParam() - { - return $this->param; - } - - abstract public function exec(); - - public function __sleep() - { - return ['rule', 'dispatch', 'convert', 'param', 'code', 'controller', 'actionName']; - } - - public function __wakeup() - { - $this->app = Container::get('app'); - $this->request = $this->app['request']; - } - - public function __debugInfo() - { - $data = get_object_vars($this); - unset($data['app'], $data['request'], $data['rule']); - - return $data; - } -} diff --git a/thinkphp/library/think/route/Domain.php b/thinkphp/library/think/route/Domain.php deleted file mode 100644 index 80950dc2..00000000 --- a/thinkphp/library/think/route/Domain.php +++ /dev/null @@ -1,236 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\route; - -use think\Container; -use think\Loader; -use think\Route; -use think\route\dispatch\Callback as CallbackDispatch; -use think\route\dispatch\Controller as ControllerDispatch; -use think\route\dispatch\Module as ModuleDispatch; - -class Domain extends RuleGroup -{ - /** - * 架构函数 - * @access public - * @param Route $router 路由对象 - * @param string $name 路由域名 - * @param mixed $rule 域名路由 - * @param array $option 路由参数 - * @param array $pattern 变量规则 - */ - public function __construct(Route $router, $name = '', $rule = null, $option = [], $pattern = []) - { - $this->router = $router; - $this->domain = $name; - $this->option = $option; - $this->rule = $rule; - $this->pattern = $pattern; - } - - /** - * 检测域名路由 - * @access public - * @param Request $request 请求对象 - * @param string $url 访问地址 - * @param bool $completeMatch 路由是否完全匹配 - * @return Dispatch|false - */ - public function check($request, $url, $completeMatch = false) - { - // 检测别名路由 - $result = $this->checkRouteAlias($request, $url); - - if (false !== $result) { - return $result; - } - - // 检测URL绑定 - $result = $this->checkUrlBind($request, $url); - - if (!empty($this->option['append'])) { - $request->setRouteVars($this->option['append']); - unset($this->option['append']); - } - - if (false !== $result) { - return $result; - } - - // 添加域名中间件 - if (!empty($this->option['middleware'])) { - Container::get('middleware')->import($this->option['middleware']); - unset($this->option['middleware']); - } - - return parent::check($request, $url, $completeMatch); - } - - /** - * 设置路由绑定 - * @access public - * @param string $bind 绑定信息 - * @return $this - */ - public function bind($bind) - { - $this->router->bind($bind, $this->domain); - return $this; - } - - /** - * 检测路由别名 - * @access private - * @param Request $request - * @param string $url URL地址 - * @return Dispatch|false - */ - private function checkRouteAlias($request, $url) - { - $alias = strpos($url, '|') ? strstr($url, '|', true) : $url; - - $item = $this->router->getAlias($alias); - - return $item ? $item->check($request, $url) : false; - } - - /** - * 检测URL绑定 - * @access private - * @param Request $request - * @param string $url URL地址 - * @return Dispatch|false - */ - private function checkUrlBind($request, $url) - { - $bind = $this->router->getBind($this->domain); - - if (!empty($bind)) { - $this->parseBindAppendParam($bind); - - // 记录绑定信息 - Container::get('app')->log('[ BIND ] ' . var_export($bind, true)); - - // 如果有URL绑定 则进行绑定检测 - $type = substr($bind, 0, 1); - $bind = substr($bind, 1); - - $bindTo = [ - '\\' => 'bindToClass', - '@' => 'bindToController', - ':' => 'bindToNamespace', - ]; - - if (isset($bindTo[$type])) { - return $this->{$bindTo[$type]}($request, $url, $bind); - } - } - - return false; - } - - protected function parseBindAppendParam(&$bind) - { - if (false !== strpos($bind, '?')) { - list($bind, $query) = explode('?', $bind); - parse_str($query, $vars); - $this->append($vars); - } - } - - /** - * 绑定到类 - * @access protected - * @param Request $request - * @param string $url URL地址 - * @param string $class 类名(带命名空间) - * @return CallbackDispatch - */ - protected function bindToClass($request, $url, $class) - { - $array = explode('|', $url, 2); - $action = !empty($array[0]) ? $array[0] : $this->router->config('default_action'); - $param = []; - - if (!empty($array[1])) { - $this->parseUrlParams($request, $array[1], $param); - } - - return new CallbackDispatch($request, $this, [$class, $action], $param); - } - - /** - * 绑定到命名空间 - * @access protected - * @param Request $request - * @param string $url URL地址 - * @param string $namespace 命名空间 - * @return CallbackDispatch - */ - protected function bindToNamespace($request, $url, $namespace) - { - $array = explode('|', $url, 3); - $class = !empty($array[0]) ? $array[0] : $this->router->config('default_controller'); - $method = !empty($array[1]) ? $array[1] : $this->router->config('default_action'); - $param = []; - - if (!empty($array[2])) { - $this->parseUrlParams($request, $array[2], $param); - } - - return new CallbackDispatch($request, $this, [$namespace . '\\' . Loader::parseName($class, 1), $method], $param); - } - - /** - * 绑定到控制器类 - * @access protected - * @param Request $request - * @param string $url URL地址 - * @param string $controller 控制器名 (支持带模块名 index/user ) - * @return ControllerDispatch - */ - protected function bindToController($request, $url, $controller) - { - $array = explode('|', $url, 2); - $action = !empty($array[0]) ? $array[0] : $this->router->config('default_action'); - $param = []; - - if (!empty($array[1])) { - $this->parseUrlParams($request, $array[1], $param); - } - - return new ControllerDispatch($request, $this, $controller . '/' . $action, $param); - } - - /** - * 绑定到模块/控制器 - * @access protected - * @param Request $request - * @param string $url URL地址 - * @param string $controller 控制器类名(带命名空间) - * @return ModuleDispatch - */ - protected function bindToModule($request, $url, $controller) - { - $array = explode('|', $url, 2); - $action = !empty($array[0]) ? $array[0] : $this->router->config('default_action'); - $param = []; - - if (!empty($array[1])) { - $this->parseUrlParams($request, $array[1], $param); - } - - return new ModuleDispatch($request, $this, $controller . '/' . $action, $param); - } - -} diff --git a/thinkphp/library/think/route/Resource.php b/thinkphp/library/think/route/Resource.php deleted file mode 100644 index ff139282..00000000 --- a/thinkphp/library/think/route/Resource.php +++ /dev/null @@ -1,126 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\route; - -use think\Route; - -class Resource extends RuleGroup -{ - // 资源路由名称 - protected $resource; - - // REST路由方法定义 - protected $rest = []; - - /** - * 架构函数 - * @access public - * @param Route $router 路由对象 - * @param RuleGroup $parent 上级对象 - * @param string $name 资源名称 - * @param string $route 路由地址 - * @param array $option 路由参数 - * @param array $pattern 变量规则 - * @param array $rest 资源定义 - */ - public function __construct(Route $router, RuleGroup $parent = null, $name = '', $route = '', $option = [], $pattern = [], $rest = []) - { - $this->router = $router; - $this->parent = $parent; - $this->resource = $name; - $this->route = $route; - $this->name = strpos($name, '.') ? strstr($name, '.', true) : $name; - - $this->setFullName(); - - // 资源路由默认为完整匹配 - $option['complete_match'] = true; - - $this->pattern = $pattern; - $this->option = $option; - $this->rest = $rest; - - if ($this->parent) { - $this->domain = $this->parent->getDomain(); - $this->parent->addRuleItem($this); - } - - if ($router->isTest()) { - $this->buildResourceRule(); - } - } - - /** - * 生成资源路由规则 - * @access protected - * @return void - */ - protected function buildResourceRule() - { - $origin = $this->router->getGroup(); - $this->router->setGroup($this); - - $rule = $this->resource; - $option = $this->option; - - if (strpos($rule, '.')) { - // 注册嵌套资源路由 - $array = explode('.', $rule); - $last = array_pop($array); - $item = []; - - foreach ($array as $val) { - $item[] = $val . '/<' . (isset($option['var'][$val]) ? $option['var'][$val] : $val . '_id') . '>'; - } - - $rule = implode('/', $item) . '/' . $last; - } - - $prefix = substr($rule, strlen($this->name) + 1); - - // 注册资源路由 - foreach ($this->rest as $key => $val) { - if ((isset($option['only']) && !in_array($key, $option['only'])) - || (isset($option['except']) && in_array($key, $option['except']))) { - continue; - } - - if (isset($last) && strpos($val[1], '') && isset($option['var'][$last])) { - $val[1] = str_replace('', '<' . $option['var'][$last] . '>', $val[1]); - } elseif (strpos($val[1], '') && isset($option['var'][$rule])) { - $val[1] = str_replace('', '<' . $option['var'][$rule] . '>', $val[1]); - } - - $this->addRule(trim($prefix . $val[1], '/'), $this->route . '/' . $val[2], $val[0]); - } - - $this->router->setGroup($origin); - } - - /** - * rest方法定义和修改 - * @access public - * @param string $name 方法名称 - * @param array|bool $resource 资源 - * @return $this - */ - public function rest($name, $resource = []) - { - if (is_array($name)) { - $this->rest = $resource ? $name : array_merge($this->rest, $name); - } else { - $this->rest[$name] = $resource; - } - - return $this; - } -} diff --git a/thinkphp/library/think/route/Rule.php b/thinkphp/library/think/route/Rule.php deleted file mode 100644 index 996305f7..00000000 --- a/thinkphp/library/think/route/Rule.php +++ /dev/null @@ -1,1130 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\route; - -use think\Container; -use think\Request; -use think\Response; -use think\route\dispatch\Callback as CallbackDispatch; -use think\route\dispatch\Controller as ControllerDispatch; -use think\route\dispatch\Module as ModuleDispatch; -use think\route\dispatch\Redirect as RedirectDispatch; -use think\route\dispatch\Response as ResponseDispatch; -use think\route\dispatch\View as ViewDispatch; - -abstract class Rule -{ - /** - * 路由标识 - * @var string - */ - protected $name; - - /** - * 路由对象 - * @var Route - */ - protected $router; - - /** - * 路由所属分组 - * @var RuleGroup - */ - protected $parent; - - /** - * 路由规则 - * @var mixed - */ - protected $rule; - - /** - * 路由地址 - * @var string|\Closure - */ - protected $route; - - /** - * 请求类型 - * @var string - */ - protected $method; - - /** - * 路由变量 - * @var array - */ - protected $vars = []; - - /** - * 路由参数 - * @var array - */ - protected $option = []; - - /** - * 路由变量规则 - * @var array - */ - protected $pattern = []; - - /** - * 需要和分组合并的路由参数 - * @var array - */ - protected $mergeOptions = ['after', 'model', 'header', 'response', 'append', 'middleware']; - - /** - * 是否需要后置操作 - * @var bool - */ - protected $doAfter; - - /** - * 是否锁定参数 - * @var bool - */ - protected $lockOption = false; - - abstract public function check($request, $url, $completeMatch = false); - - /** - * 获取Name - * @access public - * @return string - */ - public function getName() - { - return $this->name; - } - - /** - * 获取当前路由规则 - * @access public - * @return string - */ - public function getRule() - { - return $this->rule; - } - - /** - * 获取当前路由地址 - * @access public - * @return mixed - */ - public function getRoute() - { - return $this->route; - } - - /** - * 获取当前路由的请求类型 - * @access public - * @return string - */ - public function getMethod() - { - return strtolower($this->method); - } - - /** - * 获取当前路由的变量 - * @access public - * @return array - */ - public function getVars() - { - return $this->vars; - } - - /** - * 获取路由对象 - * @access public - * @return Route - */ - public function getRouter() - { - return $this->router; - } - - /** - * 路由是否有后置操作 - * @access public - * @return bool - */ - public function doAfter() - { - return $this->doAfter; - } - - /** - * 获取路由分组 - * @access public - * @return RuleGroup|null - */ - public function getParent() - { - return $this->parent; - } - - /** - * 获取路由所在域名 - * @access public - * @return string - */ - public function getDomain() - { - return $this->parent->getDomain(); - } - - /** - * 获取变量规则定义 - * @access public - * @param string $name 变量名 - * @return mixed - */ - public function getPattern($name = '') - { - if ('' === $name) { - return $this->pattern; - } - - return isset($this->pattern[$name]) ? $this->pattern[$name] : null; - } - - /** - * 获取路由参数 - * @access public - * @param string $name 变量名 - * @return mixed - */ - public function getConfig($name = '') - { - return $this->router->config($name); - } - - /** - * 获取路由参数定义 - * @access public - * @param string $name 参数名 - * @return mixed - */ - public function getOption($name = '') - { - if ('' === $name) { - return $this->option; - } - - return isset($this->option[$name]) ? $this->option[$name] : null; - } - - /** - * 注册路由参数 - * @access public - * @param string|array $name 参数名 - * @param mixed $value 值 - * @return $this - */ - public function option($name, $value = '') - { - if (is_array($name)) { - $this->option = array_merge($this->option, $name); - } else { - $this->option[$name] = $value; - } - - return $this; - } - - /** - * 注册变量规则 - * @access public - * @param string|array $name 变量名 - * @param string $rule 变量规则 - * @return $this - */ - public function pattern($name, $rule = '') - { - if (is_array($name)) { - $this->pattern = array_merge($this->pattern, $name); - } else { - $this->pattern[$name] = $rule; - } - - return $this; - } - - /** - * 设置标识 - * @access public - * @param string $name 标识名 - * @return $this - */ - public function name($name) - { - $this->name = $name; - - return $this; - } - - /** - * 设置变量 - * @access public - * @param array $vars 变量 - * @return $this - */ - public function vars($vars) - { - $this->vars = $vars; - - return $this; - } - - /** - * 设置路由请求类型 - * @access public - * @param string $method - * @return $this - */ - public function method($method) - { - return $this->option('method', strtolower($method)); - } - - /** - * 设置路由前置行为 - * @access public - * @param array|\Closure $before - * @return $this - */ - public function before($before) - { - return $this->option('before', $before); - } - - /** - * 设置路由后置行为 - * @access public - * @param array|\Closure $after - * @return $this - */ - public function after($after) - { - return $this->option('after', $after); - } - - /** - * 检查后缀 - * @access public - * @param string $ext - * @return $this - */ - public function ext($ext = '') - { - return $this->option('ext', $ext); - } - - /** - * 检查禁止后缀 - * @access public - * @param string $ext - * @return $this - */ - public function denyExt($ext = '') - { - return $this->option('deny_ext', $ext); - } - - /** - * 检查域名 - * @access public - * @param string $domain - * @return $this - */ - public function domain($domain) - { - return $this->option('domain', $domain); - } - - /** - * 设置参数过滤检查 - * @access public - * @param string|array $name - * @param mixed $value - * @return $this - */ - public function filter($name, $value = null) - { - if (is_array($name)) { - $this->option['filter'] = $name; - } else { - $this->option['filter'][$name] = $value; - } - - return $this; - } - - /** - * 绑定模型 - * @access public - * @param array|string $var 路由变量名 多个使用 & 分割 - * @param string|\Closure $model 绑定模型类 - * @param bool $exception 是否抛出异常 - * @return $this - */ - public function model($var, $model = null, $exception = true) - { - if ($var instanceof \Closure) { - $this->option['model'][] = $var; - } elseif (is_array($var)) { - $this->option['model'] = $var; - } elseif (is_null($model)) { - $this->option['model']['id'] = [$var, true]; - } else { - $this->option['model'][$var] = [$model, $exception]; - } - - return $this; - } - - /** - * 附加路由隐式参数 - * @access public - * @param array $append - * @return $this - */ - public function append(array $append = []) - { - if (isset($this->option['append'])) { - $this->option['append'] = array_merge($this->option['append'], $append); - } else { - $this->option['append'] = $append; - } - - return $this; - } - - /** - * 绑定验证 - * @access public - * @param mixed $validate 验证器类 - * @param string $scene 验证场景 - * @param array $message 验证提示 - * @param bool $batch 批量验证 - * @return $this - */ - public function validate($validate, $scene = null, $message = [], $batch = false) - { - $this->option['validate'] = [$validate, $scene, $message, $batch]; - - return $this; - } - - /** - * 绑定Response对象 - * @access public - * @param mixed $response - * @return $this - */ - public function response($response) - { - $this->option['response'][] = $response; - return $this; - } - - /** - * 设置Response Header信息 - * @access public - * @param string|array $name 参数名 - * @param string $value 参数值 - * @return $this - */ - public function header($header, $value = null) - { - if (is_array($header)) { - $this->option['header'] = $header; - } else { - $this->option['header'][$header] = $value; - } - - return $this; - } - - /** - * 指定路由中间件 - * @access public - * @param string|array|\Closure $middleware - * @param mixed $param - * @return $this - */ - public function middleware($middleware, $param = null) - { - if (is_null($param) && is_array($middleware)) { - $this->option['middleware'] = $middleware; - } else { - foreach ((array) $middleware as $item) { - $this->option['middleware'][] = [$item, $param]; - } - } - - return $this; - } - - /** - * 设置路由缓存 - * @access public - * @param array|string $cache - * @return $this - */ - public function cache($cache) - { - return $this->option('cache', $cache); - } - - /** - * 检查URL分隔符 - * @access public - * @param bool $depr - * @return $this - */ - public function depr($depr) - { - return $this->option('param_depr', $depr); - } - - /** - * 是否合并额外参数 - * @access public - * @param bool $merge - * @return $this - */ - public function mergeExtraVars($merge = true) - { - return $this->option('merge_extra_vars', $merge); - } - - /** - * 设置需要合并的路由参数 - * @access public - * @param array $option - * @return $this - */ - public function mergeOptions($option = []) - { - $this->mergeOptions = array_merge($this->mergeOptions, $option); - return $this; - } - - /** - * 检查是否为HTTPS请求 - * @access public - * @param bool $https - * @return $this - */ - public function https($https = true) - { - return $this->option('https', $https); - } - - /** - * 检查是否为AJAX请求 - * @access public - * @param bool $ajax - * @return $this - */ - public function ajax($ajax = true) - { - return $this->option('ajax', $ajax); - } - - /** - * 检查是否为PJAX请求 - * @access public - * @param bool $pjax - * @return $this - */ - public function pjax($pjax = true) - { - return $this->option('pjax', $pjax); - } - - /** - * 检查是否为手机访问 - * @access public - * @param bool $mobile - * @return $this - */ - public function mobile($mobile = true) - { - return $this->option('mobile', $mobile); - } - - /** - * 当前路由到一个模板地址 当使用数组的时候可以传入模板变量 - * @access public - * @param bool|array $view - * @return $this - */ - public function view($view = true) - { - return $this->option('view', $view); - } - - /** - * 当前路由为重定向 - * @access public - * @param bool $redirect 是否为重定向 - * @return $this - */ - public function redirect($redirect = true) - { - return $this->option('redirect', $redirect); - } - - /** - * 设置路由完整匹配 - * @access public - * @param bool $match - * @return $this - */ - public function completeMatch($match = true) - { - return $this->option('complete_match', $match); - } - - /** - * 是否去除URL最后的斜线 - * @access public - * @param bool $remove - * @return $this - */ - public function removeSlash($remove = true) - { - return $this->option('remove_slash', $remove); - } - - /** - * 设置是否允许跨域 - * @access public - * @param bool $allow - * @param array $header - * @return $this - */ - public function allowCrossDomain($allow = true, $header = []) - { - if (!empty($header)) { - $this->header($header); - } - - if ($allow && $this->parent) { - $this->parent->addRuleItem($this, 'options'); - } - - return $this->option('cross_domain', $allow); - } - - /** - * 检查OPTIONS请求 - * @access public - * @param Request $request - * @return Dispatch|void - */ - protected function checkCrossDomain($request) - { - if (!empty($this->option['cross_domain'])) { - $header = [ - 'Access-Control-Allow-Credentials' => 'true', - 'Access-Control-Allow-Methods' => 'GET, POST, PATCH, PUT, DELETE', - 'Access-Control-Allow-Headers' => 'Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With', - ]; - - if (!empty($this->option['header'])) { - $header = array_merge($header, $this->option['header']); - } - - if (!isset($header['Access-Control-Allow-Origin'])) { - $httpOrigin = $request->header('origin'); - - if ($httpOrigin && strpos(config('cookie.domain'), $httpOrigin)) { - $header['Access-Control-Allow-Origin'] = $httpOrigin; - } else { - $header['Access-Control-Allow-Origin'] = '*'; - } - } - - $this->option['header'] = $header; - - if ($request->method(true) == 'OPTIONS') { - return new ResponseDispatch($request, $this, Response::create()->code(204)->header($header)); - } - } - } - - /** - * 设置路由规则全局有效 - * @access public - * @return $this - */ - public function crossDomainRule() - { - if ($this instanceof RuleGroup) { - $method = '*'; - } else { - $method = $this->method; - } - - $this->router->setCrossDomainRule($this, $method); - - return $this; - } - - /** - * 合并分组参数 - * @access public - * @return array - */ - public function mergeGroupOptions() - { - if (!$this->lockOption) { - $parentOption = $this->parent->getOption(); - // 合并分组参数 - foreach ($this->mergeOptions as $item) { - if (isset($parentOption[$item]) && isset($this->option[$item])) { - $this->option[$item] = array_merge($parentOption[$item], $this->option[$item]); - } - } - - $this->option = array_merge($parentOption, $this->option); - $this->lockOption = true; - } - - return $this->option; - } - - /** - * 解析匹配到的规则路由 - * @access public - * @param Request $request 请求对象 - * @param string $rule 路由规则 - * @param string $route 路由地址 - * @param string $url URL地址 - * @param array $option 路由参数 - * @param array $matches 匹配的变量 - * @return Dispatch - */ - public function parseRule($request, $rule, $route, $url, $option = [], $matches = []) - { - if (is_string($route) && isset($option['prefix'])) { - // 路由地址前缀 - $route = $option['prefix'] . $route; - } - - // 替换路由地址中的变量 - if (is_string($route) && !empty($matches)) { - $search = $replace = []; - - foreach ($matches as $key => $value) { - $search[] = '<' . $key . '>'; - $replace[] = $value; - - $search[] = ':' . $key; - $replace[] = $value; - } - - $route = str_replace($search, $replace, $route); - } - - // 解析额外参数 - $count = substr_count($rule, '/'); - $url = array_slice(explode('|', $url), $count + 1); - $this->parseUrlParams($request, implode('|', $url), $matches); - - $this->vars = $matches; - $this->option = $option; - $this->doAfter = true; - - // 发起路由调度 - return $this->dispatch($request, $route, $option); - } - - /** - * 检查路由前置行为 - * @access protected - * @param mixed $before 前置行为 - * @return mixed - */ - protected function checkBefore($before) - { - $hook = Container::get('hook'); - - foreach ((array) $before as $behavior) { - $result = $hook->exec($behavior); - - if (false === $result) { - return false; - } - } - } - - /** - * 发起路由调度 - * @access protected - * @param Request $request Request对象 - * @param mixed $route 路由地址 - * @param array $option 路由参数 - * @return Dispatch - */ - protected function dispatch($request, $route, $option) - { - if ($route instanceof \Closure) { - // 执行闭包 - $result = new CallbackDispatch($request, $this, $route); - } elseif ($route instanceof Response) { - $result = new ResponseDispatch($request, $this, $route); - } elseif (isset($option['view']) && false !== $option['view']) { - $result = new ViewDispatch($request, $this, $route, is_array($option['view']) ? $option['view'] : []); - } elseif (!empty($option['redirect']) || 0 === strpos($route, '/') || strpos($route, '://')) { - // 路由到重定向地址 - $result = new RedirectDispatch($request, $this, $route, [], isset($option['status']) ? $option['status'] : 301); - } elseif (false !== strpos($route, '\\')) { - // 路由到方法 - $result = $this->dispatchMethod($request, $route); - } elseif (0 === strpos($route, '@')) { - // 路由到控制器 - $result = $this->dispatchController($request, substr($route, 1)); - } else { - // 路由到模块/控制器/操作 - $result = $this->dispatchModule($request, $route); - } - - return $result; - } - - /** - * 解析URL地址为 模块/控制器/操作 - * @access protected - * @param Request $request Request对象 - * @param string $route 路由地址 - * @return CallbackDispatch - */ - protected function dispatchMethod($request, $route) - { - list($path, $var) = $this->parseUrlPath($route); - - $route = str_replace('/', '@', implode('/', $path)); - $method = strpos($route, '@') ? explode('@', $route) : $route; - - return new CallbackDispatch($request, $this, $method, $var); - } - - /** - * 解析URL地址为 模块/控制器/操作 - * @access protected - * @param Request $request Request对象 - * @param string $route 路由地址 - * @return ControllerDispatch - */ - protected function dispatchController($request, $route) - { - list($route, $var) = $this->parseUrlPath($route); - - $result = new ControllerDispatch($request, $this, implode('/', $route), $var); - - $request->setAction(array_pop($route)); - $request->setController($route ? array_pop($route) : $this->getConfig('default_controller')); - $request->setModule($route ? array_pop($route) : $this->getConfig('default_module')); - - return $result; - } - - /** - * 解析URL地址为 模块/控制器/操作 - * @access protected - * @param Request $request Request对象 - * @param string $route 路由地址 - * @return ModuleDispatch - */ - protected function dispatchModule($request, $route) - { - list($path, $var) = $this->parseUrlPath($route); - - $action = array_pop($path); - $controller = !empty($path) ? array_pop($path) : null; - $module = $this->getConfig('app_multi_module') && !empty($path) ? array_pop($path) : null; - $method = $request->method(); - - if ($this->getConfig('use_action_prefix') && $this->router->getMethodPrefix($method)) { - $prefix = $this->router->getMethodPrefix($method); - // 操作方法前缀支持 - $action = 0 !== strpos($action, $prefix) ? $prefix . $action : $action; - } - - // 设置当前请求的路由变量 - $request->setRouteVars($var); - - // 路由到模块/控制器/操作 - return new ModuleDispatch($request, $this, [$module, $controller, $action], ['convert' => false]); - } - - /** - * 路由检查 - * @access protected - * @param array $option 路由参数 - * @param Request $request Request对象 - * @return bool - */ - protected function checkOption($option, Request $request) - { - // 请求类型检测 - if (!empty($option['method'])) { - if (is_string($option['method']) && false === stripos($option['method'], $request->method())) { - return false; - } - } - - // AJAX PJAX 请求检查 - foreach (['ajax', 'pjax', 'mobile'] as $item) { - if (isset($option[$item])) { - $call = 'is' . $item; - if ($option[$item] && !$request->$call() || !$option[$item] && $request->$call()) { - return false; - } - } - } - - // 伪静态后缀检测 - if ($request->url() != '/' && ((isset($option['ext']) && false === stripos('|' . $option['ext'] . '|', '|' . $request->ext() . '|')) - || (isset($option['deny_ext']) && false !== stripos('|' . $option['deny_ext'] . '|', '|' . $request->ext() . '|')))) { - return false; - } - - // 域名检查 - if ((isset($option['domain']) && !in_array($option['domain'], [$request->host(true), $request->subDomain()]))) { - return false; - } - - // HTTPS检查 - if ((isset($option['https']) && $option['https'] && !$request->isSsl()) - || (isset($option['https']) && !$option['https'] && $request->isSsl())) { - return false; - } - - // 请求参数检查 - if (isset($option['filter'])) { - foreach ($option['filter'] as $name => $value) { - if ($request->param($name, '', null) != $value) { - return false; - } - } - } - return true; - } - - /** - * 解析URL地址中的参数Request对象 - * @access protected - * @param Request $request - * @param string $rule 路由规则 - * @param array $var 变量 - * @return void - */ - protected function parseUrlParams($request, $url, &$var = []) - { - if ($url) { - if ($this->getConfig('url_param_type')) { - $var += explode('|', $url); - } else { - preg_replace_callback('/(\w+)\|([^\|]+)/', function ($match) use (&$var) { - $var[$match[1]] = strip_tags($match[2]); - }, $url); - } - } - } - - /** - * 解析URL的pathinfo参数和变量 - * @access public - * @param string $url URL地址 - * @return array - */ - public function parseUrlPath($url) - { - // 分隔符替换 确保路由定义使用统一的分隔符 - $url = str_replace('|', '/', $url); - $url = trim($url, '/'); - $var = []; - - if (false !== strpos($url, '?')) { - // [模块/控制器/操作?]参数1=值1&参数2=值2... - $info = parse_url($url); - $path = explode('/', $info['path']); - parse_str($info['query'], $var); - } elseif (strpos($url, '/')) { - // [模块/控制器/操作] - $path = explode('/', $url); - } elseif (false !== strpos($url, '=')) { - // 参数1=值1&参数2=值2... - $path = []; - parse_str($url, $var); - } else { - $path = [$url]; - } - - return [$path, $var]; - } - - /** - * 生成路由的正则规则 - * @access protected - * @param string $rule 路由规则 - * @param array $match 匹配的变量 - * @param array $pattern 路由变量规则 - * @param array $option 路由参数 - * @param bool $completeMatch 路由是否完全匹配 - * @param string $suffix 路由正则变量后缀 - * @return string - */ - protected function buildRuleRegex($rule, $match, $pattern = [], $option = [], $completeMatch = false, $suffix = '') - { - foreach ($match as $name) { - $replace[] = $this->buildNameRegex($name, $pattern, $suffix); - } - - // 是否区分 / 地址访问 - if ('/' != $rule) { - if (!empty($option['remove_slash'])) { - $rule = rtrim($rule, '/'); - } elseif (substr($rule, -1) == '/') { - $rule = rtrim($rule, '/'); - $hasSlash = true; - } - } - - $regex = str_replace(array_unique($match), array_unique($replace), $rule); - $regex = str_replace([')?/', ')/', ')?-', ')-', '\\\\/'], [')\/', ')\/', ')\-', ')\-', '\/'], $regex); - - if (isset($hasSlash)) { - $regex .= '\/'; - } - - return $regex . ($completeMatch ? '$' : ''); - } - - /** - * 生成路由变量的正则规则 - * @access protected - * @param string $name 路由变量 - * @param string $pattern 变量规则 - * @param string $suffix 路由正则变量后缀 - * @return string - */ - protected function buildNameRegex($name, $pattern, $suffix) - { - $optional = ''; - $slash = substr($name, 0, 1); - - if (in_array($slash, ['/', '-'])) { - $prefix = '\\' . $slash; - $name = substr($name, 1); - $slash = substr($name, 0, 1); - } else { - $prefix = ''; - } - - if ('<' != $slash) { - return $prefix . preg_quote($name, '/'); - } - - if (strpos($name, '?')) { - $name = substr($name, 1, -2); - $optional = '?'; - } elseif (strpos($name, '>')) { - $name = substr($name, 1, -1); - } - - if (isset($pattern[$name])) { - $nameRule = $pattern[$name]; - if (0 === strpos($nameRule, '/') && '/' == substr($nameRule, -1)) { - $nameRule = substr($nameRule, 1, -1); - } - } else { - $nameRule = $this->getConfig('default_route_pattern'); - } - - return '(' . $prefix . '(?<' . $name . $suffix . '>' . $nameRule . '))' . $optional; - } - - /** - * 分析路由规则中的变量 - * @access protected - * @param string $rule 路由规则 - * @return array - */ - protected function parseVar($rule) - { - // 提取路由规则中的变量 - $var = []; - - if (preg_match_all('/<\w+\??>/', $rule, $matches)) { - foreach ($matches[0] as $name) { - $optional = false; - - if (strpos($name, '?')) { - $name = substr($name, 1, -2); - $optional = true; - } else { - $name = substr($name, 1, -1); - } - - $var[$name] = $optional ? 2 : 1; - } - } - - return $var; - } - - /** - * 设置路由参数 - * @access public - * @param string $method 方法名 - * @param array $args 调用参数 - * @return $this - */ - public function __call($method, $args) - { - if (count($args) > 1) { - $args[0] = $args; - } - array_unshift($args, $method); - - return call_user_func_array([$this, 'option'], $args); - } - - public function __sleep() - { - return ['name', 'rule', 'route', 'method', 'vars', 'option', 'pattern', 'doAfter']; - } - - public function __wakeup() - { - $this->router = Container::get('route'); - } - - public function __debugInfo() - { - $data = get_object_vars($this); - unset($data['parent'], $data['router'], $data['route']); - - return $data; - } -} diff --git a/thinkphp/library/think/route/RuleGroup.php b/thinkphp/library/think/route/RuleGroup.php deleted file mode 100644 index 5781d8cf..00000000 --- a/thinkphp/library/think/route/RuleGroup.php +++ /dev/null @@ -1,601 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\route; - -use think\Container; -use think\Exception; -use think\Request; -use think\Response; -use think\Route; -use think\route\dispatch\Response as ResponseDispatch; -use think\route\dispatch\Url as UrlDispatch; - -class RuleGroup extends Rule -{ - // 分组路由(包括子分组) - protected $rules = [ - '*' => [], - 'get' => [], - 'post' => [], - 'put' => [], - 'patch' => [], - 'delete' => [], - 'head' => [], - 'options' => [], - ]; - - // MISS路由 - protected $miss; - - // 自动路由 - protected $auto; - - // 完整名称 - protected $fullName; - - // 所在域名 - protected $domain; - - /** - * 架构函数 - * @access public - * @param Route $router 路由对象 - * @param RuleGroup $parent 上级对象 - * @param string $name 分组名称 - * @param mixed $rule 分组路由 - * @param array $option 路由参数 - * @param array $pattern 变量规则 - */ - public function __construct(Route $router, RuleGroup $parent = null, $name = '', $rule = [], $option = [], $pattern = []) - { - $this->router = $router; - $this->parent = $parent; - $this->rule = $rule; - $this->name = trim($name, '/'); - $this->option = $option; - $this->pattern = $pattern; - - $this->setFullName(); - - if ($this->parent) { - $this->domain = $this->parent->getDomain(); - $this->parent->addRuleItem($this); - } - - if (!empty($option['cross_domain'])) { - $this->router->setCrossDomainRule($this); - } - - if ($router->isTest()) { - $this->lazy(false); - } - } - - /** - * 设置分组的路由规则 - * @access public - * @return void - */ - protected function setFullName() - { - if (false !== strpos($this->name, ':')) { - $this->name = preg_replace(['/\[\:(\w+)\]/', '/\:(\w+)/'], ['<\1?>', '<\1>'], $this->name); - } - - if ($this->parent && $this->parent->getFullName()) { - $this->fullName = $this->parent->getFullName() . ($this->name ? '/' . $this->name : ''); - } else { - $this->fullName = $this->name; - } - } - - /** - * 获取所属域名 - * @access public - * @return string - */ - public function getDomain() - { - return $this->domain; - } - - /** - * 检测分组路由 - * @access public - * @param Request $request 请求对象 - * @param string $url 访问地址 - * @param bool $completeMatch 路由是否完全匹配 - * @return Dispatch|false - */ - public function check($request, $url, $completeMatch = false) - { - // 跨域OPTIONS请求 - if ($dispatch = $this->checkCrossDomain($request)) { - return $dispatch; - } - - // 检查分组有效性 - if (!$this->checkOption($this->option, $request) || !$this->checkUrl($url)) { - return false; - } - - // 检查前置行为 - if (isset($this->option['before'])) { - if (false === $this->checkBefore($this->option['before'])) { - return false; - } - unset($this->option['before']); - } - - // 解析分组路由 - if ($this instanceof Resource) { - $this->buildResourceRule(); - } elseif ($this->rule) { - if ($this->rule instanceof Response) { - return new ResponseDispatch($request, $this, $this->rule); - } - - $this->parseGroupRule($this->rule); - } - - // 获取当前路由规则 - $method = strtolower($request->method()); - $rules = $this->getMethodRules($method); - - if ($this->parent) { - // 合并分组参数 - $this->mergeGroupOptions(); - // 合并分组变量规则 - $this->pattern = array_merge($this->parent->getPattern(), $this->pattern); - } - - if (isset($this->option['complete_match'])) { - $completeMatch = $this->option['complete_match']; - } - - if (!empty($this->option['merge_rule_regex'])) { - // 合并路由正则规则进行路由匹配检查 - $result = $this->checkMergeRuleRegex($request, $rules, $url, $completeMatch); - - if (false !== $result) { - return $result; - } - } - - // 检查分组路由 - foreach ($rules as $key => $item) { - $result = $item->check($request, $url, $completeMatch); - - if (false !== $result) { - return $result; - } - } - - if ($this->auto) { - // 自动解析URL地址 - $result = new UrlDispatch($request, $this, $this->auto . '/' . $url, ['auto_search' => false]); - } elseif ($this->miss && in_array($this->miss->getMethod(), ['*', $method])) { - // 未匹配所有路由的路由规则处理 - $result = $this->miss->parseRule($request, '', $this->miss->getRoute(), $url, $this->miss->mergeGroupOptions()); - } else { - $result = false; - } - - return $result; - } - - /** - * 获取当前请求的路由规则(包括子分组、资源路由) - * @access protected - * @param string $method - * @return array - */ - protected function getMethodRules($method) - { - return array_merge($this->rules[$method], $this->rules['*']); - } - - /** - * 分组URL匹配检查 - * @access protected - * @param string $url - * @return bool - */ - protected function checkUrl($url) - { - if ($this->fullName) { - $pos = strpos($this->fullName, '<'); - - if (false !== $pos) { - $str = substr($this->fullName, 0, $pos); - } else { - $str = $this->fullName; - } - - if ($str && 0 !== stripos(str_replace('|', '/', $url), $str)) { - return false; - } - } - - return true; - } - - /** - * 延迟解析分组的路由规则 - * @access public - * @param bool $lazy 路由是否延迟解析 - * @return $this - */ - public function lazy($lazy = true) - { - if (!$lazy) { - $this->parseGroupRule($this->rule); - $this->rule = null; - } - - return $this; - } - - /** - * 解析分组和域名的路由规则及绑定 - * @access public - * @param mixed $rule 路由规则 - * @return void - */ - public function parseGroupRule($rule) - { - $origin = $this->router->getGroup(); - $this->router->setGroup($this); - - if ($rule instanceof \Closure) { - Container::getInstance()->invokeFunction($rule); - } elseif (is_array($rule)) { - $this->addRules($rule); - } elseif (is_string($rule) && $rule) { - $this->router->bind($rule, $this->domain); - } - - $this->router->setGroup($origin); - } - - /** - * 检测分组路由 - * @access public - * @param Request $request 请求对象 - * @param array $rules 路由规则 - * @param string $url 访问地址 - * @param bool $completeMatch 路由是否完全匹配 - * @return Dispatch|false - */ - protected function checkMergeRuleRegex($request, &$rules, $url, $completeMatch) - { - $depr = $this->router->config('pathinfo_depr'); - $url = $depr . str_replace('|', $depr, $url); - - foreach ($rules as $key => $item) { - if ($item instanceof RuleItem) { - $rule = $depr . str_replace('/', $depr, $item->getRule()); - if ($depr == $rule && $depr != $url) { - unset($rules[$key]); - continue; - } - - $complete = null !== $item->getOption('complete_match') ? $item->getOption('complete_match') : $completeMatch; - - if (false === strpos($rule, '<')) { - if (0 === strcasecmp($rule, $url) || (!$complete && 0 === strncasecmp($rule, $url, strlen($rule)))) { - return $item->checkRule($request, $url, []); - } - - unset($rules[$key]); - continue; - } - - $slash = preg_quote('/-' . $depr, '/'); - - if ($matchRule = preg_split('/[' . $slash . ']<\w+\??>/', $rule, 2)) { - if ($matchRule[0] && 0 !== strncasecmp($rule, $url, strlen($matchRule[0]))) { - unset($rules[$key]); - continue; - } - } - - if (preg_match_all('/[' . $slash . ']??/', $rule, $matches)) { - unset($rules[$key]); - $pattern = array_merge($this->getPattern(), $item->getPattern()); - $option = array_merge($this->getOption(), $item->getOption()); - - $regex[$key] = $this->buildRuleRegex($rule, $matches[0], $pattern, $option, $complete, '_THINK_' . $key); - $items[$key] = $item; - } - } - } - - if (empty($regex)) { - return false; - } - - try { - $result = preg_match('/^(?:' . implode('|', $regex) . ')/u', $url, $match); - } catch (\Exception $e) { - throw new Exception('route pattern error'); - } - - if ($result) { - $var = []; - foreach ($match as $key => $val) { - if (is_string($key) && '' !== $val) { - list($name, $pos) = explode('_THINK_', $key); - - $var[$name] = $val; - } - } - - if (!isset($pos)) { - foreach ($regex as $key => $item) { - if (0 === strpos(str_replace(['\/', '\-', '\\' . $depr], ['/', '-', $depr], $item), $match[0])) { - $pos = $key; - break; - } - } - } - - $rule = $items[$pos]->getRule(); - $array = $this->router->getRule($rule); - - foreach ($array as $item) { - if (in_array($item->getMethod(), ['*', strtolower($request->method())])) { - $result = $item->checkRule($request, $url, $var); - - if (false !== $result) { - return $result; - } - } - } - } - - return false; - } - - /** - * 获取分组的MISS路由 - * @access public - * @return RuleItem|null - */ - public function getMissRule() - { - return $this->miss; - } - - /** - * 获取分组的自动路由 - * @access public - * @return string - */ - public function getAutoRule() - { - return $this->auto; - } - - /** - * 注册自动路由 - * @access public - * @param string $route 路由规则 - * @return void - */ - public function addAutoRule($route) - { - $this->auto = $route; - } - - /** - * 注册MISS路由 - * @access public - * @param string $route 路由地址 - * @param string $method 请求类型 - * @param array $option 路由参数 - * @return RuleItem - */ - public function addMissRule($route, $method = '*', $option = []) - { - // 创建路由规则实例 - $ruleItem = new RuleItem($this->router, $this, null, '', $route, strtolower($method), $option); - - $this->miss = $ruleItem; - - return $ruleItem; - } - - /** - * 添加分组下的路由规则或者子分组 - * @access public - * @param string $rule 路由规则 - * @param string $route 路由地址 - * @param string $method 请求类型 - * @param array $option 路由参数 - * @param array $pattern 变量规则 - * @return $this - */ - public function addRule($rule, $route, $method = '*', $option = [], $pattern = []) - { - // 读取路由标识 - if (is_array($rule)) { - $name = $rule[0]; - $rule = $rule[1]; - } elseif (is_string($route)) { - $name = $route; - } else { - $name = null; - } - - $method = strtolower($method); - - if ('/' === $rule || '' === $rule) { - // 首页自动完整匹配 - $rule .= '$'; - } - - // 创建路由规则实例 - $ruleItem = new RuleItem($this->router, $this, $name, $rule, $route, $method, $option, $pattern); - - if (!empty($option['cross_domain'])) { - $this->router->setCrossDomainRule($ruleItem, $method); - } - - $this->addRuleItem($ruleItem, $method); - - return $ruleItem; - } - - /** - * 批量注册路由规则 - * @access public - * @param array $rules 路由规则 - * @param string $method 请求类型 - * @param array $option 路由参数 - * @param array $pattern 变量规则 - * @return void - */ - public function addRules($rules, $method = '*', $option = [], $pattern = []) - { - foreach ($rules as $key => $val) { - if (is_numeric($key)) { - $key = array_shift($val); - } - - if (is_array($val)) { - $route = array_shift($val); - $option = $val ? array_shift($val) : []; - $pattern = $val ? array_shift($val) : []; - } else { - $route = $val; - } - - $this->addRule($key, $route, $method, $option, $pattern); - } - } - - public function addRuleItem($rule, $method = '*') - { - if (strpos($method, '|')) { - $rule->method($method); - $method = '*'; - } - - $this->rules[$method][] = $rule; - - return $this; - } - - /** - * 设置分组的路由前缀 - * @access public - * @param string $prefix - * @return $this - */ - public function prefix($prefix) - { - if ($this->parent && $this->parent->getOption('prefix')) { - $prefix = $this->parent->getOption('prefix') . $prefix; - } - - return $this->option('prefix', $prefix); - } - - /** - * 设置资源允许 - * @access public - * @param array $only - * @return $this - */ - public function only($only) - { - return $this->option('only', $only); - } - - /** - * 设置资源排除 - * @access public - * @param array $except - * @return $this - */ - public function except($except) - { - return $this->option('except', $except); - } - - /** - * 设置资源路由的变量 - * @access public - * @param array $vars - * @return $this - */ - public function vars($vars) - { - return $this->option('var', $vars); - } - - /** - * 合并分组的路由规则正则 - * @access public - * @param bool $merge - * @return $this - */ - public function mergeRuleRegex($merge = true) - { - return $this->option('merge_rule_regex', $merge); - } - - /** - * 获取完整分组Name - * @access public - * @return string - */ - public function getFullName() - { - return $this->fullName; - } - - /** - * 获取分组的路由规则 - * @access public - * @param string $method - * @return array - */ - public function getRules($method = '') - { - if ('' === $method) { - return $this->rules; - } - - return isset($this->rules[strtolower($method)]) ? $this->rules[strtolower($method)] : []; - } - - /** - * 清空分组下的路由规则 - * @access public - * @return void - */ - public function clear() - { - $this->rules = [ - '*' => [], - 'get' => [], - 'post' => [], - 'put' => [], - 'patch' => [], - 'delete' => [], - 'head' => [], - 'options' => [], - ]; - } -} diff --git a/thinkphp/library/think/route/RuleItem.php b/thinkphp/library/think/route/RuleItem.php deleted file mode 100644 index a05d2deb..00000000 --- a/thinkphp/library/think/route/RuleItem.php +++ /dev/null @@ -1,292 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\route; - -use think\Container; -use think\Exception; -use think\Route; - -class RuleItem extends Rule -{ - protected $hasSetRule; - - /** - * 架构函数 - * @access public - * @param Route $router 路由实例 - * @param RuleGroup $parent 上级对象 - * @param string $name 路由标识 - * @param string|array $rule 路由规则 - * @param string|\Closure $route 路由地址 - * @param string $method 请求类型 - * @param array $option 路由参数 - * @param array $pattern 变量规则 - */ - public function __construct(Route $router, RuleGroup $parent, $name, $rule, $route, $method = '*', $option = [], $pattern = []) - { - $this->router = $router; - $this->parent = $parent; - $this->name = $name; - $this->route = $route; - $this->method = $method; - $this->option = $option; - $this->pattern = $pattern; - - $this->setRule($rule); - - if (!empty($option['cross_domain'])) { - $this->router->setCrossDomainRule($this, $method); - } - } - - /** - * 路由规则预处理 - * @access public - * @param string $rule 路由规则 - * @return void - */ - public function setRule($rule) - { - if ('$' == substr($rule, -1, 1)) { - // 是否完整匹配 - $rule = substr($rule, 0, -1); - - $this->option['complete_match'] = true; - } - - $rule = '/' != $rule ? ltrim($rule, '/') : ''; - - if ($this->parent && $prefix = $this->parent->getFullName()) { - $rule = $prefix . ($rule ? '/' . ltrim($rule, '/') : ''); - } - - if (false !== strpos($rule, ':')) { - $this->rule = preg_replace(['/\[\:(\w+)\]/', '/\:(\w+)/'], ['<\1?>', '<\1>'], $rule); - } else { - $this->rule = $rule; - } - - // 生成路由标识的快捷访问 - $this->setRuleName(); - } - - /** - * 检查后缀 - * @access public - * @param string $ext - * @return $this - */ - public function ext($ext = '') - { - $this->option('ext', $ext); - $this->setRuleName(true); - - return $this; - } - - /** - * 设置别名 - * @access public - * @param string $name - * @return $this - */ - public function name($name) - { - $this->name = $name; - $this->setRuleName(true); - - return $this; - } - - /** - * 设置路由标识 用于URL反解生成 - * @access protected - * @param bool $first 是否插入开头 - * @return void - */ - protected function setRuleName($first = false) - { - if ($this->name) { - $vars = $this->parseVar($this->rule); - $name = strtolower($this->name); - - if (isset($this->option['ext'])) { - $suffix = $this->option['ext']; - } elseif ($this->parent->getOption('ext')) { - $suffix = $this->parent->getOption('ext'); - } else { - $suffix = null; - } - - $value = [$this->rule, $vars, $this->parent->getDomain(), $suffix, $this->method]; - - Container::get('rule_name')->set($name, $value, $first); - } - - if (!$this->hasSetRule) { - Container::get('rule_name')->setRule($this->rule, $this); - $this->hasSetRule = true; - } - } - - /** - * 检测路由 - * @access public - * @param Request $request 请求对象 - * @param string $url 访问地址 - * @param array $match 匹配路由变量 - * @param bool $completeMatch 路由是否完全匹配 - * @return Dispatch|false - */ - public function checkRule($request, $url, $match = null, $completeMatch = false) - { - // 检查参数有效性 - if (!$this->checkOption($this->option, $request)) { - return false; - } - - // 合并分组参数 - $option = $this->mergeGroupOptions(); - - $url = $this->urlSuffixCheck($request, $url, $option); - - if (is_null($match)) { - $match = $this->match($url, $option, $completeMatch); - } - - if (false !== $match) { - if (!empty($option['cross_domain'])) { - if ($dispatch = $this->checkCrossDomain($request)) { - // 允许跨域 - return $dispatch; - } - - $option['header'] = $this->option['header']; - } - - // 检查前置行为 - if (isset($option['before']) && false === $this->checkBefore($option['before'])) { - return false; - } - - return $this->parseRule($request, $this->rule, $this->route, $url, $option, $match); - } - - return false; - } - - /** - * 检测路由(含路由匹配) - * @access public - * @param Request $request 请求对象 - * @param string $url 访问地址 - * @param string $depr 路径分隔符 - * @param bool $completeMatch 路由是否完全匹配 - * @return Dispatch|false - */ - public function check($request, $url, $completeMatch = false) - { - return $this->checkRule($request, $url, null, $completeMatch); - } - - /** - * URL后缀及Slash检查 - * @access protected - * @param Request $request 请求对象 - * @param string $url 访问地址 - * @param array $option 路由参数 - * @return string - */ - protected function urlSuffixCheck($request, $url, $option = []) - { - // 是否区分 / 地址访问 - if (!empty($option['remove_slash']) && '/' != $this->rule) { - $this->rule = rtrim($this->rule, '/'); - $url = rtrim($url, '|'); - } - - if (isset($option['ext'])) { - // 路由ext参数 优先于系统配置的URL伪静态后缀参数 - $url = preg_replace('/\.(' . $request->ext() . ')$/i', '', $url); - } - - return $url; - } - - /** - * 检测URL和规则路由是否匹配 - * @access private - * @param string $url URL地址 - * @param array $option 路由参数 - * @param bool $completeMatch 路由是否完全匹配 - * @return array|false - */ - private function match($url, $option, $completeMatch) - { - if (isset($option['complete_match'])) { - $completeMatch = $option['complete_match']; - } - - $pattern = array_merge($this->parent->getPattern(), $this->pattern); - $depr = $this->router->config('pathinfo_depr'); - - // 检查完整规则定义 - if (isset($pattern['__url__']) && !preg_match(0 === strpos($pattern['__url__'], '/') ? $pattern['__url__'] : '/^' . $pattern['__url__'] . '/', str_replace('|', $depr, $url))) { - return false; - } - - $var = []; - $url = $depr . str_replace('|', $depr, $url); - $rule = $depr . str_replace('/', $depr, $this->rule); - - if ($depr == $rule && $depr != $url) { - return false; - } - - if (false === strpos($rule, '<')) { - if (0 === strcasecmp($rule, $url) || (!$completeMatch && 0 === strncasecmp($rule . $depr, $url . $depr, strlen($rule . $depr)))) { - return $var; - } - return false; - } - - $slash = preg_quote('/-' . $depr, '/'); - - if ($matchRule = preg_split('/[' . $slash . ']?<\w+\??>/', $rule, 2)) { - if ($matchRule[0] && 0 !== strncasecmp($rule, $url, strlen($matchRule[0]))) { - return false; - } - } - - if (preg_match_all('/[' . $slash . ']??/', $rule, $matches)) { - $regex = $this->buildRuleRegex($rule, $matches[0], $pattern, $option, $completeMatch); - - try { - if (!preg_match('/^' . $regex . ($completeMatch ? '$' : '') . '/u', $url, $match)) { - return false; - } - } catch (\Exception $e) { - throw new Exception('route pattern error'); - } - - foreach ($match as $key => $val) { - if (is_string($key)) { - $var[$key] = $val; - } - } - } - - // 成功匹配后返回URL中的动态变量数组 - return $var; - } - -} diff --git a/thinkphp/library/think/route/RuleName.php b/thinkphp/library/think/route/RuleName.php deleted file mode 100644 index 202fb0e2..00000000 --- a/thinkphp/library/think/route/RuleName.php +++ /dev/null @@ -1,147 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\route; - -class RuleName -{ - protected $item = []; - protected $rule = []; - - /** - * 注册路由标识 - * @access public - * @param string $name 路由标识 - * @param array $value 路由规则 - * @param bool $first 是否置顶 - * @return void - */ - public function set($name, $value, $first = false) - { - if ($first && isset($this->item[$name])) { - array_unshift($this->item[$name], $value); - } else { - $this->item[$name][] = $value; - } - } - - /** - * 注册路由规则 - * @access public - * @param string $rule 路由规则 - * @param RuleItem $route 路由 - * @return void - */ - public function setRule($rule, $route) - { - $this->rule[$route->getDomain()][$rule][$route->getMethod()] = $route; - } - - /** - * 根据路由规则获取路由对象(列表) - * @access public - * @param string $name 路由标识 - * @param string $domain 域名 - * @return array - */ - public function getRule($rule, $domain = null) - { - return isset($this->rule[$domain][$rule]) ? $this->rule[$domain][$rule] : []; - } - - /** - * 获取全部路由列表 - * @access public - * @param string $domain 域名 - * @return array - */ - public function getRuleList($domain = null) - { - $list = []; - - foreach ($this->rule as $ruleDomain => $rules) { - foreach ($rules as $rule => $items) { - foreach ($items as $item) { - $val['domain'] = $ruleDomain; - - foreach (['method', 'rule', 'name', 'route', 'pattern', 'option'] as $param) { - $call = 'get' . $param; - $val[$param] = $item->$call(); - } - - $list[$ruleDomain][] = $val; - } - } - } - - if ($domain) { - return isset($list[$domain]) ? $list[$domain] : []; - } - - return $list; - } - - /** - * 导入路由标识 - * @access public - * @param array $name 路由标识 - * @return void - */ - public function import($item) - { - $this->item = $item; - } - - /** - * 根据路由标识获取路由信息(用于URL生成) - * @access public - * @param string $name 路由标识 - * @param string $domain 域名 - * @return array|null - */ - public function get($name = null, $domain = null, $method = '*') - { - if (is_null($name)) { - return $this->item; - } - - $name = strtolower($name); - $method = strtolower($method); - - if (isset($this->item[$name])) { - if (is_null($domain)) { - $result = $this->item[$name]; - } else { - $result = []; - foreach ($this->item[$name] as $item) { - if ($item[2] == $domain && ('*' == $item[4] || $method == $item[4])) { - $result[] = $item; - } - } - } - } else { - $result = null; - } - - return $result; - } - - /** - * 清空路由规则 - * @access public - * @return void - */ - public function clear() - { - $this->item = []; - $this->rule = []; - } -} diff --git a/thinkphp/library/think/route/dispatch/Callback.php b/thinkphp/library/think/route/dispatch/Callback.php deleted file mode 100644 index ca76fc99..00000000 --- a/thinkphp/library/think/route/dispatch/Callback.php +++ /dev/null @@ -1,26 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\route\dispatch; - -use think\route\Dispatch; - -class Callback extends Dispatch -{ - public function exec() - { - // 执行回调方法 - $vars = array_merge($this->request->param(), $this->param); - - return $this->app->invoke($this->dispatch, $vars); - } - -} diff --git a/thinkphp/library/think/route/dispatch/Controller.php b/thinkphp/library/think/route/dispatch/Controller.php deleted file mode 100644 index 1de82992..00000000 --- a/thinkphp/library/think/route/dispatch/Controller.php +++ /dev/null @@ -1,30 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\route\dispatch; - -use think\route\Dispatch; - -class Controller extends Dispatch -{ - public function exec() - { - // 执行控制器的操作方法 - $vars = array_merge($this->request->param(), $this->param); - - return $this->app->action( - $this->dispatch, $vars, - $this->rule->getConfig('url_controller_layer'), - $this->rule->getConfig('controller_suffix') - ); - } - -} diff --git a/thinkphp/library/think/route/dispatch/Module.php b/thinkphp/library/think/route/dispatch/Module.php deleted file mode 100644 index 40bd7759..00000000 --- a/thinkphp/library/think/route/dispatch/Module.php +++ /dev/null @@ -1,138 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\route\dispatch; - -use ReflectionMethod; -use think\exception\ClassNotFoundException; -use think\exception\HttpException; -use think\Loader; -use think\Request; -use think\route\Dispatch; - -class Module extends Dispatch -{ - protected $controller; - protected $actionName; - - public function init() - { - parent::init(); - - $result = $this->dispatch; - - if (is_string($result)) { - $result = explode('/', $result); - } - - if ($this->rule->getConfig('app_multi_module')) { - // 多模块部署 - $module = strip_tags(strtolower($result[0] ?: $this->rule->getConfig('default_module'))); - $bind = $this->rule->getRouter()->getBind(); - $available = false; - - if ($bind && preg_match('/^[a-z]/is', $bind)) { - // 绑定模块 - list($bindModule) = explode('/', $bind); - if (empty($result[0])) { - $module = $bindModule; - } - $available = true; - } elseif (!in_array($module, $this->rule->getConfig('deny_module_list')) && is_dir($this->app->getAppPath() . $module)) { - $available = true; - } elseif ($this->rule->getConfig('empty_module')) { - $module = $this->rule->getConfig('empty_module'); - $available = true; - } - - // 模块初始化 - if ($module && $available) { - // 初始化模块 - $this->request->setModule($module); - $this->app->init($module); - } else { - throw new HttpException(404, 'module not exists:' . $module); - } - } - - // 是否自动转换控制器和操作名 - $convert = is_bool($this->convert) ? $this->convert : $this->rule->getConfig('url_convert'); - // 获取控制器名 - $controller = strip_tags($result[1] ?: $this->rule->getConfig('default_controller')); - - $this->controller = $convert ? strtolower($controller) : $controller; - - // 获取操作名 - $this->actionName = strip_tags($result[2] ?: $this->rule->getConfig('default_action')); - - // 设置当前请求的控制器、操作 - $this->request - ->setController(Loader::parseName($this->controller, 1)) - ->setAction($this->actionName); - - return $this; - } - - public function exec() - { - // 监听module_init - $this->app['hook']->listen('module_init'); - - try { - // 实例化控制器 - $instance = $this->app->controller($this->controller, - $this->rule->getConfig('url_controller_layer'), - $this->rule->getConfig('controller_suffix'), - $this->rule->getConfig('empty_controller')); - } catch (ClassNotFoundException $e) { - throw new HttpException(404, 'controller not exists:' . $e->getClass()); - } - - $this->app['middleware']->controller(function (Request $request, $next) use ($instance) { - // 获取当前操作名 - $action = $this->actionName . $this->rule->getConfig('action_suffix'); - - if (is_callable([$instance, $action])) { - // 执行操作方法 - $call = [$instance, $action]; - - // 严格获取当前操作方法名 - $reflect = new ReflectionMethod($instance, $action); - $methodName = $reflect->getName(); - $suffix = $this->rule->getConfig('action_suffix'); - $actionName = $suffix ? substr($methodName, 0, -strlen($suffix)) : $methodName; - $this->request->setAction($actionName); - - // 自动获取请求变量 - $vars = $this->rule->getConfig('url_param_type') - ? $this->request->route() - : $this->request->param(); - $vars = array_merge($vars, $this->param); - } elseif (is_callable([$instance, '_empty'])) { - // 空操作 - $call = [$instance, '_empty']; - $vars = [$this->actionName]; - $reflect = new ReflectionMethod($instance, '_empty'); - } else { - // 操作不存在 - throw new HttpException(404, 'method not exists:' . get_class($instance) . '->' . $action . '()'); - } - - $this->app['hook']->listen('action_begin', $call); - - $data = $this->app->invokeReflectMethod($instance, $reflect, $vars); - - return $this->autoResponse($data); - }); - - return $this->app['middleware']->dispatch($this->request, 'controller'); - } -} diff --git a/thinkphp/library/think/route/dispatch/Redirect.php b/thinkphp/library/think/route/dispatch/Redirect.php deleted file mode 100644 index fae2c9a6..00000000 --- a/thinkphp/library/think/route/dispatch/Redirect.php +++ /dev/null @@ -1,23 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\route\dispatch; - -use think\Response; -use think\route\Dispatch; - -class Redirect extends Dispatch -{ - public function exec() - { - return Response::create($this->dispatch, 'redirect')->code($this->code); - } -} diff --git a/thinkphp/library/think/route/dispatch/Response.php b/thinkphp/library/think/route/dispatch/Response.php deleted file mode 100644 index 66f4e5ab..00000000 --- a/thinkphp/library/think/route/dispatch/Response.php +++ /dev/null @@ -1,23 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\route\dispatch; - -use think\route\Dispatch; - -class Response extends Dispatch -{ - public function exec() - { - return $this->dispatch; - } - -} diff --git a/thinkphp/library/think/route/dispatch/Url.php b/thinkphp/library/think/route/dispatch/Url.php deleted file mode 100644 index acc524e3..00000000 --- a/thinkphp/library/think/route/dispatch/Url.php +++ /dev/null @@ -1,169 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\route\dispatch; - -use think\exception\HttpException; -use think\Loader; -use think\route\Dispatch; - -class Url extends Dispatch -{ - public function init() - { - // 解析默认的URL规则 - $result = $this->parseUrl($this->dispatch); - - return (new Module($this->request, $this->rule, $result))->init(); - } - - public function exec() - {} - - /** - * 解析URL地址 - * @access protected - * @param string $url URL - * @return array - */ - protected function parseUrl($url) - { - $depr = $this->rule->getConfig('pathinfo_depr'); - $bind = $this->rule->getRouter()->getBind(); - - if (!empty($bind) && preg_match('/^[a-z]/is', $bind)) { - $bind = str_replace('/', $depr, $bind); - // 如果有模块/控制器绑定 - $url = $bind . ('.' != substr($bind, -1) ? $depr : '') . ltrim($url, $depr); - } - - list($path, $var) = $this->rule->parseUrlPath($url); - if (empty($path)) { - return [null, null, null]; - } - - // 解析模块 - $module = $this->rule->getConfig('app_multi_module') ? array_shift($path) : null; - - if ($this->param['auto_search']) { - $controller = $this->autoFindController($module, $path); - } else { - // 解析控制器 - $controller = !empty($path) ? array_shift($path) : null; - } - - if ($controller && !preg_match('/^[A-Za-z0-9][\w|\.]*$/', $controller)) { - throw new HttpException(404, 'controller not exists:' . $controller); - } - - // 解析操作 - $action = !empty($path) ? array_shift($path) : null; - - // 解析额外参数 - if ($path) { - if ($this->rule->getConfig('url_param_type')) { - $var += $path; - } else { - preg_replace_callback('/(\w+)\|([^\|]+)/', function ($match) use (&$var) { - $var[$match[1]] = strip_tags($match[2]); - }, implode('|', $path)); - } - } - - $panDomain = $this->request->panDomain(); - - if ($panDomain && $key = array_search('*', $var)) { - // 泛域名赋值 - $var[$key] = $panDomain; - } - - // 设置当前请求的参数 - $this->request->setRouteVars($var); - - // 封装路由 - $route = [$module, $controller, $action]; - - if ($this->hasDefinedRoute($route, $bind)) { - throw new HttpException(404, 'invalid request:' . str_replace('|', $depr, $url)); - } - - return $route; - } - - /** - * 检查URL是否已经定义过路由 - * @access protected - * @param string $route 路由信息 - * @param string $bind 绑定信息 - * @return bool - */ - protected function hasDefinedRoute($route, $bind) - { - list($module, $controller, $action) = $route; - - // 检查地址是否被定义过路由 - $name = strtolower($module . '/' . Loader::parseName($controller, 1) . '/' . $action); - - $name2 = ''; - - if (empty($module) || $module == $bind) { - $name2 = strtolower(Loader::parseName($controller, 1) . '/' . $action); - } - - $host = $this->request->host(true); - - $method = $this->request->method(); - - if ($this->rule->getRouter()->getName($name, $host, $method) || $this->rule->getRouter()->getName($name2, $host, $method)) { - return true; - } - - return false; - } - - /** - * 自动定位控制器类 - * @access protected - * @param string $module 模块名 - * @param array $path URL - * @return string - */ - protected function autoFindController($module, &$path) - { - $dir = $this->app->getAppPath() . ($module ? $module . '/' : '') . $this->rule->getConfig('url_controller_layer'); - $suffix = $this->app->getSuffix() || $this->rule->getConfig('controller_suffix') ? ucfirst($this->rule->getConfig('url_controller_layer')) : ''; - - $item = []; - $find = false; - - foreach ($path as $val) { - $item[] = $val; - $file = $dir . '/' . str_replace('.', '/', $val) . $suffix . '.php'; - $file = pathinfo($file, PATHINFO_DIRNAME) . '/' . Loader::parseName(pathinfo($file, PATHINFO_FILENAME), 1) . '.php'; - if (is_file($file)) { - $find = true; - break; - } else { - $dir .= '/' . Loader::parseName($val); - } - } - - if ($find) { - $controller = implode('.', $item); - $path = array_slice($path, count($item)); - } else { - $controller = array_shift($path); - } - - return $controller; - } - -} diff --git a/thinkphp/library/think/route/dispatch/View.php b/thinkphp/library/think/route/dispatch/View.php deleted file mode 100644 index ea3ef11b..00000000 --- a/thinkphp/library/think/route/dispatch/View.php +++ /dev/null @@ -1,26 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\route\dispatch; - -use think\Response; -use think\route\Dispatch; - -class View extends Dispatch -{ - public function exec() - { - // 渲染模板输出 - $vars = array_merge($this->request->param(), $this->param); - - return Response::create($this->dispatch, 'view')->assign($vars); - } -} diff --git a/thinkphp/library/think/session/driver/Memcache.php b/thinkphp/library/think/session/driver/Memcache.php deleted file mode 100644 index 40d7bb82..00000000 --- a/thinkphp/library/think/session/driver/Memcache.php +++ /dev/null @@ -1,124 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\session\driver; - -use SessionHandlerInterface; -use think\Exception; - -class Memcache implements SessionHandlerInterface -{ - protected $handler = null; - protected $config = [ - 'host' => '127.0.0.1', // memcache主机 - 'port' => 11211, // memcache端口 - 'expire' => 3600, // session有效期 - 'timeout' => 0, // 连接超时时间(单位:毫秒) - 'persistent' => true, // 长连接 - 'session_name' => '', // memcache key前缀 - ]; - - public function __construct($config = []) - { - $this->config = array_merge($this->config, $config); - } - - /** - * 打开Session - * @access public - * @param string $savePath - * @param mixed $sessName - */ - public function open($savePath, $sessName) - { - // 检测php环境 - if (!extension_loaded('memcache')) { - throw new Exception('not support:memcache'); - } - - $this->handler = new \Memcache; - - // 支持集群 - $hosts = explode(',', $this->config['host']); - $ports = explode(',', $this->config['port']); - - if (empty($ports[0])) { - $ports[0] = 11211; - } - - // 建立连接 - foreach ((array) $hosts as $i => $host) { - $port = isset($ports[$i]) ? $ports[$i] : $ports[0]; - $this->config['timeout'] > 0 ? - $this->handler->addServer($host, $port, $this->config['persistent'], 1, $this->config['timeout']) : - $this->handler->addServer($host, $port, $this->config['persistent'], 1); - } - - return true; - } - - /** - * 关闭Session - * @access public - */ - public function close() - { - $this->gc(ini_get('session.gc_maxlifetime')); - $this->handler->close(); - $this->handler = null; - - return true; - } - - /** - * 读取Session - * @access public - * @param string $sessID - */ - public function read($sessID) - { - return (string) $this->handler->get($this->config['session_name'] . $sessID); - } - - /** - * 写入Session - * @access public - * @param string $sessID - * @param string $sessData - * @return bool - */ - public function write($sessID, $sessData) - { - return $this->handler->set($this->config['session_name'] . $sessID, $sessData, 0, $this->config['expire']); - } - - /** - * 删除Session - * @access public - * @param string $sessID - * @return bool - */ - public function destroy($sessID) - { - return $this->handler->delete($this->config['session_name'] . $sessID); - } - - /** - * Session 垃圾回收 - * @access public - * @param string $sessMaxLifeTime - * @return true - */ - public function gc($sessMaxLifeTime) - { - return true; - } -} diff --git a/thinkphp/library/think/session/driver/Memcached.php b/thinkphp/library/think/session/driver/Memcached.php deleted file mode 100644 index 074b2ff7..00000000 --- a/thinkphp/library/think/session/driver/Memcached.php +++ /dev/null @@ -1,135 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\session\driver; - -use SessionHandlerInterface; -use think\Exception; - -class Memcached implements SessionHandlerInterface -{ - protected $handler = null; - protected $config = [ - 'host' => '127.0.0.1', // memcache主机 - 'port' => 11211, // memcache端口 - 'expire' => 3600, // session有效期 - 'timeout' => 0, // 连接超时时间(单位:毫秒) - 'session_name' => '', // memcache key前缀 - 'username' => '', //账号 - 'password' => '', //密码 - ]; - - public function __construct($config = []) - { - $this->config = array_merge($this->config, $config); - } - - /** - * 打开Session - * @access public - * @param string $savePath - * @param mixed $sessName - */ - public function open($savePath, $sessName) - { - // 检测php环境 - if (!extension_loaded('memcached')) { - throw new Exception('not support:memcached'); - } - - $this->handler = new \Memcached; - - // 设置连接超时时间(单位:毫秒) - if ($this->config['timeout'] > 0) { - $this->handler->setOption(\Memcached::OPT_CONNECT_TIMEOUT, $this->config['timeout']); - } - - // 支持集群 - $hosts = explode(',', $this->config['host']); - $ports = explode(',', $this->config['port']); - - if (empty($ports[0])) { - $ports[0] = 11211; - } - - // 建立连接 - $servers = []; - foreach ((array) $hosts as $i => $host) { - $servers[] = [$host, (isset($ports[$i]) ? $ports[$i] : $ports[0]), 1]; - } - - $this->handler->addServers($servers); - - if ('' != $this->config['username']) { - $this->handler->setOption(\Memcached::OPT_BINARY_PROTOCOL, true); - $this->handler->setSaslAuthData($this->config['username'], $this->config['password']); - } - - return true; - } - - /** - * 关闭Session - * @access public - */ - public function close() - { - $this->gc(ini_get('session.gc_maxlifetime')); - $this->handler->quit(); - $this->handler = null; - - return true; - } - - /** - * 读取Session - * @access public - * @param string $sessID - */ - public function read($sessID) - { - return (string) $this->handler->get($this->config['session_name'] . $sessID); - } - - /** - * 写入Session - * @access public - * @param string $sessID - * @param string $sessData - * @return bool - */ - public function write($sessID, $sessData) - { - return $this->handler->set($this->config['session_name'] . $sessID, $sessData, $this->config['expire']); - } - - /** - * 删除Session - * @access public - * @param string $sessID - * @return bool - */ - public function destroy($sessID) - { - return $this->handler->delete($this->config['session_name'] . $sessID); - } - - /** - * Session 垃圾回收 - * @access public - * @param string $sessMaxLifeTime - * @return true - */ - public function gc($sessMaxLifeTime) - { - return true; - } -} diff --git a/thinkphp/library/think/session/driver/Redis.php b/thinkphp/library/think/session/driver/Redis.php deleted file mode 100644 index 5a0e7bc7..00000000 --- a/thinkphp/library/think/session/driver/Redis.php +++ /dev/null @@ -1,179 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\session\driver; - -use SessionHandlerInterface; -use think\Exception; - -class Redis implements SessionHandlerInterface -{ - /** @var \Redis */ - protected $handler = null; - protected $config = [ - 'host' => '127.0.0.1', // redis主机 - 'port' => 6379, // redis端口 - 'password' => '', // 密码 - 'select' => 0, // 操作库 - 'expire' => 3600, // 有效期(秒) - 'timeout' => 0, // 超时时间(秒) - 'persistent' => true, // 是否长连接 - 'session_name' => '', // sessionkey前缀 - ]; - - public function __construct($config = []) - { - $this->config = array_merge($this->config, $config); - } - - /** - * 打开Session - * @access public - * @param string $savePath - * @param mixed $sessName - * @return bool - * @throws Exception - */ - public function open($savePath, $sessName) - { - if (extension_loaded('redis')) { - $this->handler = new \Redis; - - // 建立连接 - $func = $this->config['persistent'] ? 'pconnect' : 'connect'; - $this->handler->$func($this->config['host'], $this->config['port'], $this->config['timeout']); - - if ('' != $this->config['password']) { - $this->handler->auth($this->config['password']); - } - - if (0 != $this->config['select']) { - $this->handler->select($this->config['select']); - } - } elseif (class_exists('\Predis\Client')) { - $params = []; - foreach ($this->config as $key => $val) { - if (in_array($key, ['aggregate', 'cluster', 'connections', 'exceptions', 'prefix', 'profile', 'replication'])) { - $params[$key] = $val; - unset($this->config[$key]); - } - } - $this->handler = new \Predis\Client($this->config, $params); - } else { - throw new \BadFunctionCallException('not support: redis'); - } - - return true; - } - - /** - * 关闭Session - * @access public - */ - public function close() - { - $this->gc(ini_get('session.gc_maxlifetime')); - $this->handler->close(); - $this->handler = null; - - return true; - } - - /** - * 读取Session - * @access public - * @param string $sessID - * @return string - */ - public function read($sessID) - { - return (string) $this->handler->get($this->config['session_name'] . $sessID); - } - - /** - * 写入Session - * @access public - * @param string $sessID - * @param string $sessData - * @return bool - */ - public function write($sessID, $sessData) - { - if ($this->config['expire'] > 0) { - $result = $this->handler->setex($this->config['session_name'] . $sessID, $this->config['expire'], $sessData); - } else { - $result = $this->handler->set($this->config['session_name'] . $sessID, $sessData); - } - - return $result ? true : false; - } - - /** - * 删除Session - * @access public - * @param string $sessID - * @return bool - */ - public function destroy($sessID) - { - return $this->handler->del($this->config['session_name'] . $sessID) > 0; - } - - /** - * Session 垃圾回收 - * @access public - * @param string $sessMaxLifeTime - * @return bool - */ - public function gc($sessMaxLifeTime) - { - return true; - } - - /** - * Redis Session 驱动的加锁机制 - * @access public - * @param string $sessID 用于加锁的sessID - * @param integer $timeout 默认过期时间 - * @return bool - */ - public function lock($sessID, $timeout = 10) - { - if (null == $this->handler) { - $this->open('', ''); - } - - $lockKey = 'LOCK_PREFIX_' . $sessID; - // 使用setnx操作加锁 - $isLock = $this->handler->setnx($lockKey, 1); - if ($isLock) { - // 设置过期时间,防止死任务的出现 - $this->handler->expire($lockKey, $timeout); - return true; - } - - return false; - } - - /** - * Redis Session 驱动的解锁机制 - * @access public - * @param string $sessID 用于解锁的sessID - */ - public function unlock($sessID) - { - if (null == $this->handler) { - $this->open('', ''); - } - - $this->handler->del('LOCK_PREFIX_' . $sessID); - } -} diff --git a/thinkphp/library/think/template/TagLib.php b/thinkphp/library/think/template/TagLib.php deleted file mode 100644 index bbbb2c03..00000000 --- a/thinkphp/library/think/template/TagLib.php +++ /dev/null @@ -1,351 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\template; - -use think\Exception; - -/** - * ThinkPHP标签库TagLib解析基类 - * @category Think - * @package Think - * @subpackage Template - * @author liu21st - */ -class TagLib -{ - - /** - * 标签库定义XML文件 - * @var string - * @access protected - */ - protected $xml = ''; - protected $tags = []; // 标签定义 - /** - * 标签库名称 - * @var string - * @access protected - */ - protected $tagLib = ''; - - /** - * 标签库标签列表 - * @var array - * @access protected - */ - protected $tagList = []; - - /** - * 标签库分析数组 - * @var array - * @access protected - */ - protected $parse = []; - - /** - * 标签库是否有效 - * @var bool - * @access protected - */ - protected $valid = false; - - /** - * 当前模板对象 - * @var object - * @access protected - */ - protected $tpl; - - protected $comparison = [' nheq ' => ' !== ', ' heq ' => ' === ', ' neq ' => ' != ', ' eq ' => ' == ', ' egt ' => ' >= ', ' gt ' => ' > ', ' elt ' => ' <= ', ' lt ' => ' < ']; - - /** - * 架构函数 - * @access public - * @param \stdClass $template 模板引擎对象 - */ - public function __construct($template) - { - $this->tpl = $template; - } - - /** - * 按签标库替换页面中的标签 - * @access public - * @param string $content 模板内容 - * @param string $lib 标签库名 - * @return void - */ - public function parseTag(&$content, $lib = '') - { - $tags = []; - $lib = $lib ? strtolower($lib) . ':' : ''; - - foreach ($this->tags as $name => $val) { - $close = !isset($val['close']) || $val['close'] ? 1 : 0; - $tags[$close][$lib . $name] = $name; - if (isset($val['alias'])) { - // 别名设置 - $array = (array) $val['alias']; - foreach (explode(',', $array[0]) as $v) { - $tags[$close][$lib . $v] = $name; - } - } - } - - // 闭合标签 - if (!empty($tags[1])) { - $nodes = []; - $regex = $this->getRegex(array_keys($tags[1]), 1); - if (preg_match_all($regex, $content, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { - $right = []; - foreach ($matches as $match) { - if ('' == $match[1][0]) { - $name = strtolower($match[2][0]); - // 如果有没闭合的标签头则取出最后一个 - if (!empty($right[$name])) { - // $match[0][1]为标签结束符在模板中的位置 - $nodes[$match[0][1]] = [ - 'name' => $name, - 'begin' => array_pop($right[$name]), // 标签开始符 - 'end' => $match[0], // 标签结束符 - ]; - } - } else { - // 标签头压入栈 - $right[strtolower($match[1][0])][] = $match[0]; - } - } - unset($right, $matches); - // 按标签在模板中的位置从后向前排序 - krsort($nodes); - } - - $break = ''; - if ($nodes) { - $beginArray = []; - // 标签替换 从后向前 - foreach ($nodes as $pos => $node) { - // 对应的标签名 - $name = $tags[1][$node['name']]; - $alias = $lib . $name != $node['name'] ? ($lib ? strstr($node['name'], $lib) : $node['name']) : ''; - - // 解析标签属性 - $attrs = $this->parseAttr($node['begin'][0], $name, $alias); - $method = 'tag' . $name; - - // 读取标签库中对应的标签内容 replace[0]用来替换标签头,replace[1]用来替换标签尾 - $replace = explode($break, $this->$method($attrs, $break)); - - if (count($replace) > 1) { - while ($beginArray) { - $begin = end($beginArray); - // 判断当前标签尾的位置是否在栈中最后一个标签头的后面,是则为子标签 - if ($node['end'][1] > $begin['pos']) { - break; - } else { - // 不为子标签时,取出栈中最后一个标签头 - $begin = array_pop($beginArray); - // 替换标签头部 - $content = substr_replace($content, $begin['str'], $begin['pos'], $begin['len']); - } - } - // 替换标签尾部 - $content = substr_replace($content, $replace[1], $node['end'][1], strlen($node['end'][0])); - // 把标签头压入栈 - $beginArray[] = ['pos' => $node['begin'][1], 'len' => strlen($node['begin'][0]), 'str' => $replace[0]]; - } - } - - while ($beginArray) { - $begin = array_pop($beginArray); - // 替换标签头部 - $content = substr_replace($content, $begin['str'], $begin['pos'], $begin['len']); - } - } - } - // 自闭合标签 - if (!empty($tags[0])) { - $regex = $this->getRegex(array_keys($tags[0]), 0); - $content = preg_replace_callback($regex, function ($matches) use (&$tags, &$lib) { - // 对应的标签名 - $name = $tags[0][strtolower($matches[1])]; - $alias = $lib . $name != $matches[1] ? ($lib ? strstr($matches[1], $lib) : $matches[1]) : ''; - // 解析标签属性 - $attrs = $this->parseAttr($matches[0], $name, $alias); - $method = 'tag' . $name; - return $this->$method($attrs, ''); - }, $content); - } - - return; - } - - /** - * 按标签生成正则 - * @access public - * @param array|string $tags 标签名 - * @param boolean $close 是否为闭合标签 - * @return string - */ - public function getRegex($tags, $close) - { - $begin = $this->tpl->config('taglib_begin'); - $end = $this->tpl->config('taglib_end'); - $single = strlen(ltrim($begin, '\\')) == 1 && strlen(ltrim($end, '\\')) == 1 ? true : false; - $tagName = is_array($tags) ? implode('|', $tags) : $tags; - - if ($single) { - if ($close) { - // 如果是闭合标签 - $regex = $begin . '(?:(' . $tagName . ')\b(?>[^' . $end . ']*)|\/(' . $tagName . '))' . $end; - } else { - $regex = $begin . '(' . $tagName . ')\b(?>[^' . $end . ']*)' . $end; - } - } else { - if ($close) { - // 如果是闭合标签 - $regex = $begin . '(?:(' . $tagName . ')\b(?>(?:(?!' . $end . ').)*)|\/(' . $tagName . '))' . $end; - } else { - $regex = $begin . '(' . $tagName . ')\b(?>(?:(?!' . $end . ').)*)' . $end; - } - } - - return '/' . $regex . '/is'; - } - - /** - * 分析标签属性 正则方式 - * @access public - * @param string $str 标签属性字符串 - * @param string $name 标签名 - * @param string $alias 别名 - * @return array - */ - public function parseAttr($str, $name, $alias = '') - { - $regex = '/\s+(?>(?P[\w-]+)\s*)=(?>\s*)([\"\'])(?P(?:(?!\\2).)*)\\2/is'; - $result = []; - - if (preg_match_all($regex, $str, $matches)) { - foreach ($matches['name'] as $key => $val) { - $result[$val] = $matches['value'][$key]; - } - - if (!isset($this->tags[$name])) { - // 检测是否存在别名定义 - foreach ($this->tags as $key => $val) { - if (isset($val['alias'])) { - $array = (array) $val['alias']; - if (in_array($name, explode(',', $array[0]))) { - $tag = $val; - $type = !empty($array[1]) ? $array[1] : 'type'; - $result[$type] = $name; - break; - } - } - } - } else { - $tag = $this->tags[$name]; - // 设置了标签别名 - if (!empty($alias) && isset($tag['alias'])) { - $type = !empty($tag['alias'][1]) ? $tag['alias'][1] : 'type'; - $result[$type] = $alias; - } - } - - if (!empty($tag['must'])) { - $must = explode(',', $tag['must']); - foreach ($must as $name) { - if (!isset($result[$name])) { - throw new Exception('tag attr must:' . $name); - } - } - } - } else { - // 允许直接使用表达式的标签 - if (!empty($this->tags[$name]['expression'])) { - static $_taglibs; - if (!isset($_taglibs[$name])) { - $_taglibs[$name][0] = strlen($this->tpl->config('taglib_begin_origin') . $name); - $_taglibs[$name][1] = strlen($this->tpl->config('taglib_end_origin')); - } - $result['expression'] = substr($str, $_taglibs[$name][0], -$_taglibs[$name][1]); - // 清除自闭合标签尾部/ - $result['expression'] = rtrim($result['expression'], '/'); - $result['expression'] = trim($result['expression']); - } elseif (empty($this->tags[$name]) || !empty($this->tags[$name]['attr'])) { - throw new Exception('tag error:' . $name); - } - } - - return $result; - } - - /** - * 解析条件表达式 - * @access public - * @param string $condition 表达式标签内容 - * @return string - */ - public function parseCondition($condition) - { - if (!strpos($condition, '::') && strpos($condition, ':')) { - $condition = ' ' . substr(strstr($condition, ':'), 1); - } - - $condition = str_ireplace(array_keys($this->comparison), array_values($this->comparison), $condition); - $this->tpl->parseVar($condition); - - // $this->tpl->parseVarFunction($condition); // XXX: 此句能解析表达式中用|分隔的函数,但表达式中如果有|、||这样的逻辑运算就产生了歧异 - return $condition; - } - - /** - * 自动识别构建变量 - * @access public - * @param string $name 变量描述 - * @return string - */ - public function autoBuildVar(&$name) - { - $flag = substr($name, 0, 1); - - if (':' == $flag) { - // 以:开头为函数调用,解析前去掉: - $name = substr($name, 1); - } elseif ('$' != $flag && preg_match('/[a-zA-Z_]/', $flag)) { - // XXX: 这句的写法可能还需要改进 - // 常量不需要解析 - if (defined($name)) { - return $name; - } - - // 不以$开头并且也不是常量,自动补上$前缀 - $name = '$' . $name; - } - - $this->tpl->parseVar($name); - $this->tpl->parseVarFunction($name, false); - - return $name; - } - - /** - * 获取标签列表 - * @access public - * @return array - */ - public function getTags() - { - return $this->tags; - } -} diff --git a/thinkphp/library/think/template/driver/File.php b/thinkphp/library/think/template/driver/File.php deleted file mode 100644 index 3b96a0f3..00000000 --- a/thinkphp/library/think/template/driver/File.php +++ /dev/null @@ -1,83 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\template\driver; - -use think\Exception; - -class File -{ - protected $cacheFile; - - /** - * 写入编译缓存 - * @access public - * @param string $cacheFile 缓存的文件名 - * @param string $content 缓存的内容 - * @return void|array - */ - public function write($cacheFile, $content) - { - // 检测模板目录 - $dir = dirname($cacheFile); - - if (!is_dir($dir)) { - mkdir($dir, 0755, true); - } - - // 生成模板缓存文件 - if (false === file_put_contents($cacheFile, $content)) { - throw new Exception('cache write error:' . $cacheFile, 11602); - } - } - - /** - * 读取编译编译 - * @access public - * @param string $cacheFile 缓存的文件名 - * @param array $vars 变量数组 - * @return void - */ - public function read($cacheFile, $vars = []) - { - $this->cacheFile = $cacheFile; - - if (!empty($vars) && is_array($vars)) { - // 模板阵列变量分解成为独立变量 - extract($vars, EXTR_OVERWRITE); - } - - //载入模版缓存文件 - include $this->cacheFile; - } - - /** - * 检查编译缓存是否有效 - * @access public - * @param string $cacheFile 缓存的文件名 - * @param int $cacheTime 缓存时间 - * @return boolean - */ - public function check($cacheFile, $cacheTime) - { - // 缓存文件不存在, 直接返回false - if (!file_exists($cacheFile)) { - return false; - } - - if (0 != $cacheTime && time() > filemtime($cacheFile) + $cacheTime) { - // 缓存是否在有效期 - return false; - } - - return true; - } -} diff --git a/thinkphp/library/think/template/taglib/Cx.php b/thinkphp/library/think/template/taglib/Cx.php deleted file mode 100644 index ad741f28..00000000 --- a/thinkphp/library/think/template/taglib/Cx.php +++ /dev/null @@ -1,724 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\template\taglib; - -use think\template\TagLib; - -/** - * CX标签库解析类 - * @category Think - * @package Think - * @subpackage Driver.Taglib - * @author liu21st - */ -class Cx extends Taglib -{ - - // 标签定义 - protected $tags = [ - // 标签定义: attr 属性列表 close 是否闭合(0 或者1 默认1) alias 标签别名 level 嵌套层次 - 'php' => ['attr' => ''], - 'volist' => ['attr' => 'name,id,offset,length,key,mod', 'alias' => 'iterate'], - 'foreach' => ['attr' => 'name,id,item,key,offset,length,mod', 'expression' => true], - 'if' => ['attr' => 'condition', 'expression' => true], - 'elseif' => ['attr' => 'condition', 'close' => 0, 'expression' => true], - 'else' => ['attr' => '', 'close' => 0], - 'switch' => ['attr' => 'name', 'expression' => true], - 'case' => ['attr' => 'value,break', 'expression' => true], - 'default' => ['attr' => '', 'close' => 0], - 'compare' => ['attr' => 'name,value,type', 'alias' => ['eq,equal,notequal,neq,gt,lt,egt,elt,heq,nheq', 'type']], - 'range' => ['attr' => 'name,value,type', 'alias' => ['in,notin,between,notbetween', 'type']], - 'empty' => ['attr' => 'name'], - 'notempty' => ['attr' => 'name'], - 'present' => ['attr' => 'name'], - 'notpresent' => ['attr' => 'name'], - 'defined' => ['attr' => 'name'], - 'notdefined' => ['attr' => 'name'], - 'load' => ['attr' => 'file,href,type,value,basepath', 'close' => 0, 'alias' => ['import,css,js', 'type']], - 'assign' => ['attr' => 'name,value', 'close' => 0], - 'define' => ['attr' => 'name,value', 'close' => 0], - 'for' => ['attr' => 'start,end,name,comparison,step'], - 'url' => ['attr' => 'link,vars,suffix,domain', 'close' => 0, 'expression' => true], - 'function' => ['attr' => 'name,vars,use,call'], - ]; - - /** - * php标签解析 - * 格式: - * {php}echo $name{/php} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagPhp($tag, $content) - { - $parseStr = ''; - return $parseStr; - } - - /** - * volist标签解析 循环输出数据集 - * 格式: - * {volist name="userList" id="user" empty=""} - * {user.username} - * {user.email} - * {/volist} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string|void - */ - public function tagVolist($tag, $content) - { - $name = $tag['name']; - $id = $tag['id']; - $empty = isset($tag['empty']) ? $tag['empty'] : ''; - $key = !empty($tag['key']) ? $tag['key'] : 'i'; - $mod = isset($tag['mod']) ? $tag['mod'] : '2'; - $offset = !empty($tag['offset']) && is_numeric($tag['offset']) ? intval($tag['offset']) : 0; - $length = !empty($tag['length']) && is_numeric($tag['length']) ? intval($tag['length']) : 'null'; - // 允许使用函数设定数据集 {$vo.name} - $parseStr = 'autoBuildVar($name); - $parseStr .= '$_result=' . $name . ';'; - $name = '$_result'; - } else { - $name = $this->autoBuildVar($name); - } - - $parseStr .= 'if(is_array(' . $name . ') || ' . $name . ' instanceof \think\Collection || ' . $name . ' instanceof \think\Paginator): $' . $key . ' = 0;'; - - // 设置了输出数组长度 - if (0 != $offset || 'null' != $length) { - $parseStr .= '$__LIST__ = is_array(' . $name . ') ? array_slice(' . $name . ',' . $offset . ',' . $length . ', true) : ' . $name . '->slice(' . $offset . ',' . $length . ', true); '; - } else { - $parseStr .= ' $__LIST__ = ' . $name . ';'; - } - - $parseStr .= 'if( count($__LIST__)==0 ) : echo "' . $empty . '" ;'; - $parseStr .= 'else: '; - $parseStr .= 'foreach($__LIST__ as $key=>$' . $id . '): '; - $parseStr .= '$mod = ($' . $key . ' % ' . $mod . ' );'; - $parseStr .= '++$' . $key . ';?>'; - $parseStr .= $content; - $parseStr .= ''; - - if (!empty($parseStr)) { - return $parseStr; - } - - return; - } - - /** - * foreach标签解析 循环输出数据集 - * 格式: - * {foreach name="userList" id="user" key="key" index="i" mod="2" offset="3" length="5" empty=""} - * {user.username} - * {/foreach} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string|void - */ - public function tagForeach($tag, $content) - { - // 直接使用表达式 - if (!empty($tag['expression'])) { - $expression = ltrim(rtrim($tag['expression'], ')'), '('); - $expression = $this->autoBuildVar($expression); - $parseStr = ''; - $parseStr .= $content; - $parseStr .= ''; - return $parseStr; - } - - $name = $tag['name']; - $key = !empty($tag['key']) ? $tag['key'] : 'key'; - $item = !empty($tag['id']) ? $tag['id'] : $tag['item']; - $empty = isset($tag['empty']) ? $tag['empty'] : ''; - $offset = !empty($tag['offset']) && is_numeric($tag['offset']) ? intval($tag['offset']) : 0; - $length = !empty($tag['length']) && is_numeric($tag['length']) ? intval($tag['length']) : 'null'; - - $parseStr = 'autoBuildVar($name); - $parseStr .= $var . '=' . $name . '; '; - $name = $var; - } else { - $name = $this->autoBuildVar($name); - } - - $parseStr .= 'if(is_array(' . $name . ') || ' . $name . ' instanceof \think\Collection || ' . $name . ' instanceof \think\Paginator): '; - - // 设置了输出数组长度 - if (0 != $offset || 'null' != $length) { - if (!isset($var)) { - $var = '$_' . uniqid(); - } - $parseStr .= $var . ' = is_array(' . $name . ') ? array_slice(' . $name . ',' . $offset . ',' . $length . ', true) : ' . $name . '->slice(' . $offset . ',' . $length . ', true); '; - } else { - $var = &$name; - } - - $parseStr .= 'if( count(' . $var . ')==0 ) : echo "' . $empty . '" ;'; - $parseStr .= 'else: '; - - // 设置了索引项 - if (isset($tag['index'])) { - $index = $tag['index']; - $parseStr .= '$' . $index . '=0; '; - } - - $parseStr .= 'foreach(' . $var . ' as $' . $key . '=>$' . $item . '): '; - - // 设置了索引项 - if (isset($tag['index'])) { - $index = $tag['index']; - if (isset($tag['mod'])) { - $mod = (int) $tag['mod']; - $parseStr .= '$mod = ($' . $index . ' % ' . $mod . '); '; - } - $parseStr .= '++$' . $index . '; '; - } - - $parseStr .= '?>'; - // 循环体中的内容 - $parseStr .= $content; - $parseStr .= ''; - - if (!empty($parseStr)) { - return $parseStr; - } - - return; - } - - /** - * if标签解析 - * 格式: - * {if condition=" $a eq 1"} - * {elseif condition="$a eq 2" /} - * {else /} - * {/if} - * 表达式支持 eq neq gt egt lt elt == > >= < <= or and || && - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagIf($tag, $content) - { - $condition = !empty($tag['expression']) ? $tag['expression'] : $tag['condition']; - $condition = $this->parseCondition($condition); - $parseStr = '' . $content . ''; - - return $parseStr; - } - - /** - * elseif标签解析 - * 格式:见if标签 - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagElseif($tag, $content) - { - $condition = !empty($tag['expression']) ? $tag['expression'] : $tag['condition']; - $condition = $this->parseCondition($condition); - $parseStr = ''; - - return $parseStr; - } - - /** - * else标签解析 - * 格式:见if标签 - * @access public - * @param array $tag 标签属性 - * @return string - */ - public function tagElse($tag) - { - $parseStr = ''; - - return $parseStr; - } - - /** - * switch标签解析 - * 格式: - * {switch name="a.name"} - * {case value="1" break="false"}1{/case} - * {case value="2" }2{/case} - * {default /}other - * {/switch} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagSwitch($tag, $content) - { - $name = !empty($tag['expression']) ? $tag['expression'] : $tag['name']; - $name = $this->autoBuildVar($name); - $parseStr = '' . $content . ''; - - return $parseStr; - } - - /** - * case标签解析 需要配合switch才有效 - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagCase($tag, $content) - { - $value = isset($tag['expression']) ? $tag['expression'] : $tag['value']; - $flag = substr($value, 0, 1); - - if ('$' == $flag || ':' == $flag) { - $value = $this->autoBuildVar($value); - $value = 'case ' . $value . ':'; - } elseif (strpos($value, '|')) { - $values = explode('|', $value); - $value = ''; - foreach ($values as $val) { - $value .= 'case "' . addslashes($val) . '":'; - } - } else { - $value = 'case "' . $value . '":'; - } - - $parseStr = '' . $content; - $isBreak = isset($tag['break']) ? $tag['break'] : ''; - - if ('' == $isBreak || $isBreak) { - $parseStr .= ''; - } - - return $parseStr; - } - - /** - * default标签解析 需要配合switch才有效 - * 使用: {default /}ddfdf - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagDefault($tag) - { - $parseStr = ''; - - return $parseStr; - } - - /** - * compare标签解析 - * 用于值的比较 支持 eq neq gt lt egt elt heq nheq 默认是eq - * 格式: {compare name="" type="eq" value="" }content{/compare} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagCompare($tag, $content) - { - $name = $tag['name']; - $value = $tag['value']; - $type = isset($tag['type']) ? $tag['type'] : 'eq'; // 比较类型 - $name = $this->autoBuildVar($name); - $flag = substr($value, 0, 1); - - if ('$' == $flag || ':' == $flag) { - $value = $this->autoBuildVar($value); - } else { - $value = '\'' . $value . '\''; - } - - switch ($type) { - case 'equal': - $type = 'eq'; - break; - case 'notequal': - $type = 'neq'; - break; - } - $type = $this->parseCondition(' ' . $type . ' '); - $parseStr = '' . $content . ''; - - return $parseStr; - } - - /** - * range标签解析 - * 如果某个变量存在于某个范围 则输出内容 type= in 表示在范围内 否则表示在范围外 - * 格式: {range name="var|function" value="val" type='in|notin' }content{/range} - * example: {range name="a" value="1,2,3" type='in' }content{/range} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagRange($tag, $content) - { - $name = $tag['name']; - $value = $tag['value']; - $type = isset($tag['type']) ? $tag['type'] : 'in'; // 比较类型 - - $name = $this->autoBuildVar($name); - $flag = substr($value, 0, 1); - - if ('$' == $flag || ':' == $flag) { - $value = $this->autoBuildVar($value); - $str = 'is_array(' . $value . ')?' . $value . ':explode(\',\',' . $value . ')'; - } else { - $value = '"' . $value . '"'; - $str = 'explode(\',\',' . $value . ')'; - } - - if ('between' == $type) { - $parseStr = '= $_RANGE_VAR_[0] && ' . $name . '<= $_RANGE_VAR_[1]):?>' . $content . ''; - } elseif ('notbetween' == $type) { - $parseStr = '$_RANGE_VAR_[1]):?>' . $content . ''; - } else { - $fun = ('in' == $type) ? 'in_array' : '!in_array'; - $parseStr = '' . $content . ''; - } - - return $parseStr; - } - - /** - * present标签解析 - * 如果某个变量已经设置 则输出内容 - * 格式: {present name="" }content{/present} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagPresent($tag, $content) - { - $name = $tag['name']; - $name = $this->autoBuildVar($name); - $parseStr = '' . $content . ''; - - return $parseStr; - } - - /** - * notpresent标签解析 - * 如果某个变量没有设置,则输出内容 - * 格式: {notpresent name="" }content{/notpresent} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagNotpresent($tag, $content) - { - $name = $tag['name']; - $name = $this->autoBuildVar($name); - $parseStr = '' . $content . ''; - - return $parseStr; - } - - /** - * empty标签解析 - * 如果某个变量为empty 则输出内容 - * 格式: {empty name="" }content{/empty} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagEmpty($tag, $content) - { - $name = $tag['name']; - $name = $this->autoBuildVar($name); - $parseStr = 'isEmpty())): ?>' . $content . ''; - - return $parseStr; - } - - /** - * notempty标签解析 - * 如果某个变量不为empty 则输出内容 - * 格式: {notempty name="" }content{/notempty} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagNotempty($tag, $content) - { - $name = $tag['name']; - $name = $this->autoBuildVar($name); - $parseStr = 'isEmpty()))): ?>' . $content . ''; - - return $parseStr; - } - - /** - * 判断是否已经定义了该常量 - * {defined name='TXT'}已定义{/defined} - * @access public - * @param array $tag - * @param string $content - * @return string - */ - public function tagDefined($tag, $content) - { - $name = $tag['name']; - $parseStr = '' . $content . ''; - - return $parseStr; - } - - /** - * 判断是否没有定义了该常量 - * {notdefined name='TXT'}已定义{/notdefined} - * @access public - * @param array $tag - * @param string $content - * @return string - */ - public function tagNotdefined($tag, $content) - { - $name = $tag['name']; - $parseStr = '' . $content . ''; - - return $parseStr; - } - - /** - * load 标签解析 {load file="/static/js/base.js" /} - * 格式:{load file="/static/css/base.css" /} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagLoad($tag, $content) - { - $file = isset($tag['file']) ? $tag['file'] : $tag['href']; - $type = isset($tag['type']) ? strtolower($tag['type']) : ''; - - $parseStr = ''; - $endStr = ''; - - // 判断是否存在加载条件 允许使用函数判断(默认为isset) - if (isset($tag['value'])) { - $name = $tag['value']; - $name = $this->autoBuildVar($name); - $name = 'isset(' . $name . ')'; - $parseStr .= ''; - $endStr = ''; - } - - // 文件方式导入 - $array = explode(',', $file); - - foreach ($array as $val) { - $type = strtolower(substr(strrchr($val, '.'), 1)); - switch ($type) { - case 'js': - $parseStr .= ''; - break; - case 'css': - $parseStr .= ''; - break; - case 'php': - $parseStr .= ''; - break; - } - } - - return $parseStr . $endStr; - } - - /** - * assign标签解析 - * 在模板中给某个变量赋值 支持变量赋值 - * 格式: {assign name="" value="" /} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagAssign($tag, $content) - { - $name = $this->autoBuildVar($tag['name']); - $flag = substr($tag['value'], 0, 1); - - if ('$' == $flag || ':' == $flag) { - $value = $this->autoBuildVar($tag['value']); - } else { - $value = '\'' . $tag['value'] . '\''; - } - - $parseStr = ''; - - return $parseStr; - } - - /** - * define标签解析 - * 在模板中定义常量 支持变量赋值 - * 格式: {define name="" value="" /} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagDefine($tag, $content) - { - $name = '\'' . $tag['name'] . '\''; - $flag = substr($tag['value'], 0, 1); - - if ('$' == $flag || ':' == $flag) { - $value = $this->autoBuildVar($tag['value']); - } else { - $value = '\'' . $tag['value'] . '\''; - } - - $parseStr = ''; - - return $parseStr; - } - - /** - * for标签解析 - * 格式: - * {for start="" end="" comparison="" step="" name=""} - * content - * {/for} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagFor($tag, $content) - { - //设置默认值 - $start = 0; - $end = 0; - $step = 1; - $comparison = 'lt'; - $name = 'i'; - $rand = rand(); //添加随机数,防止嵌套变量冲突 - - //获取属性 - foreach ($tag as $key => $value) { - $value = trim($value); - $flag = substr($value, 0, 1); - if ('$' == $flag || ':' == $flag) { - $value = $this->autoBuildVar($value); - } - - switch ($key) { - case 'start': - $start = $value; - break; - case 'end': - $end = $value; - break; - case 'step': - $step = $value; - break; - case 'comparison': - $comparison = $value; - break; - case 'name': - $name = $value; - break; - } - } - - $parseStr = 'parseCondition('$' . $name . ' ' . $comparison . ' $__FOR_END_' . $rand . '__') . ';$' . $name . '+=' . $step . '){ ?>'; - $parseStr .= $content; - $parseStr .= ''; - - return $parseStr; - } - - /** - * url函数的tag标签 - * 格式:{url link="模块/控制器/方法" vars="参数" suffix="true或者false 是否带有后缀" domain="true或者false 是否携带域名" /} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagUrl($tag, $content) - { - $url = isset($tag['link']) ? $tag['link'] : ''; - $vars = isset($tag['vars']) ? $tag['vars'] : ''; - $suffix = isset($tag['suffix']) ? $tag['suffix'] : 'true'; - $domain = isset($tag['domain']) ? $tag['domain'] : 'false'; - - return ''; - } - - /** - * function标签解析 匿名函数,可实现递归 - * 使用: - * {function name="func" vars="$data" call="$list" use="&$a,&$b"} - * {if is_array($data)} - * {foreach $data as $val} - * {~func($val) /} - * {/foreach} - * {else /} - * {$data} - * {/if} - * {/function} - * @access public - * @param array $tag 标签属性 - * @param string $content 标签内容 - * @return string - */ - public function tagFunction($tag, $content) - { - $name = !empty($tag['name']) ? $tag['name'] : 'func'; - $vars = !empty($tag['vars']) ? $tag['vars'] : ''; - $call = !empty($tag['call']) ? $tag['call'] : ''; - $use = ['&$' . $name]; - - if (!empty($tag['use'])) { - foreach (explode(',', $tag['use']) as $val) { - $use[] = '&' . ltrim(trim($val), '&'); - } - } - - $parseStr = '' . $content . '' : '?>'; - - return $parseStr; - } -} diff --git a/thinkphp/library/think/validate/ValidateRule.php b/thinkphp/library/think/validate/ValidateRule.php deleted file mode 100644 index 7cd70174..00000000 --- a/thinkphp/library/think/validate/ValidateRule.php +++ /dev/null @@ -1,171 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\validate; - -/** - * Class ValidateRule - * @package think\validate - * @method ValidateRule confirm(mixed $rule, string $msg = '') static 验证是否和某个字段的值一致 - * @method ValidateRule different(mixed $rule, string $msg = '') static 验证是否和某个字段的值是否不同 - * @method ValidateRule egt(mixed $rule, string $msg = '') static 验证是否大于等于某个值 - * @method ValidateRule gt(mixed $rule, string $msg = '') static 验证是否大于某个值 - * @method ValidateRule elt(mixed $rule, string $msg = '') static 验证是否小于等于某个值 - * @method ValidateRule lt(mixed $rule, string $msg = '') static 验证是否小于某个值 - * @method ValidateRule eg(mixed $rule, string $msg = '') static 验证是否等于某个值 - * @method ValidateRule in(mixed $rule, string $msg = '') static 验证是否在范围内 - * @method ValidateRule notIn(mixed $rule, string $msg = '') static 验证是否不在某个范围 - * @method ValidateRule between(mixed $rule, string $msg = '') static 验证是否在某个区间 - * @method ValidateRule notBetween(mixed $rule, string $msg = '') static 验证是否不在某个区间 - * @method ValidateRule length(mixed $rule, string $msg = '') static 验证数据长度 - * @method ValidateRule max(mixed $rule, string $msg = '') static 验证数据最大长度 - * @method ValidateRule min(mixed $rule, string $msg = '') static 验证数据最小长度 - * @method ValidateRule after(mixed $rule, string $msg = '') static 验证日期 - * @method ValidateRule before(mixed $rule, string $msg = '') static 验证日期 - * @method ValidateRule expire(mixed $rule, string $msg = '') static 验证有效期 - * @method ValidateRule allowIp(mixed $rule, string $msg = '') static 验证IP许可 - * @method ValidateRule denyIp(mixed $rule, string $msg = '') static 验证IP禁用 - * @method ValidateRule regex(mixed $rule, string $msg = '') static 使用正则验证数据 - * @method ValidateRule token(mixed $rule='__token__', string $msg = '') static 验证表单令牌 - * @method ValidateRule is(mixed $rule, string $msg = '') static 验证字段值是否为有效格式 - * @method ValidateRule isRequire(mixed $rule = null, string $msg = '') static 验证字段必须 - * @method ValidateRule isNumber(mixed $rule = null, string $msg = '') static 验证字段值是否为数字 - * @method ValidateRule isArray(mixed $rule = null, string $msg = '') static 验证字段值是否为数组 - * @method ValidateRule isInteger(mixed $rule = null, string $msg = '') static 验证字段值是否为整形 - * @method ValidateRule isFloat(mixed $rule = null, string $msg = '') static 验证字段值是否为浮点数 - * @method ValidateRule isMobile(mixed $rule = null, string $msg = '') static 验证字段值是否为手机 - * @method ValidateRule isIdCard(mixed $rule = null, string $msg = '') static 验证字段值是否为身份证号码 - * @method ValidateRule isChs(mixed $rule = null, string $msg = '') static 验证字段值是否为中文 - * @method ValidateRule isChsDash(mixed $rule = null, string $msg = '') static 验证字段值是否为中文字母及下划线 - * @method ValidateRule isChsAlpha(mixed $rule = null, string $msg = '') static 验证字段值是否为中文和字母 - * @method ValidateRule isChsAlphaNum(mixed $rule = null, string $msg = '') static 验证字段值是否为中文字母和数字 - * @method ValidateRule isDate(mixed $rule = null, string $msg = '') static 验证字段值是否为有效格式 - * @method ValidateRule isBool(mixed $rule = null, string $msg = '') static 验证字段值是否为布尔值 - * @method ValidateRule isAlpha(mixed $rule = null, string $msg = '') static 验证字段值是否为字母 - * @method ValidateRule isAlphaDash(mixed $rule = null, string $msg = '') static 验证字段值是否为字母和下划线 - * @method ValidateRule isAlphaNum(mixed $rule = null, string $msg = '') static 验证字段值是否为字母和数字 - * @method ValidateRule isAccepted(mixed $rule = null, string $msg = '') static 验证字段值是否为yes, on, 或是 1 - * @method ValidateRule isEmail(mixed $rule = null, string $msg = '') static 验证字段值是否为有效邮箱格式 - * @method ValidateRule isUrl(mixed $rule = null, string $msg = '') static 验证字段值是否为有效URL地址 - * @method ValidateRule activeUrl(mixed $rule, string $msg = '') static 验证是否为合格的域名或者IP - * @method ValidateRule ip(mixed $rule, string $msg = '') static 验证是否有效IP - * @method ValidateRule fileExt(mixed $rule, string $msg = '') static 验证文件后缀 - * @method ValidateRule fileMime(mixed $rule, string $msg = '') static 验证文件类型 - * @method ValidateRule fileSize(mixed $rule, string $msg = '') static 验证文件大小 - * @method ValidateRule image(mixed $rule, string $msg = '') static 验证图像文件 - * @method ValidateRule method(mixed $rule, string $msg = '') static 验证请求类型 - * @method ValidateRule dateFormat(mixed $rule, string $msg = '') static 验证时间和日期是否符合指定格式 - * @method ValidateRule unique(mixed $rule, string $msg = '') static 验证是否唯一 - * @method ValidateRule behavior(mixed $rule, string $msg = '') static 使用行为类验证 - * @method ValidateRule filter(mixed $rule, string $msg = '') static 使用filter_var方式验证 - * @method ValidateRule requireIf(mixed $rule, string $msg = '') static 验证某个字段等于某个值的时候必须 - * @method ValidateRule requireCallback(mixed $rule, string $msg = '') static 通过回调方法验证某个字段是否必须 - * @method ValidateRule requireWith(mixed $rule, string $msg = '') static 验证某个字段有值的情况下必须 - * @method ValidateRule must(mixed $rule = null, string $msg = '') static 必须验证 - */ -class ValidateRule -{ - // 验证字段的名称 - protected $title; - - // 当前验证规则 - protected $rule = []; - - // 验证提示信息 - protected $message = []; - - /** - * 添加验证因子 - * @access protected - * @param string $name 验证名称 - * @param mixed $rule 验证规则 - * @param string $msg 提示信息 - * @return $this - */ - protected function addItem($name, $rule = null, $msg = '') - { - if ($rule || 0 === $rule) { - $this->rule[$name] = $rule; - } else { - $this->rule[] = $name; - } - - $this->message[] = $msg; - - return $this; - } - - /** - * 获取验证规则 - * @access public - * @return array - */ - public function getRule() - { - return $this->rule; - } - - /** - * 获取验证字段名称 - * @access public - * @return string - */ - public function getTitle() - { - return $this->title; - } - - /** - * 获取验证提示 - * @access public - * @return array - */ - public function getMsg() - { - return $this->message; - } - - /** - * 设置验证字段名称 - * @access public - * @return $this - */ - public function title($title) - { - $this->title = $title; - - return $this; - } - - public function __call($method, $args) - { - if ('is' == strtolower(substr($method, 0, 2))) { - $method = substr($method, 2); - } - - array_unshift($args, lcfirst($method)); - - return call_user_func_array([$this, 'addItem'], $args); - } - - public static function __callStatic($method, $args) - { - $rule = new static(); - - if ('is' == strtolower(substr($method, 0, 2))) { - $method = substr($method, 2); - } - - array_unshift($args, lcfirst($method)); - - return call_user_func_array([$rule, 'addItem'], $args); - } -} diff --git a/thinkphp/library/think/view/driver/Php.php b/thinkphp/library/think/view/driver/Php.php deleted file mode 100644 index 7948dc05..00000000 --- a/thinkphp/library/think/view/driver/Php.php +++ /dev/null @@ -1,183 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\view\driver; - -use think\App; -use think\exception\TemplateNotFoundException; -use think\Loader; - -class Php -{ - // 模板引擎参数 - protected $config = [ - // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 - 'auto_rule' => 1, - // 视图基础目录(集中式) - 'view_base' => '', - // 模板起始路径 - 'view_path' => '', - // 模板文件后缀 - 'view_suffix' => 'php', - // 模板文件名分隔符 - 'view_depr' => DIRECTORY_SEPARATOR, - ]; - - protected $template; - protected $app; - protected $content; - - public function __construct(App $app, $config = []) - { - $this->app = $app; - $this->config = array_merge($this->config, (array) $config); - } - - /** - * 检测是否存在模板文件 - * @access public - * @param string $template 模板文件或者模板规则 - * @return bool - */ - public function exists($template) - { - if ('' == pathinfo($template, PATHINFO_EXTENSION)) { - // 获取模板文件名 - $template = $this->parseTemplate($template); - } - - return is_file($template); - } - - /** - * 渲染模板文件 - * @access public - * @param string $template 模板文件 - * @param array $data 模板变量 - * @return void - */ - public function fetch($template, $data = []) - { - if ('' == pathinfo($template, PATHINFO_EXTENSION)) { - // 获取模板文件名 - $template = $this->parseTemplate($template); - } - - // 模板不存在 抛出异常 - if (!is_file($template)) { - throw new TemplateNotFoundException('template not exists:' . $template, $template); - } - - $this->template = $template; - - // 记录视图信息 - $this->app - ->log('[ VIEW ] ' . $template . ' [ ' . var_export(array_keys($data), true) . ' ]'); - - extract($data, EXTR_OVERWRITE); - include $this->template; - } - - /** - * 渲染模板内容 - * @access public - * @param string $content 模板内容 - * @param array $data 模板变量 - * @return void - */ - public function display($content, $data = []) - { - $this->content = $content; - - extract($data, EXTR_OVERWRITE); - eval('?>' . $this->content); - } - - /** - * 自动定位模板文件 - * @access private - * @param string $template 模板文件规则 - * @return string - */ - private function parseTemplate($template) - { - if (empty($this->config['view_path'])) { - $this->config['view_path'] = $this->app->getModulePath() . 'view' . DIRECTORY_SEPARATOR; - } - - $request = $this->app['request']; - - // 获取视图根目录 - if (strpos($template, '@')) { - // 跨模块调用 - list($module, $template) = explode('@', $template); - } - - if ($this->config['view_base']) { - // 基础视图目录 - $module = isset($module) ? $module : $request->module(); - $path = $this->config['view_base'] . ($module ? $module . DIRECTORY_SEPARATOR : ''); - } else { - $path = isset($module) ? $this->app->getAppPath() . $module . DIRECTORY_SEPARATOR . 'view' . DIRECTORY_SEPARATOR : $this->config['view_path']; - } - - $depr = $this->config['view_depr']; - - if (0 !== strpos($template, '/')) { - $template = str_replace(['/', ':'], $depr, $template); - $controller = Loader::parseName($request->controller()); - - if ($controller) { - if ('' == $template) { - // 如果模板文件名为空 按照默认规则定位 - $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $this->getActionTemplate($request); - } elseif (false === strpos($template, $depr)) { - $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template; - } - } - } else { - $template = str_replace(['/', ':'], $depr, substr($template, 1)); - } - - return $path . ltrim($template, '/') . '.' . ltrim($this->config['view_suffix'], '.'); - } - - protected function getActionTemplate($request) - { - $rule = [$request->action(true), Loader::parseName($request->action(true)), $request->action()]; - $type = $this->config['auto_rule']; - - return isset($rule[$type]) ? $rule[$type] : $rule[0]; - } - - /** - * 配置模板引擎 - * @access private - * @param string|array $name 参数名 - * @param mixed $value 参数值 - * @return void - */ - public function config($name, $value = null) - { - if (is_array($name)) { - $this->config = array_merge($this->config, $name); - } elseif (is_null($value)) { - return isset($this->config[$name]) ? $this->config[$name] : null; - } else { - $this->config[$name] = $value; - } - } - - public function __debugInfo() - { - return ['config' => $this->config]; - } -} diff --git a/thinkphp/library/think/view/driver/Think.php b/thinkphp/library/think/view/driver/Think.php deleted file mode 100644 index 877aee85..00000000 --- a/thinkphp/library/think/view/driver/Think.php +++ /dev/null @@ -1,192 +0,0 @@ - -// +---------------------------------------------------------------------- - -namespace think\view\driver; - -use think\App; -use think\exception\TemplateNotFoundException; -use think\Loader; -use think\Template; - -class Think -{ - // 模板引擎实例 - private $template; - private $app; - - // 模板引擎参数 - protected $config = [ - // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 - 'auto_rule' => 1, - // 视图基础目录(集中式) - 'view_base' => '', - // 模板起始路径 - 'view_path' => '', - // 模板文件后缀 - 'view_suffix' => 'html', - // 模板文件名分隔符 - 'view_depr' => DIRECTORY_SEPARATOR, - // 是否开启模板编译缓存,设为false则每次都会重新编译 - 'tpl_cache' => true, - ]; - - public function __construct(App $app, $config = []) - { - $this->app = $app; - $this->config = array_merge($this->config, (array) $config); - - if (empty($this->config['view_path'])) { - $this->config['view_path'] = $app->getModulePath() . 'view' . DIRECTORY_SEPARATOR; - } - - $this->template = new Template($app, $this->config); - } - - /** - * 检测是否存在模板文件 - * @access public - * @param string $template 模板文件或者模板规则 - * @return bool - */ - public function exists($template) - { - if ('' == pathinfo($template, PATHINFO_EXTENSION)) { - // 获取模板文件名 - $template = $this->parseTemplate($template); - } - - return is_file($template); - } - - /** - * 渲染模板文件 - * @access public - * @param string $template 模板文件 - * @param array $data 模板变量 - * @param array $config 模板参数 - * @return void - */ - public function fetch($template, $data = [], $config = []) - { - if ('' == pathinfo($template, PATHINFO_EXTENSION)) { - // 获取模板文件名 - $template = $this->parseTemplate($template); - } - - // 模板不存在 抛出异常 - if (!is_file($template)) { - throw new TemplateNotFoundException('template not exists:' . $template, $template); - } - - // 记录视图信息 - $this->app - ->log('[ VIEW ] ' . $template . ' [ ' . var_export(array_keys($data), true) . ' ]'); - - $this->template->fetch($template, $data, $config); - } - - /** - * 渲染模板内容 - * @access public - * @param string $template 模板内容 - * @param array $data 模板变量 - * @param array $config 模板参数 - * @return void - */ - public function display($template, $data = [], $config = []) - { - $this->template->display($template, $data, $config); - } - - /** - * 自动定位模板文件 - * @access private - * @param string $template 模板文件规则 - * @return string - */ - private function parseTemplate($template) - { - // 分析模板文件规则 - $request = $this->app['request']; - - // 获取视图根目录 - if (strpos($template, '@')) { - // 跨模块调用 - list($module, $template) = explode('@', $template); - } - - if ($this->config['view_base']) { - // 基础视图目录 - $module = isset($module) ? $module : $request->module(); - $path = $this->config['view_base'] . ($module ? $module . DIRECTORY_SEPARATOR : ''); - } else { - $path = isset($module) ? $this->app->getAppPath() . $module . DIRECTORY_SEPARATOR . 'view' . DIRECTORY_SEPARATOR : $this->config['view_path']; - } - - $depr = $this->config['view_depr']; - - if (0 !== strpos($template, '/')) { - $template = str_replace(['/', ':'], $depr, $template); - $controller = Loader::parseName($request->controller()); - - if ($controller) { - if ('' == $template) { - // 如果模板文件名为空 按照默认规则定位 - $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $this->getActionTemplate($request); - } elseif (false === strpos($template, $depr)) { - $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template; - } - } - } else { - $template = str_replace(['/', ':'], $depr, substr($template, 1)); - } - - return $path . ltrim($template, '/') . '.' . ltrim($this->config['view_suffix'], '.'); - } - - protected function getActionTemplate($request) - { - $rule = [$request->action(true), Loader::parseName($request->action(true)), $request->action()]; - $type = $this->config['auto_rule']; - - return isset($rule[$type]) ? $rule[$type] : $rule[0]; - } - - /** - * 配置或者获取模板引擎参数 - * @access private - * @param string|array $name 参数名 - * @param mixed $value 参数值 - * @return mixed - */ - public function config($name, $value = null) - { - if (is_array($name)) { - $this->template->config($name); - $this->config = array_merge($this->config, $name); - } elseif (is_null($value)) { - return $this->template->config($name); - } else { - $this->template->$name = $value; - $this->config[$name] = $value; - } - } - - public function __call($method, $params) - { - return call_user_func_array([$this->template, $method], $params); - } - - public function __debugInfo() - { - return ['config' => $this->config]; - } -} diff --git a/thinkphp/library/traits/controller/Jump.php b/thinkphp/library/traits/controller/Jump.php deleted file mode 100644 index 41f7e930..00000000 --- a/thinkphp/library/traits/controller/Jump.php +++ /dev/null @@ -1,168 +0,0 @@ -error(); - * $this->redirect(); - * } - * } - */ -namespace traits\controller; - -use think\Container; -use think\exception\HttpResponseException; -use think\Response; -use think\response\Redirect; - -trait Jump -{ - /** - * 应用实例 - * @var \think\App - */ - protected $app; - - /** - * 操作成功跳转的快捷方法 - * @access protected - * @param mixed $msg 提示信息 - * @param string $url 跳转的URL地址 - * @param mixed $data 返回的数据 - * @param integer $wait 跳转等待时间 - * @param array $header 发送的Header信息 - * @return void - */ - protected function success($msg = '', $url = null, $data = '', $wait = 3, array $header = []) - { - if (is_null($url) && isset($_SERVER["HTTP_REFERER"])) { - $url = $_SERVER["HTTP_REFERER"]; - } elseif ('' !== $url) { - $url = (strpos($url, '://') || 0 === strpos($url, '/')) ? $url : Container::get('url')->build($url); - } - - $result = [ - 'code' => 1, - 'msg' => $msg, - 'data' => $data, - 'url' => $url, - 'wait' => $wait, - ]; - - $type = $this->getResponseType(); - // 把跳转模板的渲染下沉,这样在 response_send 行为里通过getData()获得的数据是一致性的格式 - if ('html' == strtolower($type)) { - $type = 'jump'; - } - - $response = Response::create($result, $type)->header($header)->options(['jump_template' => $this->app['config']->get('dispatch_success_tmpl')]); - - throw new HttpResponseException($response); - } - - /** - * 操作错误跳转的快捷方法 - * @access protected - * @param mixed $msg 提示信息 - * @param string $url 跳转的URL地址 - * @param mixed $data 返回的数据 - * @param integer $wait 跳转等待时间 - * @param array $header 发送的Header信息 - * @return void - */ - protected function error($msg = '', $url = null, $data = '', $wait = 3, array $header = []) - { - $type = $this->getResponseType(); - if (is_null($url)) { - $url = $this->app['request']->isAjax() ? '' : 'javascript:history.back(-1);'; - } elseif ('' !== $url) { - $url = (strpos($url, '://') || 0 === strpos($url, '/')) ? $url : $this->app['url']->build($url); - } - - $result = [ - 'code' => 0, - 'msg' => $msg, - 'data' => $data, - 'url' => $url, - 'wait' => $wait, - ]; - - if ('html' == strtolower($type)) { - $type = 'jump'; - } - - $response = Response::create($result, $type)->header($header)->options(['jump_template' => $this->app['config']->get('dispatch_error_tmpl')]); - - throw new HttpResponseException($response); - } - - /** - * 返回封装后的API数据到客户端 - * @access protected - * @param mixed $data 要返回的数据 - * @param integer $code 返回的code - * @param mixed $msg 提示信息 - * @param string $type 返回数据格式 - * @param array $header 发送的Header信息 - * @return void - */ - protected function result($data, $code = 0, $msg = '', $type = '', array $header = []) - { - $result = [ - 'code' => $code, - 'msg' => $msg, - 'time' => time(), - 'data' => $data, - ]; - - $type = $type ?: $this->getResponseType(); - $response = Response::create($result, $type)->header($header); - - throw new HttpResponseException($response); - } - - /** - * URL重定向 - * @access protected - * @param string $url 跳转的URL表达式 - * @param array|integer $params 其它URL参数 - * @param integer $code http code - * @param array $with 隐式传参 - * @return void - */ - protected function redirect($url, $params = [], $code = 302, $with = []) - { - $response = new Redirect($url); - - if (is_integer($params)) { - $code = $params; - $params = []; - } - - $response->code($code)->params($params)->with($with); - - throw new HttpResponseException($response); - } - - /** - * 获取当前的response 输出类型 - * @access protected - * @return string - */ - protected function getResponseType() - { - if (!$this->app) { - $this->app = Container::get('app'); - } - - $isAjax = $this->app['request']->isAjax(); - $config = $this->app['config']; - - return $isAjax - ? $config->get('default_ajax_return') - : $config->get('default_return_type'); - } -} diff --git a/thinkphp/logo.png b/thinkphp/logo.png deleted file mode 100644 index 25fd0593..00000000 Binary files a/thinkphp/logo.png and /dev/null differ diff --git a/thinkphp/phpunit.xml.dist b/thinkphp/phpunit.xml.dist deleted file mode 100644 index 37c3d2b5..00000000 --- a/thinkphp/phpunit.xml.dist +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - ./library/think/*/tests/ - - - - - - ./library/ - - ./library/think/*/tests - ./library/think/*/assets - ./library/think/*/resources - ./library/think/*/vendor - - - - \ No newline at end of file diff --git a/thinkphp/tpl/default_index.tpl b/thinkphp/tpl/default_index.tpl deleted file mode 100644 index e5c1363a..00000000 --- a/thinkphp/tpl/default_index.tpl +++ /dev/null @@ -1,10 +0,0 @@ -*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }

    :)

    ThinkPHP V5.1
    12载初心不改(2006-2018) - 你值得信赖的PHP框架

    '; - } -} diff --git a/thinkphp/tpl/dispatch_jump.tpl b/thinkphp/tpl/dispatch_jump.tpl deleted file mode 100644 index 583376bb..00000000 --- a/thinkphp/tpl/dispatch_jump.tpl +++ /dev/null @@ -1,49 +0,0 @@ -{__NOLAYOUT__} - - - - - 跳转提示 - - - -
    - - -

    :)

    -

    - - -

    :(

    -

    - - -

    -

    - 页面自动 跳转 等待时间: -

    -
    - - - diff --git a/thinkphp/tpl/page_trace.tpl b/thinkphp/tpl/page_trace.tpl deleted file mode 100644 index 2e5afbab..00000000 --- a/thinkphp/tpl/page_trace.tpl +++ /dev/null @@ -1,71 +0,0 @@ -
    - - -
    -
    -
    getUseTime().'s ';?>
    - -
    - - diff --git a/thinkphp/tpl/think_exception.tpl b/thinkphp/tpl/think_exception.tpl deleted file mode 100644 index 19ecbdc1..00000000 --- a/thinkphp/tpl/think_exception.tpl +++ /dev/null @@ -1,507 +0,0 @@ -'.end($names).''; - } - } - - if(!function_exists('parse_file')){ - function parse_file($file, $line) - { - return ''.basename($file)." line {$line}".''; - } - } - - if(!function_exists('parse_args')){ - function parse_args($args) - { - $result = []; - - foreach ($args as $key => $item) { - switch (true) { - case is_object($item): - $value = sprintf('object(%s)', parse_class(get_class($item))); - break; - case is_array($item): - if(count($item) > 3){ - $value = sprintf('[%s, ...]', parse_args(array_slice($item, 0, 3))); - } else { - $value = sprintf('[%s]', parse_args($item)); - } - break; - case is_string($item): - if(strlen($item) > 20){ - $value = sprintf( - '\'%s...\'', - htmlentities($item), - htmlentities(substr($item, 0, 20)) - ); - } else { - $value = sprintf("'%s'", htmlentities($item)); - } - break; - case is_int($item): - case is_float($item): - $value = $item; - break; - case is_null($item): - $value = 'null'; - break; - case is_bool($item): - $value = '' . ($item ? 'true' : 'false') . ''; - break; - case is_resource($item): - $value = 'resource'; - break; - default: - $value = htmlentities(str_replace("\n", '', var_export(strval($item), true))); - break; - } - - $result[] = is_int($key) ? $value : "'{$key}' => {$value}"; - } - - return implode(', ', $result); - } - } -?> - - - - - 系统发生错误 - - - - -
    - -
    - -
    -
    - -
    -
    -

    [] 

    -
    -

    -
    - -
    - -
    -
      $value) { ?>
    -
    - -
    -

    Call Stack

    -
      -
    1. - -
    2. - -
    3. - -
    -
    -
    - -
    - -

    - -
    - - - -
    -

    Exception Datas

    - $value) { ?> - - - - - - - $val) { ?> - - - - - - - -
    empty
    - -
    - -
    - - - -
    -

    Environment Variables

    - $value) { ?> - - - - - - - $val) { ?> - - - - - - - -
    empty
    - -
    - -
    - - - - - - - - diff --git a/vendor/autoload.php b/vendor/autoload.php deleted file mode 100644 index 7d8f4d50..00000000 --- a/vendor/autoload.php +++ /dev/null @@ -1,7 +0,0 @@ - array( - __DIR__ . '/autoload_classmap.php', - ), - 'Zend\Loader\StandardAutoloader' => array( - 'namespaces' => array( - __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, - ), - ), - ); - } -} diff --git a/vendor/bacon/bacon-qr-code/README.md b/vendor/bacon/bacon-qr-code/README.md deleted file mode 100644 index a836bd61..00000000 --- a/vendor/bacon/bacon-qr-code/README.md +++ /dev/null @@ -1,24 +0,0 @@ -QR Code generator -================= - -Master: [![Build Status](https://api.travis-ci.org/Bacon/BaconQrCode.png?branch=master)](http://travis-ci.org/Bacon/BaconQrCode) - -Introduction ------------- -BaconQrCode is a port of QR code portion of the ZXing library. It currently -only features the encoder part, but could later receive the decoder part as -well. - -As the Reed Solomon codec implementation of the ZXing library performs quite -slow in PHP, it was exchanged with the implementation by Phil Karn. - - -Example usage -------------- -```php -$renderer = new \BaconQrCode\Renderer\Image\Png(); -$renderer->setHeight(256); -$renderer->setWidth(256); -$writer = new \BaconQrCode\Writer($renderer); -$writer->writeFile('Hello World!', 'qrcode.png'); -``` diff --git a/vendor/bacon/bacon-qr-code/autoload_classmap.php b/vendor/bacon/bacon-qr-code/autoload_classmap.php deleted file mode 100644 index 9fbeb35b..00000000 --- a/vendor/bacon/bacon-qr-code/autoload_classmap.php +++ /dev/null @@ -1,43 +0,0 @@ - __DIR__ . '/src/BaconQrCode/Common/AbstractEnum.php', - 'BaconQrCode\Common\BitArray' => __DIR__ . '/src/BaconQrCode/Common/BitArray.php', - 'BaconQrCode\Common\BitMatrix' => __DIR__ . '/src/BaconQrCode/Common/BitMatrix.php', - 'BaconQrCode\Common\BitUtils' => __DIR__ . '/src/BaconQrCode/Common/BitUtils.php', - 'BaconQrCode\Common\CharacterSetEci' => __DIR__ . '/src/BaconQrCode/Common/CharacterSetEci.php', - 'BaconQrCode\Common\EcBlock' => __DIR__ . '/src/BaconQrCode/Common/EcBlock.php', - 'BaconQrCode\Common\EcBlocks' => __DIR__ . '/src/BaconQrCode/Common/EcBlocks.php', - 'BaconQrCode\Common\ErrorCorrectionLevel' => __DIR__ . '/src/BaconQrCode/Common/ErrorCorrectionLevel.php', - 'BaconQrCode\Common\FormatInformation' => __DIR__ . '/src/BaconQrCode/Common/FormatInformation.php', - 'BaconQrCode\Common\Mode' => __DIR__ . '/src/BaconQrCode/Common/Mode.php', - 'BaconQrCode\Common\ReedSolomonCodec' => __DIR__ . '/src/BaconQrCode/Common/ReedSolomonCodec.php', - 'BaconQrCode\Common\Version' => __DIR__ . '/src/BaconQrCode/Common/Version.php', - 'BaconQrCode\Encoder\BlockPair' => __DIR__ . '/src/BaconQrCode/Encoder/BlockPair.php', - 'BaconQrCode\Encoder\ByteMatrix' => __DIR__ . '/src/BaconQrCode/Encoder/ByteMatrix.php', - 'BaconQrCode\Encoder\Encoder' => __DIR__ . '/src/BaconQrCode/Encoder/Encoder.php', - 'BaconQrCode\Encoder\MaskUtil' => __DIR__ . '/src/BaconQrCode/Encoder/MaskUtil.php', - 'BaconQrCode\Encoder\MatrixUtil' => __DIR__ . '/src/BaconQrCode/Encoder/MatrixUtil.php', - 'BaconQrCode\Encoder\QrCode' => __DIR__ . '/src/BaconQrCode/Encoder/QrCode.php', - 'BaconQrCode\Exception\ExceptionInterface' => __DIR__ . '/src/BaconQrCode/Exception/ExceptionInterface.php', - 'BaconQrCode\Exception\InvalidArgumentException' => __DIR__ . '/src/BaconQrCode/Exception/InvalidArgumentException.php', - 'BaconQrCode\Exception\OutOfBoundsException' => __DIR__ . '/src/BaconQrCode/Exception/OutOfBoundsException.php', - 'BaconQrCode\Exception\RuntimeException' => __DIR__ . '/src/BaconQrCode/Exception/RuntimeException.php', - 'BaconQrCode\Exception\UnexpectedValueException' => __DIR__ . '/src/BaconQrCode/Exception/UnexpectedValueException.php', - 'BaconQrCode\Exception\WriterException' => __DIR__ . '/src/BaconQrCode/Exception/WriterException.php', - 'BaconQrCode\Renderer\Color\Cmyk' => __DIR__ . '/src/BaconQrCode/Renderer/Color/Cmyk.php', - 'BaconQrCode\Renderer\Color\ColorInterface' => __DIR__ . '/src/BaconQrCode/Renderer/Color/ColorInterface.php', - 'BaconQrCode\Renderer\Color\Gray' => __DIR__ . '/src/BaconQrCode/Renderer/Color/Gray.php', - 'BaconQrCode\Renderer\Color\Rgb' => __DIR__ . '/src/BaconQrCode/Renderer/Color/Rgb.php', - 'BaconQrCode\Renderer\Image\AbstractRenderer' => __DIR__ . '/src/BaconQrCode/Renderer/Image/AbstractRenderer.php', - 'BaconQrCode\Renderer\Image\Decorator\DecoratorInterface' => __DIR__ . '/src/BaconQrCode/Renderer/Image/Decorator/DecoratorInterface.php', - 'BaconQrCode\Renderer\Image\Decorator\FinderPattern' => __DIR__ . '/src/BaconQrCode/Renderer/Image/Decorator/FinderPattern.php', - 'BaconQrCode\Renderer\Image\Eps' => __DIR__ . '/src/BaconQrCode/Renderer/Image/Eps.php', - 'BaconQrCode\Renderer\Image\Png' => __DIR__ . '/src/BaconQrCode/Renderer/Image/Png.php', - 'BaconQrCode\Renderer\Image\RendererInterface' => __DIR__ . '/src/BaconQrCode/Renderer/Image/RendererInterface.php', - 'BaconQrCode\Renderer\Image\Svg' => __DIR__ . '/src/BaconQrCode/Renderer/Image/Svg.php', - 'BaconQrCode\Renderer\RendererInterface' => __DIR__ . '/src/BaconQrCode/Renderer/RendererInterface.php', - 'BaconQrCode\Renderer\Text\Plain' => __DIR__ . '/src/BaconQrCode/Renderer/Text/Plain.php', - 'BaconQrCode\Renderer\Text\Html' => __DIR__ . '/src/BaconQrCode/Renderer/Text/Html.php', - 'BaconQrCode\Writer' => __DIR__ . '/src/BaconQrCode/Writer.php', -); \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/autoload_function.php b/vendor/bacon/bacon-qr-code/autoload_function.php deleted file mode 100644 index 9148da38..00000000 --- a/vendor/bacon/bacon-qr-code/autoload_function.php +++ /dev/null @@ -1,12 +0,0 @@ -strict = $strict; - $this->change($initialValue); - } - - /** - * Changes the value of the enum. - * - * @param mixed $value - * @return void - */ - public function change($value) - { - if (!in_array($value, $this->getConstList(), $this->strict)) { - throw new Exception\UnexpectedValueException('Value not a const in enum ' . get_class($this)); - } - - $this->value = $value; - } - - /** - * Gets current value. - * - * @return mixed - */ - public function get() - { - return $this->value; - } - - /** - * Gets all constants (possible values) as an array. - * - * @param boolean $includeDefault - * @return array - */ - public function getConstList($includeDefault = true) - { - if ($this->constants === null) { - $reflection = new ReflectionClass($this); - $this->constants = $reflection->getConstants(); - } - - if ($includeDefault) { - return $this->constants; - } - - $constants = $this->constants; - unset($constants['__default']); - - return $constants; - } - - /** - * Gets the name of the enum. - * - * @return string - */ - public function __toString() - { - return array_search($this->value, $this->getConstList()); - } -} diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/BitArray.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/BitArray.php deleted file mode 100644 index 0a99d9a9..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/BitArray.php +++ /dev/null @@ -1,435 +0,0 @@ -size = $size; - $this->bits = new SplFixedArray(($this->size + 31) >> 3); - } - - /** - * Gets the size in bits. - * - * @return integer - */ - public function getSize() - { - return $this->size; - } - - /** - * Gets the size in bytes. - * - * @return integer - */ - public function getSizeInBytes() - { - return ($this->size + 7) >> 3; - } - - /** - * Ensures that the array has a minimum capacity. - * - * @param integer $size - * @return void - */ - public function ensureCapacity($size) - { - if ($size > count($this->bits) << 5) { - $this->bits->setSize(($size + 31) >> 5); - } - } - - /** - * Gets a specific bit. - * - * @param integer $i - * @return boolean - */ - public function get($i) - { - return ($this->bits[$i >> 5] & (1 << ($i & 0x1f))) !== 0; - } - - /** - * Sets a specific bit. - * - * @param integer $i - * @return void - */ - public function set($i) - { - $this->bits[$i >> 5] = $this->bits[$i >> 5] | 1 << ($i & 0x1f); - } - - /** - * Flips a specific bit. - * - * @param integer $i - * @return void - */ - public function flip($i) - { - $this->bits[$i >> 5] ^= 1 << ($i & 0x1f); - } - - /** - * Gets the next set bit position from a given position. - * - * @param integer $from - * @return integer - */ - public function getNextSet($from) - { - if ($from >= $this->size) { - return $this->size; - } - - $bitsOffset = $from >> 5; - $currentBits = $this->bits[$bitsOffset]; - $bitsLength = count($this->bits); - - $currentBits &= ~((1 << ($from & 0x1f)) - 1); - - while ($currentBits === 0) { - if (++$bitsOffset === $bitsLength) { - return $this->size; - } - - $currentBits = $this->bits[$bitsOffset]; - } - - $result = ($bitsOffset << 5) + BitUtils::numberOfTrailingZeros($currentBits); - - return $result > $this->size ? $this->size : $result; - } - - /** - * Gets the next unset bit position from a given position. - * - * @param integer $from - * @return integer - */ - public function getNextUnset($from) - { - if ($from >= $this->size) { - return $this->size; - } - - $bitsOffset = $from >> 5; - $currentBits = ~$this->bits[$bitsOffset]; - $bitsLength = count($this->bits); - - $currentBits &= ~((1 << ($from & 0x1f)) - 1); - - while ($currentBits === 0) { - if (++$bitsOffset === $bitsLength) { - return $this->size; - } - - $currentBits = ~$this->bits[$bitsOffset]; - } - - $result = ($bitsOffset << 5) + BitUtils::numberOfTrailingZeros($currentBits); - - return $result > $this->size ? $this->size : $result; - } - - /** - * Sets a bulk of bits. - * - * @param integer $i - * @param integer $newBits - * @return void - */ - public function setBulk($i, $newBits) - { - $this->bits[$i >> 5] = $newBits; - } - - /** - * Sets a range of bits. - * - * @param integer $start - * @param integer $end - * @return void - * @throws Exception\InvalidArgumentException - */ - public function setRange($start, $end) - { - if ($end < $start) { - throw new Exception\InvalidArgumentException('End must be greater or equal to start'); - } - - if ($end === $start) { - return; - } - - $end--; - - $firstInt = $start >> 5; - $lastInt = $end >> 5; - - for ($i = $firstInt; $i <= $lastInt; $i++) { - $firstBit = $i > $firstInt ? 0 : $start & 0x1f; - $lastBit = $i < $lastInt ? 31 : $end & 0x1f; - - if ($firstBit === 0 && $lastBit === 31) { - $mask = 0x7fffffff; - } else { - $mask = 0; - - for ($j = $firstBit; $j < $lastBit; $j++) { - $mask |= 1 << $j; - } - } - - $this->bits[$i] = $this->bits[$i] | $mask; - } - } - - /** - * Clears the bit array, unsetting every bit. - * - * @return void - */ - public function clear() - { - $bitsLength = count($this->bits); - - for ($i = 0; $i < $bitsLength; $i++) { - $this->bits[$i] = 0; - } - } - - /** - * Checks if a range of bits is set or not set. - * - * @param integer $start - * @param integer $end - * @param integer $value - * @return boolean - * @throws Exception\InvalidArgumentException - */ - public function isRange($start, $end, $value) - { - if ($end < $start) { - throw new Exception\InvalidArgumentException('End must be greater or equal to start'); - } - - if ($end === $start) { - return; - } - - $end--; - - $firstInt = $start >> 5; - $lastInt = $end >> 5; - - for ($i = $firstInt; $i <= $lastInt; $i++) { - $firstBit = $i > $firstInt ? 0 : $start & 0x1f; - $lastBit = $i < $lastInt ? 31 : $end & 0x1f; - - if ($firstBit === 0 && $lastBit === 31) { - $mask = 0x7fffffff; - } else { - $mask = 0; - - for ($j = $firstBit; $j <= $lastBit; $j++) { - $mask |= 1 << $j; - } - } - - if (($this->bits[$i] & $mask) !== ($value ? $mask : 0)) { - return false; - } - } - - return true; - } - - /** - * Appends a bit to the array. - * - * @param boolean $bit - * @return void - */ - public function appendBit($bit) - { - $this->ensureCapacity($this->size + 1); - - if ($bit) { - $this->bits[$this->size >> 5] = $this->bits[$this->size >> 5] | (1 << ($this->size & 0x1f)); - } - - $this->size++; - } - - /** - * Appends a number of bits (up to 32) to the array. - * - * @param integer $value - * @param integer $numBits - * @return void - * @throws Exception\InvalidArgumentException - */ - public function appendBits($value, $numBits) - { - if ($numBits < 0 || $numBits > 32) { - throw new Exception\InvalidArgumentException('Num bits must be between 0 and 32'); - } - - $this->ensureCapacity($this->size + $numBits); - - for ($numBitsLeft = $numBits; $numBitsLeft > 0; $numBitsLeft--) { - $this->appendBit((($value >> ($numBitsLeft - 1)) & 0x01) === 1); - } - } - - /** - * Appends another bit array to this array. - * - * @param BitArray $other - * @return void - */ - public function appendBitArray(self $other) - { - $otherSize = $other->getSize(); - $this->ensureCapacity($this->size + $other->getSize()); - - for ($i = 0; $i < $otherSize; $i++) { - $this->appendBit($other->get($i)); - } - } - - /** - * Makes an exclusive-or comparision on the current bit array. - * - * @param BitArray $other - * @return void - * @throws Exception\InvalidArgumentException - */ - public function xorBits(self $other) - { - $bitsLength = count($this->bits); - $otherBits = $other->getBitArray(); - - if ($bitsLength !== count($otherBits)) { - throw new Exception\InvalidArgumentException('Sizes don\'t match'); - } - - for ($i = 0; $i < $bitsLength; $i++) { - $this->bits[$i] = $this->bits[$i] ^ $otherBits[$i]; - } - } - - /** - * Converts the bit array to a byte array. - * - * @param integer $bitOffset - * @param integer $numBytes - * @return SplFixedArray - */ - public function toBytes($bitOffset, $numBytes) - { - $bytes = new SplFixedArray($numBytes); - - for ($i = 0; $i < $numBytes; $i++) { - $byte = 0; - - for ($j = 0; $j < 8; $j++) { - if ($this->get($bitOffset)) { - $byte |= 1 << (7 - $j); - } - - $bitOffset++; - } - - $bytes[$i] = $byte; - } - - return $bytes; - } - - /** - * Gets the internal bit array. - * - * @return SplFixedArray - */ - public function getBitArray() - { - return $this->bits; - } - - /** - * Reverses the array. - * - * @return void - */ - public function reverse() - { - $newBits = new SplFixedArray(count($this->bits)); - - for ($i = 0; $i < $this->size; $i++) { - if ($this->get($this->size - $i - 1)) { - $newBits[$i >> 5] = $newBits[$i >> 5] | (1 << ($i & 0x1f)); - } - } - - $this->bits = newBits; - } - - /** - * Returns a string representation of the bit array. - * - * @return string - */ - public function __toString() - { - $result = ''; - - for ($i = 0; $i < $this->size; $i++) { - if (($i & 0x07) === 0) { - $result .= ' '; - } - - $result .= $this->get($i) ? 'X' : '.'; - } - - return $result; - } -} diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/BitMatrix.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/BitMatrix.php deleted file mode 100644 index b930f88b..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/BitMatrix.php +++ /dev/null @@ -1,350 +0,0 @@ -width = $width; - $this->height = $height; - $this->rowSize = ($width + 31) >> 5; - $this->bits = new SplFixedArray($this->rowSize * $height); - } - - /** - * Gets the requested bit, where true means black. - * - * @param integer $x - * @param integer $y - * @return boolean - */ - public function get($x, $y) - { - $offset = $y * $this->rowSize + ($x >> 5); - return (BitUtils::unsignedRightShift($this->bits[$offset], ($x & 0x1f)) & 1) !== 0; - } - - /** - * Sets the given bit to true. - * - * @param integer $x - * @param integer $y - * @return void - */ - public function set($x, $y) - { - $offset = $y * $this->rowSize + ($x >> 5); - $this->bits[$offset] = $this->bits[$offset] | (1 << ($x & 0x1f)); - } - - /** - * Flips the given bit. - * - * @param integer $x - * @param integer $y - * @return void - */ - public function flip($x, $y) - { - $offset = $y * $this->rowSize + ($x >> 5); - $this->bits[$offset] = $this->bits[$offset] ^ (1 << ($x & 0x1f)); - } - - /** - * Clears all bits (set to false). - * - * @return void - */ - public function clear() - { - $max = count($this->bits); - - for ($i = 0; $i < $max; $i++) { - $this->bits[$i] = 0; - } - } - - /** - * Sets a square region of the bit matrix to true. - * - * @param integer $left - * @param integer $top - * @param integer $width - * @param integer $height - * @return void - */ - public function setRegion($left, $top, $width, $height) - { - if ($top < 0 || $left < 0) { - throw new Exception\InvalidArgumentException('Left and top must be non-negative'); - } - - if ($height < 1 || $width < 1) { - throw new Exception\InvalidArgumentException('Width and height must be at least 1'); - } - - $right = $left + $width; - $bottom = $top + $height; - - if ($bottom > $this->height || $right > $this->width) { - throw new Exception\InvalidArgumentException('The region must fit inside the matrix'); - } - - for ($y = $top; $y < $bottom; $y++) { - $offset = $y * $this->rowSize; - - for ($x = $left; $x < $right; $x++) { - $index = $offset + ($x >> 5); - $this->bits[$index] = $this->bits[$index] | (1 << ($x & 0x1f)); - } - } - } - - /** - * A fast method to retrieve one row of data from the matrix as a BitArray. - * - * @param integer $y - * @param BitArray $row - * @return BitArray - */ - public function getRow($y, BitArray $row = null) - { - if ($row === null || $row->getSize() < $this->width) { - $row = new BitArray($this->width); - } - - $offset = $y * $this->rowSize; - - for ($x = 0; $x < $this->rowSize; $x++) { - $row->setBulk($x << 5, $this->bits[$offset + $x]); - } - - return $row; - } - - /** - * Sets a row of data from a BitArray. - * - * @param integer $y - * @param BitArray $row - * @return void - */ - public function setRow($y, BitArray $row) - { - $bits = $row->getBitArray(); - - for ($i = 0; $i < $this->rowSize; $i++) { - $this->bits[$y * $this->rowSize + $i] = $bits[$i]; - } - } - - /** - * This is useful in detecting the enclosing rectangle of a 'pure' barcode. - * - * @return SplFixedArray - */ - public function getEnclosingRectangle() - { - $left = $this->width; - $top = $this->height; - $right = -1; - $bottom = -1; - - for ($y = 0; $y < $this->height; $y++) { - for ($x32 = 0; $x32 < $this->rowSize; $x32++) { - $bits = $this->bits[$y * $this->rowSize + $x32]; - - if ($bits !== 0) { - if ($y < $top) { - $top = $y; - } - - if ($y > $bottom) { - $bottom = $y; - } - - if ($x32 * 32 < $left) { - $bit = 0; - - while (($bits << (31 - $bit)) === 0) { - $bit++; - } - - if (($x32 * 32 + $bit) < $left) { - $left = $x32 * 32 + $bit; - } - } - } - - if ($x32 * 32 + 31 > $right) { - $bit = 31; - - while (BitUtils::unsignedRightShift($bits, $bit) === 0) { - $bit--; - } - - if (($x32 * 32 + $bit) > $right) { - $right = $x32 * 32 + $bit; - } - } - } - } - - $width = $right - $left; - $height = $bottom - $top; - - if ($width < 0 || $height < 0) { - return null; - } - - return SplFixedArray::fromArray(array($left, $top, $width, $height), false); - } - - /** - * Gets the most top left set bit. - * - * This is useful in detecting a corner of a 'pure' barcode. - * - * @return SplFixedArray - */ - public function getTopLeftOnBit() - { - $bitsOffset = 0; - - while ($bitsOffset < count($this->bits) && $this->bits[$bitsOffset] === 0) { - $bitsOffset++; - } - - if ($bitsOffset === count($this->bits)) { - return null; - } - - $x = intval($bitsOffset / $this->rowSize); - $y = ($bitsOffset % $this->rowSize) << 5; - - $bits = $this->bits[$bitsOffset]; - $bit = 0; - - while (($bits << (31 - $bit)) === 0) { - $bit++; - } - - $x += $bit; - - return SplFixedArray::fromArray(array($x, $y), false); - } - - /** - * Gets the most bottom right set bit. - * - * This is useful in detecting a corner of a 'pure' barcode. - * - * @return SplFixedArray - */ - public function getBottomRightOnBit() - { - $bitsOffset = count($this->bits) - 1; - - while ($bitsOffset >= 0 && $this->bits[$bitsOffset] === 0) { - $bitsOffset--; - } - - if ($bitsOffset < 0) { - return null; - } - - $x = intval($bitsOffset / $this->rowSize); - $y = ($bitsOffset % $this->rowSize) << 5; - - $bits = $this->bits[$bitsOffset]; - $bit = 0; - - while (BitUtils::unsignedRightShift($bits, $bit) === 0) { - $bit--; - } - - $x += $bit; - - return SplFixedArray::fromArray(array($x, $y), false); - } - - /** - * Gets the width of the matrix, - * - * @return integer - */ - public function getWidth() - { - return $this->width; - } - - /** - * Gets the height of the matrix. - * - * @return integer - */ - public function getHeight() - { - return $this->height; - } -} diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/BitUtils.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/BitUtils.php deleted file mode 100644 index a6412440..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/BitUtils.php +++ /dev/null @@ -1,51 +0,0 @@ ->>" in other - * languages. - * - * @param integer $a - * @param integer $b - * @return integer - */ - public static function unsignedRightShift($a, $b) - { - return ( - $a >= 0 - ? $a >> $b - : (($a & 0x7fffffff) >> $b) | (0x40000000 >> ($b - 1)) - ); - } - - /** - * Gets the number of trailing zeros. - * - * @param integer $i - * @return integer - */ - public static function numberOfTrailingZeros($i) - { - $lastPos = strrpos(str_pad(decbin($i), 32, '0', STR_PAD_LEFT), '1'); - - return $lastPos === false ? 32 : 31 - $lastPos; - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/CharacterSetEci.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/CharacterSetEci.php deleted file mode 100644 index 77662360..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/CharacterSetEci.php +++ /dev/null @@ -1,134 +0,0 @@ - self::ISO8859_1, - 'ISO-8859-2' => self::ISO8859_2, - 'ISO-8859-3' => self::ISO8859_3, - 'ISO-8859-4' => self::ISO8859_4, - 'ISO-8859-5' => self::ISO8859_5, - 'ISO-8859-6' => self::ISO8859_6, - 'ISO-8859-7' => self::ISO8859_7, - 'ISO-8859-8' => self::ISO8859_8, - 'ISO-8859-9' => self::ISO8859_9, - 'ISO-8859-10' => self::ISO8859_10, - 'ISO-8859-11' => self::ISO8859_11, - 'ISO-8859-12' => self::ISO8859_12, - 'ISO-8859-13' => self::ISO8859_13, - 'ISO-8859-14' => self::ISO8859_14, - 'ISO-8859-15' => self::ISO8859_15, - 'ISO-8859-16' => self::ISO8859_16, - 'SHIFT-JIS' => self::SJIS, - 'WINDOWS-1250' => self::CP1250, - 'WINDOWS-1251' => self::CP1251, - 'WINDOWS-1252' => self::CP1252, - 'WINDOWS-1256' => self::CP1256, - 'UTF-16BE' => self::UNICODE_BIG_UNMARKED, - 'UTF-8' => self::UTF8, - 'ASCII' => self::ASCII, - 'GBK' => self::GB18030, - 'EUC-KR' => self::EUC_KR, - ); - - /** - * Additional possible values for character sets. - * - * @var array - */ - protected $additionalValues = array( - self::CP437 => 2, - self::ASCII => 170, - ); - - /** - * Gets character set ECI by value. - * - * @param string $name - * @return CharacterSetEci|null - */ - public static function getCharacterSetECIByValue($value) - { - if ($value < 0 || $value >= 900) { - throw new Exception\InvalidArgumentException('Value must be between 0 and 900'); - } - - if (false !== ($key = array_search($value, self::$additionalValues))) { - $value = $key; - } - - try { - return new self($value); - } catch (Exception\UnexpectedValueException $e) { - return null; - } - } - - /** - * Gets character set ECI by name. - * - * @param string $name - * @return CharacterSetEci|null - */ - public static function getCharacterSetECIByName($name) - { - $name = strtoupper($name); - - if (isset(self::$nameToEci[$name])) { - return new self(self::$nameToEci[$name]); - } - - return null; - } -} diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/EcBlock.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/EcBlock.php deleted file mode 100644 index cbcc2ba0..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/EcBlock.php +++ /dev/null @@ -1,65 +0,0 @@ -count = $count; - $this->dataCodewords = $dataCodewords; - } - - /** - * Returns how many times the block is used. - * - * @return integer - */ - public function getCount() - { - return $this->count; - } - - /** - * Returns the number of data codewords. - * - * @return integer - */ - public function getDataCodewords() - { - return $this->dataCodewords; - } -} diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/EcBlocks.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/EcBlocks.php deleted file mode 100644 index 87cef5d0..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/EcBlocks.php +++ /dev/null @@ -1,101 +0,0 @@ -ecCodewordsPerBlock = $ecCodewordsPerBlock; - - $this->ecBlocks = new SplFixedArray($ecb2 === null ? 1 : 2); - $this->ecBlocks[0] = $ecb1; - - if ($ecb2 !== null) { - $this->ecBlocks[1] = $ecb2; - } - } - - /** - * Gets the number of EC codewords per block. - * - * @return integer - */ - public function getEcCodewordsPerBlock() - { - return $this->ecCodewordsPerBlock; - } - - /** - * Gets the total number of EC block appearances. - * - * @return integer - */ - public function getNumBlocks() - { - $total = 0; - - foreach ($this->ecBlocks as $ecBlock) { - $total += $ecBlock->getCount(); - } - - return $total; - } - - /** - * Gets the total count of EC codewords. - * - * @return integer - */ - public function getTotalEcCodewords() - { - return $this->ecCodewordsPerBlock * $this->getNumBlocks(); - } - - /** - * Gets the EC blocks included in this collection. - * - * @return SplFixedArray - */ - public function getEcBlocks() - { - return $this->ecBlocks; - } -} diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/ErrorCorrectionLevel.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/ErrorCorrectionLevel.php deleted file mode 100644 index bd0a60a3..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/ErrorCorrectionLevel.php +++ /dev/null @@ -1,62 +0,0 @@ -value) { - case self::L: - return 0; - break; - - case self::M: - return 1; - break; - - case self::Q: - return 2; - break; - - case self::H: - return 3; - break; - } - } -} diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/FormatInformation.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/FormatInformation.php deleted file mode 100644 index 5ec9ffd4..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/FormatInformation.php +++ /dev/null @@ -1,236 +0,0 @@ -ecLevel = new ErrorCorrectionLevel(($formatInfo >> 3) & 0x3); - $this->dataMask = $formatInfo & 0x7; - } - - /** - * Checks how many bits are different between two integers. - * - * @param integer $a - * @param integer $b - * @return integer - */ - public static function numBitsDiffering($a, $b) - { - $a ^= $b; - - return ( - self::$bitsSetInHalfByte[$a & 0xf] - + self::$bitsSetInHalfByte[(BitUtils::unsignedRightShift($a, 4) & 0xf)] - + self::$bitsSetInHalfByte[(BitUtils::unsignedRightShift($a, 8) & 0xf)] - + self::$bitsSetInHalfByte[(BitUtils::unsignedRightShift($a, 12) & 0xf)] - + self::$bitsSetInHalfByte[(BitUtils::unsignedRightShift($a, 16) & 0xf)] - + self::$bitsSetInHalfByte[(BitUtils::unsignedRightShift($a, 20) & 0xf)] - + self::$bitsSetInHalfByte[(BitUtils::unsignedRightShift($a, 24) & 0xf)] - + self::$bitsSetInHalfByte[(BitUtils::unsignedRightShift($a, 28) & 0xf)] - ); - } - - /** - * Decodes format information. - * - * @param integer $maskedFormatInfo1 - * @param integer $maskedFormatInfo2 - * @return FormatInformation|null - */ - public static function decodeFormatInformation($maskedFormatInfo1, $maskedFormatInfo2) - { - $formatInfo = self::doDecodeFormatInformation($maskedFormatInfo1, $maskedFormatInfo2); - - if ($formatInfo !== null) { - return $formatInfo; - } - - // Should return null, but, some QR codes apparently do not mask this - // info. Try again by actually masking the pattern first. - return self::doDecodeFormatInformation( - $maskedFormatInfo1 ^ self::FORMAT_INFO_MASK_QR, - $maskedFormatInfo2 ^ self::FORMAT_INFO_MASK_QR - ); - } - - /** - * Internal method for decoding format information. - * - * @param integer $maskedFormatInfo1 - * @param integer $maskedFormatInfo2 - * @return FormatInformation|null - */ - protected static function doDecodeFormatInformation($maskedFormatInfo1, $maskedFormatInfo2) - { - $bestDifference = PHP_INT_MAX; - $bestFormatInfo = 0; - - foreach (self::$formatInfoDecodeLookup as $decodeInfo) { - $targetInfo = $decodeInfo[0]; - - if ($targetInfo === $maskedFormatInfo1 || $targetInfo === $maskedFormatInfo2) { - // Found an exact match - return new self($decodeInfo[1]); - } - - $bitsDifference = self::numBitsDiffering($maskedFormatInfo1, $targetInfo); - - if ($bitsDifference < $bestDifference) { - $bestFormatInfo = $decodeInfo[1]; - $bestDifference = $bitsDifference; - } - - if ($maskedFormatInfo1 !== $maskedFormatInfo2) { - // Also try the other option - $bitsDifference = self::numBitsDiffering($maskedFormatInfo2, $targetInfo); - - if ($bitsDifference < $bestDifference) { - $bestFormatInfo = $decodeInfo[1]; - $bestDifference = $bitsDifference; - } - } - } - - // Hamming distance of the 32 masked codes is 7, by construction, so - // <= 3 bits differing means we found a match. - if ($bestDifference <= 3) { - return new self($bestFormatInfo); - } - - return null; - } - - /** - * Gets the error correction level. - * - * @return ErrorCorrectionLevel - */ - public function getErrorCorrectionLevel() - { - return $this->ecLevel; - } - - /** - * Gets the data mask. - * - * @return integer - */ - public function getDataMask() - { - return $this->dataMask; - } - - /** - * Hashes the code of the EC level. - * - * @return integer - */ - public function hashCode() - { - return ($this->ecLevel->get() << 3) | $this->dataMask; - } - - /** - * Verifies if this instance equals another one. - * - * @param mixed $other - * @return boolean - */ - public function equals($other) { - if (!$other instanceof self) { - return false; - } - - return ( - $this->ecLevel->get() === $other->getErrorCorrectionLevel()->get() - && $this->dataMask === $other->getDataMask() - ); - } -} diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/Mode.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/Mode.php deleted file mode 100644 index 8faf344e..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/Mode.php +++ /dev/null @@ -1,70 +0,0 @@ - array(0, 0, 0), - self::NUMERIC => array(10, 12, 14), - self::ALPHANUMERIC => array(9, 11, 13), - self::STRUCTURED_APPEND => array(0, 0, 0), - self::BYTE => array(8, 16, 16), - self::ECI => array(0, 0, 0), - self::KANJI => array(8, 10, 12), - self::FNC1_FIRST_POSITION => array(0, 0, 0), - self::FNC1_SECOND_POSITION => array(0, 0, 0), - self::HANZI => array(8, 10, 12), - ); - - /** - * Gets the number of bits used in a specific QR code version. - * - * @param Version $version - * @return integer - */ - public function getCharacterCountBits(Version $version) - { - $number = $version->getVersionNumber(); - - if ($number <= 9) { - $offset = 0; - } elseif ($number <= 26) { - $offset = 1; - } else { - $offset = 2; - } - - return self::$characterCountBitsForVersions[$this->value][$offset]; - } -} diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/ReedSolomonCodec.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/ReedSolomonCodec.php deleted file mode 100644 index e8d45b94..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/ReedSolomonCodec.php +++ /dev/null @@ -1,476 +0,0 @@ - 8) { - throw new Exception\InvalidArgumentException('Symbol size must be between 0 and 8'); - } - - if ($firstRoot < 0 || $firstRoot >= (1 << $symbolSize)) { - throw new Exception\InvalidArgumentException('First root must be between 0 and ' . (1 << $symbolSize)); - } - - if ($numRoots < 0 || $numRoots >= (1 << $symbolSize)) { - throw new Exception\InvalidArgumentException('Num roots must be between 0 and ' . (1 << $symbolSize)); - } - - if ($padding < 0 || $padding >= ((1 << $symbolSize) - 1 - $numRoots)) { - throw new Exception\InvalidArgumentException('Padding must be between 0 and ' . ((1 << $symbolSize) - 1 - $numRoots)); - } - - $this->symbolSize = $symbolSize; - $this->blockSize = (1 << $symbolSize) - 1; - $this->padding = $padding; - $this->alphaTo = SplFixedArray::fromArray(array_fill(0, $this->blockSize + 1, 0), false); - $this->indexOf = SplFixedArray::fromArray(array_fill(0, $this->blockSize + 1, 0), false); - - // Generate galous field lookup table - $this->indexOf[0] = $this->blockSize; - $this->alphaTo[$this->blockSize] = 0; - - $sr = 1; - - for ($i = 0; $i < $this->blockSize; $i++) { - $this->indexOf[$sr] = $i; - $this->alphaTo[$i] = $sr; - - $sr <<= 1; - - if ($sr & (1 << $symbolSize)) { - $sr ^= $gfPoly; - } - - $sr &= $this->blockSize; - } - - if ($sr !== 1) { - throw new Exception\RuntimeException('Field generator polynomial is not primitive'); - } - - // Form RS code generator polynomial from its roots - $this->generatorPoly = SplFixedArray::fromArray(array_fill(0, $numRoots + 1, 0), false); - $this->firstRoot = $firstRoot; - $this->primitive = $primitive; - $this->numRoots = $numRoots; - - // Find prim-th root of 1, used in decoding - for ($iPrimitive = 1; ($iPrimitive % $primitive) !== 0; $iPrimitive += $this->blockSize); - $this->iPrimitive = intval($iPrimitive / $primitive); - - $this->generatorPoly[0] = 1; - - for ($i = 0, $root = $firstRoot * $primitive; $i < $numRoots; $i++, $root += $primitive) { - $this->generatorPoly[$i + 1] = 1; - - for ($j = $i; $j > 0; $j--) { - if ($this->generatorPoly[$j] !== 0) { - $this->generatorPoly[$j] = $this->generatorPoly[$j - 1] ^ $this->alphaTo[$this->modNn($this->indexOf[$this->generatorPoly[$j]] + $root)]; - } else { - $this->generatorPoly[$j] = $this->generatorPoly[$j - 1]; - } - } - - $this->generatorPoly[$j] = $this->alphaTo[$this->modNn($this->indexOf[$this->generatorPoly[0]] + $root)]; - } - - // Convert generator poly to index form for quicker encoding - for ($i = 0; $i <= $numRoots; $i++) { - $this->generatorPoly[$i] = $this->indexOf[$this->generatorPoly[$i]]; - } - } - - /** - * Encodes data and writes result back into parity array. - * - * @param SplFixedArray $data - * @param SplFixedArray $parity - * @return void - */ - public function encode(SplFixedArray $data, SplFixedArray $parity) - { - for ($i = 0; $i < $this->numRoots; $i++) { - $parity[$i] = 0; - } - - $iterations = $this->blockSize - $this->numRoots - $this->padding; - - for ($i = 0; $i < $iterations; $i++) { - $feedback = $this->indexOf[$data[$i] ^ $parity[0]]; - - if ($feedback !== $this->blockSize) { - // Feedback term is non-zero - $feedback = $this->modNn($this->blockSize - $this->generatorPoly[$this->numRoots] + $feedback); - - for ($j = 1; $j < $this->numRoots; $j++) { - $parity[$j] = $parity[$j] ^ $this->alphaTo[$this->modNn($feedback + $this->generatorPoly[$this->numRoots - $j])]; - } - } - - for ($j = 0; $j < $this->numRoots - 1; $j++) { - $parity[$j] = $parity[$j + 1]; - } - - if ($feedback !== $this->blockSize) { - $parity[$this->numRoots - 1] = $this->alphaTo[$this->modNn($feedback + $this->generatorPoly[0])]; - } else { - $parity[$this->numRoots - 1] = 0; - } - } - } - - /** - * Decodes received data. - * - * @param SplFixedArray $data - * @param SplFixedArray|null $erasures - * @return null|integer - */ - public function decode(SplFixedArray $data, SplFixedArray $erasures = null) - { - // This speeds up the initialization a bit. - $numRootsPlusOne = SplFixedArray::fromArray(array_fill(0, $this->numRoots + 1, 0), false); - $numRoots = SplFixedArray::fromArray(array_fill(0, $this->numRoots, 0), false); - - $lambda = clone $numRootsPlusOne; - $b = clone $numRootsPlusOne; - $t = clone $numRootsPlusOne; - $omega = clone $numRootsPlusOne; - $root = clone $numRoots; - $loc = clone $numRoots; - - $numErasures = ($erasures !== null ? count($erasures) : 0); - - // Form the Syndromes; i.e., evaluate data(x) at roots of g(x) - $syndromes = SplFixedArray::fromArray(array_fill(0, $this->numRoots, $data[0]), false); - - for ($i = 1; $i < $this->blockSize - $this->padding; $i++) { - for ($j = 0; $j < $this->numRoots; $j++) { - if ($syndromes[$j] === 0) { - $syndromes[$j] = $data[$i]; - } else { - $syndromes[$j] = $data[$i] ^ $this->alphaTo[ - $this->modNn($this->indexOf[$syndromes[$j]] + ($this->firstRoot + $j) * $this->primitive) - ]; - } - } - } - - // Convert syndromes to index form, checking for nonzero conditions - $syndromeError = 0; - - for ($i = 0; $i < $this->numRoots; $i++) { - $syndromeError |= $syndromes[$i]; - $syndromes[$i] = $this->indexOf[$syndromes[$i]]; - } - - if (!$syndromeError) { - // If syndrome is zero, data[] is a codeword and there are no errors - // to correct, so return data[] unmodified. - return 0; - } - - $lambda[0] = 1; - - if ($numErasures > 0) { - // Init lambda to be the erasure locator polynomial - $lambda[1] = $this->alphaTo[$this->modNn($this->primitive * ($this->blockSize - 1 - $erasures[0]))]; - - for ($i = 1; $i < $numErasures; $i++) { - $u = $this->modNn($this->primitive * ($this->blockSize - 1 - $erasures[$i])); - - for ($j = $i + 1; $j > 0; $j--) { - $tmp = $this->indexOf[$lambda[$j - 1]]; - - if ($tmp !== $this->blockSize) { - $lambda[$j] = $lambda[$j] ^ $this->alphaTo[$this->modNn($u + $tmp)]; - } - } - } - } - - for ($i = 0; $i <= $this->numRoots; $i++) { - $b[$i] = $this->indexOf[$lambda[$i]]; - } - - // Begin Berlekamp-Massey algorithm to determine error+erasure locator - // polynomial - $r = $numErasures; - $el = $numErasures; - - while (++$r <= $this->numRoots) { - // Compute discrepancy at the r-th step in poly form - $discrepancyR = 0; - - for ($i = 0; $i < $r; $i++) { - if ($lambda[$i] !== 0 && $syndromes[$r - $i - 1] !== $this->blockSize) { - $discrepancyR ^= $this->alphaTo[$this->modNn($this->indexOf[$lambda[$i]] + $syndromes[$r - $i - 1])]; - } - } - - $discrepancyR = $this->indexOf[$discrepancyR]; - - if ($discrepancyR === $this->blockSize) { - $tmp = $b->toArray(); - array_unshift($tmp, $this->blockSize); - array_pop($tmp); - $b = SplFixedArray::fromArray($tmp, false); - } else { - $t[0] = $lambda[0]; - - for ($i = 0; $i < $this->numRoots; $i++) { - if ($b[$i] !== $this->blockSize) { - $t[$i + 1] = $lambda[$i + 1] ^ $this->alphaTo[$this->modNn($discrepancyR + $b[$i])]; - } else { - $t[$i + 1] = $lambda[$i + 1]; - } - } - - if (2 * $el <= $r + $numErasures - 1) { - $el = $r + $numErasures - $el; - - for ($i = 0; $i <= $this->numRoots; $i++) { - $b[$i] = ( - $lambda[$i] === 0 - ? $this->blockSize - : $this->modNn($this->indexOf[$lambda[$i]] - $discrepancyR + $this->blockSize) - ); - } - } else { - $tmp = $b->toArray(); - array_unshift($tmp, $this->blockSize); - array_pop($tmp); - $b = SplFixedArray::fromArray($tmp, false); - } - - $lambda = clone $t; - } - } - - // Convert lambda to index form and compute deg(lambda(x)) - $degLambda = 0; - - for ($i = 0; $i <= $this->numRoots; $i++) { - $lambda[$i] = $this->indexOf[$lambda[$i]]; - - if ($lambda[$i] !== $this->blockSize) { - $degLambda = $i; - } - } - - // Find roots of the error+erasure locator polynomial by Chien search. - $reg = clone $lambda; - $reg[0] = 0; - $count = 0; - - for ($i = 1, $k = $this->iPrimitive - 1; $i <= $this->blockSize; $i++, $k = $this->modNn($k + $this->iPrimitive)) { - $q = 1; - - for ($j = $degLambda; $j > 0; $j--) { - if ($reg[$j] !== $this->blockSize) { - $reg[$j] = $this->modNn($reg[$j] + $j); - $q ^= $this->alphaTo[$reg[$j]]; - } - } - - if ($q !== 0) { - // Not a root - continue; - } - - // Store root (index-form) and error location number - $root[$count] = $i; - $loc[$count] = $k; - - if (++$count === $degLambda) { - break; - } - } - - if ($degLambda !== $count) { - // deg(lambda) unequal to number of roots: uncorreactable error - // detected - return null; - } - - // Compute err+eras evaluate poly omega(x) = s(x)*lambda(x) (modulo - // x**numRoots). In index form. Also find deg(omega). - $degOmega = $degLambda - 1; - - for ($i = 0; $i <= $degOmega; $i++) { - $tmp = 0; - - for ($j = $i; $j >= 0; $j--) { - if ($syndromes[$i - $j] !== $this->blockSize && $lambda[$j] !== $this->blockSize) { - $tmp ^= $this->alphaTo[$this->modNn($syndromes[$i - $j] + $lambda[$j])]; - } - } - - $omega[$i] = $this->indexOf[$tmp]; - } - - // Compute error values in poly-form. num1 = omega(inv(X(l))), num2 = - // inv(X(l))**(firstRoot-1) and den = lambda_pr(inv(X(l))) all in poly - // form. - for ($j = $count - 1; $j >= 0; $j--) { - $num1 = 0; - - for ($i = $degOmega; $i >= 0; $i--) { - if ($omega[$i] !== $this->blockSize) { - $num1 ^= $this->alphaTo[$this->modNn($omega[$i] + $i * $root[$j])]; - } - } - - $num2 = $this->alphaTo[$this->modNn($root[$j] * ($this->firstRoot - 1) + $this->blockSize)]; - $den = 0; - - // lambda[i+1] for i even is the formal derivativelambda_pr of - // lambda[i] - for ($i = min($degLambda, $this->numRoots - 1) & ~1; $i >= 0; $i -= 2) { - if ($lambda[$i + 1] !== $this->blockSize) { - $den ^= $this->alphaTo[$this->modNn($lambda[$i + 1] + $i * $root[$j])]; - } - } - - // Apply error to data - if ($num1 !== 0 && $loc[$j] >= $this->padding) { - $data[$loc[$j] - $this->padding] = $data[$loc[$j] - $this->padding] ^ ( - $this->alphaTo[ - $this->modNn( - $this->indexOf[$num1] + $this->indexOf[$num2] + $this->blockSize - $this->indexOf[$den] - ) - ] - ); - } - } - - if ($erasures !== null) { - if (count($erasures) < $count) { - $erasures->setSize($count); - } - - for ($i = 0; $i < $count; $i++) { - $erasures[$i] = $loc[$i]; - } - } - - return $count; - } - - /** - * Computes $x % GF_SIZE, where GF_SIZE is 2**GF_BITS - 1, without a slow - * divide. - * - * @param itneger $x - * @return integer - */ - protected function modNn($x) - { - while ($x >= $this->blockSize) { - $x -= $this->blockSize; - $x = ($x >> $this->symbolSize) + ($x & $this->blockSize); - } - - return $x; - } -} diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/Version.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/Version.php deleted file mode 100644 index d6986399..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Common/Version.php +++ /dev/null @@ -1,687 +0,0 @@ -versionNumber = $versionNumber; - $this->alignmentPatternCenters = $alignmentPatternCenters; - $this->errorCorrectionBlocks = $ecBlocks; - - $totalCodewords = 0; - $ecCodewords = $ecBlocks[0]->getEcCodewordsPerBlock(); - - foreach ($ecBlocks[0]->getEcBlocks() as $ecBlock) { - $totalCodewords += $ecBlock->getCount() * ($ecBlock->getDataCodewords() + $ecCodewords); - } - - $this->totalCodewords = $totalCodewords; - } - - /** - * Gets the version number. - * - * @return integer - */ - public function getVersionNumber() - { - return $this->versionNumber; - } - - /** - * Gets the alignment pattern centers. - * - * @return SplFixedArray - */ - public function getAlignmentPatternCenters() - { - return $this->alignmentPatternCenters; - } - - /** - * Gets the total number of codewords. - * - * @return integer - */ - public function getTotalCodewords() - { - return $this->totalCodewords; - } - - /** - * Gets the dimension for the current version. - * - * @return integer - */ - public function getDimensionForVersion() - { - return 17 + 4 * $this->versionNumber; - } - - /** - * Gets the number of EC blocks for a specific EC level. - * - * @param ErrorCorrectionLevel $ecLevel - * @return integer - */ - public function getEcBlocksForLevel(ErrorCorrectionLevel $ecLevel) - { - return $this->errorCorrectionBlocks[$ecLevel->getOrdinal()]; - } - - /** - * Gets a provisional version number for a specific dimension. - * - * @param integer $dimension - * @return Version - * @throws Exception\InvalidArgumentException - */ - public static function getProvisionalVersionForDimension($dimension) - { - if ($dimension % 4 !== 1) { - throw new Exception\InvalidArgumentException('Dimension is not 1 mod 4'); - } - - return self::getVersionForNumber(($dimension - 17) >> 2); - } - - /** - * Gets a version instance for a specific version number. - * - * @param integer $versionNumber - * @return Version - * @throws Exception\InvalidArgumentException - */ - public static function getVersionForNumber($versionNumber) - { - if ($versionNumber < 1 || $versionNumber > 40) { - throw new Exception\InvalidArgumentException('Version number must be between 1 and 40'); - } - - if (!isset(self::$versions[$versionNumber])) { - self::buildVersion($versionNumber); - } - - return self::$versions[$versionNumber - 1]; - } - - /** - * Decodes version information from an integer and returns the version. - * - * @param integer $versionBits - * @return Version|null - */ - public static function decodeVersionInformation($versionBits) - { - $bestDifference = PHP_INT_MAX; - $bestVersion = 0; - - foreach (self::$versionDecodeInfo as $i => $targetVersion) { - if ($targetVersion === $versionBits) { - return self::getVersionForNumber($i + 7); - } - - $bitsDifference = FormatInformation::numBitsDiffering($versionBits, $targetVersion); - - if ($bitsDifference < $bestDifference) { - $bestVersion = $i + 7; - $bestDifference = $bitsDifference; - } - } - - if ($bestDifference <= 3) { - return self::getVersionForNumber($bestVersion); - } - - return null; - } - - /** - * Builds the function pattern for the current version. - * - * @return BitMatrix - */ - public function buildFunctionPattern() - { - $dimension = $this->getDimensionForVersion(); - $bitMatrix = new BitMatrix($dimension); - - // Top left finder pattern + separator + format - $bitMatrix->setRegion(0, 0, 9, 9); - // Top right finder pattern + separator + format - $bitMatrix->setRegion($dimension - 8, 0, 8, 9); - // Bottom left finder pattern + separator + format - $bitMatrix->setRegion(0, $dimension - 8, 9, 8); - - // Alignment patterns - $max = count($this->alignmentPatternCenters); - - for ($x = 0; $x < $max; $x++) { - $i = $this->alignmentPatternCenters[$x] - 2; - - for ($y = 0; $y < $max; $y++) { - if (($x === 0 && ($y === 0 || $y === $max - 1)) || ($x === $max - 1 && $y === 0)) { - // No alignment patterns near the three finder paterns - continue; - } - - $bitMatrix->setRegion($this->alignmentPatternCenters[$y] - 2, $i, 5, 5); - } - } - - // Vertical timing pattern - $bitMatrix->setRegion(6, 9, 1, $dimension - 17); - // Horizontal timing pattern - $bitMatrix->setRegion(9, 6, $dimension - 17, 1); - - if ($this->versionNumber > 6) { - // Version info, top right - $bitMatrix->setRegion($dimension - 11, 0, 3, 6); - // Version info, bottom left - $bitMatrix->setRegion(0, $dimension - 11, 6, 3); - } - - return $bitMatrix; - } - - /** - * Returns a string representation for the version. - * - * @return string - */ - public function __toString() - { - return (string) $this->versionNumber; - } - - /** - * Build and cache a specific version. - * - * See ISO 18004:2006 6.5.1 Table 9. - * - * @param integer $versionNumber - * @return void - */ - protected static function buildVersion($versionNumber) - { - switch ($versionNumber) { - case 1: - $patterns = array(); - $ecBlocks = array( - new EcBlocks(7, new EcBlock(1, 19)), - new EcBlocks(10, new EcBlock(1, 16)), - new EcBlocks(13, new EcBlock(1, 13)), - new EcBlocks(17, new EcBlock(1, 9)), - ); - break; - - case 2: - $patterns = array(6, 18); - $ecBlocks = array( - new EcBlocks(10, new EcBlock(1, 34)), - new EcBlocks(16, new EcBlock(1, 28)), - new EcBlocks(22, new EcBlock(1, 22)), - new EcBlocks(28, new EcBlock(1, 16)), - ); - break; - - case 3: - $patterns = array(6, 22); - $ecBlocks = array( - new EcBlocks(15, new EcBlock(1, 55)), - new EcBlocks(26, new EcBlock(1, 44)), - new EcBlocks(18, new EcBlock(2, 17)), - new EcBlocks(22, new EcBlock(2, 13)), - ); - break; - - case 4: - $patterns = array(6, 26); - $ecBlocks = array( - new EcBlocks(20, new EcBlock(1, 80)), - new EcBlocks(18, new EcBlock(2, 32)), - new EcBlocks(26, new EcBlock(3, 24)), - new EcBlocks(16, new EcBlock(4, 9)), - ); - break; - - case 5: - $patterns = array(6, 30); - $ecBlocks = array( - new EcBlocks(26, new EcBlock(1, 108)), - new EcBlocks(24, new EcBlock(2, 43)), - new EcBlocks(18, new EcBlock(2, 15), new EcBlock(2, 16)), - new EcBlocks(22, new EcBlock(2, 11), new EcBlock(2, 12)), - ); - break; - - case 6: - $patterns = array(6, 34); - $ecBlocks = array( - new EcBlocks(18, new EcBlock(2, 68)), - new EcBlocks(16, new EcBlock(4, 27)), - new EcBlocks(24, new EcBlock(4, 19)), - new EcBlocks(28, new EcBlock(4, 15)), - ); - break; - - case 7: - $patterns = array(6, 22, 38); - $ecBlocks = array( - new EcBlocks(20, new EcBlock(2, 78)), - new EcBlocks(18, new EcBlock(4, 31)), - new EcBlocks(18, new EcBlock(2, 14), new EcBlock(4, 15)), - new EcBlocks(26, new EcBlock(4, 13), new EcBlock(1, 14)), - ); - break; - - case 8: - $patterns = array(6, 24, 42); - $ecBlocks = array( - new EcBlocks(24, new EcBlock(2, 97)), - new EcBlocks(22, new EcBlock(2, 38), new EcBlock(2, 39)), - new EcBlocks(22, new EcBlock(4, 18), new EcBlock(2, 19)), - new EcBlocks(26, new EcBlock(4, 14), new EcBlock(2, 15)), - ); - break; - - case 9: - $patterns = array(6, 26, 46); - $ecBlocks = array( - new EcBlocks(30, new EcBlock(2, 116)), - new EcBlocks(22, new EcBlock(3, 36), new EcBlock(2, 37)), - new EcBlocks(20, new EcBlock(4, 16), new EcBlock(4, 17)), - new EcBlocks(24, new EcBlock(4, 12), new EcBlock(4, 13)), - ); - break; - - case 10: - $patterns = array(6, 28, 50); - $ecBlocks = array( - new EcBlocks(18, new EcBlock(2, 68), new EcBlock(2, 69)), - new EcBlocks(26, new EcBlock(4, 43), new EcBlock(1, 44)), - new EcBlocks(24, new EcBlock(6, 19), new EcBlock(2, 20)), - new EcBlocks(28, new EcBlock(6, 15), new EcBlock(2, 16)), - ); - break; - - case 11: - $patterns = array(6, 30, 54); - $ecBlocks = array( - new EcBlocks(20, new EcBlock(4, 81)), - new EcBlocks(30, new EcBlock(1, 50), new EcBlock(4, 51)), - new EcBlocks(28, new EcBlock(4, 22), new EcBlock(4, 23)), - new EcBlocks(24, new EcBlock(3, 12), new EcBlock(8, 13)), - ); - break; - - case 12: - $patterns = array(6, 32, 58); - $ecBlocks = array( - new EcBlocks(24, new EcBlock(2, 92), new EcBlock(2, 93)), - new EcBlocks(22, new EcBlock(6, 36), new EcBlock(2, 37)), - new EcBlocks(26, new EcBlock(4, 20), new EcBlock(6, 21)), - new EcBlocks(28, new EcBlock(7, 14), new EcBlock(4, 15)), - ); - break; - - case 13: - $patterns = array(6, 34, 62); - $ecBlocks = array( - new EcBlocks(26, new EcBlock(4, 107)), - new EcBlocks(22, new EcBlock(8, 37), new EcBlock(1, 38)), - new EcBlocks(24, new EcBlock(8, 20), new EcBlock(4, 21)), - new EcBlocks(22, new EcBlock(12, 11), new EcBlock(4, 12)), - ); - break; - - case 14: - $patterns = array(6, 26, 46, 66); - $ecBlocks = array( - new EcBlocks(30, new EcBlock(3, 115), new EcBlock(1, 116)), - new EcBlocks(24, new EcBlock(4, 40), new EcBlock(5, 41)), - new EcBlocks(20, new EcBlock(11, 16), new EcBlock(5, 17)), - new EcBlocks(24, new EcBlock(11, 12), new EcBlock(5, 13)), - ); - break; - - case 15: - $patterns = array(6, 26, 48, 70); - $ecBlocks = array( - new EcBlocks(22, new EcBlock(5, 87), new EcBlock(1, 88)), - new EcBlocks(24, new EcBlock(5, 41), new EcBlock(5, 42)), - new EcBlocks(30, new EcBlock(5, 24), new EcBlock(7, 25)), - new EcBlocks(24, new EcBlock(11, 12), new EcBlock(7, 13)), - ); - break; - - case 16: - $patterns = array(6, 26, 50, 74); - $ecBlocks = array( - new EcBlocks(24, new EcBlock(5, 98), new EcBlock(1, 99)), - new EcBlocks(28, new EcBlock(7, 45), new EcBlock(3, 46)), - new EcBlocks(24, new EcBlock(15, 19), new EcBlock(2, 20)), - new EcBlocks(30, new EcBlock(3, 15), new EcBlock(13, 16)), - ); - break; - - case 17: - $patterns = array(6, 30, 54, 78); - $ecBlocks = array( - new EcBlocks(28, new EcBlock(1, 107), new EcBlock(5, 108)), - new EcBlocks(28, new EcBlock(10, 46), new EcBlock(1, 47)), - new EcBlocks(28, new EcBlock(1, 22), new EcBlock(15, 23)), - new EcBlocks(28, new EcBlock(2, 14), new EcBlock(17, 15)), - ); - break; - - case 18: - $patterns = array(6, 30, 56, 82); - $ecBlocks = array( - new EcBlocks(30, new EcBlock(5, 120), new EcBlock(1, 121)), - new EcBlocks(26, new EcBlock(9, 43), new EcBlock(4, 44)), - new EcBlocks(28, new EcBlock(17, 22), new EcBlock(1, 23)), - new EcBlocks(28, new EcBlock(2, 14), new EcBlock(19, 15)), - ); - break; - - case 19: - $patterns = array(6, 30, 58, 86); - $ecBlocks = array( - new EcBlocks(28, new EcBlock(3, 113), new EcBlock(4, 114)), - new EcBlocks(26, new EcBlock(3, 44), new EcBlock(11, 45)), - new EcBlocks(26, new EcBlock(17, 21), new EcBlock(4, 22)), - new EcBlocks(26, new EcBlock(9, 13), new EcBlock(16, 14)), - ); - break; - - case 20: - $patterns = array(6, 34, 62, 90); - $ecBlocks = array( - new EcBlocks(28, new EcBlock(3, 107), new EcBlock(5, 108)), - new EcBlocks(26, new EcBlock(3, 41), new EcBlock(13, 42)), - new EcBlocks(30, new EcBlock(15, 24), new EcBlock(5, 25)), - new EcBlocks(28, new EcBlock(15, 15), new EcBlock(10, 16)), - ); - break; - - case 21: - $patterns = array(6, 28, 50, 72, 94); - $ecBlocks = array( - new EcBlocks(28, new EcBlock(4, 116), new EcBlock(4, 117)), - new EcBlocks(26, new EcBlock(17, 42)), - new EcBlocks(28, new EcBlock(17, 22), new EcBlock(6, 23)), - new EcBlocks(30, new EcBlock(19, 16), new EcBlock(6, 17)), - ); - break; - - case 22: - $patterns = array(6, 26, 50, 74, 98); - $ecBlocks = array( - new EcBlocks(28, new EcBlock(2, 111), new EcBlock(7, 112)), - new EcBlocks(28, new EcBlock(17, 46)), - new EcBlocks(30, new EcBlock(7, 24), new EcBlock(16, 25)), - new EcBlocks(24, new EcBlock(34, 13)), - ); - break; - - case 23: - $patterns = array(6, 30, 54, 78, 102); - $ecBlocks = array( - new EcBlocks(30, new EcBlock(4, 121), new EcBlock(5, 122)), - new EcBlocks(28, new EcBlock(4, 47), new EcBlock(14, 48)), - new EcBlocks(30, new EcBlock(11, 24), new EcBlock(14, 25)), - new EcBlocks(30, new EcBlock(16, 15), new EcBlock(14, 16)), - ); - break; - - case 24: - $patterns = array(6, 28, 54, 80, 106); - $ecBlocks = array( - new EcBlocks(30, new EcBlock(6, 117), new EcBlock(4, 118)), - new EcBlocks(28, new EcBlock(6, 45), new EcBlock(14, 46)), - new EcBlocks(30, new EcBlock(11, 24), new EcBlock(16, 25)), - new EcBlocks(30, new EcBlock(30, 16), new EcBlock(2, 17)), - ); - break; - - case 25: - $patterns = array(6, 32, 58, 84, 110); - $ecBlocks = array( - new EcBlocks(26, new EcBlock(8, 106), new EcBlock(4, 107)), - new EcBlocks(28, new EcBlock(8, 47), new EcBlock(13, 48)), - new EcBlocks(30, new EcBlock(7, 24), new EcBlock(22, 25)), - new EcBlocks(30, new EcBlock(22, 15), new EcBlock(13, 16)), - ); - break; - - case 26: - $patterns = array(6, 30, 58, 86, 114); - $ecBlocks = array( - new EcBlocks(28, new EcBlock(10, 114), new EcBlock(2, 115)), - new EcBlocks(28, new EcBlock(19, 46), new EcBlock(4, 47)), - new EcBlocks(28, new EcBlock(28, 22), new EcBlock(6, 23)), - new EcBlocks(30, new EcBlock(33, 16), new EcBlock(4, 17)), - ); - break; - - case 27: - $patterns = array(6, 34, 62, 90, 118); - $ecBlocks = array( - new EcBlocks(30, new EcBlock(8, 122), new EcBlock(4, 123)), - new EcBlocks(28, new EcBlock(22, 45), new EcBlock(3, 46)), - new EcBlocks(30, new EcBlock(8, 23), new EcBlock(26, 24)), - new EcBlocks(30, new EcBlock(12, 15), new EcBlock(28, 16)), - ); - break; - - case 28: - $patterns = array(6, 26, 50, 74, 98, 122); - $ecBlocks = array( - new EcBlocks(30, new EcBlock(3, 117), new EcBlock(10, 118)), - new EcBlocks(28, new EcBlock(3, 45), new EcBlock(23, 46)), - new EcBlocks(30, new EcBlock(4, 24), new EcBlock(31, 25)), - new EcBlocks(30, new EcBlock(11, 15), new EcBlock(31, 16)), - ); - break; - - case 29: - $patterns = array(6, 30, 54, 78, 102, 126); - $ecBlocks = array( - new EcBlocks(30, new EcBlock(7, 116), new EcBlock(7, 117)), - new EcBlocks(28, new EcBlock(21, 45), new EcBlock(7, 46)), - new EcBlocks(30, new EcBlock(1, 23), new EcBlock(37, 24)), - new EcBlocks(30, new EcBlock(19, 15), new EcBlock(26, 16)), - ); - break; - - case 30: - $patterns = array(6, 26, 52, 78, 104, 130); - $ecBlocks = array( - new EcBlocks(30, new EcBlock(5, 115), new EcBlock(10, 116)), - new EcBlocks(28, new EcBlock(19, 47), new EcBlock(10, 48)), - new EcBlocks(30, new EcBlock(15, 24), new EcBlock(25, 25)), - new EcBlocks(30, new EcBlock(23, 15), new EcBlock(25, 16)), - ); - break; - - case 31: - $patterns = array(6, 30, 56, 82, 108, 134); - $ecBlocks = array( - new EcBlocks(30, new EcBlock(13, 115), new EcBlock(3, 116)), - new EcBlocks(28, new EcBlock(2, 46), new EcBlock(29, 47)), - new EcBlocks(30, new EcBlock(42, 24), new EcBlock(1, 25)), - new EcBlocks(30, new EcBlock(23, 15), new EcBlock(28, 16)), - ); - break; - - case 32: - $patterns = array(6, 34, 60, 86, 112, 138); - $ecBlocks = array( - new EcBlocks(30, new EcBlock(17, 115)), - new EcBlocks(28, new EcBlock(10, 46), new EcBlock(23, 47)), - new EcBlocks(30, new EcBlock(10, 24), new EcBlock(35, 25)), - new EcBlocks(30, new EcBlock(19, 15), new EcBlock(35, 16)), - ); - break; - - case 33: - $patterns = array(6, 30, 58, 86, 114, 142); - $ecBlocks = array( - new EcBlocks(30, new EcBlock(17, 115), new EcBlock(1, 116)), - new EcBlocks(28, new EcBlock(14, 46), new EcBlock(21, 47)), - new EcBlocks(30, new EcBlock(29, 24), new EcBlock(19, 25)), - new EcBlocks(30, new EcBlock(11, 15), new EcBlock(46, 16)), - ); - break; - - case 34: - $patterns = array(6, 34, 62, 90, 118, 146); - $ecBlocks = array( - new EcBlocks(30, new EcBlock(13, 115), new EcBlock(6, 116)), - new EcBlocks(28, new EcBlock(14, 46), new EcBlock(23, 47)), - new EcBlocks(30, new EcBlock(44, 24), new EcBlock(7, 25)), - new EcBlocks(30, new EcBlock(59, 16), new EcBlock(1, 17)), - ); - break; - - case 35: - $patterns = array(6, 30, 54, 78, 102, 126, 150); - $ecBlocks = array( - new EcBlocks(30, new EcBlock(12, 121), new EcBlock(7, 122)), - new EcBlocks(28, new EcBlock(12, 47), new EcBlock(26, 48)), - new EcBlocks(30, new EcBlock(39, 24), new EcBlock(14, 25)), - new EcBlocks(30, new EcBlock(22, 15), new EcBlock(41, 16)), - ); - break; - - case 36: - $patterns = array(6, 24, 50, 76, 102, 128, 154); - $ecBlocks = array( - new EcBlocks(30, new EcBlock(6, 121), new EcBlock(14, 122)), - new EcBlocks(28, new EcBlock(6, 47), new EcBlock(34, 48)), - new EcBlocks(30, new EcBlock(46, 24), new EcBlock(10, 25)), - new EcBlocks(30, new EcBlock(2, 15), new EcBlock(64, 16)), - ); - break; - - case 37: - $patterns = array(6, 28, 54, 80, 106, 132, 158); - $ecBlocks = array( - new EcBlocks(30, new EcBlock(17, 122), new EcBlock(4, 123)), - new EcBlocks(28, new EcBlock(29, 46), new EcBlock(14, 47)), - new EcBlocks(30, new EcBlock(49, 24), new EcBlock(10, 25)), - new EcBlocks(30, new EcBlock(24, 15), new EcBlock(46, 16)), - ); - break; - - case 38: - $patterns = array(6, 32, 58, 84, 110, 136, 162); - $ecBlocks = array( - new EcBlocks(30, new EcBlock(4, 122), new EcBlock(18, 123)), - new EcBlocks(28, new EcBlock(13, 46), new EcBlock(32, 47)), - new EcBlocks(30, new EcBlock(48, 24), new EcBlock(14, 25)), - new EcBlocks(30, new EcBlock(42, 15), new EcBlock(32, 16)), - ); - break; - - case 39: - $patterns = array(6, 26, 54, 82, 110, 138, 166); - $ecBlocks = array( - new EcBlocks(30, new EcBlock(20, 117), new EcBlock(4, 118)), - new EcBlocks(28, new EcBlock(40, 47), new EcBlock(7, 48)), - new EcBlocks(30, new EcBlock(43, 24), new EcBlock(22, 25)), - new EcBlocks(30, new EcBlock(10, 15), new EcBlock(67, 16)), - ); - break; - - case 40: - $patterns = array(6, 30, 58, 86, 114, 142, 170); - $ecBlocks = array( - new EcBlocks(30, new EcBlock(19, 118), new EcBlock(6, 119)), - new EcBlocks(28, new EcBlock(18, 47), new EcBlock(31, 48)), - new EcBlocks(30, new EcBlock(34, 24), new EcBlock(34, 25)), - new EcBlocks(30, new EcBlock(20, 15), new EcBlock(61, 16)), - ); - break; - } - - self::$versions[$versionNumber - 1] = new self( - $versionNumber, - SplFixedArray::fromArray($patterns, false), - SplFixedArray::fromArray($ecBlocks, false) - ); - } -} diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Encoder/BlockPair.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Encoder/BlockPair.php deleted file mode 100644 index 090db297..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Encoder/BlockPair.php +++ /dev/null @@ -1,64 +0,0 @@ -dataBytes = $data; - $this->errorCorrectionBytes = $errorCorrection; - } - - /** - * Gets the data bytes. - * - * @return SplFixedArray - */ - public function getDataBytes() - { - return $this->dataBytes; - } - - /** - * Gets the error correction bytes. - * - * @return SplFixedArray - */ - public function getErrorCorrectionBytes() - { - return $this->errorCorrectionBytes; - } -} diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Encoder/ByteMatrix.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Encoder/ByteMatrix.php deleted file mode 100644 index a378f083..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Encoder/ByteMatrix.php +++ /dev/null @@ -1,158 +0,0 @@ -height = $height; - $this->width = $width; - $this->bytes = new SplFixedArray($height); - - for ($y = 0; $y < $height; $y++) { - $this->bytes[$y] = new SplFixedArray($width); - } - } - - /** - * Gets the width of the matrix. - * - * @return integer - */ - public function getWidth() - { - return $this->width; - } - - /** - * Gets the height of the matrix. - * - * @return integer - */ - public function getHeight() - { - return $this->height; - } - - /** - * Gets the internal representation of the matrix. - * - * @return SplFixedArray - */ - public function getArray() - { - return $this->bytes; - } - - /** - * Gets the byte for a specific position. - * - * @param integer $x - * @param integer $y - * @return integer - */ - public function get($x, $y) - { - return $this->bytes[$y][$x]; - } - - /** - * Sets the byte for a specific position. - * - * @param integer $x - * @param integer $y - * @param integer $value - * @return void - */ - public function set($x, $y, $value) - { - $this->bytes[$y][$x] = (int) $value; - } - - /** - * Clears the matrix with a specific value. - * - * @param integer $value - * @return void - */ - public function clear($value) - { - for ($y = 0; $y < $this->height; $y++) { - for ($x = 0; $x < $this->width; $x++) { - $this->bytes[$y][$x] = $value; - } - } - } - - /** - * Returns a string representation of the matrix. - * - * @return string - */ - public function __toString() - { - $result = ''; - - for ($y = 0; $y < $this->height; $y++) { - for ($x = 0; $x < $this->width; $x++) { - switch ($this->bytes[$y][$x]) { - case 0: - $result .= ' 0'; - break; - - case 1: - $result .= ' 1'; - break; - - default: - $result .= ' '; - break; - } - } - - $result .= "\n"; - } - - return $result; - } -} diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Encoder/Encoder.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Encoder/Encoder.php deleted file mode 100644 index c8efc35d..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Encoder/Encoder.php +++ /dev/null @@ -1,687 +0,0 @@ -get() === Mode::BYTE && $encoding !== self::DEFAULT_BYTE_MODE_ECODING) { - $eci = CharacterSetEci::getCharacterSetEciByName($encoding); - - if ($eci !== null) { - self::appendEci($eci, $headerBits); - } - } - - // (With ECI in place,) Write the mode marker - self::appendModeInfo($mode, $headerBits); - - // Collect data within the main segment, separately, to count its size - // if needed. Don't add it to main payload yet. - $dataBits = new BitArray(); - self::appendBytes($content, $mode, $dataBits, $encoding); - - // Hard part: need to know version to know how many bits length takes. - // But need to know how many bits it takes to know version. First we - // take a guess at version by assuming version will be the minimum, 1: - $provisionalBitsNeeded = $headerBits->getSize() - + $mode->getCharacterCountBits(Version::getVersionForNumber(1)) - + $dataBits->getSize(); - $provisionalVersion = self::chooseVersion($provisionalBitsNeeded, $ecLevel); - - // Use that guess to calculate the right version. I am still not sure - // this works in 100% of cases. - $bitsNeeded = $headerBits->getSize() - + $mode->getCharacterCountBits($provisionalVersion) - + $dataBits->getSize(); - $version = self::chooseVersion($bitsNeeded, $ecLevel); - - $headerAndDataBits = new BitArray(); - $headerAndDataBits->appendBitArray($headerBits); - - // Find "length" of main segment and write it. - $numLetters = ($mode->get() === Mode::BYTE ? $dataBits->getSizeInBytes() : strlen($content)); - self::appendLengthInfo($numLetters, $version, $mode, $headerAndDataBits); - - // Put data together into the overall payload. - $headerAndDataBits->appendBitArray($dataBits); - $ecBlocks = $version->getEcBlocksForLevel($ecLevel); - $numDataBytes = $version->getTotalCodewords() - $ecBlocks->getTotalEcCodewords(); - - // Terminate the bits properly. - self::terminateBits($numDataBytes, $headerAndDataBits); - - // Interleave data bits with error correction code. - $finalBits = self::interleaveWithEcBytes( - $headerAndDataBits, - $version->getTotalCodewords(), - $numDataBytes, - $ecBlocks->getNumBlocks() - ); - - $qrCode = new QrCode(); - $qrCode->setErrorCorrectionLevel($ecLevel); - $qrCode->setMode($mode); - $qrCode->setVersion($version); - - // Choose the mask pattern and set to "qrCode". - $dimension = $version->getDimensionForVersion(); - $matrix = new ByteMatrix($dimension, $dimension); - $maskPattern = self::chooseMaskPattern($finalBits, $ecLevel, $version, $matrix); - $qrCode->setMaskPattern($maskPattern); - - // Build the matrix and set it to "qrCode". - MatrixUtil::buildMatrix($finalBits, $ecLevel, $version, $maskPattern, $matrix); - $qrCode->setMatrix($matrix); - - return $qrCode; - } - - /** - * Gets the alphanumeric code for a byte. - * - * @param string|integer $code - * @return integer - */ - protected static function getAlphanumericCode($code) - { - $code = (is_string($code) ? ord($code) : $code); - - if (isset(self::$alphanumericTable[$code])) { - return self::$alphanumericTable[$code]; - } - - return -1; - } - - /** - * Chooses the best mode for a given content. - * - * @param string $content - * @param string $encoding - * @return Mode - */ - protected static function chooseMode($content, $encoding = null) - { - if (strcasecmp($encoding, 'SHIFT-JIS') === 0) { - return self::isOnlyDoubleByteKanji($content) ? new Mode(Mode::KANJI) : new Mode(Mode::BYTE); - } - - $hasNumeric = false; - $hasAlphanumeric = false; - $contentLength = strlen($content); - - for ($i = 0; $i < $contentLength; $i++) { - $char = $content[$i]; - - if (ctype_digit($char)) { - $hasNumeric = true; - } elseif (self::getAlphanumericCode($char) !== -1) { - $hasAlphanumeric = true; - } else { - return new Mode(Mode::BYTE); - } - } - - if ($hasAlphanumeric) { - return new Mode(Mode::ALPHANUMERIC); - } elseif ($hasNumeric) { - return new Mode(Mode::NUMERIC); - } - - return new Mode(Mode::BYTE); - } - - /** - * Calculates the mask penalty for a matrix. - * - * @param ByteMatrix $matrix - * @return integer - */ - protected static function calculateMaskPenalty(ByteMatrix $matrix) - { - return ( - MaskUtil::applyMaskPenaltyRule1($matrix) - + MaskUtil::applyMaskPenaltyRule2($matrix) - + MaskUtil::applyMaskPenaltyRule3($matrix) - + MaskUtil::applyMaskPenaltyRule4($matrix) - ); - } - - /** - * Chooses the best mask pattern for a matrix. - * - * @param BitArray $bits - * @param ErrorCorrectionLevel $ecLevel - * @param Version $version - * @param ByteMatrix $matrix - * @return integer - */ - protected static function chooseMaskPattern( - BitArray $bits, - ErrorCorrectionLevel $ecLevel, - Version $version, - ByteMatrix $matrix - ) { - $minPenality = PHP_INT_MAX; - $bestMaskPattern = -1; - - for ($maskPattern = 0; $maskPattern < QrCode::NUM_MASK_PATTERNS; $maskPattern++) { - MatrixUtil::buildMatrix($bits, $ecLevel, $version, $maskPattern, $matrix); - $penalty = self::calculateMaskPenalty($matrix); - - if ($penalty < $minPenality) { - $minPenality = $penalty; - $bestMaskPattern = $maskPattern; - } - } - - return $bestMaskPattern; - } - - /** - * Chooses the best version for the input. - * - * @param integer $numInputBits - * @param ErrorCorrectionLevel $ecLevel - * @return Version - * @throws Exception\WriterException - */ - protected static function chooseVersion($numInputBits, ErrorCorrectionLevel $ecLevel) - { - for ($versionNum = 1; $versionNum <= 40; $versionNum++) { - $version = Version::getVersionForNumber($versionNum); - $numBytes = $version->getTotalCodewords(); - - $ecBlocks = $version->getEcBlocksForLevel($ecLevel); - $numEcBytes = $ecBlocks->getTotalEcCodewords(); - - $numDataBytes = $numBytes - $numEcBytes; - $totalInputBytes = intval(($numInputBits + 8) / 8); - - if ($numDataBytes >= $totalInputBytes) { - return $version; - } - } - - throw new Exception\WriterException('Data too big'); - } - - /** - * Terminates the bits in a bit array. - * - * @param integer $numDataBytes - * @param BitArray $bits - * @throws Exception\WriterException - */ - protected static function terminateBits($numDataBytes, BitArray $bits) - { - $capacity = $numDataBytes << 3; - - if ($bits->getSize() > $capacity) { - throw new Exception\WriterException('Data bits cannot fit in the QR code'); - } - - for ($i = 0; $i < 4 && $bits->getSize() < $capacity; $i++) { - $bits->appendBit(false); - } - - $numBitsInLastByte = $bits->getSize() & 0x7; - - if ($numBitsInLastByte > 0) { - for ($i = $numBitsInLastByte; $i < 8; $i++) { - $bits->appendBit(false); - } - } - - $numPaddingBytes = $numDataBytes - $bits->getSizeInBytes(); - - for ($i = 0; $i < $numPaddingBytes; $i++) { - $bits->appendBits(($i & 0x1) === 0 ? 0xec : 0x11, 8); - } - - if ($bits->getSize() !== $capacity) { - throw new Exception\WriterException('Bits size does not equal capacity'); - } - } - - /** - * Gets number of data- and EC bytes for a block ID. - * - * @param integer $numTotalBytes - * @param integer $numDataBytes - * @param integer $numRsBlocks - * @param integer $blockId - * @return array - * @throws Exception\WriterException - */ - protected static function getNumDataBytesAndNumEcBytesForBlockId( - $numTotalBytes, - $numDataBytes, - $numRsBlocks, - $blockId - ) { - if ($blockId >= $numRsBlocks) { - throw new Exception\WriterException('Block ID too large'); - } - - $numRsBlocksInGroup2 = $numTotalBytes % $numRsBlocks; - $numRsBlocksInGroup1 = $numRsBlocks - $numRsBlocksInGroup2; - $numTotalBytesInGroup1 = intval($numTotalBytes / $numRsBlocks); - $numTotalBytesInGroup2 = $numTotalBytesInGroup1 + 1; - $numDataBytesInGroup1 = intval($numDataBytes / $numRsBlocks); - $numDataBytesInGroup2 = $numDataBytesInGroup1 + 1; - $numEcBytesInGroup1 = $numTotalBytesInGroup1 - $numDataBytesInGroup1; - $numEcBytesInGroup2 = $numTotalBytesInGroup2 - $numDataBytesInGroup2; - - if ($numEcBytesInGroup1 !== $numEcBytesInGroup2) { - throw new Exception\WriterException('EC bytes mismatch'); - } - - if ($numRsBlocks !== $numRsBlocksInGroup1 + $numRsBlocksInGroup2) { - throw new Exception\WriterException('RS blocks mismatch'); - } - - if ($numTotalBytes !== - (($numDataBytesInGroup1 + $numEcBytesInGroup1) * $numRsBlocksInGroup1) - + (($numDataBytesInGroup2 + $numEcBytesInGroup2) * $numRsBlocksInGroup2) - ) { - throw new Exception\WriterException('Total bytes mismatch'); - } - - if ($blockId < $numRsBlocksInGroup1) { - return array($numDataBytesInGroup1, $numEcBytesInGroup1); - } else { - return array($numDataBytesInGroup2, $numEcBytesInGroup2); - } - } - - /** - * Interleaves data with EC bytes. - * - * @param BitArray $bits - * @param integer $numTotalBytes - * @param integer $numDataBytes - * @param integer $numRsBlocks - * @return BitArray - * @throws Exception\WriterException - */ - protected static function interleaveWithEcBytes(BitArray $bits, $numTotalBytes, $numDataBytes, $numRsBlocks) - { - if ($bits->getSizeInBytes() !== $numDataBytes) { - throw new Exception\WriterException('Number of bits and data bytes does not match'); - } - - $dataBytesOffset = 0; - $maxNumDataBytes = 0; - $maxNumEcBytes = 0; - - $blocks = new SplFixedArray($numRsBlocks); - - for ($i = 0; $i < $numRsBlocks; $i++) { - list($numDataBytesInBlock, $numEcBytesInBlock) = self::getNumDataBytesAndNumEcBytesForBlockId( - $numTotalBytes, - $numDataBytes, - $numRsBlocks, - $i - ); - - $size = $numDataBytesInBlock; - $dataBytes = $bits->toBytes(8 * $dataBytesOffset, $size); - $ecBytes = self::generateEcBytes($dataBytes, $numEcBytesInBlock); - $blocks[$i] = new BlockPair($dataBytes, $ecBytes); - - $maxNumDataBytes = max($maxNumDataBytes, $size); - $maxNumEcBytes = max($maxNumEcBytes, count($ecBytes)); - $dataBytesOffset += $numDataBytesInBlock; - } - - if ($numDataBytes !== $dataBytesOffset) { - throw new Exception\WriterException('Data bytes does not match offset'); - } - - $result = new BitArray(); - - for ($i = 0; $i < $maxNumDataBytes; $i++) { - foreach ($blocks as $block) { - $dataBytes = $block->getDataBytes(); - - if ($i < count($dataBytes)) { - $result->appendBits($dataBytes[$i], 8); - } - } - } - - for ($i = 0; $i < $maxNumEcBytes; $i++) { - foreach ($blocks as $block) { - $ecBytes = $block->getErrorCorrectionBytes(); - - if ($i < count($ecBytes)) { - $result->appendBits($ecBytes[$i], 8); - } - } - } - - if ($numTotalBytes !== $result->getSizeInBytes()) { - throw new Exception\WriterException('Interleaving error: ' . $numTotalBytes . ' and ' . $result->getSizeInBytes() . ' differ'); - } - - return $result; - } - - /** - * Generates EC bytes for given data. - * - * @param SplFixedArray $dataBytes - * @param integer $numEcBytesInBlock - * @return SplFixedArray - */ - protected static function generateEcBytes(SplFixedArray $dataBytes, $numEcBytesInBlock) - { - $numDataBytes = count($dataBytes); - $toEncode = new SplFixedArray($numDataBytes + $numEcBytesInBlock); - - for ($i = 0; $i < $numDataBytes; $i++) { - $toEncode[$i] = $dataBytes[$i] & 0xff; - } - - $ecBytes = new SplFixedArray($numEcBytesInBlock); - $codec = self::getCodec($numDataBytes, $numEcBytesInBlock); - $codec->encode($toEncode, $ecBytes); - - return $ecBytes; - } - - /** - * Gets an RS codec and caches it. - * - * @param integer $numDataBytes - * @param integer $numEcBytesInBlock - * @return ReedSolomonCodec - */ - protected static function getCodec($numDataBytes, $numEcBytesInBlock) - { - $cacheId = $numDataBytes . '-' . $numEcBytesInBlock; - - if (!isset(self::$codecs[$cacheId])) { - self::$codecs[$cacheId] = new ReedSolomonCodec( - 8, - 0x11d, - 0, - 1, - $numEcBytesInBlock, - 255 - $numDataBytes - $numEcBytesInBlock - ); - } - - return self::$codecs[$cacheId]; - } - - /** - * Appends mode information to a bit array. - * - * @param Mode $mode - * @param BitArray $bits - * @return void - */ - protected static function appendModeInfo(Mode $mode, BitArray $bits) - { - $bits->appendBits($mode->get(), 4); - } - - /** - * Appends length information to a bit array. - * - * @param integer $numLetters - * @param Version $version - * @param Mode $mode - * @param BitArray $bits - * @return void - * @throws Exception\WriterException - */ - protected static function appendLengthInfo($numLetters, Version $version, Mode $mode, BitArray $bits) - { - $numBits = $mode->getCharacterCountBits($version); - - if ($numLetters >= (1 << $numBits)) { - throw new Exception\WriterException($numLetters . ' is bigger than ' . ((1 << $numBits) - 1)); - } - - $bits->appendBits($numLetters, $numBits); - } - - /** - * Appends bytes to a bit array in a specific mode. - * - * @param stirng $content - * @param Mode $mode - * @param BitArray $bits - * @param string $encoding - * @return void - * @throws Exception\WriterException - */ - protected static function appendBytes($content, Mode $mode, BitArray $bits, $encoding) - { - switch ($mode->get()) { - case Mode::NUMERIC: - self::appendNumericBytes($content, $bits); - break; - - case Mode::ALPHANUMERIC: - self::appendAlphanumericBytes($content, $bits); - break; - - case Mode::BYTE: - self::append8BitBytes($content, $bits, $encoding); - break; - - case Mode::KANJI: - self::appendKanjiBytes($content, $bits); - break; - - default: - throw new Exception\WriterException('Invalid mode: ' . $mode->get()); - } - } - - /** - * Appends numeric bytes to a bit array. - * - * @param string $content - * @param BitArray $bits - * @return void - */ - protected static function appendNumericBytes($content, BitArray $bits) - { - $length = strlen($content); - $i = 0; - - while ($i < $length) { - $num1 = (int) $content[$i]; - - if ($i + 2 < $length) { - // Encode three numeric letters in ten bits. - $num2 = (int) $content[$i + 1]; - $num3 = (int) $content[$i + 2]; - $bits->appendBits($num1 * 100 + $num2 * 10 + $num3, 10); - $i += 3; - } elseif ($i + 1 < $length) { - // Encode two numeric letters in seven bits. - $num2 = (int) $content[$i + 1]; - $bits->appendBits($num1 * 10 + $num2, 7); - $i += 2; - } else { - // Encode one numeric letter in four bits. - $bits->appendBits($num1, 4); - $i++; - } - } - } - - /** - * Appends alpha-numeric bytes to a bit array. - * - * @param string $content - * @param BitArray $bits - * @return void - */ - protected static function appendAlphanumericBytes($content, BitArray $bits) - { - $length = strlen($content); - $i = 0; - - while ($i < $length) { - if (-1 === ($code1 = self::getAlphanumericCode($content[$i]))) { - throw new Exception\WriterException('Invalid alphanumeric code'); - } - - if ($i + 1 < $length) { - if (-1 === ($code2 = self::getAlphanumericCode($content[$i + 1]))) { - throw new Exception\WriterException('Invalid alphanumeric code'); - } - - // Encode two alphanumeric letters in 11 bits. - $bits->appendBits($code1 * 45 + $code2, 11); - $i += 2; - } else { - // Encode one alphanumeric letter in six bits. - $bits->appendBits($code1, 6); - $i++; - } - } - } - - /** - * Appends regular 8-bit bytes to a bit array. - * - * @param string $content - * @param BitArray $bits - * @return void - */ - protected static function append8BitBytes($content, BitArray $bits, $encoding) - { - if (false === ($bytes = @iconv('utf-8', $encoding, $content))) { - throw new Exception\WriterException('Could not encode content to ' . $encoding); - } - - $length = strlen($bytes); - - for ($i = 0; $i < $length; $i++) { - $bits->appendBits(ord($bytes[$i]), 8); - } - } - - /** - * Appends KANJI bytes to a bit array. - * - * @param string $content - * @param BitArray $bits - * @return void - */ - protected static function appendKanjiBytes($content, BitArray $bits) - { - if (strlen($content) % 2 > 0) { - // We just do a simple length check here. The for loop will check - // individual characters. - throw new Exception\WriterException('Content does not seem to be encoded in SHIFT-JIS'); - } - - $length = strlen($content); - - for ($i = 0; $i < $length; $i += 2) { - $byte1 = ord($content[$i]) & 0xff; - $byte2 = ord($content[$i + 1]) & 0xff; - $code = ($byte1 << 8) | $byte2; - - if ($code >= 0x8140 && $code <= 0x9ffc) { - $subtracted = $code - 0x8140; - } elseif ($code >= 0xe040 && $code <= 0xebbf) { - $subtracted = $code - 0xc140; - } else { - throw new Exception\WriterException('Invalid byte sequence'); - } - - $encoded = (($subtracted >> 8) * 0xc0) + ($subtracted & 0xff); - - $bits->appendBits($encoded, 13); - } - } - - /** - * Appends ECI information to a bit array. - * - * @param CharacterSetEci $eci - * @param BitArray $bits - * @return void - */ - protected static function appendEci(CharacterSetEci $eci, BitArray $bits) - { - $mode = new Mode(Mode::ECI); - $bits->appendBits($mode->get(), 4); - $bits->appendBits($eci->get(), 8); - } -} diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Encoder/MaskUtil.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Encoder/MaskUtil.php deleted file mode 100644 index c294d557..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Encoder/MaskUtil.php +++ /dev/null @@ -1,291 +0,0 @@ -getArray(); - $width = $matrix->getWidth(); - $height = $matrix->getHeight(); - - for ($y = 0; $y < $height - 1; $y++) { - for ($x = 0; $x < $width - 1; $x++) { - $value = $array[$y][$x]; - - if ($value === $array[$y][$x + 1] && $value === $array[$y + 1][$x] && $value === $array[$y + 1][$x + 1]) { - $penalty++; - } - } - } - - return self::N2 * $penalty; - } - - /** - * Applies mask penalty rule 3 and returns the penalty. - * - * Finds consecutive cells of 00001011101 or 10111010000, and gives penalty - * to them. If we find patterns like 000010111010000, we give penalties - * twice (i.e. 40 * 2). - * - * @param ByteMatrix $matrix - * @return integer - */ - public static function applyMaskPenaltyRule3(ByteMatrix $matrix) - { - $penalty = 0; - $array = $matrix->getArray(); - $width = $matrix->getWidth(); - $height = $matrix->getHeight(); - - for ($y = 0; $y < $height; $y++) { - for ($x = 0; $x < $width; $x++) { - if ( - $x + 6 < $width - && $array[$y][$x] === 1 - && $array[$y][$x + 1] === 0 - && $array[$y][$x + 2] === 1 - && $array[$y][$x + 3] === 1 - && $array[$y][$x + 4] === 1 - && $array[$y][$x + 5] === 0 - && $array[$y][$x + 6] === 1 - && ( - ( - $x + 10 < $width - && $array[$y][$x + 7] === 0 - && $array[$y][$x + 8] === 0 - && $array[$y][$x + 9] === 0 - && $array[$y][$x + 10] === 0 - ) - || ( - $x - 4 >= 0 - && $array[$y][$x - 1] === 0 - && $array[$y][$x - 2] === 0 - && $array[$y][$x - 3] === 0 - && $array[$y][$x - 4] === 0 - ) - ) - ) { - $penalty += self::N3; - } - - if ( - $y + 6 < $height - && $array[$y][$x] === 1 - && $array[$y + 1][$x] === 0 - && $array[$y + 2][$x] === 1 - && $array[$y + 3][$x] === 1 - && $array[$y + 4][$x] === 1 - && $array[$y + 5][$x] === 0 - && $array[$y + 6][$x] === 1 - && ( - ( - $y + 10 < $height - && $array[$y + 7][$x] === 0 - && $array[$y + 8][$x] === 0 - && $array[$y + 9][$x] === 0 - && $array[$y + 10][$x] === 0 - ) - || ( - $y - 4 >= 0 - && $array[$y - 1][$x] === 0 - && $array[$y - 2][$x] === 0 - && $array[$y - 3][$x] === 0 - && $array[$y - 4][$x] === 0 - ) - ) - ) { - $penalty += self::N3; - } - } - } - - return $penalty; - } - - /** - * Applies mask penalty rule 4 and returns the penalty. - * - * Calculates the ratio of dark cells and gives penalty if the ratio is far - * from 50%. It gives 10 penalty for 5% distance. - * - * @param ByteMatrix $matrix - * @return integer - */ - public static function applyMaskPenaltyRule4(ByteMatrix $matrix) - { - $numDarkCells = 0; - - $array = $matrix->getArray(); - $width = $matrix->getWidth(); - $height = $matrix->getHeight(); - - for ($y = 0; $y < $height; $y++) { - $arrayY = $array[$y]; - - for ($x = 0; $x < $width; $x++) { - if ($arrayY[$x] === 1) { - $numDarkCells++; - } - } - } - - $numTotalCells = $height * $width; - $darkRatio = $numDarkCells / $numTotalCells; - $fixedPercentVariances = (int) (abs($darkRatio - 0.5) * 20); - - return $fixedPercentVariances * self::N4; - } - - /** - * Returns the mask bit for "getMaskPattern" at "x" and "y". - * - * See 8.8 of JISX0510:2004 for mask pattern conditions. - * - * @param integer $maskPattern - * @param integer $x - * @param integer $y - * @return integer - * @throws Exception\InvalidArgumentException - */ - public static function getDataMaskBit($maskPattern, $x, $y) - { - switch ($maskPattern) { - case 0: - $intermediate = ($y + $x) & 0x1; - break; - - case 1: - $intermediate = $y & 0x1; - break; - - case 2: - $intermediate = $x % 3; - break; - - case 3: - $intermediate = ($y + $x) % 3; - break; - - case 4: - $intermediate = (BitUtils::unsignedRightShift($y, 1) + ($x / 3)) & 0x1; - break; - - case 5: - $temp = $y * $x; - $intermediate = ($temp & 0x1) + ($temp % 3); - break; - - case 6: - $temp = $y * $x; - $intermediate = (($temp & 0x1) + ($temp % 3)) & 0x1; - break; - - case 7: - $temp = $y * $x; - $intermediate = (($temp % 3) + (($y + $x) & 0x1)) & 0x1; - break; - - default: - throw new Exception\InvalidArgumentException('Invalid mask pattern: ' . $maskPattern); - } - - return $intermediate === 0; - } - - /** - * Helper function for applyMaskPenaltyRule1. - * - * We need this for doing this calculation in both vertical and horizontal - * orders respectively. - * - * @param ByteMatrix $matrix - * @param boolean $isHorizontal - * @return integer - */ - protected static function applyMaskPenaltyRule1Internal(ByteMatrix $matrix, $isHorizontal) - { - $penalty = 0; - $iLimit = $isHorizontal ? $matrix->getHeight() : $matrix->getWidth(); - $jLimit = $isHorizontal ? $matrix->getWidth() : $matrix->getHeight(); - $array = $matrix->getArray(); - - for ($i = 0; $i < $iLimit; $i++) { - $numSameBitCells = 0; - $prevBit = -1; - - for ($j = 0; $j < $jLimit; $j++) { - $bit = $isHorizontal ? $array[$i][$j] : $array[$j][$i]; - - if ($bit === $prevBit) { - $numSameBitCells++; - } else { - if ($numSameBitCells >= 5) { - $penalty += self::N1 + ($numSameBitCells - 5); - } - - $numSameBitCells = 1; - $prevBit = $bit; - } - } - - if ($numSameBitCells >= 5) { - $penalty += self::N1 + ($numSameBitCells - 5); - } - } - - return $penalty; - } -} diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Encoder/MatrixUtil.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Encoder/MatrixUtil.php deleted file mode 100644 index 83273818..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Encoder/MatrixUtil.php +++ /dev/null @@ -1,580 +0,0 @@ -clear(-1); - } - - /** - * Builds a complete matrix. - * - * @param BitArray $dataBits - * @param ErrorCorrectionLevel $level - * @param Version $version - * @param integer $maskPattern - * @param ByteMatrix $matrix - * @return void - */ - public static function buildMatrix( - BitArray $dataBits, - ErrorCorrectionLevel $level, - Version $version, - $maskPattern, - ByteMatrix $matrix - ) { - self::clearMatrix($matrix); - self::embedBasicPatterns($version, $matrix); - self::embedTypeInfo($level, $maskPattern, $matrix); - self::maybeEmbedVersionInfo($version, $matrix); - self::embedDataBits($dataBits, $maskPattern, $matrix); - } - - /** - * Embeds type information into a matrix. - * - * @param ErrorCorrectionLevel $level - * @param integer $maskPattern - * @param ByteMatrix $matrix - * @return void - */ - protected static function embedTypeInfo(ErrorCorrectionLevel $level, $maskPattern, ByteMatrix $matrix) - { - $typeInfoBits = new BitArray(); - self::makeTypeInfoBits($level, $maskPattern, $typeInfoBits); - - $typeInfoBitsSize = $typeInfoBits->getSize(); - - for ($i = 0; $i < $typeInfoBitsSize; $i++) { - $bit = $typeInfoBits->get($typeInfoBitsSize - 1 - $i); - - $x1 = self::$typeInfoCoordinates[$i][0]; - $y1 = self::$typeInfoCoordinates[$i][1]; - - $matrix->set($x1, $y1, $bit); - - if ($i < 8) { - $x2 = $matrix->getWidth() - $i - 1; - $y2 = 8; - } else { - $x2 = 8; - $y2 = $matrix->getHeight() - 7 + ($i - 8); - } - - $matrix->set($x2, $y2, $bit); - } - } - - /** - * Generates type information bits and appends them to a bit array. - * - * @param ErrorCorrectionLevel $level - * @param integer $maskPattern - * @param BitArray $bits - * @return void - * @throws Exception\RuntimeException - */ - protected static function makeTypeInfoBits(ErrorCorrectionLevel $level, $maskPattern, BitArray $bits) - { - $typeInfo = ($level->get() << 3) | $maskPattern; - $bits->appendBits($typeInfo, 5); - - $bchCode = self::calculateBchCode($typeInfo, self::$typeInfoPoly); - $bits->appendBits($bchCode, 10); - - $maskBits = new BitArray(); - $maskBits->appendBits(self::$typeInfoMaskPattern, 15); - $bits->xorBits($maskBits); - - if ($bits->getSize() !== 15) { - throw new Exception\RuntimeException('Bit array resulted in invalid size: ' . $bits->getSize()); - } - } - - /** - * Embeds version information if required. - * - * @param Version $version - * @param ByteMatrix $matrix - * @return void - */ - protected static function maybeEmbedVersionInfo(Version $version, ByteMatrix $matrix) - { - if ($version->getVersionNumber() < 7) { - return; - } - - $versionInfoBits = new BitArray(); - self::makeVersionInfoBits($version, $versionInfoBits); - - $bitIndex = 6 * 3 - 1; - - for ($i = 0; $i < 6; $i++) { - for ($j = 0; $j < 3; $j++) { - $bit = $versionInfoBits->get($bitIndex); - $bitIndex--; - - $matrix->set($i, $matrix->getHeight() - 11 + $j, $bit); - $matrix->set($matrix->getHeight() - 11 + $j, $i, $bit); - } - } - } - - /** - * Generates version information bits and appends them to a bit array. - * - * @param Version $version - * @param BitArray $bits - * @return void - * @throws Exception\RuntimeException - */ - protected static function makeVersionInfoBits(Version $version, BitArray $bits) - { - $bits->appendBits($version->getVersionNumber(), 6); - - $bchCode = self::calculateBchCode($version->getVersionNumber(), self::$versionInfoPoly); - $bits->appendBits($bchCode, 12); - - if ($bits->getSize() !== 18) { - throw new Exception\RuntimeException('Bit array resulted in invalid size: ' . $bits->getSize()); - } - } - - /** - * Calculates the BHC code for a value and a polynomial. - * - * @param integer $value - * @param integer $poly - * @return integer - */ - protected static function calculateBchCode($value, $poly) - { - $msbSetInPoly = self::findMsbSet($poly); - $value <<= $msbSetInPoly - 1; - - while (self::findMsbSet($value) >= $msbSetInPoly) { - $value ^= $poly << (self::findMsbSet($value) - $msbSetInPoly); - } - - return $value; - } - - /** - * Finds and MSB set. - * - * @param integer $value - * @return integer - */ - protected static function findMsbSet($value) - { - $numDigits = 0; - - while ($value !== 0) { - $value >>= 1; - $numDigits++; - } - - return $numDigits; - } - - /** - * Embeds basic patterns into a matrix. - * - * @param Version $version - * @param ByteMatrix $matrix - * @return void - */ - protected static function embedBasicPatterns(Version $version, ByteMatrix $matrix) - { - self::embedPositionDetectionPatternsAndSeparators($matrix); - self::embedDarkDotAtLeftBottomCorner($matrix); - self::maybeEmbedPositionAdjustmentPatterns($version, $matrix); - self::embedTimingPatterns($matrix); - } - - /** - * Embeds position detection patterns and separators into a byte matrix. - * - * @param ByteMatrix $matrix - * @return void - */ - protected static function embedPositionDetectionPatternsAndSeparators(ByteMatrix $matrix) - { - $pdpWidth = count(self::$positionDetectionPattern[0]); - - self::embedPositionDetectionPattern(0, 0, $matrix); - self::embedPositionDetectionPattern($matrix->getWidth() - $pdpWidth, 0, $matrix); - self::embedPositionDetectionPattern(0, $matrix->getWidth() - $pdpWidth, $matrix); - - $hspWidth = 8; - - self::embedHorizontalSeparationPattern(0, $hspWidth - 1, $matrix); - self::embedHorizontalSeparationPattern($matrix->getWidth() - $hspWidth, $hspWidth - 1, $matrix); - self::embedHorizontalSeparationPattern(0, $matrix->getWidth() - $hspWidth, $matrix); - - $vspSize = 7; - - self::embedVerticalSeparationPattern($vspSize, 0, $matrix); - self::embedVerticalSeparationPattern($matrix->getHeight() - $vspSize - 1, 0, $matrix); - self::embedVerticalSeparationPattern($vspSize, $matrix->getHeight() - $vspSize, $matrix); - } - - /** - * Embeds a single position detection pattern into a byte matrix. - * - * @param integer $xStart - * @param integer $yStart - * @param ByteMatrix $matrix - * @return void - */ - protected static function embedPositionDetectionPattern($xStart, $yStart, ByteMatrix $matrix) - { - for ($y = 0; $y < 7; $y++) { - for ($x = 0; $x < 7; $x++) { - $matrix->set($xStart + $x, $yStart + $y, self::$positionDetectionPattern[$y][$x]); - } - } - } - - /** - * Embeds a single horizontal separation pattern. - * - * @param integer $xStart - * @param integer $yStart - * @param ByteMatrix $matrix - * @return void - * @throws Exception\RuntimeException - */ - protected static function embedHorizontalSeparationPattern($xStart, $yStart, ByteMatrix $matrix) - { - for ($x = 0; $x < 8; $x++) { - if ($matrix->get($xStart + $x, $yStart) !== -1) { - throw new Exception\RuntimeException('Byte already set'); - } - - $matrix->set($xStart + $x, $yStart, 0); - } - } - - /** - * Embeds a single vertical separation pattern. - * - * @param integer $xStart - * @param integer $yStart - * @param ByteMatrix $matrix - * @return void - * @throws Exception\RuntimeException - */ - protected static function embedVerticalSeparationPattern($xStart, $yStart, ByteMatrix $matrix) - { - for ($y = 0; $y < 7; $y++) { - if ($matrix->get($xStart, $yStart + $y) !== -1) { - throw new Exception\RuntimeException('Byte already set'); - } - - $matrix->set($xStart, $yStart + $y, 0); - } - } - - /** - * Embeds a dot at the left bottom corner. - * - * @param ByteMatrix $matrix - * @return void - * @throws Exception\RuntimeException - */ - protected static function embedDarkDotAtLeftBottomCorner(ByteMatrix $matrix) - { - if ($matrix->get(8, $matrix->getHeight() - 8) === 0) { - throw new Exception\RuntimeException('Byte already set to 0'); - } - - $matrix->set(8, $matrix->getHeight() - 8, 1); - } - - /** - * Embeds position adjustment patterns if required. - * - * @param Version $version - * @param ByteMatrix $matrix - * @return void - */ - protected static function maybeEmbedPositionAdjustmentPatterns(Version $version, ByteMatrix $matrix) - { - if ($version->getVersionNumber() < 2) { - return; - } - - $index = $version->getVersionNumber() - 1; - - $coordinates = self::$positionAdjustmentPatternCoordinateTable[$index]; - $numCoordinates = count($coordinates); - - for ($i = 0; $i < $numCoordinates; $i++) { - for ($j = 0; $j < $numCoordinates; $j++) { - $y = $coordinates[$i]; - $x = $coordinates[$j]; - - if ($x === null || $y === null) { - continue; - } - - if ($matrix->get($x, $y) === -1) { - self::embedPositionAdjustmentPattern($x - 2, $y - 2, $matrix); - } - } - } - } - - /** - * Embeds a single position adjustment pattern. - * - * @param integer $xStart - * @param intger $yStart - * @param ByteMatrix $matrix - * @return void - */ - protected static function embedPositionAdjustmentPattern($xStart, $yStart, ByteMatrix $matrix) - { - for ($y = 0; $y < 5; $y++) { - for ($x = 0; $x < 5; $x++) { - $matrix->set($xStart + $x, $yStart + $y, self::$positionAdjustmentPattern[$y][$x]); - } - } - } - - /** - * Embeds timing patterns into a matrix. - * - * @param ByteMatrix $matrix - * @return void - */ - protected static function embedTimingPatterns(ByteMatrix $matrix) - { - $matrixWidth = $matrix->getWidth(); - - for ($i = 8; $i < $matrixWidth - 8; $i++) { - $bit = ($i + 1) % 2; - - if ($matrix->get($i, 6) === -1) { - $matrix->set($i, 6, $bit); - } - - if ($matrix->get(6, $i) === -1) { - $matrix->set(6, $i, $bit); - } - } - } - - /** - * Embeds "dataBits" using "getMaskPattern". - * - * For debugging purposes, it skips masking process if "getMaskPattern" is - * -1. See 8.7 of JISX0510:2004 (p.38) for how to embed data bits. - * - * @param BitArray $dataBits - * @param integer $maskPattern - * @param ByteMatrix $matrix - * @return void - * @throws Exception\WriterException - */ - protected static function embedDataBits(BitArray $dataBits, $maskPattern, ByteMatrix $matrix) - { - $bitIndex = 0; - $direction = -1; - - // Start from the right bottom cell. - $x = $matrix->getWidth() - 1; - $y = $matrix->getHeight() - 1; - - while ($x > 0) { - // Skip vertical timing pattern. - if ($x === 6) { - $x--; - } - - while ($y >= 0 && $y < $matrix->getHeight()) { - for ($i = 0; $i < 2; $i++) { - $xx = $x - $i; - - // Skip the cell if it's not empty. - if ($matrix->get($xx, $y) !== -1) { - continue; - } - - if ($bitIndex < $dataBits->getSize()) { - $bit = $dataBits->get($bitIndex); - $bitIndex++; - } else { - // Padding bit. If there is no bit left, we'll fill the - // left cells with 0, as described in 8.4.9 of - // JISX0510:2004 (p. 24). - $bit = false; - } - - // Skip masking if maskPattern is -1. - if ($maskPattern !== -1 && MaskUtil::getDataMaskBit($maskPattern, $xx, $y)) { - $bit = !$bit; - } - - $matrix->set($xx, $y, $bit); - } - - $y += $direction; - } - - $direction = -$direction; - $y += $direction; - $x -= 2; - } - - // All bits should be consumed - if ($bitIndex !== $dataBits->getSize()) { - throw new Exception\WriterException('Not all bits consumed (' . $bitIndex . ' out of ' . $dataBits->getSize() .')'); - } - } -} diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Encoder/QrCode.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Encoder/QrCode.php deleted file mode 100644 index 07e1c385..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Encoder/QrCode.php +++ /dev/null @@ -1,201 +0,0 @@ -mode; - } - - /** - * Sets the mode. - * - * @param Mode $mode - * @return void - */ - public function setMode(Mode $mode) - { - $this->mode = $mode; - } - - /** - * Gets the EC level. - * - * @return ErrorCorrectionLevel - */ - public function getErrorCorrectionLevel() - { - return $this->errorCorrectionLevel; - } - - /** - * Sets the EC level. - * - * @param ErrorCorrectionLevel $errorCorrectionLevel - * @return void - */ - public function setErrorCorrectionLevel(ErrorCorrectionLevel $errorCorrectionLevel) - { - $this->errorCorrectionLevel = $errorCorrectionLevel; - } - - /** - * Gets the version. - * - * @return Version - */ - public function getVersion() - { - return $this->version; - } - - /** - * Sets the version. - * - * @param Version $version - * @return void - */ - public function setVersion(Version $version) - { - $this->version = $version; - } - - /** - * Gets the mask pattern. - * - * @return integer - */ - public function getMaskPattern() - { - return $this->maskPattern; - } - - /** - * Sets the mask pattern. - * - * @param integer $maskPattern - * @return void - */ - public function setMaskPattern($maskPattern) - { - $this->maskPattern = $maskPattern; - } - - /** - * Gets the matrix. - * - * @return ByteMatrix - */ - public function getMatrix() - { - return $this->matrix; - } - - /** - * Sets the matrix. - * - * @param ByteMatrix $matrix - * @return void - */ - public function setMatrix(ByteMatrix $matrix) - { - $this->matrix = $matrix; - } - - /** - * Validates whether a mask pattern is valid. - * - * @param integer $maskPattern - * @return boolean - */ - public static function isValidMaskPattern($maskPattern) - { - return $maskPattern > 0 && $maskPattern < self::NUM_MASK_PATTERNS; - } - - /** - * Returns a string representation of the QR code. - * - * @return string - */ - public function __toString() - { - $result = "<<\n" - . " mode: " . $this->mode . "\n" - . " ecLevel: " . $this->errorCorrectionLevel . "\n" - . " version: " . $this->version . "\n" - . " maskPattern: " . $this->maskPattern . "\n"; - - if ($this->matrix === null) { - $result .= " matrix: null\n"; - } else { - $result .= " matrix:\n"; - $result .= $this->matrix; - } - - $result .= ">>\n"; - - return $result; - } -} diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Exception/ExceptionInterface.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Exception/ExceptionInterface.php deleted file mode 100644 index 5c58fc51..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Exception/ExceptionInterface.php +++ /dev/null @@ -1,14 +0,0 @@ - 100) { - throw new Exception\InvalidArgumentException('Cyan must be between 0 and 100'); - } - - if ($magenta < 0 || $magenta > 100) { - throw new Exception\InvalidArgumentException('Magenta must be between 0 and 100'); - } - - if ($yellow < 0 || $yellow > 100) { - throw new Exception\InvalidArgumentException('Yellow must be between 0 and 100'); - } - - if ($black < 0 || $black > 100) { - throw new Exception\InvalidArgumentException('Black must be between 0 and 100'); - } - - $this->cyan = (int) $cyan; - $this->magenta = (int) $magenta; - $this->yellow = (int) $yellow; - $this->black = (int) $black; - } - - /** - * Returns the cyan value. - * - * @return integer - */ - public function getCyan() - { - return $this->cyan; - } - - /** - * Returns the magenta value. - * - * @return integer - */ - public function getMagenta() - { - return $this->magenta; - } - - /** - * Returns the yellow value. - * - * @return integer - */ - public function getYellow() - { - return $this->yellow; - } - - /** - * Returns the black value. - * - * @return integer - */ - public function getBlack() - { - return $this->black; - } - - /** - * toRgb(): defined by ColorInterface. - * - * @see ColorInterface::toRgb() - * @return Rgb - */ - public function toRgb() - { - $k = $this->black / 100; - $c = (-$k * $this->cyan + $k * 100 + $this->cyan) / 100; - $m = (-$k * $this->magenta + $k * 100 + $this->magenta) / 100; - $y = (-$k * $this->yellow + $k * 100 + $this->yellow) / 100; - - return new Rgb( - -$c * 255 + 255, - -$m * 255 + 255, - -$y * 255 + 255 - ); - } - - /** - * toCmyk(): defined by ColorInterface. - * - * @see ColorInterface::toCmyk() - * @return Cmyk - */ - public function toCmyk() - { - return $this; - } - - /** - * toGray(): defined by ColorInterface. - * - * @see ColorInterface::toGray() - * @return Gray - */ - public function toGray() - { - return $this->toRgb()->toGray(); - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/Color/ColorInterface.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/Color/ColorInterface.php deleted file mode 100644 index 747accc1..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/Color/ColorInterface.php +++ /dev/null @@ -1,37 +0,0 @@ - 100) { - throw new Exception\InvalidArgumentException('Gray must be between 0 and 100'); - } - - $this->gray = (int) $gray; - } - - /** - * Returns the gray value. - * - * @return integer - */ - public function getGray() - { - return $this->gray; - } - - /** - * toRgb(): defined by ColorInterface. - * - * @see ColorInterface::toRgb() - * @return Rgb - */ - public function toRgb() - { - return new Rgb($this->gray * 2.55, $this->gray * 2.55, $this->gray * 2.55); - } - - /** - * toCmyk(): defined by ColorInterface. - * - * @see ColorInterface::toCmyk() - * @return Cmyk - */ - public function toCmyk() - { - return new Cmyk(0, 0, 0, 100 - $this->gray); - } - - /** - * toGray(): defined by ColorInterface. - * - * @see ColorInterface::toGray() - * @return Gray - */ - public function toGray() - { - return $this; - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/Color/Rgb.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/Color/Rgb.php deleted file mode 100644 index 44e4060c..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/Color/Rgb.php +++ /dev/null @@ -1,148 +0,0 @@ - 255) { - throw new Exception\InvalidArgumentException('Red must be between 0 and 255'); - } - - if ($green < 0 || $green > 255) { - throw new Exception\InvalidArgumentException('Green must be between 0 and 255'); - } - - if ($blue < 0 || $blue > 255) { - throw new Exception\InvalidArgumentException('Blue must be between 0 and 255'); - } - - $this->red = (int) $red; - $this->green = (int) $green; - $this->blue = (int) $blue; - } - - /** - * Returns the red value. - * - * @return integer - */ - public function getRed() - { - return $this->red; - } - - /** - * Returns the green value. - * - * @return integer - */ - public function getGreen() - { - return $this->green; - } - - /** - * Returns the blue value. - * - * @return integer - */ - public function getBlue() - { - return $this->blue; - } - - /** - * Returns a hexadecimal string representation of the RGB value. - * - * @return string - */ - public function __toString() - { - return sprintf('%02x%02x%02x', $this->red, $this->green, $this->blue); - } - - /** - * toRgb(): defined by ColorInterface. - * - * @see ColorInterface::toRgb() - * @return Rgb - */ - public function toRgb() - { - return $this; - } - - /** - * toCmyk(): defined by ColorInterface. - * - * @see ColorInterface::toCmyk() - * @return Cmyk - */ - public function toCmyk() - { - $c = 1 - ($this->red / 255); - $m = 1 - ($this->green / 255); - $y = 1 - ($this->blue / 255); - $k = min($c, $m, $y); - - return new Cmyk( - 100 * ($c - $k) / (1 - $k), - 100 * ($m - $k) / (1 - $k), - 100 * ($y - $k) / (1 - $k), - 100 * $k - ); - } - - /** - * toGray(): defined by ColorInterface. - * - * @see ColorInterface::toGray() - * @return Gray - */ - public function toGray() - { - return new Gray(($this->red * 0.21 + $this->green * 0.71 + $this->blue * 0.07) / 2.55); - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/Image/AbstractRenderer.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/Image/AbstractRenderer.php deleted file mode 100644 index b0bb02ac..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/Image/AbstractRenderer.php +++ /dev/null @@ -1,338 +0,0 @@ -margin = (int) $margin; - return $this; - } - - /** - * Gets the margin around the QR code. - * - * @return integer - */ - public function getMargin() - { - return $this->margin; - } - - /** - * Sets the height around the renderd image. - * - * If the width is smaller than the matrix width plus padding, the renderer - * will automatically use that as the width instead of the specified one. - * - * @param integer $width - * @return AbstractRenderer - */ - public function setWidth($width) - { - $this->width = (int) $width; - return $this; - } - - /** - * Gets the width of the rendered image. - * - * @return integer - */ - public function getWidth() - { - return $this->width; - } - - /** - * Sets the height around the renderd image. - * - * If the height is smaller than the matrix height plus padding, the - * renderer will automatically use that as the height instead of the - * specified one. - * - * @param integer $height - * @return AbstractRenderer - */ - public function setHeight($height) - { - $this->height = (int) $height; - return $this; - } - - /** - * Gets the height around the rendered image. - * - * @return integer - */ - public function getHeight() - { - return $this->height; - } - - /** - * Sets whether dimensions should be rounded down. - * - * @param boolean $flag - * @return AbstractRenderer - */ - public function setRoundDimensions($flag) - { - $this->floorToClosestDimension = $flag; - return $this; - } - - /** - * Gets whether dimensions should be rounded down. - * - * @return boolean - */ - public function shouldRoundDimensions() - { - return $this->floorToClosestDimension; - } - - /** - * Sets background color. - * - * @param Color\ColorInterface $color - * @return AbstractRenderer - */ - public function setBackgroundColor(Color\ColorInterface $color) - { - $this->backgroundColor = $color; - return $this; - } - - /** - * Gets background color. - * - * @return Color\ColorInterface - */ - public function getBackgroundColor() - { - if ($this->backgroundColor === null) { - $this->backgroundColor = new Color\Gray(100); - } - - return $this->backgroundColor; - } - - /** - * Sets foreground color. - * - * @param Color\ColorInterface $color - * @return AbstractRenderer - */ - public function setForegroundColor(Color\ColorInterface $color) - { - $this->foregroundColor = $color; - return $this; - } - - /** - * Gets foreground color. - * - * @return Color\ColorInterface - */ - public function getForegroundColor() - { - if ($this->foregroundColor === null) { - $this->foregroundColor = new Color\Gray(0); - } - - return $this->foregroundColor; - } - - /** - * Adds a decorator to the renderer. - * - * @param DecoratorInterface $decorator - * @return AbstractRenderer - */ - public function addDecorator(DecoratorInterface $decorator) - { - $this->decorators[] = $decorator; - return $this; - } - - /** - * render(): defined by RendererInterface. - * - * @see RendererInterface::render() - * @param QrCode $qrCode - * @return string - */ - public function render(QrCode $qrCode) - { - $input = $qrCode->getMatrix(); - $inputWidth = $input->getWidth(); - $inputHeight = $input->getHeight(); - $qrWidth = $inputWidth + ($this->getMargin() << 1); - $qrHeight = $inputHeight + ($this->getMargin() << 1); - $outputWidth = max($this->getWidth(), $qrWidth); - $outputHeight = max($this->getHeight(), $qrHeight); - $multiple = (int) min($outputWidth / $qrWidth, $outputHeight / $qrHeight); - - if ($this->shouldRoundDimensions()) { - $outputWidth -= $outputWidth % $multiple; - $outputHeight -= $outputHeight % $multiple; - } - - // Padding includes both the quiet zone and the extra white pixels to - // accommodate the requested dimensions. For example, if input is 25x25 - // the QR will be 33x33 including the quiet zone. If the requested size - // is 200x160, the multiple will be 4, for a QR of 132x132. These will - // handle all the padding from 100x100 (the actual QR) up to 200x160. - $leftPadding = (int) (($outputWidth - ($inputWidth * $multiple)) / 2); - $topPadding = (int) (($outputHeight - ($inputHeight * $multiple)) / 2); - - // Store calculated parameters - $this->finalWidth = $outputWidth; - $this->finalHeight = $outputHeight; - $this->blockSize = $multiple; - - $this->init(); - $this->addColor('background', $this->getBackgroundColor()); - $this->addColor('foreground', $this->getForegroundColor()); - $this->drawBackground('background'); - - foreach ($this->decorators as $decorator) { - $decorator->preProcess( - $qrCode, - $this, - $outputWidth, - $outputHeight, - $leftPadding, - $topPadding, - $multiple - ); - } - - for ($inputY = 0, $outputY = $topPadding; $inputY < $inputHeight; $inputY++, $outputY += $multiple) { - for ($inputX = 0, $outputX = $leftPadding; $inputX < $inputWidth; $inputX++, $outputX += $multiple) { - if ($input->get($inputX, $inputY) === 1) { - $this->drawBlock($outputX, $outputY, 'foreground'); - } - } - } - - foreach ($this->decorators as $decorator) { - $decorator->postProcess( - $qrCode, - $this, - $outputWidth, - $outputHeight, - $leftPadding, - $topPadding, - $multiple - ); - } - - return $this->getByteStream(); - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/Image/Decorator/DecoratorInterface.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/Image/Decorator/DecoratorInterface.php deleted file mode 100644 index e67268b5..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/Image/Decorator/DecoratorInterface.php +++ /dev/null @@ -1,63 +0,0 @@ -outerColor = $color; - return $this; - } - - /** - * Gets outer color. - * - * @return Color\ColorInterface - */ - public function getOuterColor() - { - if ($this->outerColor === null) { - $this->outerColor = new Color\Gray(100); - } - - return $this->outerColor; - } - - /** - * Sets inner color. - * - * @param Color\ColorInterface $color - * @return FinderPattern - */ - public function setInnerColor(Color\ColorInterface $color) - { - $this->innerColor = $color; - return $this; - } - - /** - * Gets inner color. - * - * @return Color\ColorInterface - */ - public function getInnerColor() - { - if ($this->innerColor === null) { - $this->innerColor = new Color\Gray(0); - } - - return $this->innerColor; - } - - /** - * preProcess(): defined by DecoratorInterface. - * - * @see DecoratorInterface::preProcess() - * @param QrCode $qrCode - * @param RendererInterface $renderer - * @param integer $outputWidth - * @param integer $outputHeight - * @param integer $leftPadding - * @param integer $topPadding - * @param integer $multiple - * @return void - */ - public function preProcess( - QrCode $qrCode, - RendererInterface $renderer, - $outputWidth, - $outputHeight, - $leftPadding, - $topPadding, - $multiple - ) { - $matrix = $qrCode->getMatrix(); - $positions = array( - array(0, 0), - array($matrix->getWidth() - 7, 0), - array(0, $matrix->getHeight() - 7), - ); - - foreach (self::$outerPositionDetectionPattern as $y => $row) { - foreach ($row as $x => $isSet) { - foreach ($positions as $position) { - $matrix->set($x + $position[0], $y + $position[1], 0); - } - } - } - } - - /** - * postProcess(): defined by DecoratorInterface. - * - * @see DecoratorInterface::postProcess() - * - * @param QrCode $qrCode - * @param RendererInterface $renderer - * @param integer $outputWidth - * @param integer $outputHeight - * @param integer $leftPadding - * @param integer $topPadding - * @param integer $multiple - * @return void - */ - public function postProcess( - QrCode $qrCode, - RendererInterface $renderer, - $outputWidth, - $outputHeight, - $leftPadding, - $topPadding, - $multiple - ) { - $matrix = $qrCode->getMatrix(); - $positions = array( - array(0, 0), - array($matrix->getWidth() - 7, 0), - array(0, $matrix->getHeight() - 7), - ); - - $renderer->addColor('finder-outer', $this->getOuterColor()); - $renderer->addColor('finder-inner', $this->getInnerColor()); - - foreach (self::$outerPositionDetectionPattern as $y => $row) { - foreach ($row as $x => $isOuterSet) { - $isInnerSet = self::$innerPositionDetectionPattern[$y][$x]; - - if ($isOuterSet) { - foreach ($positions as $position) { - $renderer->drawBlock( - $leftPadding + $x * $multiple + $position[0] * $multiple, - $topPadding + $y * $multiple + $position[1] * $multiple, - 'finder-outer' - ); - } - } - - if ($isInnerSet) { - foreach ($positions as $position) { - $renderer->drawBlock( - $leftPadding + $x * $multiple + $position[0] * $multiple, - $topPadding + $y * $multiple + $position[1] * $multiple, - 'finder-inner' - ); - } - } - } - } - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/Image/Eps.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/Image/Eps.php deleted file mode 100644 index 97661951..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/Image/Eps.php +++ /dev/null @@ -1,152 +0,0 @@ -eps = "%!PS-Adobe-3.0 EPSF-3.0\n" - . "%%BoundingBox: 0 0 " . $this->finalWidth . " " . $this->finalHeight . "\n" - . "/F { rectfill } def\n"; - } - - /** - * addColor(): defined by RendererInterface. - * - * @see ImageRendererInterface::addColor() - * @param string $id - * @param ColorInterface $color - * @return void - */ - public function addColor($id, ColorInterface $color) - { - if ( - !$color instanceof Rgb - && !$color instanceof Cmyk - && !$color instanceof Gray - ) { - $color = $color->toCmyk(); - } - - $this->colors[$id] = $color; - } - - /** - * drawBackground(): defined by RendererInterface. - * - * @see ImageRendererInterface::drawBackground() - * @param string $colorId - * @return void - */ - public function drawBackground($colorId) - { - $this->setColor($colorId); - $this->eps .= "0 0 " . $this->finalWidth . " " . $this->finalHeight . " F\n"; - } - - /** - * drawBlock(): defined by RendererInterface. - * - * @see ImageRendererInterface::drawBlock() - * @param integer $x - * @param integer $y - * @param string $colorId - * @return void - */ - public function drawBlock($x, $y, $colorId) - { - $this->setColor($colorId); - $this->eps .= $x . " " . ($this->finalHeight - $y - $this->blockSize) . " " . $this->blockSize . " " . $this->blockSize . " F\n"; - } - - /** - * getByteStream(): defined by RendererInterface. - * - * @see ImageRendererInterface::getByteStream() - * @return string - */ - public function getByteStream() - { - return $this->eps; - } - - /** - * Sets color to use. - * - * @param string $colorId - * @return void - */ - protected function setColor($colorId) - { - if ($colorId !== $this->currentColor) { - $color = $this->colors[$colorId]; - - if ($color instanceof Rgb) { - $this->eps .= sprintf( - "%F %F %F setrgbcolor\n", - $color->getRed() / 100, - $color->getGreen() / 100, - $color->getBlue() / 100 - ); - } elseif ($color instanceof Cmyk) { - $this->eps .= sprintf( - "%F %F %F %F setcmykcolor\n", - $color->getCyan() / 100, - $color->getMagenta() / 100, - $color->getYellow() / 100, - $color->getBlack() / 100 - ); - } elseif ($color instanceof Gray) { - $this->eps .= sprintf( - "%F setgray\n", - $color->getGray() / 100 - ); - } - - $this->currentColor = $colorId; - } - } -} diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/Image/Png.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/Image/Png.php deleted file mode 100644 index dd593a8b..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/Image/Png.php +++ /dev/null @@ -1,115 +0,0 @@ -image = imagecreatetruecolor($this->finalWidth, $this->finalHeight); - } - - /** - * addColor(): defined by RendererInterface. - * - * @see ImageRendererInterface::addColor() - * @param string $id - * @param ColorInterface $color - * @return void - * @throws Exception\RuntimeException - */ - public function addColor($id, ColorInterface $color) - { - if ($this->image === null) { - throw new Exception\RuntimeException('Colors can only be added after init'); - } - - $color = $color->toRgb(); - - $this->colors[$id] = imagecolorallocate( - $this->image, - $color->getRed(), - $color->getGreen(), - $color->getBlue() - ); - } - - /** - * drawBackground(): defined by RendererInterface. - * - * @see ImageRendererInterface::drawBackground() - * @param string $colorId - * @return void - */ - public function drawBackground($colorId) - { - imagefill($this->image, 0, 0, $this->colors[$colorId]); - } - - /** - * drawBlock(): defined by RendererInterface. - * - * @see ImageRendererInterface::drawBlock() - * @param integer $x - * @param integer $y - * @param string $colorId - * @return void - */ - public function drawBlock($x, $y, $colorId) - { - imagefilledrectangle( - $this->image, - $x, - $y, - $x + $this->blockSize - 1, - $y + $this->blockSize - 1, - $this->colors[$colorId] - ); - } - - /** - * getByteStream(): defined by RendererInterface. - * - * @see ImageRendererInterface::getByteStream() - * @return string - */ - public function getByteStream() - { - ob_start(); - imagepng($this->image); - return ob_get_clean(); - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/Image/RendererInterface.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/Image/RendererInterface.php deleted file mode 100644 index 52101a65..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/Image/RendererInterface.php +++ /dev/null @@ -1,61 +0,0 @@ -svg = new SimpleXMLElement( - '' - . '' - ); - $this->svg->addAttribute('version', '1.1'); - $this->svg->addAttribute('width', $this->finalWidth . 'px'); - $this->svg->addAttribute('height', $this->finalHeight . 'px'); - $this->svg->addAttribute('viewBox', '0 0 ' . $this->finalWidth . ' ' . $this->finalHeight); - $this->svg->addChild('defs'); - } - - /** - * addColor(): defined by RendererInterface. - * - * @see ImageRendererInterface::addColor() - * @param string $id - * @param ColorInterface $color - * @return void - * @throws Exception\InvalidArgumentException - */ - public function addColor($id, ColorInterface $color) - { - $this->colors[$id] = (string) $color->toRgb(); - } - - /** - * drawBackground(): defined by RendererInterface. - * - * @see ImageRendererInterface::drawBackground() - * @param string $colorId - * @return void - */ - public function drawBackground($colorId) - { - $rect = $this->svg->addChild('rect'); - $rect->addAttribute('x', 0); - $rect->addAttribute('y', 0); - $rect->addAttribute('width', $this->finalWidth); - $rect->addAttribute('height', $this->finalHeight); - $rect->addAttribute('fill', '#' . $this->colors[$colorId]); - } - - /** - * drawBlock(): defined by RendererInterface. - * - * @see ImageRendererInterface::drawBlock() - * @param integer $x - * @param integer $y - * @param string $colorId - * @return void - */ - public function drawBlock($x, $y, $colorId) - { - $use = $this->svg->addChild('use'); - $use->addAttribute('x', $x); - $use->addAttribute('y', $y); - $use->addAttribute( - 'xlink:href', - $this->getRectPrototypeId($colorId), - 'http://www.w3.org/1999/xlink' - ); - } - - /** - * getByteStream(): defined by RendererInterface. - * - * @see ImageRendererInterface::getByteStream() - * @return string - */ - public function getByteStream() - { - return $this->svg->asXML(); - } - - /** - * Get the prototype ID for a color. - * - * @param integer $colorId - * @return string - */ - protected function getRectPrototypeId($colorId) - { - if (!isset($this->prototypeIds[$colorId])) { - $id = 'r' . dechex(count($this->prototypeIds)); - - $rect = $this->svg->defs->addChild('rect'); - $rect->addAttribute('id', $id); - $rect->addAttribute('width', $this->blockSize); - $rect->addAttribute('height', $this->blockSize); - $rect->addAttribute('fill', '#' . $this->colors[$colorId]); - - $this->prototypeIds[$colorId] = '#' . $id; - } - - return $this->prototypeIds[$colorId]; - } -} diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/RendererInterface.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/RendererInterface.php deleted file mode 100644 index 554e1d88..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/RendererInterface.php +++ /dev/null @@ -1,26 +0,0 @@ -class = $class; - } - - /** - * Get CSS class name. - * - * @return string - */ - public function getClass() - { - return $this->class; - } - - /** - * Set CSS style value. - * - * @param string $style - */ - public function setStyle($style) - { - $this->style = $style; - } - - /** - * Get CSS style value. - * - * @return string - */ - public function getStyle() - { - return $this->style; - } - - /** - * render(): defined by RendererInterface. - * - * @see RendererInterface::render() - * @param QrCode $qrCode - * @return string - */ - public function render(QrCode $qrCode) - { - $textCode = parent::render($qrCode); - - $result = '' . $textCode . ''; - - return $result; - } -} diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/Text/Plain.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/Text/Plain.php deleted file mode 100644 index a7e4cfb7..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Renderer/Text/Plain.php +++ /dev/null @@ -1,150 +0,0 @@ -fullBlock = $fullBlock; - } - - /** - * Get char used as full block (occupied space, "black"). - * - * @return string - */ - public function getFullBlock() - { - return $this->fullBlock; - } - - /** - * Set char used as empty block (empty space, "white"). - * - * @param string $emptyBlock - */ - public function setEmptyBlock($emptyBlock) - { - $this->emptyBlock = $emptyBlock; - } - - /** - * Get char used as empty block (empty space, "white"). - * - * @return string - */ - public function getEmptyBlock() - { - return $this->emptyBlock; - } - - /** - * Sets the margin around the QR code. - * - * @param integer $margin - * @return AbstractRenderer - * @throws Exception\InvalidArgumentException - */ - public function setMargin($margin) - { - if ($margin < 0) { - throw new Exception\InvalidArgumentException('Margin must be equal to greater than 0'); - } - - $this->margin = (int) $margin; - - return $this; - } - - /** - * Gets the margin around the QR code. - * - * @return integer - */ - public function getMargin() - { - return $this->margin; - } - - /** - * render(): defined by RendererInterface. - * - * @see RendererInterface::render() - * @param QrCode $qrCode - * @return string - */ - public function render(QrCode $qrCode) - { - $result = ''; - $matrix = $qrCode->getMatrix(); - $width = $matrix->getWidth(); - - // Top margin - for ($x = 0; $x < $this->margin; $x++) { - $result .= str_repeat($this->emptyBlock, $width + 2 * $this->margin)."\n"; - } - - // Body - $array = $matrix->getArray(); - - foreach ($array as $row) { - $result .= str_repeat($this->emptyBlock, $this->margin); // left margin - foreach ($row as $byte) { - $result .= $byte ? $this->fullBlock : $this->emptyBlock; - } - $result .= str_repeat($this->emptyBlock, $this->margin); // right margin - $result .= "\n"; - } - - // Bottom margin - for ($x = 0; $x < $this->margin; $x++) { - $result .= str_repeat($this->emptyBlock, $width + 2 * $this->margin)."\n"; - } - - return $result; - } -} diff --git a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Writer.php b/vendor/bacon/bacon-qr-code/src/BaconQrCode/Writer.php deleted file mode 100644 index 0f803138..00000000 --- a/vendor/bacon/bacon-qr-code/src/BaconQrCode/Writer.php +++ /dev/null @@ -1,105 +0,0 @@ -renderer = $renderer; - } - - /** - * Sets the renderer used to create a byte stream. - * - * @param RendererInterface $renderer - * @return Writer - */ - public function setRenderer(RendererInterface $renderer) - { - $this->renderer = $renderer; - return $this; - } - - /** - * Gets the renderer used to create a byte stream. - * - * @return RendererInterface - */ - public function getRenderer() - { - return $this->renderer; - } - - /** - * Writes QR code and returns it as string. - * - * Content is a string which *should* be encoded in UTF-8, in case there are - * non ASCII-characters present. - * - * @param string $content - * @param string $encoding - * @param integer $ecLevel - * @return string - * @throws Exception\InvalidArgumentException - */ - public function writeString( - $content, - $encoding = Encoder::DEFAULT_BYTE_MODE_ECODING, - $ecLevel = ErrorCorrectionLevel::L - ) { - if (strlen($content) === 0) { - throw new Exception\InvalidArgumentException('Found empty contents'); - } - - $qrCode = Encoder::encode($content, new ErrorCorrectionLevel($ecLevel), $encoding); - - return $this->getRenderer()->render($qrCode); - } - - /** - * Writes QR code to a file. - * - * @see Writer::writeString() - * @param string $content - * @param string $filename - * @param string $encoding - * @param integer $ecLevel - * @return void - */ - public function writeFile( - $content, - $filename, - $encoding = Encoder::DEFAULT_BYTE_MODE_ECODING, - $ecLevel = ErrorCorrectionLevel::L - ) { - file_put_contents($filename, $this->writeString($content, $encoding, $ecLevel)); - } -} diff --git a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/BitArrayTest.php b/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/BitArrayTest.php deleted file mode 100644 index 81bcbce6..00000000 --- a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/BitArrayTest.php +++ /dev/null @@ -1,201 +0,0 @@ -assertFalse($array->get($i)); - $array->set($i); - $this->assertTrue($array->get($i)); - } - } - - public function testGetNextSet1() - { - $array = new BitArray(32); - - for ($i = 0; $i < $array->getSize(); $i++) { - $this->assertEquals($i, 32, '', $array->getNextSet($i)); - } - - $array = new BitArray(33); - - for ($i = 0; $i < $array->getSize(); $i++) { - $this->assertEquals($i, 33, '', $array->getNextSet($i)); - } - } - - public function testGetNextSet2() - { - $array = new BitArray(33); - - for ($i = 0; $i < $array->getSize(); $i++) { - $this->assertEquals($i, $i <= 31 ? 31 : 33, '', $array->getNextSet($i)); - } - - $array = new BitArray(33); - - for ($i = 0; $i < $array->getSize(); $i++) { - $this->assertEquals($i, 32, '', $array->getNextSet($i)); - } - } - - public function testGetNextSet3() - { - $array = new BitArray(63); - $array->set(31); - $array->set(32); - - for ($i = 0; $i < $array->getSize(); $i++) { - if ($i <= 31) { - $expected = 31; - } elseif ($i <= 32) { - $expected = 32; - } else { - $expected = 63; - } - - $this->assertEquals($i, $expected, '', $array->getNextSet($i)); - } - } - - public function testGetNextSet4() - { - $array = new BitArray(63); - $array->set(33); - $array->set(40); - - for ($i = 0; $i < $array->getSize(); $i++) { - if ($i <= 33) { - $expected = 33; - } elseif ($i <= 40) { - $expected = 40; - } else { - $expected = 63; - } - - $this->assertEquals($i, $expected, '', $array->getNextSet($i)); - } - } - - public function testGetNextSet5() - { - if (defined('MT_RAND_PHP')) { - mt_srand(0xdeadbeef, MT_RAND_PHP); - } else { - mt_srand(0xdeadbeef); - } - - for ($i = 0; $i < 10; $i++) { - $array = new BitArray(mt_rand(1, 100)); - $numSet = mt_rand(0, 19); - - for ($j = 0; $j < $numSet; $j++) { - $array->set(mt_rand(0, $array->getSize() - 1)); - } - - $numQueries = mt_rand(0, 19); - - for ($j = 0; $j < $numQueries; $j++) { - $query = mt_rand(0, $array->getSize() - 1); - $expected = $query; - - while ($expected < $array->getSize() && !$array->get($expected)) { - $expected++; - } - - $actual = $array->getNextSet($query); - - if ($actual !== $expected) { - $array->getNextSet($query); - } - - $this->assertEquals($expected, $actual); - } - } - } - - public function testSetBulk() - { - $array = new BitArray(64); - $array->setBulk(32, 0xFFFF0000); - - for ($i = 0; $i < 48; $i++) { - $this->assertFalse($array->get($i)); - } - - for ($i = 48; $i < 64; $i++) { - $this->assertTrue($array->get($i)); - } - } - - public function testClear() - { - $array = new BitArray(32); - - for ($i = 0; $i < 32; $i++) { - $array->set($i); - } - - $array->clear(); - - for ($i = 0; $i < 32; $i++) { - $this->assertFalse($array->get($i)); - } - } - - public function testGetArray() - { - $array = new BitArray(64); - $array->set(0); - $array->set(63); - - $ints = $array->getBitArray(); - - $this->assertEquals(1, $ints[0]); - $this->assertEquals(0x80000000, $ints[1]); - } - - public function testIsRange() - { - $array = new BitArray(64); - $this->assertTrue($array->isRange(0, 64, false)); - $this->assertFalse($array->isRange(0, 64, true)); - - $array->set(32); - $this->assertTrue($array->isRange(32, 33, true)); - - $array->set(31); - $this->assertTrue($array->isRange(31, 33, true)); - - $array->set(34); - $this->assertFalse($array->isRange(31, 35, true)); - - for ($i = 0; $i < 31; $i++) { - $array->set($i); - } - - $this->assertTrue($array->isRange(0, 33, true)); - - for ($i = 33; $i < 64; $i++) { - $array->set($i); - } - - $this->assertTrue($array->isRange(0, 64, true)); - $this->assertFalse($array->isRange(0, 64, false)); - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/BitMatrixTest.php b/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/BitMatrixTest.php deleted file mode 100644 index 89a58812..00000000 --- a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/BitMatrixTest.php +++ /dev/null @@ -1,119 +0,0 @@ -assertEquals(33, $matrix->getHeight()); - - for ($y = 0; $y < 33; $y++) { - for ($x = 0; $x < 33; $x++) { - if ($y * $x % 3 === 0) { - $matrix->set($x, $y); - } - } - } - - for ($y = 0; $y < 33; $y++) { - for ($x = 0; $x < 33; $x++) { - $this->assertEquals($x * $y % 3 === 0, $matrix->get($x, $y)); - } - } - } - - public function testSetRegion() - { - $matrix = new BitMatrix(5); - $matrix->setRegion(1, 1, 3, 3); - - for ($y = 0; $y < 5; $y++) { - for ($x = 0; $x < 5; $x++) { - $this->assertEquals($y >= 1 && $y <= 3 && $x >= 1 && $x <= 3, $matrix->get($x, $y)); - } - } - } - - public function testRectangularMatrix() - { - $matrix = new BitMatrix(75, 20); - $this->assertEquals(75, $matrix->getWidth()); - $this->assertEquals(20, $matrix->getHeight()); - - $matrix->set(10, 0); - $matrix->set(11, 1); - $matrix->set(50, 2); - $matrix->set(51, 3); - $matrix->flip(74, 4); - $matrix->flip(0, 5); - - $this->assertTrue($matrix->get(10, 0)); - $this->assertTrue($matrix->get(11, 1)); - $this->assertTrue($matrix->get(50, 2)); - $this->assertTrue($matrix->get(51, 3)); - $this->assertTrue($matrix->get(74, 4)); - $this->assertTrue($matrix->get(0, 5)); - - $matrix->flip(50, 2); - $matrix->flip(51, 3); - - $this->assertFalse($matrix->get(50, 2)); - $this->assertFalse($matrix->get(51, 3)); - } - - public function testRectangularSetRegion() - { - $matrix = new BitMatrix(320, 240); - $this->assertEquals(320, $matrix->getWidth()); - $this->assertEquals(240, $matrix->getHeight()); - - $matrix->setRegion(105, 22, 80, 12); - - for ($y = 0; $y < 240; $y++) { - for ($x = 0; $x < 320; $x++) { - $this->assertEquals($y >= 22 && $y < 34 && $x >= 105 && $x < 185, $matrix->get($x, $y)); - } - } - } - - public function testGetRow() - { - $matrix = new BitMatrix(102, 5); - - for ($x = 0; $x < 102; $x++) { - if ($x & 3 === 0) { - $matrix->set($x, 2); - } - } - - $array1 = $matrix->getRow(2, null); - $this->assertEquals(102, $array1->getSize()); - - $array2 = new BitArray(60); - $array2 = $matrix->getRow(2, $array2); - $this->assertEquals(102, $array2->getSize()); - - $array3 = new BitArray(200); - $array3 = $matrix->getRow(2, $array3); - $this->assertEquals(200, $array3->getSize()); - - for ($x = 0; $x < 102; $x++) { - $on = ($x & 3 === 0); - - $this->assertEquals($on, $array1->get($x)); - $this->assertEquals($on, $array2->get($x)); - $this->assertEquals($on, $array3->get($x)); - } - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/BitUtilsTest.php b/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/BitUtilsTest.php deleted file mode 100644 index b80ff7df..00000000 --- a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/BitUtilsTest.php +++ /dev/null @@ -1,30 +0,0 @@ -assertEquals(1, BitUtils::unsignedRightShift(1, 0)); - $this->assertEquals(1, BitUtils::unsignedRightShift(10, 3)); - $this->assertEquals(536870910, BitUtils::unsignedRightShift(-10, 3)); - } - - public function testNumberOfTrailingZeros() - { - $this->assertEquals(32, BitUtils::numberOfTrailingZeros(0)); - $this->assertEquals(1, BitUtils::numberOfTrailingZeros(10)); - $this->assertEquals(0, BitUtils::numberOfTrailingZeros(15)); - $this->assertEquals(2, BitUtils::numberOfTrailingZeros(20)); - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/ErrorCorrectionLevelTest.php b/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/ErrorCorrectionLevelTest.php deleted file mode 100644 index 736e995d..00000000 --- a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/ErrorCorrectionLevelTest.php +++ /dev/null @@ -1,40 +0,0 @@ -assertEquals(0x0, ErrorCorrectionLevel::M); - $this->assertEquals(0x1, ErrorCorrectionLevel::L); - $this->assertEquals(0x2, ErrorCorrectionLevel::H); - $this->assertEquals(0x3, ErrorCorrectionLevel::Q); - } - - public function testInvalidErrorCorrectionLevelThrowsException() - { - $this->setExpectedException( - 'BaconQrCode\Exception\UnexpectedValueException', - 'Value not a const in enum BaconQrCode\Common\ErrorCorrectionLevel' - ); - new ErrorCorrectionLevel(4); - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/FormatInformationTest.php b/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/FormatInformationTest.php deleted file mode 100644 index 5f6ee58c..00000000 --- a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/FormatInformationTest.php +++ /dev/null @@ -1,104 +0,0 @@ -unmaskedTestFormatInfo = $this->maskedTestFormatInfo ^ 0x5412; - } - - - public function testBitsDiffering() - { - $this->assertEquals(0, FormatInformation::numBitsDiffering(1, 1)); - $this->assertEquals(1, FormatInformation::numBitsDiffering(0, 2)); - $this->assertEquals(2, FormatInformation::numBitsDiffering(1, 2)); - $this->assertEquals(32, FormatInformation::numBitsDiffering(-1, 0)); - } - - public function testDecode() - { - $expected = FormatInformation::decodeFormatInformation( - $this->maskedTestFormatInfo, - $this->maskedTestFormatInfo - ); - - $this->assertNotNull($expected); - $this->assertEquals(7, $expected->getDataMask()); - $this->assertEquals(ErrorCorrectionLevel::Q, $expected->getErrorCorrectionLevel()->get()); - - $this->assertEquals( - $expected, - FormatInformation::decodeFormatInformation( - $this->unmaskedTestFormatInfo, - $this->maskedTestFormatInfo - ) - ); - } - - public function testDecodeWithBitDifference() - { - $expected = FormatInformation::decodeFormatInformation( - $this->maskedTestFormatInfo, - $this->maskedTestFormatInfo - ); - - $this->assertEquals( - $expected, - FormatInformation::decodeFormatInformation( - $this->maskedTestFormatInfo ^ 0x1, - $this->maskedTestFormatInfo ^ 0x1 - ) - ); - $this->assertEquals( - $expected, - FormatInformation::decodeFormatInformation( - $this->maskedTestFormatInfo ^ 0x3, - $this->maskedTestFormatInfo ^ 0x3 - ) - ); - $this->assertEquals( - $expected, - FormatInformation::decodeFormatInformation( - $this->maskedTestFormatInfo ^ 0x7, - $this->maskedTestFormatInfo ^ 0x7 - ) - ); - $this->assertNull( - FormatInformation::decodeFormatInformation( - $this->maskedTestFormatInfo ^ 0xf, - $this->maskedTestFormatInfo ^ 0xf - ) - ); - } - - public function testDecodeWithMisRead() - { - $expected = FormatInformation::decodeFormatInformation( - $this->maskedTestFormatInfo, - $this->maskedTestFormatInfo - ); - - $this->assertEquals( - $expected, - FormatInformation::decodeFormatInformation( - $this->maskedTestFormatInfo ^ 0x3, - $this->maskedTestFormatInfo ^ 0xf - ) - ); - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/ModeTest.php b/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/ModeTest.php deleted file mode 100644 index 4daab7c3..00000000 --- a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/ModeTest.php +++ /dev/null @@ -1,42 +0,0 @@ -assertEquals(0x0, Mode::TERMINATOR); - $this->assertEquals(0x1, Mode::NUMERIC); - $this->assertEquals(0x2, Mode::ALPHANUMERIC); - $this->assertEquals(0x4, Mode::BYTE); - $this->assertEquals(0x8, Mode::KANJI); - } - - public function testInvalidModeThrowsException() - { - $this->setExpectedException( - 'BaconQrCode\Exception\UnexpectedValueException', - 'Value not a const in enum BaconQrCode\Common\Mode' - ); - new Mode(10); - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/ReedSolomonCodecTest.php b/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/ReedSolomonCodecTest.php deleted file mode 100644 index 604641a0..00000000 --- a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/ReedSolomonCodecTest.php +++ /dev/null @@ -1,111 +0,0 @@ -encode($block, $parity); - - // Copy parity into test blocks - for ($i = 0; $i < $numRoots; $i++) { - $block[$i + $dataSize] = $parity[$i]; - $tBlock[$i + $dataSize] = $parity[$i]; - } - - // Seed with errors - for ($i = 0; $i < $errors; $i++) { - $errorValue = mt_rand(1, $blockSize); - - do { - $errorLocation = mt_rand(0, $blockSize); - } while ($errorLocations[$errorLocation] !== 0); - - $errorLocations[$errorLocation] = 1; - - if (mt_rand(0, 1)) { - $erasures[] = $errorLocation; - } - - $tBlock[$errorLocation] ^= $errorValue; - } - - $erasures = SplFixedArray::fromArray($erasures, false); - - // Decode the errored block - $foundErrors = $codec->decode($tBlock, $erasures); - - if ($errors > 0 && $foundErrors === null) { - $this->assertEquals($block, $tBlock, 'Decoder failed to correct errors'); - } - - $this->assertEquals($errors, $foundErrors, 'Found errors do not equal expected errors'); - - for ($i = 0; $i < $foundErrors; $i++) { - if ($errorLocations[$erasures[$i]] === 0) { - $this->fail(sprintf('Decoder indicates error in location %d without error', $erasures[$i])); - } - } - - $this->assertEquals($block, $tBlock, 'Decoder did not correct errors'); - } - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/VersionTest.php b/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/VersionTest.php deleted file mode 100644 index 8b3fc01f..00000000 --- a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Common/VersionTest.php +++ /dev/null @@ -1,88 +0,0 @@ -assertNotNull($version); - $this->assertEquals($versionNumber, $version->getVersionNumber()); - $this->assertNotNull($version->getAlignmentPatternCenters()); - - if ($versionNumber > 1) { - $this->assertTrue(count($version->getAlignmentPatternCenters()) > 0); - } - - $this->assertEquals($dimension, $version->getDimensionForVersion()); - $this->assertNotNull($version->getEcBlocksForLevel(new ErrorCorrectionLevel(ErrorCorrectionLevel::H))); - $this->assertNotNull($version->getEcBlocksForLevel(new ErrorCorrectionLevel(ErrorCorrectionLevel::L))); - $this->assertNotNull($version->getEcBlocksForLevel(new ErrorCorrectionLevel(ErrorCorrectionLevel::M))); - $this->assertNotNull($version->getEcBlocksForLevel(new ErrorCorrectionLevel(ErrorCorrectionLevel::Q))); - $this->assertNotNull($version->buildFunctionPattern()); - } - - /** - * @dataProvider versionProvider - * @param integer $versionNumber - * @param integer $dimension - */ - public function testGetProvisionalVersionForDimension($versionNumber, $dimension) - { - $this->assertEquals( - $versionNumber, - Version::getProvisionalVersionForDimension($dimension)->getVersionNumber() - ); - } - - /** - * @dataProvider decodeInformationProvider - * @param integer $expectedVersion - * @param integer $mask - */ - public function testDecodeVersionInformation($expectedVersion, $mask) - { - $version = Version::decodeVersionInformation($mask); - $this->assertNotNull($version); - $this->assertEquals($expectedVersion, $version->getVersionNumber()); - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Encoder/EncoderTest.php b/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Encoder/EncoderTest.php deleted file mode 100644 index 31cdaa4e..00000000 --- a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Encoder/EncoderTest.php +++ /dev/null @@ -1,468 +0,0 @@ -getMethods(ReflectionMethod::IS_STATIC) as $method) { - $method->setAccessible(true); - $this->methods[$method->getName()] = $method; - } - } - - public function testGetAlphanumericCode() - { - // The first ten code points are numbers. - for ($i = 0; $i < 10; $i++) { - $this->assertEquals($i, $this->methods['getAlphanumericCode']->invoke(null, ord('0') + $i)); - } - - // The next 26 code points are capital alphabet letters. - for ($i = 10; $i < 36; $i++) { - // The first ten code points are numbers - $this->assertEquals($i, $this->methods['getAlphanumericCode']->invoke(null, ord('A') + $i - 10)); - } - - // Others are symbol letters. - $this->assertEquals(36, $this->methods['getAlphanumericCode']->invoke(null, ' ')); - $this->assertEquals(37, $this->methods['getAlphanumericCode']->invoke(null, '$')); - $this->assertEquals(38, $this->methods['getAlphanumericCode']->invoke(null, '%')); - $this->assertEquals(39, $this->methods['getAlphanumericCode']->invoke(null, '*')); - $this->assertEquals(40, $this->methods['getAlphanumericCode']->invoke(null, '+')); - $this->assertEquals(41, $this->methods['getAlphanumericCode']->invoke(null, '-')); - $this->assertEquals(42, $this->methods['getAlphanumericCode']->invoke(null, '.')); - $this->assertEquals(43, $this->methods['getAlphanumericCode']->invoke(null, '/')); - $this->assertEquals(44, $this->methods['getAlphanumericCode']->invoke(null, ':')); - - // Should return -1 for other letters. - $this->assertEquals(-1, $this->methods['getAlphanumericCode']->invoke(null, 'a')); - $this->assertEquals(-1, $this->methods['getAlphanumericCode']->invoke(null, '#')); - $this->assertEquals(-1, $this->methods['getAlphanumericCode']->invoke(null, "\0")); - } - - public function testChooseMode() - { - // Numeric mode - $this->assertSame(Mode::NUMERIC, $this->methods['chooseMode']->invoke(null, '0')->get()); - $this->assertSame(Mode::NUMERIC, $this->methods['chooseMode']->invoke(null, '0123456789')->get()); - - // Alphanumeric mode - $this->assertSame(Mode::ALPHANUMERIC, $this->methods['chooseMode']->invoke(null, 'A')->get()); - $this->assertSame(Mode::ALPHANUMERIC, $this->methods['chooseMode']->invoke(null, '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:')->get()); - - // 8-bit byte mode - $this->assertSame(Mode::BYTE, $this->methods['chooseMode']->invoke(null, 'a')->get()); - $this->assertSame(Mode::BYTE, $this->methods['chooseMode']->invoke(null, '#')->get()); - $this->assertSame(Mode::BYTE, $this->methods['chooseMode']->invoke(null, '')->get()); - - // AIUE in Hiragana in SHIFT-JIS - $this->assertSame(Mode::BYTE, $this->methods['chooseMode']->invoke(null, "\x8\xa\x8\xa\x8\xa\x8\xa6")->get()); - - // Nihon in Kanji in SHIFT-JIS - $this->assertSame(Mode::BYTE, $this->methods['chooseMode']->invoke(null, "\x9\xf\x9\x7b")->get()); - - // Sou-Utso-Byou in Kanji in SHIFT-JIS - $this->assertSame(Mode::BYTE, $this->methods['chooseMode']->invoke(null, "\xe\x4\x9\x5\x9\x61")->get()); - } - - public function testEncode() - { - $qrCode = Encoder::encode('ABCDEF', new ErrorCorrectionLevel(ErrorCorrectionLevel::H)); - $expected = "<<\n" - . " mode: ALPHANUMERIC\n" - . " ecLevel: H\n" - . " version: 1\n" - . " maskPattern: 0\n" - . " matrix:\n" - . " 1 1 1 1 1 1 1 0 1 1 1 1 0 0 1 1 1 1 1 1 1\n" - . " 1 0 0 0 0 0 1 0 0 1 1 1 0 0 1 0 0 0 0 0 1\n" - . " 1 0 1 1 1 0 1 0 0 1 0 1 1 0 1 0 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 1 1 1 0 1 0 1 0 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1\n" - . " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 1\n" - . " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n" - . " 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0\n" - . " 0 0 1 0 1 1 1 0 1 1 0 0 1 1 0 0 0 1 0 0 1\n" - . " 1 0 1 1 1 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0\n" - . " 0 0 1 1 0 0 1 0 1 0 0 0 1 0 1 0 1 0 1 1 0\n" - . " 1 1 0 1 0 1 0 1 1 1 0 1 0 1 0 0 0 0 0 1 0\n" - . " 0 0 1 1 0 1 1 1 1 0 0 0 1 0 1 0 1 1 1 1 0\n" - . " 0 0 0 0 0 0 0 0 1 0 0 1 1 1 0 1 0 1 0 0 0\n" - . " 1 1 1 1 1 1 1 0 0 0 1 0 1 0 1 1 0 0 0 0 1\n" - . " 1 0 0 0 0 0 1 0 1 1 1 1 0 1 0 1 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 1 0 1 1 0 1 0 1 0 0 0 0 1\n" - . " 1 0 1 1 1 0 1 0 0 1 1 0 1 1 1 1 0 1 0 1 0\n" - . " 1 0 1 1 1 0 1 0 1 0 0 0 1 0 1 0 1 1 1 0 1\n" - . " 1 0 0 0 0 0 1 0 0 1 1 0 1 1 0 1 0 0 0 1 1\n" - . " 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 1 0 1\n" - . ">>\n"; - - $this->assertEquals($expected, $qrCode->__toString()); - } - - public function testSimpleUtf8Eci() - { - $qrCode = Encoder::encode('hello', new ErrorCorrectionLevel(ErrorCorrectionLevel::H), 'utf-8'); - $expected = "<<\n" - . " mode: BYTE\n" - . " ecLevel: H\n" - . " version: 1\n" - . " maskPattern: 3\n" - . " matrix:\n" - . " 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1\n" - . " 1 0 0 0 0 0 1 0 0 0 1 0 1 0 1 0 0 0 0 0 1\n" - . " 1 0 1 1 1 0 1 0 0 1 0 1 0 0 1 0 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 0 1 1 0 1 0 1 0 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1\n" - . " 1 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 1\n" - . " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n" - . " 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0\n" - . " 0 0 1 1 0 0 1 1 1 1 0 0 0 1 1 0 1 0 0 0 0\n" - . " 0 0 1 1 1 0 0 0 0 0 1 1 0 0 0 1 0 1 1 1 0\n" - . " 0 1 0 1 0 1 1 1 0 1 0 1 0 0 0 0 0 1 1 1 1\n" - . " 1 1 0 0 1 0 0 1 1 0 0 1 1 1 1 0 1 0 1 1 0\n" - . " 0 0 0 0 1 0 1 1 1 1 0 0 0 0 0 1 0 0 1 0 0\n" - . " 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 0 0 0 1\n" - . " 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 0 0 1 0 0\n" - . " 1 0 0 0 0 0 1 0 0 0 1 0 0 1 1 1 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 0 1 0 0 0 0 1 1 0 0 0 0 0\n" - . " 1 0 1 1 1 0 1 0 1 1 1 0 1 0 0 0 1 1 0 0 0\n" - . " 1 0 1 1 1 0 1 0 1 1 0 0 0 1 0 0 1 0 0 0 0\n" - . " 1 0 0 0 0 0 1 0 0 0 0 1 1 0 1 0 1 0 1 1 0\n" - . " 1 1 1 1 1 1 1 0 0 1 0 1 1 1 0 1 1 0 0 0 0\n" - . ">>\n"; - - $this->assertEquals($expected, $qrCode->__toString()); - } - - public function testAppendModeInfo() - { - $bits = new BitArray(); - $this->methods['appendModeInfo']->invoke(null, new Mode(Mode::NUMERIC), $bits); - $this->assertEquals(' ...X', $bits->__toString()); - } - - public function testAppendLengthInfo() - { - // 1 letter (1/1), 10 bits. - $bits = new BitArray(); - $this->methods['appendLengthInfo']->invoke( - null, - 1, - Version::getVersionForNumber(1), - new Mode(Mode::NUMERIC), - $bits - ); - $this->assertEquals(' ........ .X', $bits->__toString()); - - // 2 letters (2/1), 11 bits. - $bits = new BitArray(); - $this->methods['appendLengthInfo']->invoke( - null, - 2, - Version::getVersionForNumber(10), - new Mode(Mode::ALPHANUMERIC), - $bits - ); - $this->assertEquals(' ........ .X.', $bits->__toString()); - - // 255 letters (255/1), 16 bits. - $bits = new BitArray(); - $this->methods['appendLengthInfo']->invoke( - null, - 255, - Version::getVersionForNumber(27), - new Mode(Mode::BYTE), - $bits - ); - $this->assertEquals(' ........ XXXXXXXX', $bits->__toString()); - - // 512 letters (1024/2), 12 bits. - $bits = new BitArray(); - $this->methods['appendLengthInfo']->invoke( - null, - 512, - Version::getVersionForNumber(40), - new Mode(Mode::KANJI), - $bits - ); - $this->assertEquals(' ..X..... ....', $bits->__toString()); - } - - public function testAppendBytes() - { - // Should use appendNumericBytes. - // 1 = 01 = 0001 in 4 bits. - $bits = new BitArray(); - $this->methods['appendBytes']->invoke( - null, - '1', - new Mode(Mode::NUMERIC), - $bits, - Encoder::DEFAULT_BYTE_MODE_ECODING - ); - $this->assertEquals(' ...X', $bits->__toString()); - - // Should use appendAlphaNumericBytes. - // A = 10 = 0xa = 001010 in 6 bits. - $bits = new BitArray(); - $this->methods['appendBytes']->invoke( - null, - 'A', - new Mode(Mode::ALPHANUMERIC), - $bits, - Encoder::DEFAULT_BYTE_MODE_ECODING - ); - $this->assertEquals(' ..X.X.', $bits->__toString()); - - // Should use append8BitBytes. - // 0x61, 0x62, 0x63 - $bits = new BitArray(); - $this->methods['appendBytes']->invoke( - null, - 'abc', - new Mode(Mode::BYTE), - $bits, - Encoder::DEFAULT_BYTE_MODE_ECODING - ); - $this->assertEquals(' .XX....X .XX...X. .XX...XX', $bits->__toString()); - - // Should use appendKanjiBytes. - // 0x93, 0x5f - $bits = new BitArray(); - $this->methods['appendBytes']->invoke( - null, - "\x93\x5f", - new Mode(Mode::KANJI), - $bits, - Encoder::DEFAULT_BYTE_MODE_ECODING - ); - $this->assertEquals(' .XX.XX.. XXXXX', $bits->__toString()); - - // Lower letters such as 'a' cannot be encoded in alphanumeric mode. - $this->setExpectedException( - 'BaconQrCode\Exception\WriterException', - 'Invalid alphanumeric code' - ); - $this->methods['appendBytes']->invoke( - null, - "a", - new Mode(Mode::ALPHANUMERIC), - $bits, - Encoder::DEFAULT_BYTE_MODE_ECODING - ); - } - - public function testTerminateBits() - { - $bits = new BitArray(); - $this->methods['terminateBits']->invoke(null, 0, $bits); - $this->assertEquals('', $bits->__toString()); - - $bits = new BitArray(); - $this->methods['terminateBits']->invoke(null, 1, $bits); - $this->assertEquals(' ........', $bits->__toString()); - - $bits = new BitArray(); - $bits->appendBits(0, 3); - $this->methods['terminateBits']->invoke(null, 1, $bits); - $this->assertEquals(' ........', $bits->__toString()); - - $bits = new BitArray(); - $bits->appendBits(0, 5); - $this->methods['terminateBits']->invoke(null, 1, $bits); - $this->assertEquals(' ........', $bits->__toString()); - - $bits = new BitArray(); - $bits->appendBits(0, 8); - $this->methods['terminateBits']->invoke(null, 1, $bits); - $this->assertEquals(' ........', $bits->__toString()); - - $bits = new BitArray(); - $this->methods['terminateBits']->invoke(null, 2, $bits); - $this->assertEquals(' ........ XXX.XX..', $bits->__toString()); - - $bits = new BitArray(); - $bits->appendBits(0, 1); - $this->methods['terminateBits']->invoke(null, 3, $bits); - $this->assertEquals(' ........ XXX.XX.. ...X...X', $bits->__toString()); - } - - public function testGetNumDataBytesAndNumEcBytesForBlockId() - { - // Version 1-H. - list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId']->invoke(null, 26, 9, 1, 0); - $this->assertEquals(9, $numDataBytes); - $this->assertEquals(17, $numEcBytes); - - // Version 3-H. 2 blocks. - list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId']->invoke(null, 70, 26, 2, 0); - $this->assertEquals(13, $numDataBytes); - $this->assertEquals(22, $numEcBytes); - list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId']->invoke(null, 70, 26, 2, 1); - $this->assertEquals(13, $numDataBytes); - $this->assertEquals(22, $numEcBytes); - - // Version 7-H. (4 + 1) blocks. - list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId']->invoke(null, 196, 66, 5, 0); - $this->assertEquals(13, $numDataBytes); - $this->assertEquals(26, $numEcBytes); - list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId']->invoke(null, 196, 66, 5, 4); - $this->assertEquals(14, $numDataBytes); - $this->assertEquals(26, $numEcBytes); - - // Version 40-H. (20 + 61) blocks. - list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId']->invoke(null, 3706, 1276, 81, 0); - $this->assertEquals(15, $numDataBytes); - $this->assertEquals(30, $numEcBytes); - list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId']->invoke(null, 3706, 1276, 81, 20); - $this->assertEquals(16, $numDataBytes); - $this->assertEquals(30, $numEcBytes); - list($numDataBytes, $numEcBytes) = $this->methods['getNumDataBytesAndNumEcBytesForBlockId']->invoke(null, 3706, 1276, 81, 80); - $this->assertEquals(16, $numDataBytes); - $this->assertEquals(30, $numEcBytes); - } - - public function testInterleaveWithEcBytes() - { - $dataBytes = SplFixedArray::fromArray(array(32, 65, 205, 69, 41, 220, 46, 128, 236), false); - $in = new BitArray(); - - foreach ($dataBytes as $dataByte) { - $in->appendBits($dataByte, 8); - } - - $outBits = $this->methods['interleaveWithEcBytes']->invoke(null, $in, 26, 9, 1); - $expected = SplFixedArray::fromArray(array( - // Data bytes. - 32, 65, 205, 69, 41, 220, 46, 128, 236, - // Error correction bytes. - 42, 159, 74, 221, 244, 169, 239, 150, 138, 70, 237, 85, 224, 96, 74, 219, 61, - ), false); - - $out = $outBits->toBytes(0, count($expected)); - - $this->assertEquals($expected, $out); - } - - public function testAppendNumericBytes() - { - // 1 = 01 = 0001 in 4 bits. - $bits = new BitArray(); - $this->methods['appendNumericBytes']->invoke(null, '1', $bits); - $this->assertEquals(' ...X', $bits->__toString()); - - // 12 = 0xc = 0001100 in 7 bits. - $bits = new BitArray(); - $this->methods['appendNumericBytes']->invoke(null, '12', $bits); - $this->assertEquals(' ...XX..', $bits->__toString()); - - // 123 = 0x7b = 0001111011 in 10 bits. - $bits = new BitArray(); - $this->methods['appendNumericBytes']->invoke(null, '123', $bits); - $this->assertEquals(' ...XXXX. XX', $bits->__toString()); - - // 1234 = "123" + "4" = 0001111011 + 0100 in 14 bits. - $bits = new BitArray(); - $this->methods['appendNumericBytes']->invoke(null, '1234', $bits); - $this->assertEquals(' ...XXXX. XX.X..', $bits->__toString()); - - // Empty - $bits = new BitArray(); - $this->methods['appendNumericBytes']->invoke(null, '', $bits); - $this->assertEquals('', $bits->__toString()); - } - - public function testAppendAlphanumericBytes() - { - $bits = new BitArray(); - $this->methods['appendAlphanumericBytes']->invoke(null, 'A', $bits); - $this->assertEquals(' ..X.X.', $bits->__toString()); - - $bits = new BitArray(); - $this->methods['appendAlphanumericBytes']->invoke(null, 'AB', $bits); - $this->assertEquals(' ..XXX..X X.X', $bits->__toString()); - - $bits = new BitArray(); - $this->methods['appendAlphanumericBytes']->invoke(null, 'ABC', $bits); - $this->assertEquals(' ..XXX..X X.X..XX. .', $bits->__toString()); - - // Empty - $bits = new BitArray(); - $this->methods['appendAlphanumericBytes']->invoke(null, '', $bits); - $this->assertEquals('', $bits->__toString()); - - // Invalid data - $this->setExpectedException('BaconQrCode\Exception\WriterException', 'Invalid alphanumeric code'); - $bits = new BitArray(); - $this->methods['appendAlphanumericBytes']->invoke(null, 'abc', $bits); - } - - public function testAppend8BitBytes() - { - // 0x61, 0x62, 0x63 - $bits = new BitArray(); - $this->methods['append8BitBytes']->invoke(null, 'abc', $bits, Encoder::DEFAULT_BYTE_MODE_ECODING); - $this->assertEquals(' .XX....X .XX...X. .XX...XX', $bits->__toString()); - - // Empty - $bits = new BitArray(); - $this->methods['append8BitBytes']->invoke(null, '', $bits, Encoder::DEFAULT_BYTE_MODE_ECODING); - $this->assertEquals('', $bits->__toString()); - } - - public function testAppendKanjiBytes() - { - // Numbers are from page 21 of JISX0510:2004 - $bits = new BitArray(); - $this->methods['appendKanjiBytes']->invoke(null, "\x93\x5f", $bits); - $this->assertEquals(' .XX.XX.. XXXXX', $bits->__toString()); - - $this->methods['appendKanjiBytes']->invoke(null, "\xe4\xaa", $bits); - $this->assertEquals(' .XX.XX.. XXXXXXX. X.X.X.X. X.', $bits->__toString()); - } - - public function testGenerateEcBytes() - { - // Numbers are from http://www.swetake.com/qr/qr3.html and - // http://www.swetake.com/qr/qr9.html - $dataBytes = SplFixedArray::fromArray(array(32, 65, 205, 69, 41, 220, 46, 128, 236), false); - $ecBytes = $this->methods['generateEcBytes']->invoke(null, $dataBytes, 17); - $expected = SplFixedArray::fromArray(array(42, 159, 74, 221, 244, 169, 239, 150, 138, 70, 237, 85, 224, 96, 74, 219, 61), false); - $this->assertEquals($expected, $ecBytes); - - $dataBytes = SplFixedArray::fromArray(array(67, 70, 22, 38, 54, 70, 86, 102, 118, 134, 150, 166, 182, 198, 214), false); - $ecBytes = $this->methods['generateEcBytes']->invoke(null, $dataBytes, 18); - $expected = SplFixedArray::fromArray(array(175, 80, 155, 64, 178, 45, 214, 233, 65, 209, 12, 155, 117, 31, 140, 214, 27, 187), false); - $this->assertEquals($expected, $ecBytes); - - // High-order zero coefficient case. - $dataBytes = SplFixedArray::fromArray(array(32, 49, 205, 69, 42, 20, 0, 236, 17), false); - $ecBytes = $this->methods['generateEcBytes']->invoke(null, $dataBytes, 17); - $expected = SplFixedArray::fromArray(array(0, 3, 130, 179, 194, 0, 55, 211, 110, 79, 98, 72, 170, 96, 211, 137, 213), false); - $this->assertEquals($expected, $ecBytes); - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Encoder/MaskUtilTest.php b/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Encoder/MaskUtilTest.php deleted file mode 100644 index a5c38656..00000000 --- a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Encoder/MaskUtilTest.php +++ /dev/null @@ -1,281 +0,0 @@ -fail('Data mask bit did not match'); - } - } - } - } - - public function testApplyMaskPenaltyRule1() - { - $matrix = new ByteMatrix(4, 1); - $matrix->set(0, 0, 0); - $matrix->set(1, 0, 0); - $matrix->set(2, 0, 0); - $matrix->set(3, 0, 0); - - $this->assertEquals(0, MaskUtil::applyMaskPenaltyRule1($matrix)); - - // Horizontal - $matrix = new ByteMatrix(6, 1); - $matrix->set(0, 0, 0); - $matrix->set(1, 0, 0); - $matrix->set(2, 0, 0); - $matrix->set(3, 0, 0); - $matrix->set(4, 0, 0); - $matrix->set(5, 0, 1); - $this->assertEquals(3, MaskUtil::applyMaskPenaltyRule1($matrix)); - $matrix->set(5, 0, 0); - $this->assertEquals(4, MaskUtil::applyMaskPenaltyRule1($matrix)); - - // Vertical - $matrix = new ByteMatrix(1, 6); - $matrix->set(0, 0, 0); - $matrix->set(0, 1, 0); - $matrix->set(0, 2, 0); - $matrix->set(0, 3, 0); - $matrix->set(0, 4, 0); - $matrix->set(0, 5, 1); - $this->assertEquals(3, MaskUtil::applyMaskPenaltyRule1($matrix)); - $matrix->set(0, 5, 0); - $this->assertEquals(4, MaskUtil::applyMaskPenaltyRule1($matrix)); - } - - public function testApplyMaskPenaltyRule2() - { - $matrix = new ByteMatrix(1, 1); - $matrix->set(0, 0, 0); - $this->assertEquals(0, MaskUtil::applyMaskPenaltyRule2($matrix)); - - $matrix = new ByteMatrix(2, 2); - $matrix->set(0, 0, 0); - $matrix->set(1, 0, 0); - $matrix->set(0, 1, 0); - $matrix->set(1, 1, 1); - $this->assertEquals(0, MaskUtil::applyMaskPenaltyRule2($matrix)); - - $matrix = new ByteMatrix(2, 2); - $matrix->set(0, 0, 0); - $matrix->set(1, 0, 0); - $matrix->set(0, 1, 0); - $matrix->set(1, 1, 0); - $this->assertEquals(3, MaskUtil::applyMaskPenaltyRule2($matrix)); - - $matrix = new ByteMatrix(3, 3); - $matrix->set(0, 0, 0); - $matrix->set(1, 0, 0); - $matrix->set(2, 0, 0); - $matrix->set(0, 1, 0); - $matrix->set(1, 1, 0); - $matrix->set(2, 1, 0); - $matrix->set(0, 2, 0); - $matrix->set(1, 2, 0); - $matrix->set(2, 2, 0); - $this->assertEquals(3 * 4, MaskUtil::applyMaskPenaltyRule2($matrix)); - } - - public function testApplyMaskPenalty3() - { - // Horizontal 00001011101 - $matrix = new ByteMatrix(11, 1); - $matrix->set(0, 0, 0); - $matrix->set(1, 0, 0); - $matrix->set(2, 0, 0); - $matrix->set(3, 0, 0); - $matrix->set(4, 0, 1); - $matrix->set(5, 0, 0); - $matrix->set(6, 0, 1); - $matrix->set(7, 0, 1); - $matrix->set(8, 0, 1); - $matrix->set(9, 0, 0); - $matrix->set(10, 0, 1); - $this->assertEquals(40, MaskUtil::applyMaskPenaltyRule3($matrix)); - - // Horizontal 10111010000 - $matrix = new ByteMatrix(11, 1); - $matrix->set(0, 0, 1); - $matrix->set(1, 0, 0); - $matrix->set(2, 0, 1); - $matrix->set(3, 0, 1); - $matrix->set(4, 0, 1); - $matrix->set(5, 0, 0); - $matrix->set(6, 0, 1); - $matrix->set(7, 0, 0); - $matrix->set(8, 0, 0); - $matrix->set(9, 0, 0); - $matrix->set(10, 0, 0); - $this->assertEquals(40, MaskUtil::applyMaskPenaltyRule3($matrix)); - - // Vertical 00001011101 - $matrix = new ByteMatrix(1, 11); - $matrix->set(0, 0, 0); - $matrix->set(0, 1, 0); - $matrix->set(0, 2, 0); - $matrix->set(0, 3, 0); - $matrix->set(0, 4, 1); - $matrix->set(0, 5, 0); - $matrix->set(0, 6, 1); - $matrix->set(0, 7, 1); - $matrix->set(0, 8, 1); - $matrix->set(0, 9, 0); - $matrix->set(0, 10, 1); - $this->assertEquals(40, MaskUtil::applyMaskPenaltyRule3($matrix)); - - // Vertical 10111010000 - $matrix = new ByteMatrix(1, 11); - $matrix->set(0, 0, 1); - $matrix->set(0, 1, 0); - $matrix->set(0, 2, 1); - $matrix->set(0, 3, 1); - $matrix->set(0, 4, 1); - $matrix->set(0, 5, 0); - $matrix->set(0, 6, 1); - $matrix->set(0, 7, 0); - $matrix->set(0, 8, 0); - $matrix->set(0, 9, 0); - $matrix->set(0, 10, 0); - $this->assertEquals(40, MaskUtil::applyMaskPenaltyRule3($matrix)); - } - - public function testApplyMaskPenaltyRule4() - { - // Dark cell ratio = 0% - $matrix = new ByteMatrix(1, 1); - $matrix->set(0, 0, 0); - $this->assertEquals(100, MaskUtil::applyMaskPenaltyRule4($matrix)); - - // Dark cell ratio = 5% - $matrix = new ByteMatrix(2, 1); - $matrix->set(0, 0, 0); - $matrix->set(0, 0, 1); - $this->assertEquals(0, MaskUtil::applyMaskPenaltyRule4($matrix)); - - // Dark cell ratio = 66.67% - $matrix = new ByteMatrix(6, 1); - $matrix->set(0, 0, 0); - $matrix->set(1, 0, 1); - $matrix->set(2, 0, 1); - $matrix->set(3, 0, 1); - $matrix->set(4, 0, 1); - $matrix->set(5, 0, 0); - $this->assertEquals(30, MaskUtil::applyMaskPenaltyRule4($matrix)); - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Encoder/MatrixUtilTest.php b/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Encoder/MatrixUtilTest.php deleted file mode 100644 index bf3544f0..00000000 --- a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Encoder/MatrixUtilTest.php +++ /dev/null @@ -1,336 +0,0 @@ -getMethods(ReflectionMethod::IS_STATIC) as $method) { - $method->setAccessible(true); - $this->methods[$method->getName()] = $method; - } - } - - public function testToString() - { - $matrix= new ByteMatrix(3, 3); - $matrix->set(0, 0, 0); - $matrix->set(1, 0, 1); - $matrix->set(2, 0, 0); - $matrix->set(0, 1, 1); - $matrix->set(1, 1, 0); - $matrix->set(2, 1, 1); - $matrix->set(0, 2, -1); - $matrix->set(1, 2, -1); - $matrix->set(2, 2, -1); - - $expected = " 0 1 0\n 1 0 1\n \n"; - $this->assertEquals($expected, $matrix->__toString()); - } - - public function testClearMatrix() - { - $matrix = new ByteMatrix(2, 2); - MatrixUtil::clearMatrix($matrix); - - $this->assertEquals(-1, $matrix->get(0, 0)); - $this->assertEquals(-1, $matrix->get(1, 0)); - $this->assertEquals(-1, $matrix->get(0, 1)); - $this->assertEquals(-1, $matrix->get(1, 1)); - } - - public function testEmbedBasicPatterns1() - { - $matrix = new ByteMatrix(21, 21); - MatrixUtil::clearMatrix($matrix); - $this->methods['embedBasicPatterns']->invoke( - null, - Version::getVersionForNumber(1), - $matrix - ); - $expected = " 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1\n" - . " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1\n" - . " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" - . " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1\n" - . " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n" - . " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 1 \n" - . " 0 \n" - . " 1 \n" - . " 0 \n" - . " 1 \n" - . " 0 0 0 0 0 0 0 0 1 \n" - . " 1 1 1 1 1 1 1 0 \n" - . " 1 0 0 0 0 0 1 0 \n" - . " 1 0 1 1 1 0 1 0 \n" - . " 1 0 1 1 1 0 1 0 \n" - . " 1 0 1 1 1 0 1 0 \n" - . " 1 0 0 0 0 0 1 0 \n" - . " 1 1 1 1 1 1 1 0 \n"; - - $this->assertEquals($expected, $matrix->__toString()); - } - - public function testEmbedBasicPatterns2() - { - $matrix = new ByteMatrix(25, 25); - MatrixUtil::clearMatrix($matrix); - $this->methods['embedBasicPatterns']->invoke( - null, - Version::getVersionForNumber(2), - $matrix - ); - $expected = " 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1\n" - . " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1\n" - . " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 0 1 0 1 1 1 0 1\n" - . " 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1\n" - . " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n" - . " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 1 \n" - . " 0 \n" - . " 1 \n" - . " 0 \n" - . " 1 \n" - . " 0 \n" - . " 1 \n" - . " 0 \n" - . " 1 1 1 1 1 1 \n" - . " 0 0 0 0 0 0 0 0 1 1 0 0 0 1 \n" - . " 1 1 1 1 1 1 1 0 1 0 1 0 1 \n" - . " 1 0 0 0 0 0 1 0 1 0 0 0 1 \n" - . " 1 0 1 1 1 0 1 0 1 1 1 1 1 \n" - . " 1 0 1 1 1 0 1 0 \n" - . " 1 0 1 1 1 0 1 0 \n" - . " 1 0 0 0 0 0 1 0 \n" - . " 1 1 1 1 1 1 1 0 \n"; - - $this->assertEquals($expected, $matrix->__toString()); - } - - public function testEmbedTypeInfo() - { - $matrix = new ByteMatrix(21, 21); - MatrixUtil::clearMatrix($matrix); - $this->methods['embedTypeInfo']->invoke( - null, - new ErrorCorrectionLevel(ErrorCorrectionLevel::M), - 5, - $matrix - ); - $expected = " 0 \n" - . " 1 \n" - . " 1 \n" - . " 1 \n" - . " 0 \n" - . " 0 \n" - . " \n" - . " 1 \n" - . " 1 0 0 0 0 0 0 1 1 1 0 0 1 1 1 0\n" - . " \n" - . " \n" - . " \n" - . " \n" - . " \n" - . " 0 \n" - . " 0 \n" - . " 0 \n" - . " 0 \n" - . " 0 \n" - . " 0 \n" - . " 1 \n"; - - $this->assertEquals($expected, $matrix->__toString()); - } - - public function testEmbedVersionInfo() - { - $matrix = new ByteMatrix(21, 21); - MatrixUtil::clearMatrix($matrix); - $this->methods['maybeEmbedVersionInfo']->invoke( - null, - Version::getVersionForNumber(7), - $matrix - ); - $expected = " 0 0 1 \n" - . " 0 1 0 \n" - . " 0 1 0 \n" - . " 0 1 1 \n" - . " 1 1 1 \n" - . " 0 0 0 \n" - . " \n" - . " \n" - . " \n" - . " \n" - . " 0 0 0 0 1 0 \n" - . " 0 1 1 1 1 0 \n" - . " 1 0 0 1 1 0 \n" - . " \n" - . " \n" - . " \n" - . " \n" - . " \n" - . " \n" - . " \n" - . " \n"; - - $this->assertEquals($expected, $matrix->__toString()); - } - - public function testEmbedDataBits() - { - $matrix = new ByteMatrix(21, 21); - MatrixUtil::clearMatrix($matrix); - $this->methods['embedBasicPatterns']->invoke( - null, - Version::getVersionForNumber(1), - $matrix - ); - - $bits = new BitArray(); - $this->methods['embedDataBits']->invoke( - null, - $bits, - -1, - $matrix - ); - - $expected = " 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1\n" - . " 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1\n" - . " 1 0 1 1 1 0 1 0 0 0 0 0 0 0 1 0 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 0 0 0 0 0 0 1 0 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 0 0 0 0 0 0 1 0 1 1 1 0 1\n" - . " 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1\n" - . " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n" - . " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 1 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 1 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 1 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" - . " 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n"; - - $this->assertEquals($expected, $matrix->__toString()); - } - - public function testBuildMatrix() - { - $bytes = array( - 32, 65, 205, 69, 41, 220, 46, 128, 236, 42, 159, 74, 221, 244, 169, - 239, 150, 138, 70, 237, 85, 224, 96, 74, 219 , 61 - ); - $bits = new BitArray(); - - foreach ($bytes as $byte) { - $bits->appendBits($byte, 8); - } - - $matrix = new ByteMatrix(21, 21); - MatrixUtil::buildMatrix( - $bits, - new ErrorCorrectionLevel(ErrorCorrectionLevel::H), - Version::getVersionForNumber(1), - 3, - $matrix - ); - - $expected = " 1 1 1 1 1 1 1 0 0 1 1 0 0 0 1 1 1 1 1 1 1\n" - . " 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1\n" - . " 1 0 1 1 1 0 1 0 0 0 0 1 0 0 1 0 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 0 1 1 0 0 0 1 0 1 1 1 0 1\n" - . " 1 0 1 1 1 0 1 0 1 1 0 0 1 0 1 0 1 1 1 0 1\n" - . " 1 0 0 0 0 0 1 0 0 0 1 1 1 0 1 0 0 0 0 0 1\n" - . " 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 1\n" - . " 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 0 0\n" - . " 0 0 1 1 0 0 1 1 1 0 0 1 1 1 1 0 1 0 0 0 0\n" - . " 1 0 1 0 1 0 0 0 0 0 1 1 1 0 0 1 0 1 1 1 0\n" - . " 1 1 1 1 0 1 1 0 1 0 1 1 1 0 0 1 1 1 0 1 0\n" - . " 1 0 1 0 1 1 0 1 1 1 0 0 1 1 1 0 0 1 0 1 0\n" - . " 0 0 1 0 0 1 1 1 0 0 0 0 0 0 1 0 1 1 1 1 1\n" - . " 0 0 0 0 0 0 0 0 1 1 0 1 0 0 0 0 0 1 0 1 1\n" - . " 1 1 1 1 1 1 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0\n" - . " 1 0 0 0 0 0 1 0 0 0 0 1 0 1 1 1 0 0 0 0 0\n" - . " 1 0 1 1 1 0 1 0 0 1 0 0 1 1 0 0 1 0 0 1 1\n" - . " 1 0 1 1 1 0 1 0 1 1 0 1 0 0 0 0 0 1 1 1 0\n" - . " 1 0 1 1 1 0 1 0 1 1 1 1 0 0 0 0 1 1 1 0 0\n" - . " 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0\n" - . " 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 0 1 0 0 1 0\n"; - - $this->assertEquals($expected, $matrix->__toString()); - } - - public function testFindMsbSet() - { - $this->assertEquals(0, $this->methods['findMsbSet']->invoke(null, 0)); - $this->assertEquals(1, $this->methods['findMsbSet']->invoke(null, 1)); - $this->assertEquals(8, $this->methods['findMsbSet']->invoke(null, 0x80)); - $this->assertEquals(32, $this->methods['findMsbSet']->invoke(null, 0x80000000)); - } - - public function testCalculateBchCode() - { - // Encoding of type information. - // From Appendix C in JISX0510:2004 (p 65) - $this->assertEquals(0xdc, $this->methods['calculateBchCode']->invoke(null, 5, 0x537)); - // From http://www.swetake.com/qr/qr6.html - $this->assertEquals(0x1c2, $this->methods['calculateBchCode']->invoke(null, 0x13, 0x537)); - // From http://www.swetake.com/qr/qr11.html - $this->assertEquals(0x214, $this->methods['calculateBchCode']->invoke(null, 0x1b, 0x537)); - - // Encoding of version information. - // From Appendix D in JISX0510:2004 (p 68) - $this->assertEquals(0xc94, $this->methods['calculateBchCode']->invoke(null, 7, 0x1f25)); - $this->assertEquals(0x5bc, $this->methods['calculateBchCode']->invoke(null, 8, 0x1f25)); - $this->assertEquals(0xa99, $this->methods['calculateBchCode']->invoke(null, 9, 0x1f25)); - $this->assertEquals(0x4d3, $this->methods['calculateBchCode']->invoke(null, 10, 0x1f25)); - $this->assertEquals(0x9a6, $this->methods['calculateBchCode']->invoke(null, 20, 0x1f25)); - $this->assertEquals(0xd75, $this->methods['calculateBchCode']->invoke(null, 30, 0x1f25)); - $this->assertEquals(0xc69, $this->methods['calculateBchCode']->invoke(null, 40, 0x1f25)); - } - - public function testMakeVersionInfoBits() - { - // From Appendix D in JISX0510:2004 (p 68) - $bits = new BitArray(); - $this->methods['makeVersionInfoBits']->invoke(null, Version::getVersionForNumber(7), $bits); - $this->assertEquals(' ...XXXXX ..X..X.X ..', $bits->__toString()); - } - - public function testMakeTypeInfoBits() - { - // From Appendix D in JISX0510:2004 (p 68) - $bits = new BitArray(); - $this->methods['makeTypeInfoBits']->invoke(null, new ErrorCorrectionLevel(ErrorCorrectionLevel::M), 5, $bits); - $this->assertEquals(' X......X X..XXX.', $bits->__toString()); - } -} \ No newline at end of file diff --git a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Renderer/Text/HtmlTest.php b/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Renderer/Text/HtmlTest.php deleted file mode 100644 index 0c69dd2e..00000000 --- a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Renderer/Text/HtmlTest.php +++ /dev/null @@ -1,99 +0,0 @@ -renderer = new Html(); - $this->writer = new Writer($this->renderer); - } - - public function testBasicRender() - { - $content = 'foobar'; - $expected = - '
    ' .
    -            "                       \n" .
    -            " ███████ █████ ███████ \n" .
    -            " █     █  █ █  █     █ \n" .
    -            " █ ███ █  ██   █ ███ █ \n" .
    -            " █ ███ █  ███  █ ███ █ \n" .
    -            " █ ███ █   █ █ █ ███ █ \n" .
    -            " █     █    ██ █     █ \n" .
    -            " ███████ █ █ █ ███████ \n" .
    -            "         █████         \n" .
    -            " ██ ██ █  ██ █ █     █ \n" .
    -            "    ██    ██ █ █ ██    \n" .
    -            "  ████████ █  ██ █  ██ \n" .
    -            "           ██      █ █ \n" .
    -            "  ██  ███  █   █  █  █ \n" .
    -            "         █ ███    █ █  \n" .
    -            " ███████  ██ ██████    \n" .
    -            " █     █   ████   ██   \n" .
    -            " █ ███ █ ██ ██ ██ █ ██ \n" .
    -            " █ ███ █ ██ ██  █ ██   \n" .
    -            " █ ███ █   █   █ ██ ██ \n" .
    -            " █     █ ███  ███ ████ \n" .
    -            " ███████ ████   ██     \n" .
    -            "                       \n" .
    -            '
    ' - ; - - $qrCode = Encoder::encode( - $content, - new ErrorCorrectionLevel(ErrorCorrectionLevel::L), - Encoder::DEFAULT_BYTE_MODE_ECODING - ); - $this->assertEquals($expected, $this->renderer->render($qrCode)); - } - - public function testSetStyle() - { - $content = 'foobar'; - $qrCode = Encoder::encode( - $content, - new ErrorCorrectionLevel(ErrorCorrectionLevel::L), - Encoder::DEFAULT_BYTE_MODE_ECODING - ); - $this->renderer->setStyle('bar'); - $this->assertEquals('bar', $this->renderer->getStyle()); - $this->assertStringMatchesFormat('%astyle="bar"%a', $this->renderer->render($qrCode)); - } - - public function testSetClass() - { - $content = 'foobar'; - $qrCode = Encoder::encode( - $content, - new ErrorCorrectionLevel(ErrorCorrectionLevel::L), - Encoder::DEFAULT_BYTE_MODE_ECODING - ); - $this->renderer->setClass('bar'); - $this->assertEquals('bar', $this->renderer->getClass()); - $this->assertStringMatchesFormat('%aclass="bar"%a', $this->renderer->render($qrCode)); - } -} diff --git a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Renderer/Text/TextTest.php b/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Renderer/Text/TextTest.php deleted file mode 100644 index d94e8e5d..00000000 --- a/vendor/bacon/bacon-qr-code/tests/BaconQrCode/Renderer/Text/TextTest.php +++ /dev/null @@ -1,149 +0,0 @@ -renderer = new Plain(); - $this->writer = new Writer($this->renderer); - } - - public function testBasicRender() - { - $content = 'foobar'; - $expected = - " \n" . - " ███████ █████ ███████ \n" . - " █ █ █ █ █ █ \n" . - " █ ███ █ ██ █ ███ █ \n" . - " █ ███ █ ███ █ ███ █ \n" . - " █ ███ █ █ █ █ ███ █ \n" . - " █ █ ██ █ █ \n" . - " ███████ █ █ █ ███████ \n" . - " █████ \n" . - " ██ ██ █ ██ █ █ █ \n" . - " ██ ██ █ █ ██ \n" . - " ████████ █ ██ █ ██ \n" . - " ██ █ █ \n" . - " ██ ███ █ █ █ █ \n" . - " █ ███ █ █ \n" . - " ███████ ██ ██████ \n" . - " █ █ ████ ██ \n" . - " █ ███ █ ██ ██ ██ █ ██ \n" . - " █ ███ █ ██ ██ █ ██ \n" . - " █ ███ █ █ █ ██ ██ \n" . - " █ █ ███ ███ ████ \n" . - " ███████ ████ ██ \n" . - " \n" - ; - - $qrCode = Encoder::encode( - $content, - new ErrorCorrectionLevel(ErrorCorrectionLevel::L), - Encoder::DEFAULT_BYTE_MODE_ECODING - ); - $this->assertEquals($expected, $this->renderer->render($qrCode)); - } - - public function testBasicRenderNoMargins() - { - $content = 'foobar'; - $expected = - "███████ █████ ███████\n" . - "█ █ █ █ █ █\n" . - "█ ███ █ ██ █ ███ █\n" . - "█ ███ █ ███ █ ███ █\n" . - "█ ███ █ █ █ █ ███ █\n" . - "█ █ ██ █ █\n" . - "███████ █ █ █ ███████\n" . - " █████ \n" . - "██ ██ █ ██ █ █ █\n" . - " ██ ██ █ █ ██ \n" . - " ████████ █ ██ █ ██\n" . - " ██ █ █\n" . - " ██ ███ █ █ █ █\n" . - " █ ███ █ █ \n" . - "███████ ██ ██████ \n" . - "█ █ ████ ██ \n" . - "█ ███ █ ██ ██ ██ █ ██\n" . - "█ ███ █ ██ ██ █ ██ \n" . - "█ ███ █ █ █ ██ ██\n" . - "█ █ ███ ███ ████\n" . - "███████ ████ ██ \n" - ; - - $qrCode = Encoder::encode( - $content, - new ErrorCorrectionLevel(ErrorCorrectionLevel::L), - Encoder::DEFAULT_BYTE_MODE_ECODING - ); - $this->renderer->setMargin(0); - $this->assertEquals(0, $this->renderer->getMargin()); - $this->assertEquals($expected, $this->renderer->render($qrCode)); - } - - public function testBasicRenderCustomChar() - { - $content = 'foobar'; - $expected = - "-----------------------\n" . - "-#######-#####-#######-\n" . - "-#-----#--#-#--#-----#-\n" . - "-#-###-#--##---#-###-#-\n" . - "-#-###-#--###--#-###-#-\n" . - "-#-###-#---#-#-#-###-#-\n" . - "-#-----#----##-#-----#-\n" . - "-#######-#-#-#-#######-\n" . - "---------#####---------\n" . - "-##-##-#--##-#-#-----#-\n" . - "----##----##-#-#-##----\n" . - "--########-#--##-#--##-\n" . - "-----------##------#-#-\n" . - "--##--###--#---#--#--#-\n" . - "---------#-###----#-#--\n" . - "-#######--##-######----\n" . - "-#-----#---####---##---\n" . - "-#-###-#-##-##-##-#-##-\n" . - "-#-###-#-##-##--#-##---\n" . - "-#-###-#---#---#-##-##-\n" . - "-#-----#-###--###-####-\n" . - "-#######-####---##-----\n" . - "-----------------------\n" - ; - - $qrCode = Encoder::encode( - $content, - new ErrorCorrectionLevel(ErrorCorrectionLevel::L), - Encoder::DEFAULT_BYTE_MODE_ECODING - ); - $this->renderer->setFullBlock('#'); - $this->renderer->setEmptyBlock('-'); - $this->assertEquals('#', $this->renderer->getFullBlock()); - $this->assertEquals('-', $this->renderer->getEmptyBlock()); - $this->assertEquals($expected, $this->renderer->render($qrCode)); - } -} diff --git a/vendor/bacon/bacon-qr-code/tests/bootstrap.php b/vendor/bacon/bacon-qr-code/tests/bootstrap.php deleted file mode 100644 index 05a49415..00000000 --- a/vendor/bacon/bacon-qr-code/tests/bootstrap.php +++ /dev/null @@ -1,10 +0,0 @@ - - - - . - - - - ../src/ - - - diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php deleted file mode 100644 index fce8549f..00000000 --- a/vendor/composer/ClassLoader.php +++ /dev/null @@ -1,445 +0,0 @@ - - * Jordi Boggiano - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Composer\Autoload; - -/** - * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. - * - * $loader = new \Composer\Autoload\ClassLoader(); - * - * // register classes with namespaces - * $loader->add('Symfony\Component', __DIR__.'/component'); - * $loader->add('Symfony', __DIR__.'/framework'); - * - * // activate the autoloader - * $loader->register(); - * - * // to enable searching the include path (eg. for PEAR packages) - * $loader->setUseIncludePath(true); - * - * In this example, if you try to use a class in the Symfony\Component - * namespace or one of its children (Symfony\Component\Console for instance), - * the autoloader will first look for the class under the component/ - * directory, and it will then fallback to the framework/ directory if not - * found before giving up. - * - * This class is loosely based on the Symfony UniversalClassLoader. - * - * @author Fabien Potencier - * @author Jordi Boggiano - * @see http://www.php-fig.org/psr/psr-0/ - * @see http://www.php-fig.org/psr/psr-4/ - */ -class ClassLoader -{ - // PSR-4 - private $prefixLengthsPsr4 = array(); - private $prefixDirsPsr4 = array(); - private $fallbackDirsPsr4 = array(); - - // PSR-0 - private $prefixesPsr0 = array(); - private $fallbackDirsPsr0 = array(); - - private $useIncludePath = false; - private $classMap = array(); - private $classMapAuthoritative = false; - private $missingClasses = array(); - private $apcuPrefix; - - public function getPrefixes() - { - if (!empty($this->prefixesPsr0)) { - return call_user_func_array('array_merge', $this->prefixesPsr0); - } - - return array(); - } - - public function getPrefixesPsr4() - { - return $this->prefixDirsPsr4; - } - - public function getFallbackDirs() - { - return $this->fallbackDirsPsr0; - } - - public function getFallbackDirsPsr4() - { - return $this->fallbackDirsPsr4; - } - - public function getClassMap() - { - return $this->classMap; - } - - /** - * @param array $classMap Class to filename map - */ - public function addClassMap(array $classMap) - { - if ($this->classMap) { - $this->classMap = array_merge($this->classMap, $classMap); - } else { - $this->classMap = $classMap; - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, either - * appending or prepending to the ones previously set for this prefix. - * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories - */ - public function add($prefix, $paths, $prepend = false) - { - if (!$prefix) { - if ($prepend) { - $this->fallbackDirsPsr0 = array_merge( - (array) $paths, - $this->fallbackDirsPsr0 - ); - } else { - $this->fallbackDirsPsr0 = array_merge( - $this->fallbackDirsPsr0, - (array) $paths - ); - } - - return; - } - - $first = $prefix[0]; - if (!isset($this->prefixesPsr0[$first][$prefix])) { - $this->prefixesPsr0[$first][$prefix] = (array) $paths; - - return; - } - if ($prepend) { - $this->prefixesPsr0[$first][$prefix] = array_merge( - (array) $paths, - $this->prefixesPsr0[$first][$prefix] - ); - } else { - $this->prefixesPsr0[$first][$prefix] = array_merge( - $this->prefixesPsr0[$first][$prefix], - (array) $paths - ); - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, either - * appending or prepending to the ones previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories - * - * @throws \InvalidArgumentException - */ - public function addPsr4($prefix, $paths, $prepend = false) - { - if (!$prefix) { - // Register directories for the root namespace. - if ($prepend) { - $this->fallbackDirsPsr4 = array_merge( - (array) $paths, - $this->fallbackDirsPsr4 - ); - } else { - $this->fallbackDirsPsr4 = array_merge( - $this->fallbackDirsPsr4, - (array) $paths - ); - } - } elseif (!isset($this->prefixDirsPsr4[$prefix])) { - // Register directories for a new namespace. - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; - } elseif ($prepend) { - // Prepend directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - (array) $paths, - $this->prefixDirsPsr4[$prefix] - ); - } else { - // Append directories for an already registered namespace. - $this->prefixDirsPsr4[$prefix] = array_merge( - $this->prefixDirsPsr4[$prefix], - (array) $paths - ); - } - } - - /** - * Registers a set of PSR-0 directories for a given prefix, - * replacing any others previously set for this prefix. - * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 base directories - */ - public function set($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr0 = (array) $paths; - } else { - $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; - } - } - - /** - * Registers a set of PSR-4 directories for a given namespace, - * replacing any others previously set for this namespace. - * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories - * - * @throws \InvalidArgumentException - */ - public function setPsr4($prefix, $paths) - { - if (!$prefix) { - $this->fallbackDirsPsr4 = (array) $paths; - } else { - $length = strlen($prefix); - if ('\\' !== $prefix[$length - 1]) { - throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); - } - $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; - } - } - - /** - * Turns on searching the include path for class files. - * - * @param bool $useIncludePath - */ - public function setUseIncludePath($useIncludePath) - { - $this->useIncludePath = $useIncludePath; - } - - /** - * Can be used to check if the autoloader uses the include path to check - * for classes. - * - * @return bool - */ - public function getUseIncludePath() - { - return $this->useIncludePath; - } - - /** - * Turns off searching the prefix and fallback directories for classes - * that have not been registered with the class map. - * - * @param bool $classMapAuthoritative - */ - public function setClassMapAuthoritative($classMapAuthoritative) - { - $this->classMapAuthoritative = $classMapAuthoritative; - } - - /** - * Should class lookup fail if not found in the current class map? - * - * @return bool - */ - public function isClassMapAuthoritative() - { - return $this->classMapAuthoritative; - } - - /** - * APCu prefix to use to cache found/not-found classes, if the extension is enabled. - * - * @param string|null $apcuPrefix - */ - public function setApcuPrefix($apcuPrefix) - { - $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; - } - - /** - * The APCu prefix in use, or null if APCu caching is not enabled. - * - * @return string|null - */ - public function getApcuPrefix() - { - return $this->apcuPrefix; - } - - /** - * Registers this instance as an autoloader. - * - * @param bool $prepend Whether to prepend the autoloader or not - */ - public function register($prepend = false) - { - spl_autoload_register(array($this, 'loadClass'), true, $prepend); - } - - /** - * Unregisters this instance as an autoloader. - */ - public function unregister() - { - spl_autoload_unregister(array($this, 'loadClass')); - } - - /** - * Loads the given class or interface. - * - * @param string $class The name of the class - * @return bool|null True if loaded, null otherwise - */ - public function loadClass($class) - { - if ($file = $this->findFile($class)) { - includeFile($file); - - return true; - } - } - - /** - * Finds the path to the file where the class is defined. - * - * @param string $class The name of the class - * - * @return string|false The path if found, false otherwise - */ - public function findFile($class) - { - // class map lookup - if (isset($this->classMap[$class])) { - return $this->classMap[$class]; - } - if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { - return false; - } - if (null !== $this->apcuPrefix) { - $file = apcu_fetch($this->apcuPrefix.$class, $hit); - if ($hit) { - return $file; - } - } - - $file = $this->findFileWithExtension($class, '.php'); - - // Search for Hack files if we are running on HHVM - if (false === $file && defined('HHVM_VERSION')) { - $file = $this->findFileWithExtension($class, '.hh'); - } - - if (null !== $this->apcuPrefix) { - apcu_add($this->apcuPrefix.$class, $file); - } - - if (false === $file) { - // Remember that this class does not exist. - $this->missingClasses[$class] = true; - } - - return $file; - } - - private function findFileWithExtension($class, $ext) - { - // PSR-4 lookup - $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; - - $first = $class[0]; - if (isset($this->prefixLengthsPsr4[$first])) { - $subPath = $class; - while (false !== $lastPos = strrpos($subPath, '\\')) { - $subPath = substr($subPath, 0, $lastPos); - $search = $subPath . '\\'; - if (isset($this->prefixDirsPsr4[$search])) { - $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); - foreach ($this->prefixDirsPsr4[$search] as $dir) { - if (file_exists($file = $dir . $pathEnd)) { - return $file; - } - } - } - } - } - - // PSR-4 fallback dirs - foreach ($this->fallbackDirsPsr4 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { - return $file; - } - } - - // PSR-0 lookup - if (false !== $pos = strrpos($class, '\\')) { - // namespaced class name - $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) - . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); - } else { - // PEAR-like class name - $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; - } - - if (isset($this->prefixesPsr0[$first])) { - foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { - if (0 === strpos($class, $prefix)) { - foreach ($dirs as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - } - } - } - - // PSR-0 fallback dirs - foreach ($this->fallbackDirsPsr0 as $dir) { - if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { - return $file; - } - } - - // PSR-0 include paths. - if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { - return $file; - } - - return false; - } -} - -/** - * Scope isolated include. - * - * Prevents access to $this/self from included files. - */ -function includeFile($file) -{ - include $file; -} diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE deleted file mode 100644 index f27399a0..00000000 --- a/vendor/composer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - -Copyright (c) Nils Adermann, Jordi Boggiano - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php deleted file mode 100644 index 6cd157c3..00000000 --- a/vendor/composer/autoload_classmap.php +++ /dev/null @@ -1,10 +0,0 @@ - $vendorDir . '/pclzip/pclzip/pclzip.lib.php', -); diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php deleted file mode 100644 index 35b785f6..00000000 --- a/vendor/composer/autoload_files.php +++ /dev/null @@ -1,56 +0,0 @@ - $vendorDir . '/symfony/polyfill-ctype/bootstrap.php', - 'a9ed0d27b5a698798a89181429f162c5' => $vendorDir . '/khanamiryan/qrcode-detector-decoder/lib/Common/customFunctions.php', - 'abede361264e2ae69ec1eee813a101af' => $vendorDir . '/markbaker/complex/classes/src/functions/abs.php', - '21a5860fbef5be28db5ddfbc3cca67c4' => $vendorDir . '/markbaker/complex/classes/src/functions/acos.php', - '1546e3f9d127f2a9bb2d1b6c31c26ef1' => $vendorDir . '/markbaker/complex/classes/src/functions/acosh.php', - 'd2516f7f4fba5ea5905f494b4a8262e0' => $vendorDir . '/markbaker/complex/classes/src/functions/acot.php', - '4511163d560956219b96882c0980b65e' => $vendorDir . '/markbaker/complex/classes/src/functions/acoth.php', - 'c361f5616dc2a8da4fa3e137077cd4ea' => $vendorDir . '/markbaker/complex/classes/src/functions/acsc.php', - '02d68920fc98da71991ce569c91df0f6' => $vendorDir . '/markbaker/complex/classes/src/functions/acsch.php', - '88e19525eae308b4a6aa3419364875d3' => $vendorDir . '/markbaker/complex/classes/src/functions/argument.php', - '60e8e2d0827b58bfc904f13957e51849' => $vendorDir . '/markbaker/complex/classes/src/functions/asec.php', - '13d2f040713999eab66c359b4d79871d' => $vendorDir . '/markbaker/complex/classes/src/functions/asech.php', - '838ab38beb32c68a79d3cd2c007d5a04' => $vendorDir . '/markbaker/complex/classes/src/functions/asin.php', - 'bb28eccd0f8f008333a1b3c163d604ac' => $vendorDir . '/markbaker/complex/classes/src/functions/asinh.php', - '9e483de83558c98f7d3feaa402c78cb3' => $vendorDir . '/markbaker/complex/classes/src/functions/atan.php', - '36b74b5b765ded91ee58c8ee3c0e85e3' => $vendorDir . '/markbaker/complex/classes/src/functions/atanh.php', - '05c15ee9510da7fd6bf6136f436500c0' => $vendorDir . '/markbaker/complex/classes/src/functions/conjugate.php', - 'd3208dfbce2505e370788f9f22f6785f' => $vendorDir . '/markbaker/complex/classes/src/functions/cos.php', - '141cf1fb3a3046f8b64534b0ebab33ca' => $vendorDir . '/markbaker/complex/classes/src/functions/cosh.php', - 'be660df75fd0dbe7fa7c03b7434b3294' => $vendorDir . '/markbaker/complex/classes/src/functions/cot.php', - '01e31ea298a51bc9e91517e3ce6b9e76' => $vendorDir . '/markbaker/complex/classes/src/functions/coth.php', - '803ddd97f7b1da68982a7b087c3476f6' => $vendorDir . '/markbaker/complex/classes/src/functions/csc.php', - '3001cdfd101ec3c32da34ee43c2e149b' => $vendorDir . '/markbaker/complex/classes/src/functions/csch.php', - '77b2d7629ef2a93fabb8c56754a91051' => $vendorDir . '/markbaker/complex/classes/src/functions/exp.php', - '4a4471296dec796c21d4f4b6552396a9' => $vendorDir . '/markbaker/complex/classes/src/functions/inverse.php', - 'c3e9897e1744b88deb56fcdc39d34d85' => $vendorDir . '/markbaker/complex/classes/src/functions/ln.php', - 'a83cacf2de942cff288de15a83afd26d' => $vendorDir . '/markbaker/complex/classes/src/functions/log2.php', - '6a861dacc9ee2f3061241d4c7772fa21' => $vendorDir . '/markbaker/complex/classes/src/functions/log10.php', - '4d2522d968c8ba78d6c13548a1b4200e' => $vendorDir . '/markbaker/complex/classes/src/functions/negative.php', - 'fd587ca933fc0447fa5ab4843bdd97f7' => $vendorDir . '/markbaker/complex/classes/src/functions/pow.php', - '383ef01c62028fc78cd4388082fce3c2' => $vendorDir . '/markbaker/complex/classes/src/functions/rho.php', - '150fbd1b95029dc47292da97ecab9375' => $vendorDir . '/markbaker/complex/classes/src/functions/sec.php', - '549abd9bae174286d660bdaa07407c68' => $vendorDir . '/markbaker/complex/classes/src/functions/sech.php', - '6bfbf5eaea6b17a0ed85cb21ba80370c' => $vendorDir . '/markbaker/complex/classes/src/functions/sin.php', - '22efe13f1a497b8e199540ae2d9dc59c' => $vendorDir . '/markbaker/complex/classes/src/functions/sinh.php', - 'e90135ab8e787795a509ed7147de207d' => $vendorDir . '/markbaker/complex/classes/src/functions/sqrt.php', - 'bb0a7923ffc6a90919cd64ec54ff06bc' => $vendorDir . '/markbaker/complex/classes/src/functions/tan.php', - '2d302f32ce0fd4e433dd91c5bb404a28' => $vendorDir . '/markbaker/complex/classes/src/functions/tanh.php', - '24dd4658a952171a4ee79218c4f9fd06' => $vendorDir . '/markbaker/complex/classes/src/functions/theta.php', - 'e49b7876281d6f5bc39536dde96d1f4a' => $vendorDir . '/markbaker/complex/classes/src/operations/add.php', - '47596e02b43cd6da7700134fd08f88cf' => $vendorDir . '/markbaker/complex/classes/src/operations/subtract.php', - '883af48563631547925fa4c3b48ead07' => $vendorDir . '/markbaker/complex/classes/src/operations/multiply.php', - 'f190e3308e6ca23234a2875edc985c03' => $vendorDir . '/markbaker/complex/classes/src/operations/divideby.php', - 'ac9e33ce6841aa5bf5d16d465a2f03a7' => $vendorDir . '/markbaker/complex/classes/src/operations/divideinto.php', - '1cfd2761b63b0a29ed23657ea394cb2d' => $vendorDir . '/topthink/think-captcha/src/helper.php', - '9b552a3cc426e3287cc811caefa3cf53' => $vendorDir . '/topthink/think-helper/src/helper.php', - 'ddc3cd2a04224f9638c5d0de6a69c7e3' => $vendorDir . '/topthink/think-migration/src/config.php', -); diff --git a/vendor/composer/autoload_namespaces.php b/vendor/composer/autoload_namespaces.php deleted file mode 100644 index c3a2bfe0..00000000 --- a/vendor/composer/autoload_namespaces.php +++ /dev/null @@ -1,10 +0,0 @@ - array($vendorDir . '/bacon/bacon-qr-code/src'), -); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php deleted file mode 100644 index 159daa7b..00000000 --- a/vendor/composer/autoload_psr4.php +++ /dev/null @@ -1,31 +0,0 @@ - array($vendorDir . '/topthink/think-migration/src'), - 'think\\helper\\' => array($vendorDir . '/topthink/think-helper/src'), - 'think\\composer\\' => array($vendorDir . '/topthink/think-installer/src'), - 'think\\captcha\\' => array($vendorDir . '/topthink/think-captcha/src'), - 'php4world\\' => array($vendorDir . '/php4world/auth/src'), - 'app\\' => array($baseDir . '/application'), - 'Zxing\\' => array($vendorDir . '/khanamiryan/qrcode-detector-decoder/lib'), - 'Zend\\Escaper\\' => array($vendorDir . '/zendframework/zend-escaper/src'), - 'WhiteHat101\\Crypt\\' => array($vendorDir . '/whitehat101/apr1-md5/src'), - 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'), - 'Symfony\\Component\\PropertyAccess\\' => array($vendorDir . '/symfony/property-access'), - 'Symfony\\Component\\OptionsResolver\\' => array($vendorDir . '/symfony/options-resolver'), - 'Symfony\\Component\\Inflector\\' => array($vendorDir . '/symfony/inflector'), - 'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'), - 'PhpOffice\\PhpWord\\' => array($vendorDir . '/phpoffice/phpword/src/PhpWord'), - 'PhpOffice\\PhpSpreadsheet\\' => array($vendorDir . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet'), - 'PhpOffice\\Common\\' => array($vendorDir . '/phpoffice/common/src/Common'), - 'Phinx\\' => array($vendorDir . '/topthink/think-migration/phinx/src/Phinx'), - 'MyCLabs\\Enum\\' => array($vendorDir . '/myclabs/php-enum/src'), - 'Endroid\\QrCode\\' => array($vendorDir . '/endroid/qr-code/src'), - 'Endroid\\Installer\\' => array($vendorDir . '/endroid/installer/src'), - 'Complex\\' => array($vendorDir . '/markbaker/complex/classes/src'), -); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php deleted file mode 100644 index b5b489ee..00000000 --- a/vendor/composer/autoload_real.php +++ /dev/null @@ -1,70 +0,0 @@ -= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); - if ($useStaticLoader) { - require_once __DIR__ . '/autoload_static.php'; - - call_user_func(\Composer\Autoload\ComposerStaticInitbe7733f58d7b733cc58f1391b7bd5053::getInitializer($loader)); - } else { - $map = require __DIR__ . '/autoload_namespaces.php'; - foreach ($map as $namespace => $path) { - $loader->set($namespace, $path); - } - - $map = require __DIR__ . '/autoload_psr4.php'; - foreach ($map as $namespace => $path) { - $loader->setPsr4($namespace, $path); - } - - $classMap = require __DIR__ . '/autoload_classmap.php'; - if ($classMap) { - $loader->addClassMap($classMap); - } - } - - $loader->register(true); - - if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInitbe7733f58d7b733cc58f1391b7bd5053::$files; - } else { - $includeFiles = require __DIR__ . '/autoload_files.php'; - } - foreach ($includeFiles as $fileIdentifier => $file) { - composerRequirebe7733f58d7b733cc58f1391b7bd5053($fileIdentifier, $file); - } - - return $loader; - } -} - -function composerRequirebe7733f58d7b733cc58f1391b7bd5053($fileIdentifier, $file) -{ - if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { - require $file; - - $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; - } -} diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php deleted file mode 100644 index 383defe5..00000000 --- a/vendor/composer/autoload_static.php +++ /dev/null @@ -1,229 +0,0 @@ - __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', - 'a9ed0d27b5a698798a89181429f162c5' => __DIR__ . '/..' . '/khanamiryan/qrcode-detector-decoder/lib/Common/customFunctions.php', - 'abede361264e2ae69ec1eee813a101af' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/abs.php', - '21a5860fbef5be28db5ddfbc3cca67c4' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/acos.php', - '1546e3f9d127f2a9bb2d1b6c31c26ef1' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/acosh.php', - 'd2516f7f4fba5ea5905f494b4a8262e0' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/acot.php', - '4511163d560956219b96882c0980b65e' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/acoth.php', - 'c361f5616dc2a8da4fa3e137077cd4ea' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/acsc.php', - '02d68920fc98da71991ce569c91df0f6' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/acsch.php', - '88e19525eae308b4a6aa3419364875d3' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/argument.php', - '60e8e2d0827b58bfc904f13957e51849' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/asec.php', - '13d2f040713999eab66c359b4d79871d' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/asech.php', - '838ab38beb32c68a79d3cd2c007d5a04' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/asin.php', - 'bb28eccd0f8f008333a1b3c163d604ac' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/asinh.php', - '9e483de83558c98f7d3feaa402c78cb3' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/atan.php', - '36b74b5b765ded91ee58c8ee3c0e85e3' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/atanh.php', - '05c15ee9510da7fd6bf6136f436500c0' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/conjugate.php', - 'd3208dfbce2505e370788f9f22f6785f' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/cos.php', - '141cf1fb3a3046f8b64534b0ebab33ca' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/cosh.php', - 'be660df75fd0dbe7fa7c03b7434b3294' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/cot.php', - '01e31ea298a51bc9e91517e3ce6b9e76' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/coth.php', - '803ddd97f7b1da68982a7b087c3476f6' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/csc.php', - '3001cdfd101ec3c32da34ee43c2e149b' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/csch.php', - '77b2d7629ef2a93fabb8c56754a91051' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/exp.php', - '4a4471296dec796c21d4f4b6552396a9' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/inverse.php', - 'c3e9897e1744b88deb56fcdc39d34d85' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/ln.php', - 'a83cacf2de942cff288de15a83afd26d' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/log2.php', - '6a861dacc9ee2f3061241d4c7772fa21' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/log10.php', - '4d2522d968c8ba78d6c13548a1b4200e' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/negative.php', - 'fd587ca933fc0447fa5ab4843bdd97f7' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/pow.php', - '383ef01c62028fc78cd4388082fce3c2' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/rho.php', - '150fbd1b95029dc47292da97ecab9375' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/sec.php', - '549abd9bae174286d660bdaa07407c68' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/sech.php', - '6bfbf5eaea6b17a0ed85cb21ba80370c' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/sin.php', - '22efe13f1a497b8e199540ae2d9dc59c' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/sinh.php', - 'e90135ab8e787795a509ed7147de207d' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/sqrt.php', - 'bb0a7923ffc6a90919cd64ec54ff06bc' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/tan.php', - '2d302f32ce0fd4e433dd91c5bb404a28' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/tanh.php', - '24dd4658a952171a4ee79218c4f9fd06' => __DIR__ . '/..' . '/markbaker/complex/classes/src/functions/theta.php', - 'e49b7876281d6f5bc39536dde96d1f4a' => __DIR__ . '/..' . '/markbaker/complex/classes/src/operations/add.php', - '47596e02b43cd6da7700134fd08f88cf' => __DIR__ . '/..' . '/markbaker/complex/classes/src/operations/subtract.php', - '883af48563631547925fa4c3b48ead07' => __DIR__ . '/..' . '/markbaker/complex/classes/src/operations/multiply.php', - 'f190e3308e6ca23234a2875edc985c03' => __DIR__ . '/..' . '/markbaker/complex/classes/src/operations/divideby.php', - 'ac9e33ce6841aa5bf5d16d465a2f03a7' => __DIR__ . '/..' . '/markbaker/complex/classes/src/operations/divideinto.php', - '1cfd2761b63b0a29ed23657ea394cb2d' => __DIR__ . '/..' . '/topthink/think-captcha/src/helper.php', - '9b552a3cc426e3287cc811caefa3cf53' => __DIR__ . '/..' . '/topthink/think-helper/src/helper.php', - 'ddc3cd2a04224f9638c5d0de6a69c7e3' => __DIR__ . '/..' . '/topthink/think-migration/src/config.php', - ); - - public static $prefixLengthsPsr4 = array ( - 't' => - array ( - 'think\\migration\\' => 16, - 'think\\helper\\' => 13, - 'think\\composer\\' => 15, - 'think\\captcha\\' => 14, - ), - 'p' => - array ( - 'php4world\\' => 10, - ), - 'a' => - array ( - 'app\\' => 4, - ), - 'Z' => - array ( - 'Zxing\\' => 6, - 'Zend\\Escaper\\' => 13, - ), - 'W' => - array ( - 'WhiteHat101\\Crypt\\' => 18, - ), - 'S' => - array ( - 'Symfony\\Polyfill\\Ctype\\' => 23, - 'Symfony\\Component\\PropertyAccess\\' => 33, - 'Symfony\\Component\\OptionsResolver\\' => 34, - 'Symfony\\Component\\Inflector\\' => 28, - ), - 'P' => - array ( - 'Psr\\SimpleCache\\' => 16, - 'PhpOffice\\PhpWord\\' => 18, - 'PhpOffice\\PhpSpreadsheet\\' => 25, - 'PhpOffice\\Common\\' => 17, - 'Phinx\\' => 6, - ), - 'M' => - array ( - 'MyCLabs\\Enum\\' => 13, - ), - 'E' => - array ( - 'Endroid\\QrCode\\' => 15, - 'Endroid\\Installer\\' => 18, - ), - 'C' => - array ( - 'Complex\\' => 8, - ), - ); - - public static $prefixDirsPsr4 = array ( - 'think\\migration\\' => - array ( - 0 => __DIR__ . '/..' . '/topthink/think-migration/src', - ), - 'think\\helper\\' => - array ( - 0 => __DIR__ . '/..' . '/topthink/think-helper/src', - ), - 'think\\composer\\' => - array ( - 0 => __DIR__ . '/..' . '/topthink/think-installer/src', - ), - 'think\\captcha\\' => - array ( - 0 => __DIR__ . '/..' . '/topthink/think-captcha/src', - ), - 'php4world\\' => - array ( - 0 => __DIR__ . '/..' . '/php4world/auth/src', - ), - 'app\\' => - array ( - 0 => __DIR__ . '/../..' . '/application', - ), - 'Zxing\\' => - array ( - 0 => __DIR__ . '/..' . '/khanamiryan/qrcode-detector-decoder/lib', - ), - 'Zend\\Escaper\\' => - array ( - 0 => __DIR__ . '/..' . '/zendframework/zend-escaper/src', - ), - 'WhiteHat101\\Crypt\\' => - array ( - 0 => __DIR__ . '/..' . '/whitehat101/apr1-md5/src', - ), - 'Symfony\\Polyfill\\Ctype\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype', - ), - 'Symfony\\Component\\PropertyAccess\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/property-access', - ), - 'Symfony\\Component\\OptionsResolver\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/options-resolver', - ), - 'Symfony\\Component\\Inflector\\' => - array ( - 0 => __DIR__ . '/..' . '/symfony/inflector', - ), - 'Psr\\SimpleCache\\' => - array ( - 0 => __DIR__ . '/..' . '/psr/simple-cache/src', - ), - 'PhpOffice\\PhpWord\\' => - array ( - 0 => __DIR__ . '/..' . '/phpoffice/phpword/src/PhpWord', - ), - 'PhpOffice\\PhpSpreadsheet\\' => - array ( - 0 => __DIR__ . '/..' . '/phpoffice/phpspreadsheet/src/PhpSpreadsheet', - ), - 'PhpOffice\\Common\\' => - array ( - 0 => __DIR__ . '/..' . '/phpoffice/common/src/Common', - ), - 'Phinx\\' => - array ( - 0 => __DIR__ . '/..' . '/topthink/think-migration/phinx/src/Phinx', - ), - 'MyCLabs\\Enum\\' => - array ( - 0 => __DIR__ . '/..' . '/myclabs/php-enum/src', - ), - 'Endroid\\QrCode\\' => - array ( - 0 => __DIR__ . '/..' . '/endroid/qr-code/src', - ), - 'Endroid\\Installer\\' => - array ( - 0 => __DIR__ . '/..' . '/endroid/installer/src', - ), - 'Complex\\' => - array ( - 0 => __DIR__ . '/..' . '/markbaker/complex/classes/src', - ), - ); - - public static $prefixesPsr0 = array ( - 'B' => - array ( - 'BaconQrCode' => - array ( - 0 => __DIR__ . '/..' . '/bacon/bacon-qr-code/src', - ), - ), - ); - - public static $classMap = array ( - 'PclZip' => __DIR__ . '/..' . '/pclzip/pclzip/pclzip.lib.php', - ); - - public static function getInitializer(ClassLoader $loader) - { - return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInitbe7733f58d7b733cc58f1391b7bd5053::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInitbe7733f58d7b733cc58f1391b7bd5053::$prefixDirsPsr4; - $loader->prefixesPsr0 = ComposerStaticInitbe7733f58d7b733cc58f1391b7bd5053::$prefixesPsr0; - $loader->classMap = ComposerStaticInitbe7733f58d7b733cc58f1391b7bd5053::$classMap; - - }, null, ClassLoader::class); - } -} diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json deleted file mode 100644 index 51b01b52..00000000 --- a/vendor/composer/installed.json +++ /dev/null @@ -1,1430 +0,0 @@ -[ - { - "name": "bacon/bacon-qr-code", - "version": "1.0.3", - "version_normalized": "1.0.3.0", - "source": { - "type": "git", - "url": "https://github.com/Bacon/BaconQrCode.git", - "reference": "5a91b62b9d37cee635bbf8d553f4546057250bee" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Bacon/BaconQrCode/zipball/5a91b62b9d37cee635bbf8d553f4546057250bee", - "reference": "5a91b62b9d37cee635bbf8d553f4546057250bee", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-iconv": "*", - "php": "^5.4|^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8" - }, - "suggest": { - "ext-gd": "to generate QR code images" - }, - "time": "2017-10-17T09:59:25+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-0": { - "BaconQrCode": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-2-Clause" - ], - "authors": [ - { - "name": "Ben Scholzen 'DASPRiD'", - "email": "mail@dasprids.de", - "homepage": "http://www.dasprids.de", - "role": "Developer" - } - ], - "description": "BaconQrCode is a QR code generator for PHP.", - "homepage": "https://github.com/Bacon/BaconQrCode" - }, - { - "name": "endroid/installer", - "version": "1.0.7", - "version_normalized": "1.0.7.0", - "source": { - "type": "git", - "url": "https://github.com/endroid/installer.git", - "reference": "2db0498b3a1cdb95db75309ea3087739f8017e62" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/endroid/installer/zipball/2db0498b3a1cdb95db75309ea3087739f8017e62", - "reference": "2db0498b3a1cdb95db75309ea3087739f8017e62", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "composer-plugin-api": "^1.1", - "php": ">=7.1" - }, - "require-dev": { - "phpunit/phpunit": "^5.7|^6.0" - }, - "time": "2018-10-13T18:47:03+00:00", - "type": "composer-plugin", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "class": "Endroid\\Installer\\Installer" - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Endroid\\Installer\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jeroen van den Enden", - "email": "info@endroid.nl" - } - ] - }, - { - "name": "endroid/qr-code", - "version": "3.4.9", - "version_normalized": "3.4.9.0", - "source": { - "type": "git", - "url": "https://github.com/endroid/qr-code.git", - "reference": "4752fc7cc7f658c17049919af33872e9b7d5e64d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/endroid/qr-code/zipball/4752fc7cc7f658c17049919af33872e9b7d5e64d", - "reference": "4752fc7cc7f658c17049919af33872e9b7d5e64d", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "bacon/bacon-qr-code": "^1.0.3", - "endroid/installer": "^1.0.3", - "ext-gd": "*", - "khanamiryan/qrcode-detector-decoder": "^1.0.2", - "myclabs/php-enum": "^1.5", - "php": ">=7.1", - "symfony/options-resolver": "^2.7|^3.0|^4.0", - "symfony/property-access": "^2.7|^3.0|^4.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7|^6.0" - }, - "time": "2018-11-26T11:53:30+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Endroid\\QrCode\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jeroen van den Enden", - "email": "info@endroid.nl" - } - ], - "description": "Endroid QR Code", - "homepage": "https://github.com/endroid/qr-code", - "keywords": [ - "bundle", - "code", - "endroid", - "php", - "qr", - "qrcode" - ] - }, - { - "name": "khanamiryan/qrcode-detector-decoder", - "version": "1.0.2", - "version_normalized": "1.0.2.0", - "source": { - "type": "git", - "url": "https://github.com/khanamiryan/php-qrcode-detector-decoder.git", - "reference": "a75482d3bc804e3f6702332bfda6cccbb0dfaa76" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/khanamiryan/php-qrcode-detector-decoder/zipball/a75482d3bc804e3f6702332bfda6cccbb0dfaa76", - "reference": "a75482d3bc804e3f6702332bfda6cccbb0dfaa76", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^5.6|^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7" - }, - "time": "2018-04-26T11:41:33+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Zxing\\": "lib/" - }, - "files": [ - "lib/Common/customFunctions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ashot Khanamiryan", - "email": "a.khanamiryan@gmail.com", - "homepage": "https://github.com/khanamiryan", - "role": "Developer" - } - ], - "description": "QR code decoder / reader", - "homepage": "https://github.com/khanamiryan/php-qrcode-detector-decoder/", - "keywords": [ - "barcode", - "qr", - "zxing" - ] - }, - { - "name": "markbaker/complex", - "version": "1.4.7", - "version_normalized": "1.4.7.0", - "source": { - "type": "git", - "url": "https://github.com/MarkBaker/PHPComplex.git", - "reference": "1ea674a8308baf547cbcbd30c5fcd6d301b7c000" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/1ea674a8308baf547cbcbd30c5fcd6d301b7c000", - "reference": "1ea674a8308baf547cbcbd30c5fcd6d301b7c000", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^5.6.0|^7.0.0" - }, - "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3", - "phpcompatibility/php-compatibility": "^8.0", - "phpdocumentor/phpdocumentor": "2.*", - "phploc/phploc": "2.*", - "phpmd/phpmd": "2.*", - "phpunit/phpunit": "^4.8.35|^5.4.0", - "sebastian/phpcpd": "2.*", - "squizlabs/php_codesniffer": "^3.3.0" - }, - "time": "2018-10-13T23:28:42+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Complex\\": "classes/src/" - }, - "files": [ - "classes/src/functions/abs.php", - "classes/src/functions/acos.php", - "classes/src/functions/acosh.php", - "classes/src/functions/acot.php", - "classes/src/functions/acoth.php", - "classes/src/functions/acsc.php", - "classes/src/functions/acsch.php", - "classes/src/functions/argument.php", - "classes/src/functions/asec.php", - "classes/src/functions/asech.php", - "classes/src/functions/asin.php", - "classes/src/functions/asinh.php", - "classes/src/functions/atan.php", - "classes/src/functions/atanh.php", - "classes/src/functions/conjugate.php", - "classes/src/functions/cos.php", - "classes/src/functions/cosh.php", - "classes/src/functions/cot.php", - "classes/src/functions/coth.php", - "classes/src/functions/csc.php", - "classes/src/functions/csch.php", - "classes/src/functions/exp.php", - "classes/src/functions/inverse.php", - "classes/src/functions/ln.php", - "classes/src/functions/log2.php", - "classes/src/functions/log10.php", - "classes/src/functions/negative.php", - "classes/src/functions/pow.php", - "classes/src/functions/rho.php", - "classes/src/functions/sec.php", - "classes/src/functions/sech.php", - "classes/src/functions/sin.php", - "classes/src/functions/sinh.php", - "classes/src/functions/sqrt.php", - "classes/src/functions/tan.php", - "classes/src/functions/tanh.php", - "classes/src/functions/theta.php", - "classes/src/operations/add.php", - "classes/src/operations/subtract.php", - "classes/src/operations/multiply.php", - "classes/src/operations/divideby.php", - "classes/src/operations/divideinto.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mark Baker", - "email": "mark@lange.demon.co.uk" - } - ], - "description": "PHP Class for working with complex numbers", - "homepage": "https://github.com/MarkBaker/PHPComplex", - "keywords": [ - "complex", - "mathematics" - ] - }, - { - "name": "myclabs/php-enum", - "version": "1.6.4", - "version_normalized": "1.6.4.0", - "source": { - "type": "git", - "url": "https://github.com/myclabs/php-enum.git", - "reference": "550d2334d77f91b0816a5cbd6965272fe20146b8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/php-enum/zipball/550d2334d77f91b0816a5cbd6965272fe20146b8", - "reference": "550d2334d77f91b0816a5cbd6965272fe20146b8", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.4" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35|^5.7|^6.0", - "squizlabs/php_codesniffer": "1.*" - }, - "time": "2018-10-30T14:36:18+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "MyCLabs\\Enum\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP Enum contributors", - "homepage": "https://github.com/myclabs/php-enum/graphs/contributors" - } - ], - "description": "PHP Enum implementation", - "homepage": "http://github.com/myclabs/php-enum", - "keywords": [ - "enum" - ] - }, - { - "name": "pclzip/pclzip", - "version": "2.8.2", - "version_normalized": "2.8.2.0", - "source": { - "type": "git", - "url": "https://github.com/ivanlanin/pclzip.git", - "reference": "19dd1de9d3f5fc4d7d70175b4c344dee329f45fd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ivanlanin/pclzip/zipball/19dd1de9d3f5fc4d7d70175b4c344dee329f45fd", - "reference": "19dd1de9d3f5fc4d7d70175b4c344dee329f45fd", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "time": "2014-06-05T11:42:24+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "classmap": [ - "pclzip.lib.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-2.1" - ], - "authors": [ - { - "name": "Vincent Blavet" - } - ], - "description": "A PHP library that offers compression and extraction functions for Zip formatted archives", - "homepage": "http://www.phpconcept.net/pclzip", - "keywords": [ - "php", - "zip" - ] - }, - { - "name": "php4world/auth", - "version": "v1.0.3", - "version_normalized": "1.0.3.0", - "source": { - "type": "git", - "url": "https://github.com/php4world/auth.git", - "reference": "e356cad8de77c3e27f78875685b309d561c0fa94" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php4world/auth/zipball/e356cad8de77c3e27f78875685b309d561c0fa94", - "reference": "e356cad8de77c3e27f78875685b309d561c0fa94", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "topthink/framework": "5.1.*" - }, - "time": "2018-06-30T09:39:06+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "php4world\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "php4world", - "email": "76422937@qq.com" - } - ], - "description": "ThinkPHP5.1 Auth Class." - }, - { - "name": "phpoffice/common", - "version": "0.2.9", - "version_normalized": "0.2.9.0", - "source": { - "type": "git", - "url": "https://github.com/PHPOffice/Common.git", - "reference": "edb5d32b1e3400a35a5c91e2539ed6f6ce925e4d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHPOffice/Common/zipball/edb5d32b1e3400a35a5c91e2539ed6f6ce925e4d", - "reference": "edb5d32b1e3400a35a5c91e2539ed6f6ce925e4d", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "pclzip/pclzip": "^2.8", - "php": ">=5.3.0" - }, - "require-dev": { - "phpdocumentor/phpdocumentor": "2.*", - "phploc/phploc": "2.*", - "phpmd/phpmd": "2.*", - "phpunit/phpunit": "^4.8.36 || ^7.0", - "sebastian/phpcpd": "2.*", - "squizlabs/php_codesniffer": "2.*" - }, - "time": "2018-07-13T14:12:34+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "PhpOffice\\Common\\": "src/Common/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL" - ], - "authors": [ - { - "name": "Mark Baker" - }, - { - "name": "Franck Lefevre", - "homepage": "http://rootslabs.net" - } - ], - "description": "PHPOffice Common", - "homepage": "http://phpoffice.github.io", - "keywords": [ - "common", - "component", - "office", - "php" - ] - }, - { - "name": "phpoffice/phpspreadsheet", - "version": "1.5.0", - "version_normalized": "1.5.0.0", - "source": { - "type": "git", - "url": "https://github.com/PHPOffice/PhpSpreadsheet.git", - "reference": "2dfd06c59825914a1a325f2a2ed13634b9d8c411" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/2dfd06c59825914a1a325f2a2ed13634b9d8c411", - "reference": "2dfd06c59825914a1a325f2a2ed13634b9d8c411", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-ctype": "*", - "ext-dom": "*", - "ext-gd": "*", - "ext-iconv": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-simplexml": "*", - "ext-xml": "*", - "ext-xmlreader": "*", - "ext-xmlwriter": "*", - "ext-zip": "*", - "ext-zlib": "*", - "markbaker/complex": "^1.4.1", - "php": "^5.6|^7.0", - "psr/simple-cache": "^1.0" - }, - "require-dev": { - "dompdf/dompdf": "^0.8.0", - "friendsofphp/php-cs-fixer": "@stable", - "jpgraph/jpgraph": "^4.0", - "mpdf/mpdf": "^7.0.0", - "phpunit/phpunit": "^5.7", - "squizlabs/php_codesniffer": "^3.3", - "tecnickcom/tcpdf": "^6.2" - }, - "suggest": { - "dompdf/dompdf": "Option for rendering PDF with PDF Writer", - "jpgraph/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers", - "mpdf/mpdf": "Option for rendering PDF with PDF Writer", - "tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer" - }, - "time": "2018-10-21T10:04:54+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-2.1-or-later" - ], - "authors": [ - { - "name": "Maarten Balliauw", - "homepage": "http://blog.maartenballiauw.be" - }, - { - "name": "Erik Tilt" - }, - { - "name": "Franck Lefevre", - "homepage": "http://rootslabs.net" - }, - { - "name": "Mark Baker", - "homepage": "http://markbakeruk.net" - } - ], - "description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine", - "homepage": "https://github.com/PHPOffice/PhpSpreadsheet", - "keywords": [ - "OpenXML", - "excel", - "gnumeric", - "ods", - "php", - "spreadsheet", - "xls", - "xlsx" - ] - }, - { - "name": "phpoffice/phpword", - "version": "0.15.0", - "version_normalized": "0.15.0.0", - "source": { - "type": "git", - "url": "https://github.com/PHPOffice/PHPWord.git", - "reference": "dfa2f36cad2b632b7ab1c56473e4f5db9a7caf7f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHPOffice/PHPWord/zipball/dfa2f36cad2b632b7ab1c56473e4f5db9a7caf7f", - "reference": "dfa2f36cad2b632b7ab1c56473e4f5db9a7caf7f", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "ext-xml": "*", - "php": "^5.3.3 || ^7.0", - "phpoffice/common": "^0.2.9", - "zendframework/zend-escaper": "^2.2" - }, - "require-dev": { - "dompdf/dompdf": "0.8.*", - "ext-gd": "*", - "ext-zip": "*", - "friendsofphp/php-cs-fixer": "^2.2", - "mpdf/mpdf": "5.7.4 || 6.* || 7.*", - "php-coveralls/php-coveralls": "1.1.0 || ^2.0", - "phploc/phploc": "2.* || 3.* || 4.*", - "phpmd/phpmd": "2.*", - "phpunit/phpunit": "^4.8.36 || ^7.0", - "squizlabs/php_codesniffer": "^2.9", - "tecnickcom/tcpdf": "6.*" - }, - "suggest": { - "dompdf/dompdf": "Allows writing PDF", - "ext-gd2": "Allows adding images", - "ext-xmlwriter": "Allows writing OOXML and ODF", - "ext-xsl": "Allows applying XSL style sheet to headers, to main document part, and to footers of an OOXML template", - "ext-zip": "Allows writing OOXML and ODF" - }, - "time": "2018-07-14T16:59:43+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-develop": "0.16-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "PhpOffice\\PhpWord\\": "src/PhpWord" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-3.0" - ], - "authors": [ - { - "name": "Mark Baker" - }, - { - "name": "Gabriel Bull", - "email": "me@gabrielbull.com", - "homepage": "http://gabrielbull.com/" - }, - { - "name": "Ivan Lanin", - "homepage": "http://ivan.lanin.org" - }, - { - "name": "Roman Syroeshko", - "homepage": "http://ru.linkedin.com/pub/roman-syroeshko/34/a53/994/" - }, - { - "name": "Franck Lefevre", - "homepage": "https://rootslabs.net/blog/" - }, - { - "name": "Antoine de Troostembergh" - } - ], - "description": "PHPWord - A pure PHP library for reading and writing word processing documents (OOXML, ODF, RTF, HTML, PDF)", - "homepage": "http://phpoffice.github.io", - "keywords": [ - "ISO IEC 29500", - "OOXML", - "Office Open XML", - "OpenDocument", - "OpenXML", - "PhpOffice", - "PhpWord", - "Rich Text Format", - "WordprocessingML", - "doc", - "docx", - "html", - "odf", - "odt", - "office", - "pdf", - "php", - "reader", - "rtf", - "template", - "template processor", - "word", - "writer" - ] - }, - { - "name": "psr/simple-cache", - "version": "1.0.1", - "version_normalized": "1.0.1.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/simple-cache.git", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.3.0" - }, - "time": "2017-10-23T01:57:42+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Psr\\SimpleCache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interfaces for simple caching", - "keywords": [ - "cache", - "caching", - "psr", - "psr-16", - "simple-cache" - ] - }, - { - "name": "symfony/inflector", - "version": "v4.1.8", - "version_normalized": "4.1.8.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/inflector.git", - "reference": "8da789363973920dd7df6753822810592138e5ba" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/inflector/zipball/8da789363973920dd7df6753822810592138e5ba", - "reference": "8da789363973920dd7df6753822810592138e5ba", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^7.1.3", - "symfony/polyfill-ctype": "~1.8" - }, - "time": "2018-11-11T19:51:29+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.1-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\Inflector\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Inflector Component", - "homepage": "https://symfony.com", - "keywords": [ - "inflection", - "pluralize", - "singularize", - "string", - "symfony", - "words" - ] - }, - { - "name": "symfony/options-resolver", - "version": "v4.1.8", - "version_normalized": "4.1.8.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/options-resolver.git", - "reference": "31e5523373cb06163079ef46d0a2d507d70fe064" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/31e5523373cb06163079ef46d0a2d507d70fe064", - "reference": "31e5523373cb06163079ef46d0a2d507d70fe064", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^7.1.3" - }, - "time": "2018-11-11T19:51:29+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.1-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\OptionsResolver\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony OptionsResolver Component", - "homepage": "https://symfony.com", - "keywords": [ - "config", - "configuration", - "options" - ] - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.10.0", - "version_normalized": "1.10.0.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", - "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "time": "2018-08-06T14:22:27+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - }, - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ] - }, - { - "name": "symfony/property-access", - "version": "v4.1.8", - "version_normalized": "4.1.8.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/property-access.git", - "reference": "10edb6c4b6f496a2ed40a788ebbd280b421985ae" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/property-access/zipball/10edb6c4b6f496a2ed40a788ebbd280b421985ae", - "reference": "10edb6c4b6f496a2ed40a788ebbd280b421985ae", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^7.1.3", - "symfony/inflector": "~3.4|~4.0" - }, - "require-dev": { - "symfony/cache": "~3.4|~4.0" - }, - "suggest": { - "psr/cache-implementation": "To cache access methods." - }, - "time": "2018-11-26T12:16:25+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.1-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Symfony\\Component\\PropertyAccess\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony PropertyAccess Component", - "homepage": "https://symfony.com", - "keywords": [ - "access", - "array", - "extraction", - "index", - "injection", - "object", - "property", - "property path", - "reflection" - ] - }, - { - "name": "topthink/framework", - "version": "v5.1.39", - "version_normalized": "5.1.39.0", - "source": { - "type": "git", - "url": "https://github.com/top-think/framework.git", - "reference": "5762858f3d58faafb3a39427f8788884b2927007" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/top-think/framework/zipball/5762858f3d58faafb3a39427f8788884b2927007", - "reference": "5762858f3d58faafb3a39427f8788884b2927007", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.6.0", - "topthink/think-installer": "2.*" - }, - "require-dev": { - "johnkary/phpunit-speedtrap": "^1.0", - "mikey179/vfsstream": "~1.6", - "phpdocumentor/reflection-docblock": "^2.0", - "phploc/phploc": "2.*", - "phpunit/phpunit": "^5.0|^6.0", - "sebastian/phpcpd": "2.*", - "squizlabs/php_codesniffer": "2.*" - }, - "time": "2019-11-17T23:22:02+00:00", - "type": "think-framework", - "installation-source": "dist", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "liu21st", - "email": "liu21st@gmail.com" - }, - { - "name": "yunwuxin", - "email": "448901948@qq.com" - } - ], - "description": "the new thinkphp framework", - "homepage": "http://thinkphp.cn/", - "keywords": [ - "framework", - "orm", - "thinkphp" - ] - }, - { - "name": "topthink/think-captcha", - "version": "v2.0.2", - "version_normalized": "2.0.2.0", - "source": { - "type": "git", - "url": "https://github.com/top-think/think-captcha.git", - "reference": "54c8a51552f99ff9ea89ea9c272383a8f738ceee" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/top-think/think-captcha/zipball/54c8a51552f99ff9ea89ea9c272383a8f738ceee", - "reference": "54c8a51552f99ff9ea89ea9c272383a8f738ceee", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "topthink/framework": "5.1.*" - }, - "time": "2017-12-31T16:37:49+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "think\\captcha\\": "src/" - }, - "files": [ - "src/helper.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "yunwuxin", - "email": "448901948@qq.com" - } - ], - "description": "captcha package for thinkphp5" - }, - { - "name": "topthink/think-helper", - "version": "v1.0.6", - "version_normalized": "1.0.6.0", - "source": { - "type": "git", - "url": "https://github.com/top-think/think-helper.git", - "reference": "0c99dc625b0d2d4124e1b6ca15a3ad6f0125963f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/top-think/think-helper/zipball/0c99dc625b0d2d4124e1b6ca15a3ad6f0125963f", - "reference": "0c99dc625b0d2d4124e1b6ca15a3ad6f0125963f", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "time": "2017-04-05T07:15:37+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "think\\helper\\": "src" - }, - "files": [ - "src/helper.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "yunwuxin", - "email": "448901948@qq.com" - } - ], - "description": "The ThinkPHP5 Helper Package" - }, - { - "name": "topthink/think-installer", - "version": "v2.0.0", - "version_normalized": "2.0.0.0", - "source": { - "type": "git", - "url": "https://github.com/top-think/think-installer.git", - "reference": "f5400a12c60e513911aef41fe443fa6920952675" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/top-think/think-installer/zipball/f5400a12c60e513911aef41fe443fa6920952675", - "reference": "f5400a12c60e513911aef41fe443fa6920952675", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "composer-plugin-api": "^1.0" - }, - "require-dev": { - "composer/composer": "1.0.*@dev" - }, - "time": "2018-05-11T06:45:42+00:00", - "type": "composer-plugin", - "extra": { - "class": "think\\composer\\Plugin" - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "think\\composer\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "yunwuxin", - "email": "448901948@qq.com" - } - ] - }, - { - "name": "topthink/think-migration", - "version": "v2.0.3", - "version_normalized": "2.0.3.0", - "source": { - "type": "git", - "url": "https://github.com/top-think/think-migration.git", - "reference": "70c89850ca29c2eab988c7c3475d1d5331901bb8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/top-think/think-migration/zipball/70c89850ca29c2eab988c7c3475d1d5331901bb8", - "reference": "70c89850ca29c2eab988c7c3475d1d5331901bb8", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "topthink/framework": "5.1.*" - }, - "time": "2017-12-31T16:32:22+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "Phinx\\": "phinx/src/Phinx", - "think\\migration\\": "src" - }, - "files": [ - "src/config.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "yunwuxin", - "email": "448901948@qq.com" - } - ] - }, - { - "name": "whitehat101/apr1-md5", - "version": "v1.0.0", - "version_normalized": "1.0.0.0", - "source": { - "type": "git", - "url": "https://github.com/whitehat101/apr1-md5.git", - "reference": "8b261c9fc0481b4e9fa9d01c6ca70867b5d5e819" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/whitehat101/apr1-md5/zipball/8b261c9fc0481b4e9fa9d01c6ca70867b5d5e819", - "reference": "8b261c9fc0481b4e9fa9d01c6ca70867b5d5e819", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": ">=5.3.0" - }, - "require-dev": { - "phpunit/phpunit": "4.0.*" - }, - "time": "2015-02-11T11:06:42+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "WhiteHat101\\Crypt\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jeremy Ebler", - "email": "jebler@gmail.com" - } - ], - "description": "Apache's APR1-MD5 algorithm in pure PHP", - "homepage": "https://github.com/whitehat101/apr1-md5", - "keywords": [ - "MD5", - "apr1" - ] - }, - { - "name": "zendframework/zend-escaper", - "version": "2.6.0", - "version_normalized": "2.6.0.0", - "source": { - "type": "git", - "url": "https://github.com/zendframework/zend-escaper.git", - "reference": "31d8aafae982f9568287cb4dce987e6aff8fd074" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-escaper/zipball/31d8aafae982f9568287cb4dce987e6aff8fd074", - "reference": "31d8aafae982f9568287cb4dce987e6aff8fd074", - "shasum": "", - "mirrors": [ - { - "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", - "preferred": true - } - ] - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2", - "zendframework/zend-coding-standard": "~1.0.0" - }, - "time": "2018-04-25T15:48:53+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6.x-dev", - "dev-develop": "2.7.x-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Zend\\Escaper\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "description": "Securely and safely escape HTML, HTML attributes, JavaScript, CSS, and URLs", - "keywords": [ - "ZendFramework", - "escaper", - "zf" - ] - } -] diff --git a/vendor/endroid/installer/.gitignore b/vendor/endroid/installer/.gitignore deleted file mode 100644 index c8153b57..00000000 --- a/vendor/endroid/installer/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/composer.lock -/vendor/ diff --git a/vendor/endroid/installer/.travis.yml b/vendor/endroid/installer/.travis.yml deleted file mode 100644 index 610dbd72..00000000 --- a/vendor/endroid/installer/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -language: php - -php: - - 7.1 - - 7.2 - - nightly - -env: - - COMPOSER_FLAGS="--prefer-lowest" - - COMPOSER_FLAGS="" - -matrix: - fast_finish: true - allow_failures: - - php: nightly - -before_install: - - composer self-update - -install: - - composer update --no-interaction --prefer-dist $COMPOSER_FLAGS - -script: - - vendor/bin/phpunit - -notifications: - email: info@endroid.nl diff --git a/vendor/endroid/installer/LICENSE b/vendor/endroid/installer/LICENSE deleted file mode 100644 index 0966ce0e..00000000 --- a/vendor/endroid/installer/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) Jeroen van den Enden - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/endroid/installer/README.md b/vendor/endroid/installer/README.md deleted file mode 100644 index 69fcc4db..00000000 --- a/vendor/endroid/installer/README.md +++ /dev/null @@ -1,66 +0,0 @@ -# Installer - -*By [endroid](https://endroid.nl/)* - -[![Latest Stable Version](http://img.shields.io/packagist/v/endroid/installer.svg)](https://packagist.org/packages/endroid/installer) -[![Build Status](http://img.shields.io/travis/endroid/installer.svg)](http://travis-ci.org/endroid/installer) -[![Total Downloads](http://img.shields.io/packagist/dt/endroid/installer.svg)](https://packagist.org/packages/endroid/installer) -[![License](http://img.shields.io/packagist/l/endroid/installer.svg)](https://packagist.org/packages/endroid/installer) - -Composer plugin for installing configuration files. The installer automatically -detects the project type in which your library is installed and installs the -corresponding configuration files from your package. - -Read the [blog](https://medium.com/@endroid/auto-package-configuration-for-symfony-e14780e29d81) -for more information on why I created this plugin. - -## Installation - -``` bash -$ composer require endroid/installer -``` - -## Usage - -Add the configuration files you want to be copied upon installation. - -``` -.install - symfony - config - packages - package_name.yaml - routes - package_name.yaml -``` - -## Configuration - -Generally you want the files to be installed automatically but if you -experience issues with the installer or just don't want some package to be -auto installed you can specify this via your composer.json. - -``` -"extra": { - "endroid": { - "installer": { - "enabled": false, - "exclude": [ - "endroid/asset", - "endroid/embed" - ] - } - } -} -``` - -## Versioning - -Version numbers follow the MAJOR.MINOR.PATCH scheme. Backwards compatible -changes will be kept to a minimum but be aware that these can occur. Lock -your dependencies for production and test your code when upgrading. - -## License - -This bundle is under the MIT license. For the full copyright and license -information please view the LICENSE file that was distributed with this source code. diff --git a/vendor/endroid/installer/composer.json b/vendor/endroid/installer/composer.json deleted file mode 100644 index 5cd43ba2..00000000 --- a/vendor/endroid/installer/composer.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "endroid/installer", - "type": "composer-plugin", - "license": "MIT", - "authors": [ - { - "name": "Jeroen van den Enden", - "email": "info@endroid.nl" - } - ], - "require": { - "php": ">=7.1", - "composer-plugin-api": "^1.1" - }, - "require-dev": { - "phpunit/phpunit": "^5.7|^6.0" - }, - "autoload": { - "psr-4": { - "Endroid\\Installer\\": "src" - } - }, - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - }, - "class": "Endroid\\Installer\\Installer" - } -} diff --git a/vendor/endroid/installer/phpunit.xml.dist b/vendor/endroid/installer/phpunit.xml.dist deleted file mode 100644 index 2c56aa1a..00000000 --- a/vendor/endroid/installer/phpunit.xml.dist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - tests - - - diff --git a/vendor/endroid/installer/src/Installer.php b/vendor/endroid/installer/src/Installer.php deleted file mode 100644 index ca8d006e..00000000 --- a/vendor/endroid/installer/src/Installer.php +++ /dev/null @@ -1,136 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Endroid\Installer; - -use Composer\Composer; -use Composer\EventDispatcher\EventSubscriberInterface; -use Composer\IO\IOInterface; -use Composer\Plugin\PluginInterface; -use Composer\Script\ScriptEvents; - -final class Installer implements PluginInterface, EventSubscriberInterface -{ - private $composer; - private $io; - - private $projectTypes = [ - 'symfony' => [ - 'config/packages', - 'public', - ], - ]; - - public function activate(Composer $composer, IOInterface $io): void - { - $this->composer = $composer; - $this->io = $io; - } - - public static function getSubscribedEvents(): array - { - return [ - ScriptEvents::POST_INSTALL_CMD => ['install', 1], - ScriptEvents::POST_UPDATE_CMD => ['install', 1], - ]; - } - - public function install(): void - { - $enabled = $this->composer->getPackage()->getExtra()['endroid']['installer']['enabled'] ?? true; - $exclude = $this->composer->getPackage()->getExtra()['endroid']['installer']['exclude'] ?? []; - - if (!$enabled) { - $this->io->write('Endroid Installer was disabled'); - - return; - } - - $projectType = $this->detectProjectType(); - - if (null === $projectType) { - $this->io->write('Endroid Installer did not detect a compatible project type for auto-configuration'); - - return; - } - - $processedPackages = []; - $this->io->write('Endroid Installer detected project type "'.$projectType.'"'); - $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getPackages(); - - foreach ($packages as $package) { - // Avoid handling duplicates: getPackages sometimes returns duplicates - if (in_array($package->getName(), $processedPackages)) { - continue; - } - $processedPackages[] = $package->getName(); - - // Skip excluded packages - if (in_array($package->getName(), $exclude)) { - $this->io->write('- Skipping '.$package->getName().''); - continue; - } - - // Check for installation files and install - $packagePath = $this->composer->getInstallationManager()->getInstallPath($package); - $sourcePath = $packagePath.DIRECTORY_SEPARATOR.'.install'.DIRECTORY_SEPARATOR.$projectType; - if (file_exists($sourcePath)) { - $changed = $this->copy($sourcePath, getcwd()); - if ($changed) { - $this->io->write('- Configured '.$package->getName().''); - } - } - } - } - - private function detectProjectType() - { - foreach ($this->projectTypes as $projectType => $paths) { - foreach ($paths as $path) { - if (!file_exists(getcwd().DIRECTORY_SEPARATOR.$path)) { - continue 2; - } - } - - return $projectType; - } - - return null; - } - - private function copy(string $sourcePath, string $targetPath): bool - { - $changed = false; - - $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($sourcePath, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST); - foreach ($iterator as $item) { - $target = $targetPath.DIRECTORY_SEPARATOR.$iterator->getSubPathName(); - if ($item->isDir()) { - if (!is_dir($target)) { - mkdir($target); - } - } elseif (!file_exists($target)) { - $this->copyFile($item, $target); - $changed = true; - } - } - - return $changed; - } - - public function copyFile(string $source, string $target): void - { - if (file_exists($target)) { - return; - } - - copy($source, $target); - @chmod($target, fileperms($target) | (fileperms($source) & 0111)); - } -} diff --git a/vendor/endroid/installer/tests/InstallerTest.php b/vendor/endroid/installer/tests/InstallerTest.php deleted file mode 100644 index 47bcf99c..00000000 --- a/vendor/endroid/installer/tests/InstallerTest.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Endroid\Installer\Tests; - -use PHPUnit\Framework\TestCase; - -class InstallerTest extends TestCase -{ - public function testNoTestsYet() - { - $this->assertTrue(true); - } -} diff --git a/vendor/endroid/qr-code/.gitignore b/vendor/endroid/qr-code/.gitignore deleted file mode 100644 index c8153b57..00000000 --- a/vendor/endroid/qr-code/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/composer.lock -/vendor/ diff --git a/vendor/endroid/qr-code/.travis.yml b/vendor/endroid/qr-code/.travis.yml deleted file mode 100644 index bca19467..00000000 --- a/vendor/endroid/qr-code/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -language: php - -php: - - 7.1 - - 7.2 - - 7.3 - -matrix: - fast_finish: true - -env: - - COMPOSER_FLAGS="--prefer-lowest" - - COMPOSER_FLAGS="" - -before_install: - - composer self-update - -install: - - composer update --no-interaction --prefer-dist $COMPOSER_FLAGS - -script: - - vendor/bin/phpunit - -notifications: - email: - - info@endroid.nl diff --git a/vendor/endroid/qr-code/LICENSE b/vendor/endroid/qr-code/LICENSE deleted file mode 100644 index 0966ce0e..00000000 --- a/vendor/endroid/qr-code/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) Jeroen van den Enden - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/vendor/endroid/qr-code/README.md b/vendor/endroid/qr-code/README.md deleted file mode 100644 index f877b729..00000000 --- a/vendor/endroid/qr-code/README.md +++ /dev/null @@ -1,111 +0,0 @@ -# QR Code - -*By [endroid](https://endroid.nl/)* - -[![Latest Stable Version](http://img.shields.io/packagist/v/endroid/qr-code.svg)](https://packagist.org/packages/endroid/qr-code) -[![Build Status](http://img.shields.io/travis/endroid/qr-code.svg)](http://travis-ci.org/endroid/qr-code) -[![Total Downloads](http://img.shields.io/packagist/dt/endroid/qr-code.svg)](https://packagist.org/packages/endroid/qr-code) -[![Monthly Downloads](http://img.shields.io/packagist/dm/endroid/qr-code.svg)](https://packagist.org/packages/endroid/qr-code) -[![License](http://img.shields.io/packagist/l/endroid/qr-code.svg)](https://packagist.org/packages/endroid/qr-code) - -This library helps you generate QR codes in a jiffy. Makes use of [bacon/bacon-qr-code](https://github.com/Bacon/BaconQrCode) -to generate the matrix and [khanamiryan/qrcode-detector-decoder](https://github.com/khanamiryan/php-qrcode-detector-decoder) -for validating generated QR codes. Further extended with Twig extensions, generation routes, a factory and a -Symfony bundle for easy installation and configuration. - -## Installation - -Use [Composer](https://getcomposer.org/) to install the library. - -``` bash -$ composer require endroid/qr-code -``` - -## Basic usage - -```php -use Endroid\QrCode\QrCode; - -$qrCode = new QrCode('Life is too short to be generating QR codes'); - -header('Content-Type: '.$qrCode->getContentType()); -echo $qrCode->writeString(); -``` - -## Advanced usage - -```php -use Endroid\QrCode\ErrorCorrectionLevel; -use Endroid\QrCode\LabelAlignment; -use Endroid\QrCode\QrCode; -use Endroid\QrCode\Response\QrCodeResponse; - -// Create a basic QR code -$qrCode = new QrCode('Life is too short to be generating QR codes'); -$qrCode->setSize(300); - -// Set advanced options -$qrCode->setWriterByName('png'); -$qrCode->setMargin(10); -$qrCode->setEncoding('UTF-8'); -$qrCode->setErrorCorrectionLevel(ErrorCorrectionLevel::HIGH); -$qrCode->setForegroundColor(['r' => 0, 'g' => 0, 'b' => 0, 'a' => 0]); -$qrCode->setBackgroundColor(['r' => 255, 'g' => 255, 'b' => 255, 'a' => 0]); -$qrCode->setLabel('Scan the code', 16, __DIR__.'/../assets/fonts/noto_sans.otf', LabelAlignment::CENTER); -$qrCode->setLogoPath(__DIR__.'/../assets/images/symfony.png'); -$qrCode->setLogoSize(150, 200); -$qrCode->setRoundBlockSize(true); -$qrCode->setValidateResult(false); -$qrCode->setWriterOptions(['exclude_xml_declaration' => true]); - -// Directly output the QR code -header('Content-Type: '.$qrCode->getContentType()); -echo $qrCode->writeString(); - -// Save it to a file -$qrCode->writeFile(__DIR__.'/qrcode.png'); - -// Create a response object -$response = new QrCodeResponse($qrCode); -``` - -![QR Code](https://endroid.nl/qr-code/Life%20is%20too%20short%20to%20be%20generating%20QR%20codes.png) - -## Built-in validation reader - -You can enable the built-in validation reader (disabled by default) by calling -setValidateResult(true). This validation reader does not guarantee that the QR -code will be readable by all readers but it helps you provide a minimum level -of quality. - -The readability of a QR code is primarily determined by the size, the input -length, the error correction level and any possible logo over the image so you -can tweak these parameters if you are looking for optimal results. You can also -check $qrCode->getRoundBlockSize() value to see if block dimensions are rounded -so that the image is more sharp and readable. - -Take note that the validator can consume quite amount of additional resources. - -## Symfony integration - -The [endroid/qr-code-bundle](https://github.com/endroid/qr-code-bundle) -integrates the QR code library in Symfony for an even better experience. - -* Configure your defaults (like image size, default writer etc.) -* Generate QR codes quickly from anywhere via the factory service -* Generate QR codes directly by typing an URL like /qr-code/\.png?size=300 -* Generate QR codes or URLs directly from Twig using dedicated functions - -Read the [bundle documentation](https://github.com/endroid/qr-code-bundle) -for more information. - -## Versioning - -Version numbers follow the MAJOR.MINOR.PATCH scheme. Backwards compatibility -breaking changes will be kept to a minimum but be aware that these can occur. -Lock your dependencies for production and test your code when upgrading. - -## License - -This bundle is under the MIT license. For the full copyright and license -information please view the LICENSE file that was distributed with this source code. diff --git a/vendor/endroid/qr-code/assets/fonts/noto_sans.otf b/vendor/endroid/qr-code/assets/fonts/noto_sans.otf deleted file mode 100644 index 296fbebd..00000000 Binary files a/vendor/endroid/qr-code/assets/fonts/noto_sans.otf and /dev/null differ diff --git a/vendor/endroid/qr-code/assets/fonts/open_sans.ttf b/vendor/endroid/qr-code/assets/fonts/open_sans.ttf deleted file mode 100644 index db433349..00000000 Binary files a/vendor/endroid/qr-code/assets/fonts/open_sans.ttf and /dev/null differ diff --git a/vendor/endroid/qr-code/assets/images/symfony.png b/vendor/endroid/qr-code/assets/images/symfony.png deleted file mode 100644 index 55fe1983..00000000 Binary files a/vendor/endroid/qr-code/assets/images/symfony.png and /dev/null differ diff --git a/vendor/endroid/qr-code/composer.json b/vendor/endroid/qr-code/composer.json deleted file mode 100644 index c78e5262..00000000 --- a/vendor/endroid/qr-code/composer.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "endroid/qr-code", - "description": "Endroid QR Code", - "keywords": ["endroid", "qrcode", "qr", "code", "bundle", "php"], - "homepage": "https://github.com/endroid/qr-code", - "type": "library", - "license": "MIT", - "authors": [ - { - "name": "Jeroen van den Enden", - "email": "info@endroid.nl" - } - ], - "require": { - "php": ">=7.1", - "ext-gd": "*", - "bacon/bacon-qr-code": "^1.0.3", - "endroid/installer": "^1.0.3", - "khanamiryan/qrcode-detector-decoder": "^1.0.2", - "myclabs/php-enum": "^1.5", - "symfony/options-resolver": "^2.7|^3.0|^4.0", - "symfony/property-access": "^2.7|^3.0|^4.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7|^6.0" - }, - "autoload": { - "psr-4": { - "Endroid\\QrCode\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "Endroid\\QrCode\\Tests\\": "tests/" - } - }, - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - } -} diff --git a/vendor/endroid/qr-code/phpunit.xml.dist b/vendor/endroid/qr-code/phpunit.xml.dist deleted file mode 100644 index 2c56aa1a..00000000 --- a/vendor/endroid/qr-code/phpunit.xml.dist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - tests - - - diff --git a/vendor/endroid/qr-code/src/ErrorCorrectionLevel.php b/vendor/endroid/qr-code/src/ErrorCorrectionLevel.php deleted file mode 100644 index b75c216d..00000000 --- a/vendor/endroid/qr-code/src/ErrorCorrectionLevel.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Endroid\QrCode; - -use MyCLabs\Enum\Enum; - -class ErrorCorrectionLevel extends Enum -{ - const LOW = 'low'; - const MEDIUM = 'medium'; - const QUARTILE = 'quartile'; - const HIGH = 'high'; -} diff --git a/vendor/endroid/qr-code/src/Exception/InvalidPathException.php b/vendor/endroid/qr-code/src/Exception/InvalidPathException.php deleted file mode 100644 index 987de088..00000000 --- a/vendor/endroid/qr-code/src/Exception/InvalidPathException.php +++ /dev/null @@ -1,16 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Endroid\QrCode\Exception; - -class InvalidPathException extends QrCodeException -{ -} diff --git a/vendor/endroid/qr-code/src/Exception/InvalidWriterException.php b/vendor/endroid/qr-code/src/Exception/InvalidWriterException.php deleted file mode 100644 index 62a609fb..00000000 --- a/vendor/endroid/qr-code/src/Exception/InvalidWriterException.php +++ /dev/null @@ -1,16 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Endroid\QrCode\Exception; - -class InvalidWriterException extends QrCodeException -{ -} diff --git a/vendor/endroid/qr-code/src/Exception/MissingExtensionException.php b/vendor/endroid/qr-code/src/Exception/MissingExtensionException.php deleted file mode 100644 index d9ea2c7c..00000000 --- a/vendor/endroid/qr-code/src/Exception/MissingExtensionException.php +++ /dev/null @@ -1,16 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Endroid\QrCode\Exception; - -class MissingExtensionException extends QrCodeException -{ -} diff --git a/vendor/endroid/qr-code/src/Exception/MissingFunctionException.php b/vendor/endroid/qr-code/src/Exception/MissingFunctionException.php deleted file mode 100644 index 667dbbd5..00000000 --- a/vendor/endroid/qr-code/src/Exception/MissingFunctionException.php +++ /dev/null @@ -1,16 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Endroid\QrCode\Exception; - -class MissingFunctionException extends QrCodeException -{ -} diff --git a/vendor/endroid/qr-code/src/Exception/MissingLogoHeightException.php b/vendor/endroid/qr-code/src/Exception/MissingLogoHeightException.php deleted file mode 100644 index fcd66bc2..00000000 --- a/vendor/endroid/qr-code/src/Exception/MissingLogoHeightException.php +++ /dev/null @@ -1,16 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Endroid\QrCode\Exception; - -class MissingLogoHeightException extends QrCodeException -{ -} diff --git a/vendor/endroid/qr-code/src/Exception/QrCodeException.php b/vendor/endroid/qr-code/src/Exception/QrCodeException.php deleted file mode 100644 index 74e61390..00000000 --- a/vendor/endroid/qr-code/src/Exception/QrCodeException.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Endroid\QrCode\Exception; - -use Exception; - -abstract class QrCodeException extends Exception -{ -} diff --git a/vendor/endroid/qr-code/src/Exception/UnsupportedExtensionException.php b/vendor/endroid/qr-code/src/Exception/UnsupportedExtensionException.php deleted file mode 100644 index 520e4913..00000000 --- a/vendor/endroid/qr-code/src/Exception/UnsupportedExtensionException.php +++ /dev/null @@ -1,16 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Endroid\QrCode\Exception; - -class UnsupportedExtensionException extends QrCodeException -{ -} diff --git a/vendor/endroid/qr-code/src/Exception/ValidationException.php b/vendor/endroid/qr-code/src/Exception/ValidationException.php deleted file mode 100644 index 4f6a227b..00000000 --- a/vendor/endroid/qr-code/src/Exception/ValidationException.php +++ /dev/null @@ -1,16 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Endroid\QrCode\Exception; - -class ValidationException extends QrCodeException -{ -} diff --git a/vendor/endroid/qr-code/src/Factory/QrCodeFactory.php b/vendor/endroid/qr-code/src/Factory/QrCodeFactory.php deleted file mode 100644 index b7079f48..00000000 --- a/vendor/endroid/qr-code/src/Factory/QrCodeFactory.php +++ /dev/null @@ -1,95 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Endroid\QrCode\Factory; - -use Endroid\QrCode\QrCode; -use Endroid\QrCode\QrCodeInterface; -use Endroid\QrCode\WriterRegistryInterface; -use Symfony\Component\OptionsResolver\OptionsResolver; -use Symfony\Component\PropertyAccess\PropertyAccess; - -class QrCodeFactory implements QrCodeFactoryInterface -{ - private $writerRegistry; - private $optionsResolver; - private $defaultOptions; - private $definedOptions = [ - 'writer', - 'writer_options', - 'size', - 'margin', - 'foreground_color', - 'background_color', - 'encoding', - 'round_block_size', - 'error_correction_level', - 'logo_path', - 'logo_width', - 'logo_height', - 'label', - 'label_font_size', - 'label_font_path', - 'label_alignment', - 'label_margin', - 'validate_result', - ]; - - public function __construct(array $defaultOptions = [], WriterRegistryInterface $writerRegistry = null) - { - $this->defaultOptions = $defaultOptions; - $this->writerRegistry = $writerRegistry; - } - - public function create(string $text = '', array $options = []): QrCodeInterface - { - $options = $this->getOptionsResolver()->resolve($options); - $accessor = PropertyAccess::createPropertyAccessor(); - - $qrCode = new QrCode($text); - - if ($this->writerRegistry instanceof WriterRegistryInterface) { - $qrCode->setWriterRegistry($this->writerRegistry); - } - - foreach ($this->definedOptions as $option) { - if (isset($options[$option])) { - if ('writer' === $option) { - $options['writer_by_name'] = $options[$option]; - $option = 'writer_by_name'; - } - $accessor->setValue($qrCode, $option, $options[$option]); - } - } - - return $qrCode; - } - - private function getOptionsResolver(): OptionsResolver - { - if (!$this->optionsResolver instanceof OptionsResolver) { - $this->optionsResolver = $this->createOptionsResolver(); - } - - return $this->optionsResolver; - } - - private function createOptionsResolver(): OptionsResolver - { - $optionsResolver = new OptionsResolver(); - $optionsResolver - ->setDefaults($this->defaultOptions) - ->setDefined($this->definedOptions) - ; - - return $optionsResolver; - } -} diff --git a/vendor/endroid/qr-code/src/Factory/QrCodeFactoryInterface.php b/vendor/endroid/qr-code/src/Factory/QrCodeFactoryInterface.php deleted file mode 100644 index 2953fd63..00000000 --- a/vendor/endroid/qr-code/src/Factory/QrCodeFactoryInterface.php +++ /dev/null @@ -1,19 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Endroid\QrCode\Factory; - -use Endroid\QrCode\QrCodeInterface; - -interface QrCodeFactoryInterface -{ - public function create(string $text = '', array $options = []): QrCodeInterface; -} diff --git a/vendor/endroid/qr-code/src/LabelAlignment.php b/vendor/endroid/qr-code/src/LabelAlignment.php deleted file mode 100644 index f96acc52..00000000 --- a/vendor/endroid/qr-code/src/LabelAlignment.php +++ /dev/null @@ -1,21 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Endroid\QrCode; - -use MyCLabs\Enum\Enum; - -class LabelAlignment extends Enum -{ - const LEFT = 'left'; - const CENTER = 'center'; - const RIGHT = 'right'; -} diff --git a/vendor/endroid/qr-code/src/QrCode.php b/vendor/endroid/qr-code/src/QrCode.php deleted file mode 100644 index 0b32cb37..00000000 --- a/vendor/endroid/qr-code/src/QrCode.php +++ /dev/null @@ -1,372 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Endroid\QrCode; - -use Endroid\QrCode\Exception\InvalidPathException; -use Endroid\QrCode\Exception\UnsupportedExtensionException; -use Endroid\QrCode\Writer\WriterInterface; - -class QrCode implements QrCodeInterface -{ - const LABEL_FONT_PATH_DEFAULT = __DIR__.'/../assets/fonts/noto_sans.otf'; - - private $text; - - private $size = 300; - private $margin = 10; - - private $foregroundColor = [ - 'r' => 0, - 'g' => 0, - 'b' => 0, - 'a' => 0, - ]; - - private $backgroundColor = [ - 'r' => 255, - 'g' => 255, - 'b' => 255, - 'a' => 0, - ]; - - private $encoding = 'UTF-8'; - private $roundBlockSize = true; - private $errorCorrectionLevel; - - private $logoPath; - private $logoWidth; - private $logoHeight; - - private $label; - private $labelFontSize = 16; - private $labelFontPath = self::LABEL_FONT_PATH_DEFAULT; - private $labelAlignment; - private $labelMargin = [ - 't' => 0, - 'r' => 10, - 'b' => 10, - 'l' => 10, - ]; - - private $writerRegistry; - private $writer; - private $writerOptions = []; - private $validateResult = false; - - public function __construct(string $text = '') - { - $this->text = $text; - - $this->errorCorrectionLevel = new ErrorCorrectionLevel(ErrorCorrectionLevel::LOW); - $this->labelAlignment = new LabelAlignment(LabelAlignment::CENTER); - } - - public function setText(string $text): void - { - $this->text = $text; - } - - public function getText(): string - { - return $this->text; - } - - public function setSize(int $size): void - { - $this->size = $size; - } - - public function getSize(): int - { - return $this->size; - } - - public function setMargin(int $margin): void - { - $this->margin = $margin; - } - - public function getMargin(): int - { - return $this->margin; - } - - public function setForegroundColor(array $foregroundColor): void - { - if (!isset($foregroundColor['a'])) { - $foregroundColor['a'] = 0; - } - - $this->foregroundColor = $foregroundColor; - } - - public function getForegroundColor(): array - { - return $this->foregroundColor; - } - - public function setBackgroundColor(array $backgroundColor): void - { - if (!isset($backgroundColor['a'])) { - $backgroundColor['a'] = 0; - } - - $this->backgroundColor = $backgroundColor; - } - - public function getBackgroundColor(): array - { - return $this->backgroundColor; - } - - public function setEncoding(string $encoding): void - { - $this->encoding = $encoding; - } - - public function getEncoding(): string - { - return $this->encoding; - } - - public function setRoundBlockSize(bool $roundBlockSize): void - { - $this->roundBlockSize = $roundBlockSize; - } - - public function getRoundBlockSize(): bool - { - return $this->roundBlockSize; - } - - public function setErrorCorrectionLevel(string $errorCorrectionLevel): void - { - $this->errorCorrectionLevel = new ErrorCorrectionLevel($errorCorrectionLevel); - } - - public function getErrorCorrectionLevel(): string - { - return $this->errorCorrectionLevel->getValue(); - } - - public function setLogoPath(string $logoPath): void - { - $logoPath = realpath($logoPath); - - if (!is_file($logoPath)) { - throw new InvalidPathException('Invalid logo path: '.$logoPath); - } - - $this->logoPath = $logoPath; - } - - public function getLogoPath(): ?string - { - return $this->logoPath; - } - - public function setLogoSize(int $logoWidth, int $logoHeight = null): void - { - $this->logoWidth = $logoWidth; - $this->logoHeight = $logoHeight; - } - - public function setLogoWidth(int $logoWidth): void - { - $this->logoWidth = $logoWidth; - } - - public function getLogoWidth(): ?int - { - return $this->logoWidth; - } - - public function setLogoHeight(int $logoHeight): void - { - $this->logoHeight = $logoHeight; - } - - public function getLogoHeight(): ?int - { - return $this->logoHeight; - } - - public function setLabel(string $label, int $labelFontSize = null, string $labelFontPath = null, string $labelAlignment = null, array $labelMargin = null): void - { - $this->label = $label; - - if (null !== $labelFontSize) { - $this->setLabelFontSize($labelFontSize); - } - - if (null !== $labelFontPath) { - $this->setLabelFontPath($labelFontPath); - } - - if (null !== $labelAlignment) { - $this->setLabelAlignment($labelAlignment); - } - - if (null !== $labelMargin) { - $this->setLabelMargin($labelMargin); - } - } - - public function getLabel(): ?string - { - return $this->label; - } - - public function setLabelFontSize(int $labelFontSize): void - { - $this->labelFontSize = $labelFontSize; - } - - public function getLabelFontSize(): ?int - { - return $this->labelFontSize; - } - - public function setLabelFontPath(string $labelFontPath): void - { - $labelFontPath = realpath($labelFontPath); - - if (!is_file($labelFontPath)) { - throw new InvalidPathException('Invalid label font path: '.$labelFontPath); - } - - $this->labelFontPath = $labelFontPath; - } - - public function getLabelFontPath(): ?string - { - return $this->labelFontPath; - } - - public function setLabelAlignment(string $labelAlignment): void - { - $this->labelAlignment = new LabelAlignment($labelAlignment); - } - - public function getLabelAlignment(): ?string - { - return $this->labelAlignment->getValue(); - } - - public function setLabelMargin(array $labelMargin): void - { - $this->labelMargin = array_merge($this->labelMargin, $labelMargin); - } - - public function getLabelMargin(): ?array - { - return $this->labelMargin; - } - - public function setWriterRegistry(WriterRegistryInterface $writerRegistry): void - { - $this->writerRegistry = $writerRegistry; - } - - public function setWriter(WriterInterface $writer): void - { - $this->writer = $writer; - } - - public function getWriter(string $name = null): WriterInterface - { - if (!$this->writerRegistry instanceof WriterRegistryInterface) { - $this->createWriterRegistry(); - } - - if (!is_null($name)) { - return $this->writerRegistry->getWriter($name); - } - - if ($this->writer instanceof WriterInterface) { - return $this->writer; - } - - return $this->writerRegistry->getDefaultWriter(); - } - - public function setWriterOptions(array $writerOptions): void - { - $this->writerOptions = $writerOptions; - } - - public function getWriterOptions(): array - { - return $this->writerOptions; - } - - private function createWriterRegistry() - { - $this->writerRegistry = new WriterRegistry(); - $this->writerRegistry->loadDefaultWriters(); - } - - public function setWriterByName(string $name) - { - $this->writer = $this->getWriter($name); - } - - public function setWriterByPath(string $path): void - { - $extension = pathinfo($path, PATHINFO_EXTENSION); - - $this->setWriterByExtension($extension); - } - - public function setWriterByExtension(string $extension): void - { - foreach ($this->writerRegistry->getWriters() as $writer) { - if ($writer->supportsExtension($extension)) { - $this->writer = $writer; - - return; - } - } - - throw new UnsupportedExtensionException('Missing writer for extension "'.$extension.'"'); - } - - public function writeString(): string - { - return $this->getWriter()->writeString($this); - } - - public function writeDataUri(): string - { - return $this->getWriter()->writeDataUri($this); - } - - public function writeFile(string $path): void - { - $this->getWriter()->writeFile($this, $path); - } - - public function getContentType(): string - { - return $this->getWriter()->getContentType(); - } - - public function setValidateResult(bool $validateResult): void - { - $this->validateResult = $validateResult; - } - - public function getValidateResult(): bool - { - return $this->validateResult; - } -} diff --git a/vendor/endroid/qr-code/src/QrCodeInterface.php b/vendor/endroid/qr-code/src/QrCodeInterface.php deleted file mode 100644 index bb1d78f4..00000000 --- a/vendor/endroid/qr-code/src/QrCodeInterface.php +++ /dev/null @@ -1,61 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Endroid\QrCode; - -interface QrCodeInterface -{ - public function getText(): string; - - public function getSize(): int; - - public function getMargin(): int; - - public function getForegroundColor(): array; - - public function getBackgroundColor(): array; - - public function getEncoding(): string; - - public function getRoundBlockSize(): bool; - - public function getErrorCorrectionLevel(): string; - - public function getLogoPath(): ?string; - - public function getLogoWidth(): ?int; - - public function getLogoHeight(): ?int; - - public function getLabel(): ?string; - - public function getLabelFontPath(): ?string; - - public function getLabelFontSize(): ?int; - - public function getLabelAlignment(): ?string; - - public function getLabelMargin(): ?array; - - public function getValidateResult(): bool; - - public function getWriterOptions(): array; - - public function getContentType(): string; - - public function setWriterRegistry(WriterRegistryInterface $writerRegistry): void; - - public function writeString(): string; - - public function writeDataUri(): string; - - public function writeFile(string $path): void; -} diff --git a/vendor/endroid/qr-code/src/Response/QrCodeResponse.php b/vendor/endroid/qr-code/src/Response/QrCodeResponse.php deleted file mode 100644 index 8540998c..00000000 --- a/vendor/endroid/qr-code/src/Response/QrCodeResponse.php +++ /dev/null @@ -1,23 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Endroid\QrCode\Response; - -use Endroid\QrCode\QrCodeInterface; -use Symfony\Component\HttpFoundation\Response; - -class QrCodeResponse extends Response -{ - public function __construct(QrCodeInterface $qrCode) - { - parent::__construct($qrCode->writeString(), Response::HTTP_OK, ['Content-Type' => $qrCode->getContentType()]); - } -} diff --git a/vendor/endroid/qr-code/src/Writer/AbstractWriter.php b/vendor/endroid/qr-code/src/Writer/AbstractWriter.php deleted file mode 100644 index ed1cecb4..00000000 --- a/vendor/endroid/qr-code/src/Writer/AbstractWriter.php +++ /dev/null @@ -1,75 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Endroid\QrCode\Writer; - -use BaconQrCode\Common\ErrorCorrectionLevel; -use BaconQrCode\Encoder\Encoder; -use Endroid\QrCode\QrCodeInterface; - -abstract class AbstractWriter implements WriterInterface -{ - protected function getData(QrCodeInterface $qrCode): array - { - $name = strtoupper(substr($qrCode->getErrorCorrectionLevel(), 0, 1)); - $errorCorrectionLevel = constant('BaconQrCode\Common\ErrorCorrectionLevel::'.$name); - - $baconQrCode = Encoder::encode($qrCode->getText(), new ErrorCorrectionLevel($errorCorrectionLevel), $qrCode->getEncoding()); - - $matrix = $baconQrCode->getMatrix()->getArray()->toArray(); - foreach ($matrix as &$row) { - $row = $row->toArray(); - } - - $data = ['matrix' => $matrix]; - $data['block_count'] = count($matrix[0]); - $data['block_size'] = $qrCode->getSize() / $data['block_count']; - if ($qrCode->getRoundBlockSize()) { - $data['block_size'] = intval(floor($data['block_size'])); - } - $data['inner_width'] = $data['block_size'] * $data['block_count']; - $data['inner_height'] = $data['block_size'] * $data['block_count']; - $data['outer_width'] = $qrCode->getSize() + 2 * $qrCode->getMargin(); - $data['outer_height'] = $qrCode->getSize() + 2 * $qrCode->getMargin(); - $data['margin_left'] = ($data['outer_width'] - $data['inner_width']) / 2; - if ($qrCode->getRoundBlockSize()) { - $data['margin_left'] = intval(floor($data['margin_left'])); - } - $data['margin_right'] = $data['outer_width'] - $data['inner_width'] - $data['margin_left']; - - return $data; - } - - public function writeDataUri(QrCodeInterface $qrCode): string - { - $dataUri = 'data:'.$this->getContentType().';base64,'.base64_encode($this->writeString($qrCode)); - - return $dataUri; - } - - public function writeFile(QrCodeInterface $qrCode, string $path): void - { - $string = $this->writeString($qrCode); - file_put_contents($path, $string); - } - - public static function supportsExtension(string $extension): bool - { - return in_array($extension, static::getSupportedExtensions()); - } - - public static function getSupportedExtensions(): array - { - return []; - } - - abstract public function getName(): string; -} diff --git a/vendor/endroid/qr-code/src/Writer/BinaryWriter.php b/vendor/endroid/qr-code/src/Writer/BinaryWriter.php deleted file mode 100644 index 0ab61dcc..00000000 --- a/vendor/endroid/qr-code/src/Writer/BinaryWriter.php +++ /dev/null @@ -1,48 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Endroid\QrCode\Writer; - -use Endroid\QrCode\QrCodeInterface; - -class BinaryWriter extends AbstractWriter -{ - public function writeString(QrCodeInterface $qrCode): string - { - $data = $this->getData($qrCode); - - $rows = []; - foreach ($data['matrix'] as $row) { - $values = ''; - foreach ($row as $value) { - $values .= $value; - } - $rows[] = $values; - } - - return implode("\n", $rows); - } - - public static function getContentType(): string - { - return 'text/plain'; - } - - public static function getSupportedExtensions(): array - { - return ['bin', 'txt']; - } - - public function getName(): string - { - return 'binary'; - } -} diff --git a/vendor/endroid/qr-code/src/Writer/DebugWriter.php b/vendor/endroid/qr-code/src/Writer/DebugWriter.php deleted file mode 100644 index 9e5f097f..00000000 --- a/vendor/endroid/qr-code/src/Writer/DebugWriter.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Endroid\QrCode\Writer; - -use Endroid\QrCode\QrCodeInterface; -use ReflectionClass; -use Exception; - -class DebugWriter extends AbstractWriter -{ - public function writeString(QrCodeInterface $qrCode): string - { - $data = []; - - $reflectionClass = new ReflectionClass($qrCode); - foreach ($reflectionClass->getMethods() as $method) { - $methodName = $method->getShortName(); - if (0 === strpos($methodName, 'get') && 0 == $method->getNumberOfParameters()) { - $value = $qrCode->{$methodName}(); - if (is_array($value) && !is_object(current($value))) { - $value = '['.implode(', ', $value).']'; - } elseif (is_bool($value)) { - $value = $value ? 'true' : 'false'; - } elseif (is_string($value)) { - $value = '"'.$value.'"'; - } elseif (is_null($value)) { - $value = 'null'; - } - try { - $data[] = $methodName.': '.$value; - } catch (Exception $exception) { - } - } - } - - $string = implode(" \n", $data); - - return $string; - } - - public static function getContentType(): string - { - return 'text/plain'; - } - - public function getName(): string - { - return 'debug'; - } -} diff --git a/vendor/endroid/qr-code/src/Writer/EpsWriter.php b/vendor/endroid/qr-code/src/Writer/EpsWriter.php deleted file mode 100644 index a97d86f0..00000000 --- a/vendor/endroid/qr-code/src/Writer/EpsWriter.php +++ /dev/null @@ -1,57 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Endroid\QrCode\Writer; - -use Endroid\QrCode\QrCodeInterface; - -class EpsWriter extends AbstractWriter -{ - public function writeString(QrCodeInterface $qrCode): string - { - $data = $this->getData($qrCode); - - $epsData = []; - $epsData[] = '%!PS-Adobe-3.0 EPSF-3.0'; - $epsData[] = '%%BoundingBox: 0 0 '.$data['outer_width'].' '.$data['outer_height']; - $epsData[] = '/F { rectfill } def'; - $epsData[] = number_format($qrCode->getBackgroundColor()['r'] / 100, 2, '.', ',').' '.number_format($qrCode->getBackgroundColor()['g'] / 100, 2, '.', ',').' '.number_format($qrCode->getBackgroundColor()['b'] / 100, 2, '.', ',').' setrgbcolor'; - $epsData[] = '0 0 '.$data['outer_width'].' '.$data['outer_height'].' F'; - $epsData[] = number_format($qrCode->getForegroundColor()['r'] / 100, 2, '.', ',').' '.number_format($qrCode->getForegroundColor()['g'] / 100, 2, '.', ',').' '.number_format($qrCode->getForegroundColor()['b'] / 100, 2, '.', ',').' setrgbcolor'; - - foreach ($data['matrix'] as $row => $values) { - foreach ($values as $column => $value) { - if (1 === $value) { - $x = $data['margin_left'] + $data['block_size'] * $column; - $y = $data['margin_left'] + $data['block_size'] * $row; - $epsData[] = $x.' '.$y.' '.$data['block_size'].' '.$data['block_size'].' F'; - } - } - } - - return implode("\n", $epsData); - } - - public static function getContentType(): string - { - return 'image/eps'; - } - - public static function getSupportedExtensions(): array - { - return ['eps']; - } - - public function getName(): string - { - return 'eps'; - } -} diff --git a/vendor/endroid/qr-code/src/Writer/PngWriter.php b/vendor/endroid/qr-code/src/Writer/PngWriter.php deleted file mode 100644 index 8e5e2377..00000000 --- a/vendor/endroid/qr-code/src/Writer/PngWriter.php +++ /dev/null @@ -1,178 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Endroid\QrCode\Writer; - -use Endroid\QrCode\Exception\MissingFunctionException; -use Endroid\QrCode\Exception\ValidationException; -use Endroid\QrCode\LabelAlignment; -use Endroid\QrCode\QrCodeInterface; -use Zxing\QrReader; - -class PngWriter extends AbstractWriter -{ - public function writeString(QrCodeInterface $qrCode): string - { - $data = $this->getData($qrCode); - - $image = $this->createImage($data, $qrCode); - - if ($qrCode->getLogoPath()) { - $image = $this->addLogo($image, $qrCode->getLogoPath(), $qrCode->getLogoWidth(), $qrCode->getLogoHeight()); - } - - if ($qrCode->getLabel()) { - $image = $this->addLabel($image, $qrCode->getLabel(), $qrCode->getLabelFontPath(), $qrCode->getLabelFontSize(), $qrCode->getLabelAlignment(), $qrCode->getLabelMargin(), $qrCode->getForegroundColor(), $qrCode->getBackgroundColor()); - } - - $string = $this->imageToString($image); - - if ($qrCode->getValidateResult()) { - $reader = new QrReader($string, QrReader::SOURCE_TYPE_BLOB); - if ($reader->text() !== $qrCode->getText()) { - throw new ValidationException( - 'Built-in validation reader read "'.$reader->text().'" instead of "'.$qrCode->getText().'". - Adjust your parameters to increase readability or disable built-in validation.' - ); - } - } - - return $string; - } - - private function createImage(array $data, QrCodeInterface $qrCode) - { - $baseSize = $qrCode->getRoundBlockSize() ? $data['block_size'] : 25; - - $baseImage = $this->createBaseImage($baseSize, $data, $qrCode); - $interpolatedImage = $this->createInterpolatedImage($baseImage, $data, $qrCode); - - return $interpolatedImage; - } - - private function createBaseImage(int $baseSize, array $data, QrCodeInterface $qrCode) - { - $image = imagecreatetruecolor($data['block_count'] * $baseSize, $data['block_count'] * $baseSize); - $foregroundColor = imagecolorallocatealpha($image, $qrCode->getForegroundColor()['r'], $qrCode->getForegroundColor()['g'], $qrCode->getForegroundColor()['b'], $qrCode->getForegroundColor()['a']); - $backgroundColor = imagecolorallocatealpha($image, $qrCode->getBackgroundColor()['r'], $qrCode->getBackgroundColor()['g'], $qrCode->getBackgroundColor()['b'], $qrCode->getBackgroundColor()['a']); - imagefill($image, 0, 0, $backgroundColor); - - foreach ($data['matrix'] as $row => $values) { - foreach ($values as $column => $value) { - if (1 === $value) { - imagefilledrectangle($image, $column * $baseSize, $row * $baseSize, ($column + 1) * $baseSize, ($row + 1) * $baseSize, $foregroundColor); - } - } - } - - return $image; - } - - private function createInterpolatedImage($baseImage, array $data, QrCodeInterface $qrCode) - { - $image = imagecreatetruecolor($data['outer_width'], $data['outer_height']); - $backgroundColor = imagecolorallocatealpha($image, $qrCode->getBackgroundColor()['r'], $qrCode->getBackgroundColor()['g'], $qrCode->getBackgroundColor()['b'], $qrCode->getBackgroundColor()['a']); - imagefill($image, 0, 0, $backgroundColor); - imagecopyresampled($image, $baseImage, $data['margin_left'], $data['margin_left'], 0, 0, $data['inner_width'], $data['inner_height'], imagesx($baseImage), imagesy($baseImage)); - imagesavealpha($image, true); - - return $image; - } - - private function addLogo($sourceImage, string $logoPath, int $logoWidth = null, int $logoHeight = null) - { - $logoImage = imagecreatefromstring(file_get_contents($logoPath)); - $logoSourceWidth = imagesx($logoImage); - $logoSourceHeight = imagesy($logoImage); - - if (null === $logoWidth) { - $logoWidth = $logoSourceWidth; - } - - if (null === $logoHeight) { - $aspectRatio = $logoWidth / $logoSourceWidth; - $logoHeight = intval($logoSourceHeight * $aspectRatio); - } - - $logoX = imagesx($sourceImage) / 2 - $logoWidth / 2; - $logoY = imagesy($sourceImage) / 2 - $logoHeight / 2; - - imagecopyresampled($sourceImage, $logoImage, (int)$logoX, (int)$logoY, 0, 0, $logoWidth, $logoHeight, $logoSourceWidth, $logoSourceHeight); - - return $sourceImage; - } - - private function addLabel($sourceImage, string $label, string $labelFontPath, int $labelFontSize, string $labelAlignment, array $labelMargin, array $foregroundColor, array $backgroundColor) - { - if (!function_exists('imagettfbbox')) { - throw new MissingFunctionException('Missing function "imagettfbbox", please make sure you installed the FreeType library'); - } - - $labelBox = imagettfbbox($labelFontSize, 0, $labelFontPath, $label); - $labelBoxWidth = intval($labelBox[2] - $labelBox[0]); - $labelBoxHeight = intval($labelBox[0] - $labelBox[7]); - - $sourceWidth = imagesx($sourceImage); - $sourceHeight = imagesy($sourceImage); - $targetWidth = $sourceWidth; - $targetHeight = $sourceHeight + $labelBoxHeight + $labelMargin['t'] + $labelMargin['b']; - - // Create empty target image - $targetImage = imagecreatetruecolor($targetWidth, $targetHeight); - $foregroundColor = imagecolorallocate($targetImage, $foregroundColor['r'], $foregroundColor['g'], $foregroundColor['b']); - $backgroundColor = imagecolorallocate($targetImage, $backgroundColor['r'], $backgroundColor['g'], $backgroundColor['b']); - imagefill($targetImage, 0, 0, $backgroundColor); - - // Copy source image to target image - imagecopyresampled($targetImage, $sourceImage, 0, 0, 0, 0, $sourceWidth, $sourceHeight, $sourceWidth, $sourceHeight); - - switch ($labelAlignment) { - case LabelAlignment::LEFT: - $labelX = $labelMargin['l']; - break; - case LabelAlignment::RIGHT: - $labelX = $targetWidth - $labelBoxWidth - $labelMargin['r']; - break; - default: - $labelX = intval($targetWidth / 2 - $labelBoxWidth / 2); - break; - } - - $labelY = $targetHeight - $labelMargin['b']; - imagettftext($targetImage, $labelFontSize, 0, $labelX, $labelY, $foregroundColor, $labelFontPath, $label); - - return $targetImage; - } - - private function imageToString($image): string - { - ob_start(); - imagepng($image); - $string = ob_get_clean(); - - return $string; - } - - public static function getContentType(): string - { - return 'image/png'; - } - - public static function getSupportedExtensions(): array - { - return ['png']; - } - - public function getName(): string - { - return 'png'; - } -} diff --git a/vendor/endroid/qr-code/src/Writer/SvgWriter.php b/vendor/endroid/qr-code/src/Writer/SvgWriter.php deleted file mode 100644 index fefc0ed7..00000000 --- a/vendor/endroid/qr-code/src/Writer/SvgWriter.php +++ /dev/null @@ -1,140 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Endroid\QrCode\Writer; - -use Endroid\QrCode\Exception\MissingExtensionException; -use Endroid\QrCode\Exception\MissingLogoHeightException; -use Endroid\QrCode\Exception\ValidationException; -use Endroid\QrCode\QrCodeInterface; -use SimpleXMLElement; - -class SvgWriter extends AbstractWriter -{ - public function writeString(QrCodeInterface $qrCode): string - { - if ($qrCode->getValidateResult()) { - throw new ValidationException('Built-in validation reader can not check SVG images: please disable via setValidateResult(false)'); - } - - $data = $this->getData($qrCode); - - $svg = new SimpleXMLElement(''); - $svg->addAttribute('version', '1.1'); - $svg->addAttribute('width', $data['outer_width'].'px'); - $svg->addAttribute('height', $data['outer_height'].'px'); - $svg->addAttribute('viewBox', '0 0 '.$data['outer_width'].' '.$data['outer_height']); - $svg->addChild('defs'); - - // Block definition - $blockDefinition = $svg->defs->addChild('rect'); - $blockDefinition->addAttribute('id', 'block'); - $blockDefinition->addAttribute('width', strval($data['block_size'])); - $blockDefinition->addAttribute('height', strval($data['block_size'])); - $blockDefinition->addAttribute('fill', '#'.sprintf('%02x%02x%02x', $qrCode->getForegroundColor()['r'], $qrCode->getForegroundColor()['g'], $qrCode->getForegroundColor()['b'])); - $blockDefinition->addAttribute('fill-opacity', strval($this->getOpacity($qrCode->getForegroundColor()['a']))); - - // Background - $background = $svg->addChild('rect'); - $background->addAttribute('x', '0'); - $background->addAttribute('y', '0'); - $background->addAttribute('width', strval($data['outer_width'])); - $background->addAttribute('height', strval($data['outer_height'])); - $background->addAttribute('fill', '#'.sprintf('%02x%02x%02x', $qrCode->getBackgroundColor()['r'], $qrCode->getBackgroundColor()['g'], $qrCode->getBackgroundColor()['b'])); - $background->addAttribute('fill-opacity', strval($this->getOpacity($qrCode->getBackgroundColor()['a']))); - - foreach ($data['matrix'] as $row => $values) { - foreach ($values as $column => $value) { - if (1 === $value) { - $block = $svg->addChild('use'); - $block->addAttribute('x', strval($data['margin_left'] + $data['block_size'] * $column)); - $block->addAttribute('y', strval($data['margin_left'] + $data['block_size'] * $row)); - $block->addAttribute('xlink:href', '#block', 'http://www.w3.org/1999/xlink'); - } - } - } - - if ($qrCode->getLogoPath()) { - $this->addLogo($svg, $data['outer_width'], $data['outer_height'], $qrCode->getLogoPath(), $qrCode->getLogoWidth(), $qrCode->getLogoHeight()); - } - - $xml = $svg->asXML(); - - $options = $qrCode->getWriterOptions(); - if (isset($options['exclude_xml_declaration']) && $options['exclude_xml_declaration']) { - $xml = str_replace("\n", '', $xml); - } - - return $xml; - } - - private function addLogo(SimpleXMLElement $svg, int $imageWidth, int $imageHeight, string $logoPath, int $logoWidth, int $logoHeight = null): void - { - $mimeType = $this->getMimeType($logoPath); - $imageData = file_get_contents($logoPath); - - if (null === $logoHeight) { - if ('image/svg+xml' === $mimeType) { - throw new MissingLogoHeightException('SVG Logos require an explicit height set via setLogoSize($width, $height)'); - } else { - $logoImage = imagecreatefromstring($imageData); - $aspectRatio = $logoWidth / imagesx($logoImage); - $logoHeight = intval(imagesy($logoImage) * $aspectRatio); - } - } - - $imageDefinition = $svg->addChild('image'); - $imageDefinition->addAttribute('x', strval($imageWidth / 2 - $logoWidth / 2)); - $imageDefinition->addAttribute('y', strval($imageHeight / 2 - $logoHeight / 2)); - $imageDefinition->addAttribute('width', strval($logoWidth)); - $imageDefinition->addAttribute('height', strval($logoHeight)); - $imageDefinition->addAttribute('preserveAspectRatio', 'none'); - $imageDefinition->addAttribute('xlink:href', 'data:'.$mimeType.';base64,'.base64_encode($imageData)); - } - - private function getMimeType(string $path): string - { - if (!function_exists('mime_content_type')) { - throw new MissingExtensionException('You need the ext-fileinfo extension to determine the mime type'); - } - - $mimeType = mime_content_type($path); - - // Passing mime type image/svg results in invisible images - if ('image/svg' === $mimeType) { - return 'image/svg+xml'; - } - - return $mimeType; - } - - private function getOpacity(int $alpha): float - { - $opacity = 1 - $alpha / 127; - - return $opacity; - } - - public static function getContentType(): string - { - return 'image/svg+xml'; - } - - public static function getSupportedExtensions(): array - { - return ['svg']; - } - - public function getName(): string - { - return 'svg'; - } -} diff --git a/vendor/endroid/qr-code/src/Writer/WriterInterface.php b/vendor/endroid/qr-code/src/Writer/WriterInterface.php deleted file mode 100644 index 6bd462dd..00000000 --- a/vendor/endroid/qr-code/src/Writer/WriterInterface.php +++ /dev/null @@ -1,31 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Endroid\QrCode\Writer; - -use Endroid\QrCode\QrCodeInterface; - -interface WriterInterface -{ - public function writeString(QrCodeInterface $qrCode): string; - - public function writeDataUri(QrCodeInterface $qrCode): string; - - public function writeFile(QrCodeInterface $qrCode, string $path): void; - - public static function getContentType(): string; - - public static function supportsExtension(string $extension): bool; - - public static function getSupportedExtensions(): array; - - public function getName(): string; -} diff --git a/vendor/endroid/qr-code/src/WriterRegistry.php b/vendor/endroid/qr-code/src/WriterRegistry.php deleted file mode 100644 index 0755ad43..00000000 --- a/vendor/endroid/qr-code/src/WriterRegistry.php +++ /dev/null @@ -1,88 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Endroid\QrCode; - -use Endroid\QrCode\Exception\InvalidWriterException; -use Endroid\QrCode\Writer\BinaryWriter; -use Endroid\QrCode\Writer\DebugWriter; -use Endroid\QrCode\Writer\EpsWriter; -use Endroid\QrCode\Writer\PngWriter; -use Endroid\QrCode\Writer\SvgWriter; -use Endroid\QrCode\Writer\WriterInterface; - -class WriterRegistry implements WriterRegistryInterface -{ - private $writers = []; - private $defaultWriter; - - public function loadDefaultWriters(): void - { - if (count($this->writers) > 0) { - return; - } - - $this->addWriters([ - new BinaryWriter(), - new DebugWriter(), - new EpsWriter(), - new PngWriter(), - new SvgWriter(), - ]); - - $this->setDefaultWriter('png'); - } - - public function addWriters(iterable $writers): void - { - foreach ($writers as $writer) { - $this->addWriter($writer); - } - } - - public function addWriter(WriterInterface $writer): void - { - $this->writers[$writer->getName()] = $writer; - } - - public function getWriter(string $name): WriterInterface - { - $this->assertValidWriter($name); - - return $this->writers[$name]; - } - - public function getDefaultWriter() - { - if ($this->defaultWriter instanceof WriterInterface) { - return $this->defaultWriter; - } - - throw new InvalidWriterException('Please set the default writer via the second argument of addWriter'); - } - - public function setDefaultWriter(string $name) - { - $this->defaultWriter = $this->writers[$name]; - } - - public function getWriters(): array - { - return $this->writers; - } - - private function assertValidWriter(string $name) - { - if (!isset($this->writers[$name])) { - throw new InvalidWriterException('Invalid writer "'.$name.'"'); - } - } -} diff --git a/vendor/endroid/qr-code/src/WriterRegistryInterface.php b/vendor/endroid/qr-code/src/WriterRegistryInterface.php deleted file mode 100644 index 5a22d518..00000000 --- a/vendor/endroid/qr-code/src/WriterRegistryInterface.php +++ /dev/null @@ -1,25 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Endroid\QrCode; - -use Endroid\QrCode\Writer\WriterInterface; - -interface WriterRegistryInterface -{ - public function addWriters(iterable $writers): void; - - public function addWriter(WriterInterface $writer): void; - - public function getWriter(string $name): WriterInterface; - - public function getWriters(): array; -} diff --git a/vendor/endroid/qr-code/tests/QrCodeTest.php b/vendor/endroid/qr-code/tests/QrCodeTest.php deleted file mode 100644 index bda44025..00000000 --- a/vendor/endroid/qr-code/tests/QrCodeTest.php +++ /dev/null @@ -1,142 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Endroid\QrCode\Tests; - -use Endroid\QrCode\Factory\QrCodeFactory; -use Endroid\QrCode\QrCode; -use PHPUnit\Framework\TestCase; -use Zxing\QrReader; - -class QrCodeTest extends TestCase -{ - public function testReadable(): void - { - $messages = [ - 'Tiny', - 'This one has spaces', - 'd2llMS9uU01BVmlvalM2YU9BUFBPTTdQMmJabHpqdndt', - 'http://this.is.an/url?with=query&string=attached', - '11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111', - '{"i":"serialized.data","v":1,"t":1,"d":"4AEPc9XuIQ0OjsZoSRWp9DRWlN6UyDvuMlyOYy8XjOw="}', - 'Spëci&al ch@ract3rs', - '有限公司', - ]; - - $qrCode = new QrCode(); - $qrCode->setSize(300); - foreach ($messages as $message) { - $qrCode->setText($message); - $pngData = $qrCode->writeString(); - $this->assertTrue(is_string($pngData)); - $reader = new QrReader($pngData, QrReader::SOURCE_TYPE_BLOB); - $this->assertEquals($message, $reader->text()); - } - } - - public function testFactory(): void - { - $qrCodeFactory = new QrCodeFactory(); - $qrCode = $qrCodeFactory->create('QR Code', [ - 'writer' => 'png', - 'size' => 300, - 'margin' => 10, - ]); - - $pngData = $qrCode->writeString(); - $this->assertTrue(is_string($pngData)); - $reader = new QrReader($pngData, QrReader::SOURCE_TYPE_BLOB); - $this->assertEquals('QR Code', $reader->text()); - } - - public function testWriteQrCode(): void - { - $qrCode = new QrCode('QR Code'); - $qrCode->setLogoPath(__DIR__.'/../assets/images/symfony.png'); - $qrCode->setLogoWidth(100); - - $qrCode->setWriterByName('binary'); - $binData = $qrCode->writeString(); - $this->assertTrue(is_string($binData)); - - $qrCode->setWriterByName('debug'); - $debugData = $qrCode->writeString(); - $this->assertTrue(is_string($debugData)); - - $qrCode->setWriterByName('eps'); - $epsData = $qrCode->writeString(); - $this->assertTrue(is_string($epsData)); - - $qrCode->setWriterByName('png'); - $pngData = $qrCode->writeString(); - $this->assertTrue(is_string($pngData)); - $pngDataUriData = $qrCode->writeDataUri(); - $this->assertTrue(0 === strpos($pngDataUriData, 'data:image/png;base64')); - - $qrCode->setWriterByName('svg'); - $svgData = $qrCode->writeString(); - $this->assertTrue(is_string($svgData)); - $svgDataUriData = $qrCode->writeDataUri(); - $this->assertTrue(0 === strpos($svgDataUriData, 'data:image/svg+xml;base64')); - } - - public function testSetSize(): void - { - $size = 400; - $margin = 10; - - $qrCode = new QrCode('QR Code'); - $qrCode->setSize($size); - $qrCode->setMargin($margin); - - $pngData = $qrCode->writeString(); - $image = imagecreatefromstring($pngData); - - $this->assertTrue(imagesx($image) === $size + 2 * $margin); - $this->assertTrue(imagesy($image) === $size + 2 * $margin); - } - - public function testSetLabel(): void - { - $qrCode = new QrCode('QR Code'); - $qrCode->setSize(300); - $qrCode->setLabel('Scan the code', 15); - - $pngData = $qrCode->writeString(); - $this->assertTrue(is_string($pngData)); - $reader = new QrReader($pngData, QrReader::SOURCE_TYPE_BLOB); - $this->assertEquals('QR Code', $reader->text()); - } - - public function testSetLogo(): void - { - $qrCode = new QrCode('QR Code'); - $qrCode->setSize(500); - $qrCode->setLogoPath(__DIR__.'/../assets/images/symfony.png'); - $qrCode->setLogoWidth(100); - $qrCode->setValidateResult(true); - - $pngData = $qrCode->writeString(); - $this->assertTrue(is_string($pngData)); - } - - public function testWriteFile(): void - { - $filename = __DIR__.'/output/qr-code.png'; - - $qrCode = new QrCode('QR Code'); - $qrCode->writeFile($filename); - - $image = imagecreatefromstring(file_get_contents($filename)); - - $this->assertTrue(is_resource($image)); - } -} diff --git a/vendor/endroid/qr-code/tests/output/.gitignore b/vendor/endroid/qr-code/tests/output/.gitignore deleted file mode 100644 index a68d087b..00000000 --- a/vendor/endroid/qr-code/tests/output/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/* -!/.gitignore diff --git a/vendor/endroid/qrcode/.gitignore b/vendor/endroid/qrcode/.gitignore deleted file mode 100644 index c8153b57..00000000 --- a/vendor/endroid/qrcode/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/composer.lock -/vendor/ diff --git a/vendor/khanamiryan/qrcode-detector-decoder/.gitignore b/vendor/khanamiryan/qrcode-detector-decoder/.gitignore deleted file mode 100644 index f5675393..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/composer.lock -/vendor -.idea/ diff --git a/vendor/khanamiryan/qrcode-detector-decoder/README.md b/vendor/khanamiryan/qrcode-detector-decoder/README.md deleted file mode 100644 index f4eda03d..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# QR code decoder / reader for PHP -This is a PHP library to detect and decode QR-codes.
    This is first and only QR code reader that works without extensions.
    -Ported from [ZXing library](https://github.com/zxing/zxing) - - -## Installation -The recommended method of installing this library is via [Composer](https://getcomposer.org/). - -Run the following command from your project root: - -```bash -$ composer require khanamiryan/qrcode-detector-decoder -``` - - -## Usage -```php -require __DIR__ . "/vendor/autoload.php"; -$qrcode = new QrReader('path/to_image'); -$text = $qrcode->text(); //return decoded text from QR Code -``` - -## Requirements -* PHP >= 5.6 -* GD Library - - -## Contributing - -You can help the project by adding features, cleaning the code, adding composer and other. - - -1. Fork it -2. Create your feature branch: `git checkout -b my-new-feature` -3. Commit your changes: `git commit -am 'Add some feature'` -4. Push to the branch: `git push origin my-new-feature` -5. Submit a pull request diff --git a/vendor/khanamiryan/qrcode-detector-decoder/composer.json b/vendor/khanamiryan/qrcode-detector-decoder/composer.json deleted file mode 100644 index 4e75736c..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/composer.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "khanamiryan/qrcode-detector-decoder", - "type": "library", - "description": "QR code decoder / reader", - "keywords": [ - "qr", - "zxing", - "barcode" - ], - "homepage": "https://github.com/khanamiryan/php-qrcode-detector-decoder/", - "license": "MIT", - "authors": [ - { - "name": "Ashot Khanamiryan", - "email": "a.khanamiryan@gmail.com", - "homepage": "https://github.com/khanamiryan", - "role": "Developer" - } - ], - "require": { - "php": "^5.6|^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7" - }, - "autoload": { - "psr-4": { - "Zxing\\": "lib/" - }, - "files": [ - "lib/Common/customFunctions.php" - ] - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Binarizer.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Binarizer.php deleted file mode 100644 index 056890c7..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Binarizer.php +++ /dev/null @@ -1,96 +0,0 @@ -source = $source; - } - - /** - * @return LuminanceSource - */ - public final function getLuminanceSource() - { - return $this->source; - } - - /** - * Converts one row of luminance data to 1 bit data. May actually do the conversion, or return - * cached data. Callers should assume this method is expensive and call it as seldom as possible. - * This method is intended for decoding 1D barcodes and may choose to apply sharpening. - * For callers which only examine one row of pixels at a time, the same BitArray should be reused - * and passed in with each call for performance. However it is legal to keep more than one row - * at a time if needed. - * - * @param y The row to fetch, which must be in [0, bitmap height) - * @param row An optional preallocated array. If null or too small, it will be ignored. - * If used, the Binarizer will call BitArray.clear(). Always use the returned object. - * - * @return array The array of bits for this row (true means black). - * @throws NotFoundException if row can't be binarized - */ - public abstract function getBlackRow($y, $row); - - /** - * Converts a 2D array of luminance data to 1 bit data. As above, assume this method is expensive - * and do not call it repeatedly. This method is intended for decoding 2D barcodes and may or - * may not apply sharpening. Therefore, a row from this matrix may not be identical to one - * fetched using getBlackRow(), so don't mix and match between them. - * - * @return BitMatrix The 2D array of bits for the image (true means black). - * @throws NotFoundException if image can't be binarized to make a matrix - */ - public abstract function getBlackMatrix(); - - /** - * Creates a new object with the same type as this Binarizer implementation, but with pristine - * state. This is needed because Binarizer implementations may be stateful, e.g. keeping a cache - * of 1 bit data. See Effective Java for why we can't use Java's clone() method. - * - * @param source The LuminanceSource this Binarizer will operate on. - * - * @return Binarizer A new concrete Binarizer implementation object. - */ - public abstract function createBinarizer($source); - - public final function getWidth() - { - return $this->source->getWidth(); - } - - public final function getHeight() - { - return $this->source->getHeight(); - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/BinaryBitmap.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/BinaryBitmap.php deleted file mode 100644 index b23cb5f3..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/BinaryBitmap.php +++ /dev/null @@ -1,166 +0,0 @@ -binarizer = $binarizer; - } - - /** - * @return int The width of the bitmap. - */ - public function getWidth() - { - return $this->binarizer->getWidth(); - } - - /** - * @return int The height of the bitmap. - */ - public function getHeight() - { - return $this->binarizer->getHeight(); - } - - /** - * Converts one row of luminance data to 1 bit data. May actually do the conversion, or return - * cached data. Callers should assume this method is expensive and call it as seldom as possible. - * This method is intended for decoding 1D barcodes and may choose to apply sharpening. - * - * @param y The row to fetch, which must be in [0, bitmap height) - * @param row An optional preallocated array. If null or too small, it will be ignored. - * If used, the Binarizer will call BitArray.clear(). Always use the returned object. - * - * @return array The array of bits for this row (true means black). - * @throws NotFoundException if row can't be binarized - */ - public function getBlackRow($y, $row) - { - return $this->binarizer->getBlackRow($y, $row); - } - - /** - * @return bool Whether this bitmap can be cropped. - */ - public function isCropSupported() - { - return $this->binarizer->getLuminanceSource()->isCropSupported(); - } - - /** - * Returns a new object with cropped image data. Implementations may keep a reference to the - * original data rather than a copy. Only callable if isCropSupported() is true. - * - * @param left The left coordinate, which must be in [0,getWidth()) - * @param top The top coordinate, which must be in [0,getHeight()) - * @param width The width of the rectangle to crop. - * @param height The height of the rectangle to crop. - * - * @return BinaryBitmap A cropped version of this object. - */ - public function crop($left, $top, $width, $height) - { - $newSource = $this->binarizer->getLuminanceSource()->crop($left, $top, $width, $height); - - return new BinaryBitmap($this->binarizer->createBinarizer($newSource)); - } - - /** - * @return Whether this bitmap supports counter-clockwise rotation. - */ - public function isRotateSupported() - { - return $this->binarizer->getLuminanceSource()->isRotateSupported(); - } - - /** - * Returns a new object with rotated image data by 90 degrees counterclockwise. - * Only callable if {@link #isRotateSupported()} is true. - * - * @return BinaryBitmap A rotated version of this object. - */ - public function rotateCounterClockwise() - { - $newSource = $this->binarizer->getLuminanceSource()->rotateCounterClockwise(); - - return new BinaryBitmap($this->binarizer->createBinarizer($newSource)); - } - - /** - * Returns a new object with rotated image data by 45 degrees counterclockwise. - * Only callable if {@link #isRotateSupported()} is true. - * - * @return BinaryBitmap A rotated version of this object. - */ - public function rotateCounterClockwise45() - { - $newSource = $this->binarizer->getLuminanceSource()->rotateCounterClockwise45(); - - return new BinaryBitmap($this->binarizer->createBinarizer($newSource)); - } - - public function toString() - { - try { - return $this->getBlackMatrix()->toString(); - } catch (NotFoundException $e) { - } - - return ''; - } - - /** - * Converts a 2D array of luminance data to 1 bit. As above, assume this method is expensive - * and do not call it repeatedly. This method is intended for decoding 2D barcodes and may or - * may not apply sharpening. Therefore, a row from this matrix may not be identical to one - * fetched using getBlackRow(), so don't mix and match between them. - * - * @return BitMatrix The 2D array of bits for the image (true means black). - * @throws NotFoundException if image can't be binarized to make a matrix - */ - public function getBlackMatrix() - { - // The matrix is created on demand the first time it is requested, then cached. There are two - // reasons for this: - // 1. This work will never be done if the caller only installs 1D Reader objects, or if a - // 1D Reader finds a barcode before the 2D Readers run. - // 2. This work will only be done once even if the caller installs multiple 2D Readers. - if ($this->matrix === null) { - $this->matrix = $this->binarizer->getBlackMatrix(); - } - - return $this->matrix; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/ChecksumException.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/ChecksumException.php deleted file mode 100644 index ea23209b..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/ChecksumException.php +++ /dev/null @@ -1,42 +0,0 @@ -strict = $strict; - $this->change($initialValue); - } - - /** - * Changes the value of the enum. - * - * @param mixed $value - * - * @return void - */ - public function change($value) - { - if (!in_array($value, $this->getConstList(), $this->strict)) { - throw new \UnexpectedValueException('Value not a const in enum ' . get_class($this)); - } - $this->value = $value; - } - - /** - * Gets all constants (possible values) as an array. - * - * @param boolean $includeDefault - * - * @return array - */ - public function getConstList($includeDefault = true) - { - if ($this->constants === null) { - $reflection = new ReflectionClass($this); - $this->constants = $reflection->getConstants(); - } - if ($includeDefault) { - return $this->constants; - } - $constants = $this->constants; - unset($constants['__default']); - - return $constants; - } - - /** - * Gets current value. - * - * @return mixed - */ - public function get() - { - return $this->value; - } - - /** - * Gets the name of the enum. - * - * @return string - */ - public function __toString() - { - return (string)array_search($this->value, $this->getConstList()); - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/BitArray.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/BitArray.php deleted file mode 100644 index 4ab5a4c4..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/BitArray.php +++ /dev/null @@ -1,422 +0,0 @@ -A simple, fast array of bits, represented compactly by an array of ints internally.

    - * - * @author Sean Owen - */ - -final class BitArray -{ - - private $bits; - private $size; - - - public function __construct($bits = [], $size = 0) - { - - if (!$bits && !$size) { - $this->$size = 0; - $this->bits = []; - } elseif ($bits && !$size) { - $this->size = $bits; - $this->bits = $this->makeArray($bits); - } else { - $this->bits = $bits; - $this->size = $size; - } - - } - - private static function makeArray($size) - { - return []; - } - - public function getSize() - { - return $this->size; - } - - public function getSizeInBytes() - { - return ($this->size + 7) / 8; - } - - /** - * Sets bit i. - * - * @param i bit to set - */ - public function set($i) - { - $this->bits[(int)($i / 32)] |= 1 << ($i & 0x1F); - $this->bits[(int)($i / 32)] = ($this->bits[(int)($i / 32)]); - } - - /** - * Flips bit i. - * - * @param i bit to set - */ - public function flip($i) - { - $this->bits[(int)($i / 32)] ^= 1 << ($i & 0x1F); - $this->bits[(int)($i / 32)] = ($this->bits[(int)($i / 32)]); - } - - /** - * @param from first bit to check - * - * @return index of first bit that is set, starting from the given index, or size if none are set - * at or beyond this given index - * @see #getNextUnset(int) - */ - public function getNextSet($from) - { - if ($from >= $this->size) { - return $this->size; - } - $bitsOffset = (int)($from / 32); - $currentBits = (int)$this->bits[$bitsOffset]; - // mask off lesser bits first - $currentBits &= ~((1 << ($from & 0x1F)) - 1); - while ($currentBits == 0) { - if (++$bitsOffset == count($this->bits)) { - return $this->size; - } - $currentBits = $this->bits[$bitsOffset]; - } - $result = ($bitsOffset * 32) + numberOfTrailingZeros($currentBits); //numberOfTrailingZeros - - return $result > $this->size ? $this->size : $result; - } - - /** - * @param from index to start looking for unset bit - * - * @return index of next unset bit, or {@code size} if none are unset until the end - * @see #getNextSet(int) - */ - public function getNextUnset($from) - { - if ($from >= $this->size) { - return $this->size; - } - $bitsOffset = (int)($from / 32); - $currentBits = ~$this->bits[$bitsOffset]; - // mask off lesser bits first - $currentBits &= ~((1 << ($from & 0x1F)) - 1); - while ($currentBits == 0) { - if (++$bitsOffset == count($this->bits)) { - return $this->size; - } - $currentBits = (~$this->bits[$bitsOffset]); - } - $result = ($bitsOffset * 32) + numberOfTrailingZeros($currentBits); - - return $result > $this->size ? $this->size : $result; - } - - /** - * Sets a block of 32 bits, starting at bit i. - * - * @param i first bit to set - * @param newBits the new value of the next 32 bits. Note again that the least-significant bit - * corresponds to bit i, the next-least-significant to i+1, and so on. - */ - public function setBulk($i, $newBits) - { - $this->bits[(int)($i / 32)] = $newBits; - } - - /** - * Sets a range of bits. - * - * @param start start of range, inclusive. - * @param end end of range, exclusive - */ - public function setRange($start, $end) - { - if ($end < $start) { - throw new \InvalidArgumentException(); - } - if ($end == $start) { - return; - } - $end--; // will be easier to treat this as the last actually set bit -- inclusive - $firstInt = (int)($start / 32); - $lastInt = (int)($end / 32); - for ($i = $firstInt; $i <= $lastInt; $i++) { - $firstBit = $i > $firstInt ? 0 : $start & 0x1F; - $lastBit = $i < $lastInt ? 31 : $end & 0x1F; - $mask = 0; - if ($firstBit == 0 && $lastBit == 31) { - $mask = -1; - } else { - $mask = 0; - for ($j = $firstBit; $j <= $lastBit; $j++) { - $mask |= 1 << $j; - } - } - $this->bits[$i] = ($this->bits[$i] | $mask); - } - } - - /** - * Clears all bits (sets to false). - */ - public function clear() - { - $max = count($this->bits); - for ($i = 0; $i < $max; $i++) { - $this->bits[$i] = 0; - } - } - - /** - * Efficient method to check if a range of bits is set, or not set. - * - * @param start start of range, inclusive. - * @param end end of range, exclusive - * @param value if true, checks that bits in range are set, otherwise checks that they are not set - * - * @return true iff all bits are set or not set in range, according to value argument - * @throws InvalidArgumentException if end is less than or equal to start - */ - public function isRange($start, $end, $value) - { - if ($end < $start) { - throw new \InvalidArgumentException(); - } - if ($end == $start) { - return true; // empty range matches - } - $end--; // will be easier to treat this as the last actually set bit -- inclusive - $firstInt = (int)($start / 32); - $lastInt = (int)($end / 32); - for ($i = $firstInt; $i <= $lastInt; $i++) { - $firstBit = $i > $firstInt ? 0 : $start & 0x1F; - $lastBit = $i < $lastInt ? 31 : $end & 0x1F; - $mask = 0; - if ($firstBit == 0 && $lastBit == 31) { - $mask = -1; - } else { - $mask = 0; - for ($j = $firstBit; $j <= $lastBit; $j++) { - $mask = ($mask | (1 << $j)); - } - } - - // Return false if we're looking for 1s and the masked bits[i] isn't all 1s (that is, - // equals the mask, or we're looking for 0s and the masked portion is not all 0s - if (($this->bits[$i] & $mask) != ($value ? $mask : 0)) { - return false; - } - } - - return true; - } - - /** - * Appends the least-significant bits, from value, in order from most-significant to - * least-significant. For example, appending 6 bits from 0x000001E will append the bits - * 0, 1, 1, 1, 1, 0 in that order. - * - * @param value {@code int} containing bits to append - * @param numBits bits from value to append - */ - public function appendBits($value, $numBits) - { - if ($numBits < 0 || $numBits > 32) { - throw new \InvalidArgumentException("Num bits must be between 0 and 32"); - } - $this->ensureCapacity($this->size + $numBits); - for ($numBitsLeft = $numBits; $numBitsLeft > 0; $numBitsLeft--) { - $this->appendBit((($value >> ($numBitsLeft - 1)) & 0x01) == 1); - } - } - - private function ensureCapacity($size) - { - if ($size > count($this->bits) * 32) { - $newBits = $this->makeArray($size); - $newBits = arraycopy($this->bits, 0, $newBits, 0, count($this->bits)); - $this->bits = $newBits; - } - } - - public function appendBit($bit) - { - $this->ensureCapacity($this->size + 1); - if ($bit) { - $this->bits[(int)($this->size / 32)] |= 1 << ($this->size & 0x1F); - } - $this->size++; - } - - public function appendBitArray($other) - { - $otherSize = $other->size; - $this->ensureCapacity($this->size + $otherSize); - for ($i = 0; $i < $otherSize; $i++) { - $this->appendBit($other->get($i)); - } - } - - public function _xor($other) - { - if (count($this->bits) !== count($other->bits)) { - throw new \InvalidArgumentException("Sizes don't match"); - } - $count = count($this->bits); - for ($i = 0; $i < $count; $i++) { - // The last byte could be incomplete (i.e. not have 8 bits in - // it) but there is no problem since 0 XOR 0 == 0. - $this->bits[$i] ^= $other->bits[$i]; - } - } - - /** - * - * @param bitOffset first bit to start writing - * @param array array to write into. Bytes are written most-significant byte first. This is the opposite - * of the internal representation, which is exposed by {@link #getBitArray()} - * @param offset position in array to start writing - * @param numBytes how many bytes to write - */ - public function toBytes($bitOffset, &$array, $offset, $numBytes) - { - for ($i = 0; $i < $numBytes; $i++) { - $theByte = 0; - for ($j = 0; $j < 8; $j++) { - if ($this->get($bitOffset)) { - $theByte |= 1 << (7 - $j); - } - $bitOffset++; - } - $array[(int)($offset + $i)] = $theByte; - } - } - - /** - * @param $i ; bit to get - * - * @return true iff bit i is set - */ - public function get($i) - { - $key = (int)($i / 32); - - return ($this->bits[$key] & (1 << ($i & 0x1F))) != 0; - } - - /** - * @return array underlying array of ints. The first element holds the first 32 bits, and the least - * significant bit is bit 0. - */ - public function getBitArray() - { - return $this->bits; - } - - /** - * Reverses all bits in the array. - */ - public function reverse() - { - $newBits = []; - // reverse all int's first - $len = (($this->size - 1) / 32); - $oldBitsLen = $len + 1; - for ($i = 0; $i < $oldBitsLen; $i++) { - $x = $this->bits[$i];/* - $x = (($x >> 1) & 0x55555555L) | (($x & 0x55555555L) << 1); - $x = (($x >> 2) & 0x33333333L) | (($x & 0x33333333L) << 2); - $x = (($x >> 4) & 0x0f0f0f0fL) | (($x & 0x0f0f0f0fL) << 4); - $x = (($x >> 8) & 0x00ff00ffL) | (($x & 0x00ff00ffL) << 8); - $x = (($x >> 16) & 0x0000ffffL) | (($x & 0x0000ffffL) << 16);*/ - $x = (($x >> 1) & 0x55555555) | (($x & 0x55555555) << 1); - $x = (($x >> 2) & 0x33333333) | (($x & 0x33333333) << 2); - $x = (($x >> 4) & 0x0f0f0f0f) | (($x & 0x0f0f0f0f) << 4); - $x = (($x >> 8) & 0x00ff00ff) | (($x & 0x00ff00ff) << 8); - $x = (($x >> 16) & 0x0000ffff) | (($x & 0x0000ffff) << 16); - $newBits[(int)$len - $i] = (int)$x; - } - // now correct the int's if the bit size isn't a multiple of 32 - if ($this->size != $oldBitsLen * 32) { - $leftOffset = $oldBitsLen * 32 - $this->size; - $mask = 1; - for ($i = 0; $i < 31 - $leftOffset; $i++) { - $mask = ($mask << 1) | 1; - } - $currentInt = ($newBits[0] >> $leftOffset) & $mask; - for ($i = 1; $i < $oldBitsLen; $i++) { - $nextInt = $newBits[$i]; - $currentInt |= $nextInt << (32 - $leftOffset); - $newBits[(int)($i) - 1] = $currentInt; - $currentInt = ($nextInt >> $leftOffset) & $mask; - } - $newBits[(int)($oldBitsLen) - 1] = $currentInt; - } -// $bits = $newBits; - } - - public function equals($o) - { - if (!($o instanceof BitArray)) { - return false; - } - $other = $o; - - return $this->size == $other->size && $this->bits === $other->bits; - } - - public function hashCode() - { - return 31 * $this->size + hashCode($this->bits); - } - - public function toString() - { - $result = ''; - for ($i = 0; $i < $this->size; $i++) { - if (($i & 0x07) == 0) { - $result .= ' '; - } - $result .= ($this->get($i) ? 'X' : '.'); - } - - return (string)$result; - } - - public function _clone() - { - return new BitArray($this->bits, $this->size); - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/BitMatrix.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/BitMatrix.php deleted file mode 100644 index 112862de..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/BitMatrix.php +++ /dev/null @@ -1,458 +0,0 @@ -width = $width; - $this->height = $height; - $this->rowSize = $rowSize; - $this->bits = $bits; - } - - public static function parse($stringRepresentation, $setString, $unsetString) - { - if (!$stringRepresentation) { - throw new \InvalidArgumentException(); - } - $bits = []; - $bitsPos = 0; - $rowStartPos = 0; - $rowLength = -1; - $nRows = 0; - $pos = 0; - while ($pos < strlen($stringRepresentation)) { - if ($stringRepresentation{$pos} == '\n' || - $stringRepresentation->{$pos} == '\r') { - if ($bitsPos > $rowStartPos) { - if ($rowLength == -1) { - $rowLength = $bitsPos - $rowStartPos; - } else if ($bitsPos - $rowStartPos != $rowLength) { - throw new \InvalidArgumentException("row lengths do not match"); - } - $rowStartPos = $bitsPos; - $nRows++; - } - $pos++; - } else if (substr($stringRepresentation, $pos, strlen($setString)) == $setString) { - $pos += strlen($setString); - $bits[$bitsPos] = true; - $bitsPos++; - } else if (substr($stringRepresentation, $pos + strlen($unsetString)) == $unsetString) { - $pos += strlen($unsetString); - $bits[$bitsPos] = false; - $bitsPos++; - } else { - throw new \InvalidArgumentException( - "illegal character encountered: " . substr($stringRepresentation, $pos)); - } - } - - // no EOL at end? - if ($bitsPos > $rowStartPos) { - if ($rowLength == -1) { - $rowLength = $bitsPos - $rowStartPos; - } else if ($bitsPos - $rowStartPos != $rowLength) { - throw new \InvalidArgumentException("row lengths do not match"); - } - $nRows++; - } - - $matrix = new BitMatrix($rowLength, $nRows); - for ($i = 0; $i < $bitsPos; $i++) { - if ($bits[$i]) { - $matrix->set($i % $rowLength, $i / $rowLength); - } - } - - return $matrix; - } - - /** - *

    Sets the given bit to true.

    - * - * @param $x ; The horizontal component (i.e. which column) - * @param $y ; The vertical component (i.e. which row) - */ - public function set($x, $y) - { - $offset = (int)($y * $this->rowSize + ($x / 32)); - if (!isset($this->bits[$offset])) { - $this->bits[$offset] = 0; - } - //$this->bits[$offset] = $this->bits[$offset]; - - // if($this->bits[$offset]>200748364){ - //$this->bits= array(0,0,-16777216,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,-16777216,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,-16777216,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,-16777216,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,-16777216,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,-16777216,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,-16777216,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,-16777216,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,-16777216,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,-16777216,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,-16777216,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,-1090519040,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,1056964608,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,-1358954496,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,117440512,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,50331648,-1,-1,-1,-1,65535,0,0,0,0,0,0,0,33554432,-1,-1,536870911,-4096,65279,0,0,0,0,0,0,0,0,-1,-1,65535,-4096,65535,0,0,0,0,0,0,0,0,-193,536870911,0,-4096,65279,0,0,0,0,0,0,0,0,-254,32767,0,-4096,61951,0,0,0,0,0,0,0,0,20913920,0,0,-4096,50175,0,0,0,0,0,0,0,0,0,0,0,-4096,60159,0,0,0,0,0,0,0,0,0,0,0,-4096,64255,0,0,0,0,0,0,0,0,0,0,0,-8192,56319,0,0,0,0,0,0,0,0,0,0,0,-4096,16777215,0,0,0,0,0,0,0,0,0,0,0,-4096,16777215,0,0,0,0,0,0,0,0,0,0,0,-4096,16777215,0,0,0,0,0,0,0,0,0,0,0,-4096,16777215,0,0,0,0,0,0,0,0,0,0,0,-4096,16777215,0,0,0,0,0,0,0,0,0,0,0,-4096,16777215,0,0,0,0,0,0,0,0,0,0,0,-4096,16777215,0,0,0,0,0,0,0,0,0,0,0,-4096,16777215,0,0,0,0,0,0,0,251658240,0,0,0,-4096,-1,255,0,256,0,0,0,0,117440512,0,0,0,-4096,-1,255,0,512,0,0,0,0,117440512,0,0,0,-4096,-1,255,0,1024,0,0,0,0,117440512,0,0,0,-4096,-1,223,0,256,0,0,0,0,117440512,0,0,33030144,-4096,-1,191,0,256,0,0,0,0,117440512,0,0,33554428,-4096,-1,255,0,768,0,0,0,0,117440512,0,402849792,67108862,-8192,-1,255,0,768,0,0,0,0,117440512,0,470278396,63045630,-8192,-1,255,0,256,0,0,0,0,251658240,-8388608,470278399,58720286,-8192,-1,2686975,0,3842,0,0,0,0,251658240,-131072,1007149567,58720286,-8192,-1,2031615,0,3879,0,0,0,0,251658240,536739840,1007092192,58720286,-8192,-1,851967,0,3840,0,0,0,0,251658240,917504,1007092192,58720284,-8192,-1,2031615,0,3968,0,0,0,0,251658240,917504,1007092160,59244060,-8192,-1,65535,0,7936,0,0,0,0,251658240,917504,1009779136,59244060,-8192,-1,9371647,0,1792,0,0,0,0,251658240,917504,946921920,59244060,-8192,-1,8585215,0,1792,0,0,0,0,117440512,-15859712,477159875,59244060,-8192,-1,65535,0,12032,0,0,0,0,251658240,-15859712,52490691,59244060,-8192,-1,-1,0,65408,0,0,0,0,251658240,-15859712,58778051,59244060,-8192,-1,-1,0,65473,0,0,0,0,251658240,-15859712,125886915,59244060,-8192,-1,-1,0,65472,0,0,0,0,251658240,-15859712,58778051,59244060,-8192,-1,-1,0,65408,0,0,0,0,251658240,-15859712,8380867,59244060,-8192,-1,-1,0,65473,0,0,0,0,251658240,-15859712,8380867,59244060,-8192,-1,-1,0,131011,0,0,0,0,251658240,-15859712,8380867,58720284,-8192,-1,-1,0,130947,0,0,0,0,251658240,-15859712,2089411,58720284,-8192,-1,-1,0,130947,0,0,0,0,251658240,-32636928,449,58720284,-8192,-1,-1,33554431,131015,0,0,0,0,251658240,786432,448,62914588,-8192,-1,-1,16777215,131015,0,0,0,0,251658240,786432,448,67108860,-8192,-1,-1,553648127,131015,0,0,0,0,251658240,786432,946864576,67108860,-8192,-1,-1,32505855,131015,0,0,0,0,251658240,786432,946921976,8388604,-8192,-1,-1,8191999,131015,0,0,0,0,251658240,-262144,946921983,248,-8192,-1,-1,8126463,196551,0,0,0,0,251658240,-262144,7397887,0,-8192,-1,-1,16777215,262087,0,0,0,0,251658240,-262144,8257543,0,-8192,-1,-1,-2121269249,262095,0,0,0,0,520093696,0,8257536,0,-8192,-1,-1,-201326593,262095,0,0,0,0,520290304,0,8257536,117963776,-8192,-1,-1,-201326593,262095,0,0,0,0,520093696,0,-2140143616,118488579,-8192,-1,-1,-201326593,131023,0,0,0,0,520093696,0,-2131697280,118488579,-8192,-1,-1,-503316481,131023,0,0,0,0,520093696,2145386496,-2131631232,118484995,-16384,-1,-1,-469762049,262095,0,0,0,0,520093696,2147221504,552649600,118481344,-16384,-1,-1,-469762049,131023,0,0,0,0,520290304,2147221504,2029002240,118481344,-16384,-1,-1,-469762049,262031,0,0,0,0,520290304,-266600448,2029001791,125952960,-16384,-1,-1,-469762049,262031,0,0,0,0,1057423360,-266600448,2027953215,133177312,-16384,-1,-1,-134217729,262111,0,0,0,0,1058471936,-266600448,-119531393,133177343,-16384,-1,-1,-134217729,262111,0,0,0,0,1058471936,-2145648640,-253754369,66068479,-16384,-1,-1,-134217729,262111,0,0,0,0,1058471936,236716032,-253754369,15729663,-16384,-1,-1,-134217729,262095,0,0,0,0,1057947648,236716032,-253754369,6348807,-16384,-1,-1,-134217729,262095,0,0,0,0,524222464,236716032,-253690305,6348803,-16384,-1,-1,-134217729,262111,0,0,0,0,521076736,2115764224,-253625344,14737411,-16384,-1,-1,-134217729,262095,0,0,0,0,522125312,2115764224,-253625344,14743555,-16384,-1,-1,-134217729,262111,0,0,16772608,0,1073676288,-31719424,-2014283776,14810115,-16384,-1,-1,-1,262143,0,0,16776704,0,1065287680,-1642594304,-1879178880,14810115,-16384,-1,-1,-1,524287,0,0,16776192,0,2139029504,264241152,-2013396089,14809091,-16384,-1,-1,-1,262095,0,0,16776192,0,2139029504,264241152,-2080636025,14803335,-16384,-1,-1,-1,262087,0,0,16776192,0,2147418112,264241152,-2132803581,14803847,-16384,-1,-1,-402653185,524259,0,0,8386048,0,2147418112,0,-2132688896,123783,-16384,-1,-1,1207959551,262112,0,0,16775168,0,2147418112,0,14794752,1046535,-16384,-1,-1,268435455,262128,0,0,16775168,0,2147418112,0,14712832,1047615,-16384,-1,-1,536870911,524284,0,0,16776705,0,2147418112,0,14680832,1047615,-16384,-1,-1,-1,524287,0,0,16776704,0,2147418112,-1048576,14681087,1046591,-32768,-1,-1,-1,524287,0,0,16776704,0,2147418112,-524288,-2132802561,2080831,-32768,-1,-1,-1,524287,0,0,16776705,0,2147418112,-524288,-31718401,2080831,-32768,-1,-1,-1,1048575,0,0,16776193,0,2147418112,3670016,-31718528,2080831,-32768,-1,-1,-1,524287,0,0,16776195,0,2147418112,3670016,-31718528,134086719,-32768,-1,-1,-1,524287,0,0,16776195,0,2147418112,3670016,253494144,268173368,-32768,-1,-1,-1,524287,0,0,16775171,0,2147418112,3670016,268174208,268173368,-32768,-1,-1,-1,1048575,0,0,16771072,0,2147418112,-63438848,268174223,31457328,-32768,-1,-1,-1,1048575,0,0,10418176,0,-65536,-63438848,133957519,14807040,-32768,-1,-1,-1,2097151,0,0,15923200,0,2147418112,-63438848,1968015,14809095,-32768,-1,-1,-1,1048575,0,0,12808192,0,2147418112,-63438848,2082703,12711943,-32768,-1,-1,-1,2097151,0,0,6420480,0,2147418112,-63438848,2082703,14343,-32768,-1,-1,-1,2097151,0,0,15202304,0,-65536,-63438848,2082703,1849351,-32768,-1,-1,-1,2097151,0,0,15464448,0,-65536,-63438848,264472335,1849351,-32768,-1,-1,-1,4194303,0,0,16371712,0,-65536,-63438848,264472335,14343,-32768,-1,-1,-1,8388607,0,0,0,0,-65536,-63438848,532907791,235010048,-32768,-1,-1,-1,16777215,0,0,0,0,-65536,-63438848,-1603833,235010160,-32768,-1,-1,-1,16777215,0,0,0,0,-65536,3670016,-30976,67238000,-32768,-1,-1,-1,16777215,0,0,0,0,-65536,3670016,-30976,48,-32768,-1,-1,-1,16777215,0,0,0,0,-65536,3670016,-29391104,768,-32768,-1,-1,-1,16777215,0,0,0,0,-65536,3670016,-29391104,768,-32768,-1,-1,-1,16777215,0,0,0,0,-65536,-524287,-65042433,768,-32768,-1,-1,-1,16777215,0,0,0,0,-65536,-524287,2082441215,0,-65536,-1,-1,-1,16777215,0,0,0,0,-13697024,-524287,511,0,-65536,-1,-1,-1,16777215,0,0,0,0,-12648448,1,0,0,-65536,-1,-1,-1,14680063,0,0,0,0,-12648448,1,0,0,-65536,-1,-1,-1,16777215,0,0,0,0,-65536,1,0,0,-65536,-1,-1,-1,14680063,0,0,0,0,-8454144,1,0,0,-65536,-1,-1,-1,12582911,0,0,0,0,-12648448,1,0,0,-65536,-1,-1,-1,2097151,0,0,0,0,-12648448,1,0,0,-65536,-1,-1,-1,1048575,0,0,0,0,-14745600,1,0,0,-65536,-1,-1,-1,3145727,0,0,0,0,1056964608,1,0,0,-65536,-1,-1,-1,1048575,0,0,0,0,1056964608,1,0,0,-65536,-1,-1,-1,1048575,0,0,0,0,1056964608,1,0,0,-65536,-1,-1,-1,524287,0,0,0,0,2130706432,1,0,0,-65536,-1,-1,-1,1048575,0,0,0,0,1056964608,1,0,0,-65536,-1,-1,-1,524287,0,0,0,0,2130706432,1,0,0,-65536,-1,-1,-1,524287,0,0,0,0,2130706432,1,0,0,-65536,-1,-1,-1,1048575,0,0,0,0,2130706432,1,0,0,-65536,-1,-1,-1,1048575,0,0,0,0,50331648,1,0,0,-65536,-1,-1,-1,1048575,0,0,0,0,117440512,1,0,-268435456,-1,-1,-1,-1,524287,0,0,0,0,251658240,1,0,-320,-1,-1,-1,-1,262143,0,0,0,0,520093696,1,-2048,-1,-1,-1,-1,-1,262143,0,0,0,0,1056964608,-16777213,-1,-1,-1,-1,-1,-1,131071,0,0,0,0,-16777216,-121,-1,-1,-1,-1,-1,-1,131071,0,0,0,0,-16777216,-1,-1,-1,-1,-1,-1,-1,131071,0,0,0,0,-16777216,-1,-1,-1,-1,-1,-1,-1,131071,0,0,0,0,-16777216,-1,-1,-1,-1,-1,-1,-1,131071,0,0,0,0,-16777216,-1,-1,-1,-1,-1,-1,-1,65535,0,0,0,0,-16777216,-1,-1,-1,-1,-1,-1,-1,65535,0,0,0,0,-16777216,-1,-1,-1,-1,-1,-1,-1,131071,0,0,0,0,-16777216,-1,-1,-1,-1,-1,-1,-1,262143,0,0,0,0,-16777216,-1,-1,-1,-1,-1,-1,-1,524287,0,0,0,0,-16777216,-1,-1,-1,-1,-1,-1,-1,524287,0,0,0,0,-16777216,-1,-1,-1,-1,-1,-1,-1,589823,0,0,0,0,0,-1,-1,-1,-1,-1,-1,-1,8179,0,0,0,0,50331648,-1,-1,-1,-1,-1,-1,-1,4080,0,0,0,0,117440512,-1,-1,-1,-1,-1,-1,-1,1016,0,0,0,0,251658240,-1,-1,-1,-1,-1,-1,1073741823,1020,0,0,0,0,50331648,-1,-1,-1,-1,-1,-1,536870911,254,0,0,0,0,50331648,-1,-1,-1,-1,-1,-1,536870911,255,0,0,0,0,50331648,-1,-1,-1,-1,-1,-1,-1879048193,127,0,0,0,0,50331648,-1,-1,-1,-1,-1,-1,-469762049,63,0,0,0,0,1191182336,-1,-1,-1,-1,1023999,0,-520093712,15,0,0,0,0,-218103808,-1,-1,-1,-1,0,-8454144,-260046849,7,0,0,0,0,0,-193,-1,-1,-1057947649,-2147483648,-1,-58720257,1,0,0,0,0,0,-251,-1,-1,-1057423361,-2074,-1,-1,0,0,0,0,0,0,-59648,-1,-1,-1,-1,-1,1073741823,0,0,0,0,0,0,-65536,-1,-1,-1,-1,-1,268435455,0,0,0,0,0,0,-65536,-1,-1,-1,-1,-1,67108863,0,0,0,0,0,0,-65536,-1,-1,-1,-1,-1,8388607,0,0,0,0,0,0,0,-403603456,-1,-1,-1,-1,262143,0,0,0,8388656,0,0,0,-1891434496,-1,-1,-1,-1,16383,0,0,0,8388608,0,0,0,-1612513280,-1,-1,-1,-1,63,0,0,0,0,0,0,0,-24320,-1,-1,-1,8388607,0,0,0,0,0,0,0,0,-256,-1,-1,1073741823,1,0,0,0,0,0,0,0,1610612736,-15,-1,-1,16383,0,0,0,0,0,0,0,0,-16646144,-1,-1,251658239,0,0,0,0,0,0,0,0,0,-51200,-1,-1,40959,0,0,0,0,0,0,268419584,103809024,-12713984,-1,-2147483137,4194303,0,0,0,0,0,0,0,402620416,-2144010240,-13631487,-32513,3,20480,0,0,0,0,0,0,0,419299328,0,-262144,-1,0,0,0,0,0,0,0,0,0,0,0,-5832704,268049407,0,0,0,0,0,0,0,0,0,0,0,0,33030144,0,0,0,0,0,0,0,0,0,0,0,0,3670016,0,0,0,0,0,0,0,0,0,0,0,0,1572864,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,458752,0,0,0,0,0,0,0,0,0,0,0,0,229376,0,0,0,0,0,0,0,0,0,0,0,0,32768,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8192,0,0,0,0,0,0,0,0,0,0,0,0,8192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31744,0,0,0,0,0,0,0,0,0,0,0,0,31744,0,0,0,0,0,0,0,0,0,0,0,0,64512,0,0,0,0,0,0,0,0,0,0,0,0,15872,0,0,0,0,0,0,0,0,0,0,0,0,3584,0,0,0,0,0,0,0,0,0,0,0,0,7680,0,0,0,0,0,0,0,0,0,0,0,0,512,0,0,0,0,0,0,0,0,0,0,0,0,3968,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3840,0,0,0,0,0,0,0,0,0,0,0,0,1855,0,0,0,0,0,0,0,0,0,0,0,0,63,0,0,0,0,0,0,0,0,0,0,0,0,15,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,134217728,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,124,0,0,0,0,0,0,0,0,0,0,0,-260046848,63,0,0,0,0,0,0,0,0,0,0,0,-17301504,127,0,0,0,0,0,0,0,0,0,0,0,-524288,127,0,0,0,0,0,0,0,0,0,0,0,-262144,127,0,0,0,0,0,0,0,0,0,0,0,-262144,63,0,0,0,0,0,0,0,0,0,0,0,-262144,63,0,0,0,0,0,0,0,0,0,0,0,-262144,63,0,0,0,0,0,0,0,0,0,0,0,-262144,31,0,0,0,0,0,0,0,0,0,0,0,-262144,63,0,0,0,0,3,0,0,0,0,0,0,-262144,63,0,0,0,0,7,0,0,0,0,0,0,-262144,63,0,0,0,0,63,0,0,0,0,0,0,-262144,63,0,0,0,0,511,0,0,0,0,0,0,-524288,31,0,0,0,0,8191,0,0,0,0,0,0,-1048576,63,0,0,0,0,131071,0,0,0,0,0,0,-524288,63,0,0,0,0,262143,0,0,0,0,0,0,-524288,63,0,0,0,0,131071,0,0,0,0,0,0,-1048576,63,0,0,0,0,262143,0,0,0,0,0,0,-1048576,63,0,0,0,0,262143,0,0,0,0,0,0,-1048576,63,0,0,0,0,262143,0,0,0,0,0,0,-1048576,63,0,0,0,0,262143,0,0,0,0,0,0,-2097152,127,0,0,0,0,262143,0,0,0,0,0,0,-2097152,127,0,0,0,0,262143,0,0,0,0,0,0,-1048576,127,0,0,0,0,262143,0,0,0,0,0,0,-1048576,127,0,0,0,0,262143,0,0,0,0,0,0,-2097152,255,0,0,0,0,262143,0,0,0,0,0,0,-2097152,255,0,0,0,0,262142,0,0,0,0,0,0,-2097152,255,0,0,0,0,262142,0,0,0,0,0,0,-2097152,255,0,0,0,0,262142,0,0,0,0,0,0,-2097152,255,0,0,0,0,262140,0,0,0,0,0,0,-2097152,255,0,0,0,0,131068,0,0,0,0,0,0,-4194304,255,0,0,0,0,131068,0,0,0,0,0,0,-4194304,255,0,0,0,0,65528,0,0,0,0,0,0,-8388608,255,0,0,0,0,65528,0,0,0,0,0,0,-8388608,255,0,0,0,0,65528,0,0,0,0,0,0,-8388608,255,0,0,0,0,32760,0,0,0,0,0,0,-8388608,255,0,0,0,0,32760,0,0,0,0,0,0,-16777216,255,0,0,-2147483648,255,16368,0,0,0,0,0,0,-16777216,255,0,0,-536870912,1023,16368,0,0,0,0,0,0,-33554432,255,0,0,-16777216,4095,16352,0,0,0,0,0,0,-33554432,255,0,0,-8388608,262143,16352,0,0,0,0,0,0,-33554432,255,0,0,-1048576,2097151,16352,0,0,0,0,0,0,-67108864,255,0,0,-524288,8388607,16352,0,0,0,0,0,0,-67108864,255,0,0,-262144,16777215,16320,0,0,0,0,0,0,-67108864,255,0,0,-131072,16777215,100679648,0,0,0,0,0,0,-67108864,255,0,0,-16384,16776959,125861824,0,0,0,0,0,0,-134217728,255,0,0,-4096,16773121,62930880,0,0,0,0,0,0,-134217728,127,0,0,2147482624,16252928,32704,0,0,0,0,0,0,-134217728,127,0,0,268435200,14680064,16320,0,0,0,0,0,0,-134217728,127,0,0,134217600,0,32704,0,0,0,0,0,0,-33554432,127,0,1056964608,67108736,0,32704,0,0,0,0,0,0,-33554432,127,0,2130706432,33554368,0,65408,0,0,0,0,0,0,-33554432,127,0,-16777216,8388576,0,32640,0,0,0,0,0,0,-134217728,127,0,-16777216,2097136,0,32640,0,0,0,0,0,0,-134217728,63,0,-16776960,1048573,0,32640,0,0,0,0,0,0,-536870912,63,0,-16776448,1048575,0,32640,0,0,0,0,0,0,-536870912,63,0,-33553664,6291455,66752,32640,0,0,0,0,0,0,-536870912,63,0,2013266688,2097148,229376,32640,0,0,0,0,0,0,-536870912,63,0,256,4194300,229376,32640,0,0,0,0,0,0,-536870912,63,0,0,524280,196608,32512,0,0,8,0,0,0,-1073741824,63,0,0,-200,15,65280,0,0,24,0,0,0,-1073741824,63,0,0,-1867768,127,32512,0,0,56,0,0,0,-1073741824,63,0,0,-1056768,4095,32512,0,0,124,0,0,0,-1073741824,63,0,0,-1050624,8191,32512,0,0,508,0,0,0,-2147483648,31,0,0,-7866368,8191,32512,0,0,1020,0,0,0,-2147483648,31,0,0,-33030656,8095,32512,0,0,2046,0,0,0,-2147483648,63,0,0,-66586624,771,32512,0,0,4094,0,0,0,0,63,0,0,-134184960,1,32256,0,0,8190,0,0,0,0,63,0,0,1610612736,0,32256,0,0,16382,0,0,0,-2147483648,63,0,0,0,0,15872,0,0,32767,0,0,0,-2147483648,31,0,0,0,0,15872,0,-2147483648,65535,0,0,0,-2147483648,31,0,0,0,0,7680,0,0,65535,0,0,0,-2147483648,31,0,0,134217728,0,7680,0,-2147483648,65535,0,0,0,-2147483648,31,0,0,0,0,7680,0,-2147483648,65535,0,0,0,-2147483648,31,0,0,0,0,7680,0,-1073741824,65535,0,0,0,-2147483648,31,0,0,0,0,3072,0,-1073741824,65535,0,0,0,-2147483648,31,0,0,0,0,3072,0,-1073741824,65535,0,0,0,-2147483648,31,0,0,0,0,0,0,-2147483648,65535,0,0,0,-2147483648,31,0,0,0,0,0,0,-1073741824,65535,0,0,0,0,31,0,0,0,0,0,0,-1073741824,65535,0,0,0,0,31,0,0,0,0,0,0,-2147483648,65535,0,0,0,0,30,0,0,0,0,0,0,-1073741824,65535,0,0,0,0,30,0,0,0,0,0,0,-2147483648,65535,0,0,0,0,30,0,0,0,0,0,0,0,65535,0,0,0,0,28,0,0,0,0,0,0,0,65535,0,0,0,0,28,0,0,0,0,0,0,0,65535,0,0,0,0,28,0,0,0,0,0,0,0,65535,0,0,0,0,24,0,0,0,0,0,0,-2147483648,65535,0,0,0,0,0,0,0,0,0,0,0,-536870912,65535);//[$offset] |= intval32bits(1 << ($x & 0x1f)); - $bob = $this->bits[$offset]; - $bob |= 1 << ($x & 0x1f); - $this->bits[$offset] |= ($bob); - //$this->bits[$offset] = intval32bits($this->bits[$offset]); - - //} -//16777216 - } - - public function _unset($x, $y) - {//было unset, php не позволяет использовать unset - $offset = (int)($y * $this->rowSize + ($x / 32)); - $this->bits[$offset] &= ~(1 << ($x & 0x1f)); - } - - /**1 << (249 & 0x1f) - *

    Flips the given bit.

    - * - * @param $x ; The horizontal component (i.e. which column) - * @param $y ; The vertical component (i.e. which row) - */ - public function flip($x, $y) - { - $offset = $y * $this->rowSize + (int)($x / 32); - - $this->bits[$offset] = ($this->bits[$offset] ^ (1 << ($x & 0x1f))); - } - - /** - * Exclusive-or (XOR): Flip the bit in this {@code BitMatrix} if the corresponding - * mask bit is set. - * - * @param $mask ; XOR mask - */ - public function _xor($mask) - {//было xor, php не позволяет использовать xor - if ($this->width != $mask->getWidth() || $this->height != $mask->getHeight() - || $this->rowSize != $mask->getRowSize()) { - throw new \InvalidArgumentException("input matrix dimensions do not match"); - } - $rowArray = new BitArray($this->width / 32 + 1); - for ($y = 0; $y < $this->height; $y++) { - $offset = $y * $this->rowSize; - $row = $mask->getRow($y, $rowArray)->getBitArray(); - for ($x = 0; $x < $this->rowSize; $x++) { - $this->bits[$offset + $x] ^= $row[$x]; - } - } - } - - /** - * Clears all bits (sets to false). - */ - public function clear() - { - $max = count($this->bits); - for ($i = 0; $i < $max; $i++) { - $this->bits[$i] = 0; - } - } - - /** - *

    Sets a square region of the bit matrix to true.

    - * - * @param $left ; The horizontal position to begin at (inclusive) - * @param $top ; The vertical position to begin at (inclusive) - * @param $width ; The width of the region - * @param $height ; The height of the region - */ - public function setRegion($left, $top, $width, $height) - { - if ($top < 0 || $left < 0) { - throw new \InvalidArgumentException("Left and top must be nonnegative"); - } - if ($height < 1 || $width < 1) { - throw new \InvalidArgumentException("Height and width must be at least 1"); - } - $right = $left + $width; - $bottom = $top + $height; - if ($bottom > $this->height || $right > $this->width) { //> this.height || right > this.width - throw new \InvalidArgumentException("The region must fit inside the matrix"); - } - for ($y = $top; $y < $bottom; $y++) { - $offset = $y * $this->rowSize; - for ($x = $left; $x < $right; $x++) { - $this->bits[$offset + (int)($x / 32)] = ($this->bits[$offset + (int)($x / 32)] |= 1 << ($x & 0x1f)); - } - } - } - - /** - * Modifies this {@code BitMatrix} to represent the same but rotated 180 degrees - */ - public function rotate180() - { - $width = $this->getWidth(); - $height = $this->getHeight(); - $topRow = new BitArray($width); - $bottomRow = new BitArray($width); - for ($i = 0; $i < ($height + 1) / 2; $i++) { - $topRow = $this->getRow($i, $topRow); - $bottomRow = $this->getRow($height - 1 - $i, $bottomRow); - $topRow->reverse(); - $bottomRow->reverse(); - $this->setRow($i, $bottomRow); - $this->setRow($height - 1 - $i, $topRow); - } - } - - /** - * @return The width of the matrix - */ - public function getWidth() - { - return $this->width; - } - - /** - * A fast method to retrieve one row of data from the matrix as a BitArray. - * - * @param $y ; The row to retrieve - * @param $row ; An optional caller-allocated BitArray, will be allocated if null or too small - * - * @return The resulting BitArray - this reference should always be used even when passing - * your own row - */ - public function getRow($y, $row) - { - if ($row == null || $row->getSize() < $this->width) { - $row = new BitArray($this->width); - } else { - $row->clear(); - } - $offset = $y * $this->rowSize; - for ($x = 0; $x < $this->rowSize; $x++) { - $row->setBulk($x * 32, $this->bits[$offset + $x]); - } - - return $row; - } - - /** - * @param $y ; row to set - * @param $row ; {@link BitArray} to copy from - */ - public function setRow($y, $row) - { - $this->bits = arraycopy($row->getBitArray(), 0, $this->bits, $y * $this->rowSize, $this->rowSize); - } - - /** - * This is useful in detecting the enclosing rectangle of a 'pure' barcode. - * - * @return {@code left,top,width,height} enclosing rectangle of all 1 bits, or null if it is all white - */ - public function getEnclosingRectangle() - { - $left = $this->width; - $top = $this->height; - $right = -1; - $bottom = -1; - - for ($y = 0; $y < $this->height; $y++) { - for ($x32 = 0; $x32 < $this->rowSize; $x32++) { - $theBits = $this->bits[$y * $this->rowSize + $x32]; - if ($theBits != 0) { - if ($y < $top) { - $top = $y; - } - if ($y > $bottom) { - $bottom = $y; - } - if ($x32 * 32 < $left) { - $bit = 0; - while (($theBits << (31 - $bit)) == 0) { - $bit++; - } - if (($x32 * 32 + $bit) < $left) { - $left = $x32 * 32 + $bit; - } - } - if ($x32 * 32 + 31 > $right) { - $bit = 31; - while ((sdvig3($theBits, $bit)) == 0) {//>>> - $bit--; - } - if (($x32 * 32 + $bit) > $right) { - $right = $x32 * 32 + $bit; - } - } - } - } - } - - $width = $right - $left; - $height = $bottom - $top; - - if ($width < 0 || $height < 0) { - return null; - } - - return [$left, $top, $width, $height]; - } - - /** - * This is useful in detecting a corner of a 'pure' barcode. - * - * @return {@code x,y} coordinate of top-left-most 1 bit, or null if it is all white - */ - public function getTopLeftOnBit() - { - $bitsOffset = 0; - while ($bitsOffset < count($this->bits) && $this->bits[$bitsOffset] == 0) { - $bitsOffset++; - } - if ($bitsOffset == count($this->bits)) { - return null; - } - $y = $bitsOffset / $this->rowSize; - $x = ($bitsOffset % $this->rowSize) * 32; - - $theBits = $this->bits[$bitsOffset]; - $bit = 0; - while (($theBits << (31 - $bit)) == 0) { - $bit++; - } - $x += $bit; - - return [$x, $y]; - } - - public function getBottomRightOnBit() - { - $bitsOffset = count($this->bits) - 1; - while ($bitsOffset >= 0 && $this->bits[$bitsOffset] == 0) { - $bitsOffset--; - } - if ($bitsOffset < 0) { - return null; - } - - $y = $bitsOffset / $this->rowSize; - $x = ($bitsOffset % $this->rowSize) * 32; - - $theBits = $this->bits[$bitsOffset]; - $bit = 31; - while ((sdvig3($theBits, $bit)) == 0) {//>>> - $bit--; - } - $x += $bit; - - return [$x, $y]; - } - - /** - * @return The height of the matrix - */ - public function getHeight() - { - return $this->height; - } - - /** - * @return The row size of the matrix - */ - public function getRowSize() - { - return $this->rowSize; - } - - public function equals($o) - { - if (!($o instanceof BitMatrix)) { - return false; - } - $other = $o; - - return $this->width == $other->width - && $this->height == $other->height - && $this->rowSize == $other->rowSize - && $this->bits === $other->bits; - } - - //@Override - - public function hashCode() - { - $hash = $this->width; - $hash = 31 * $hash + $this->width; - $hash = 31 * $hash + $this->height; - $hash = 31 * $hash + $this->rowSize; - $hash = 31 * $hash + hashCode($this->bits); - - return $hash; - } - - //@Override - - public function toString($setString = '', $unsetString = '', $lineSeparator = '') - { - if (!$setString || !$unsetString) { - return (string)'X ' . ' '; - } - if ($lineSeparator && $lineSeparator !== "\n") { - return $this->toString_($setString, $unsetString, $lineSeparator); - } - - return (string)($setString . $unsetString . "\n"); - } - - public function toString_($setString, $unsetString, $lineSeparator) - { - //$result = new StringBuilder(height * (width + 1)); - $result = ''; - for ($y = 0; $y < $this->height; $y++) { - for ($x = 0; $x < $this->width; $x++) { - $result .= ($this->get($x, $y) ? $setString : $unsetString); - } - $result .= ($lineSeparator); - } - - return (string)$result; - } - - /** - * @deprecated call {@link #toString(String,String)} only, which uses \n line separator always - */ - // @Deprecated - /** - *

    Gets the requested bit, where true means black.

    - * - * @param $x ; The horizontal component (i.e. which column) - * @param $y ; The vertical component (i.e. which row) - * - * @return value of given bit in matrix - */ - public function get($x, $y) - { - - $offset = (int)($y * $this->rowSize + ($x / 32)); - if (!isset($this->bits[$offset])) { - $this->bits[$offset] = 0; - } - - // return (($this->bits[$offset] >> ($x & 0x1f)) & 1) != 0; - return (uRShift($this->bits[$offset], ($x & 0x1f)) & 1) != 0;//было >>> вместо >>, не знаю как эмулировать беззнаковый сдвиг - } - -// @Override - - public function _clone() - { - return new BitMatrix($this->width, $this->height, $this->rowSize, $this->bits); - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/BitSource.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/BitSource.php deleted file mode 100644 index 0ce7f4ce..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/BitSource.php +++ /dev/null @@ -1,118 +0,0 @@ -This provides an easy abstraction to read bits at a time from a sequence of bytes, where the - * number of bits read is not often a multiple of 8.

    - * - *

    This class is thread-safe but not reentrant -- unless the caller modifies the bytes array - * it passed in, in which case all bets are off.

    - * - * @author Sean Owen - */ -final class BitSource -{ - - private $bytes; - private $byteOffset = 0; - private $bitOffset = 0; - - /** - * @param bytes bytes from which this will read bits. Bits will be read from the first byte first. - * Bits are read within a byte from most-significant to least-significant bit. - */ - public function __construct($bytes) - { - $this->bytes = $bytes; - } - - /** - * @return index of next bit in current byte which would be read by the next call to {@link #readBits(int)}. - */ - public function getBitOffset() - { - return $this->bitOffset; - } - - /** - * @return index of next byte in input byte array which would be read by the next call to {@link #readBits(int)}. - */ - public function getByteOffset() - { - return $this->byteOffset; - } - - /** - * @param numBits number of bits to read - * - * @return int representing the bits read. The bits will appear as the least-significant - * bits of the int - * @throws IllegalArgumentException if numBits isn't in [1,32] or more than is available - */ - public function readBits($numBits) - { - if ($numBits < 1 || $numBits > 32 || $numBits > $this->available()) { - throw new \InvalidArgumentException(strval($numBits)); - } - - $result = 0; - - // First, read remainder from current byte - if ($this->bitOffset > 0) { - $bitsLeft = 8 - $this->bitOffset; - $toRead = $numBits < $bitsLeft ? $numBits : $bitsLeft; - $bitsToNotRead = $bitsLeft - $toRead; - $mask = (0xFF >> (8 - $toRead)) << $bitsToNotRead; - $result = ($this->bytes[$this->byteOffset] & $mask) >> $bitsToNotRead; - $numBits -= $toRead; - $this->bitOffset += $toRead; - if ($this->bitOffset == 8) { - $this->bitOffset = 0; - $this->byteOffset++; - } - } - - // Next read whole bytes - if ($numBits > 0) { - while ($numBits >= 8) { - $result = ($result << 8) | ($this->bytes[$this->byteOffset] & 0xFF); - $this->byteOffset++; - $numBits -= 8; - } - - // Finally read a partial byte - if ($numBits > 0) { - $bitsToNotRead = 8 - $numBits; - $mask = (0xFF >> $bitsToNotRead) << $bitsToNotRead; - $result = ($result << $numBits) | (($this->bytes[$this->byteOffset] & $mask) >> $bitsToNotRead); - $this->bitOffset += $numBits; - } - } - - return $result; - } - - /** - * @return number of bits that can be read successfully - */ - public function available() - { - return 8 * (count($this->bytes) - $this->byteOffset) - $this->bitOffset; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/CharacterSetECI.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/CharacterSetECI.php deleted file mode 100644 index 086d593d..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/CharacterSetECI.php +++ /dev/null @@ -1,158 +0,0 @@ - self::ISO8859_1, - 'ISO-8859-2' => self::ISO8859_2, - 'ISO-8859-3' => self::ISO8859_3, - 'ISO-8859-4' => self::ISO8859_4, - 'ISO-8859-5' => self::ISO8859_5, - 'ISO-8859-6' => self::ISO8859_6, - 'ISO-8859-7' => self::ISO8859_7, - 'ISO-8859-8' => self::ISO8859_8, - 'ISO-8859-9' => self::ISO8859_9, - 'ISO-8859-10' => self::ISO8859_10, - 'ISO-8859-11' => self::ISO8859_11, - 'ISO-8859-12' => self::ISO8859_12, - 'ISO-8859-13' => self::ISO8859_13, - 'ISO-8859-14' => self::ISO8859_14, - 'ISO-8859-15' => self::ISO8859_15, - 'ISO-8859-16' => self::ISO8859_16, - 'SHIFT-JIS' => self::SJIS, - 'WINDOWS-1250' => self::CP1250, - 'WINDOWS-1251' => self::CP1251, - 'WINDOWS-1252' => self::CP1252, - 'WINDOWS-1256' => self::CP1256, - 'UTF-16BE' => self::UNICODE_BIG_UNMARKED, - 'UTF-8' => self::UTF8, - 'ASCII' => self::ASCII, - 'GBK' => self::GB18030, - 'EUC-KR' => self::EUC_KR, - ]; - /**#@-*/ - /** - * Additional possible values for character sets. - * - * @var array - */ - protected static $additionalValues = [ - self::CP437 => 2, - self::ASCII => 170, - ]; - private static $name = null; - - /** - * Gets character set ECI by value. - * - * @param string $name - * - * @return CharacterSetEci|null - */ - public static function getCharacterSetECIByValue($value) - { - if ($value < 0 || $value >= 900) { - throw new \InvalidArgumentException('Value must be between 0 and 900'); - } - if (false !== ($key = array_search($value, self::$additionalValues))) { - $value = $key; - } - array_search($value, self::$nameToEci); - try { - self::setName($value); - - return new self($value); - } catch (\UnexpectedValueException $e) { - return null; - } - } - - private static function setName($value) - { - foreach (self::$nameToEci as $name => $key) { - if ($key == $value) { - self::$name = $name; - - return true; - } - } - if (self::$name == null) { - foreach (self::$additionalValues as $name => $key) { - if ($key == $value) { - self::$name = $name; - - return true; - } - } - } - } - - /** - * Gets character set ECI name. - * - * @return character set ECI name|null - */ - public static function name() - { - return self::$name; - } - - /** - * Gets character set ECI by name. - * - * @param string $name - * - * @return CharacterSetEci|null - */ - public static function getCharacterSetECIByName($name) - { - $name = strtoupper($name); - if (isset(self::$nameToEci[$name])) { - return new self(self::$nameToEci[$name]); - } - - return null; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/DecoderResult.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/DecoderResult.php deleted file mode 100644 index 22aee044..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/DecoderResult.php +++ /dev/null @@ -1,122 +0,0 @@ -Encapsulates the result of decoding a matrix of bits. This typically - * applies to 2D barcode formats. For now it contains the raw bytes obtained, - * as well as a String interpretation of those bytes, if applicable.

    - * - * @author Sean Owen - */ -final class DecoderResult -{ - - private $rawBytes; - private $text; - private $byteSegments; - private $ecLevel; - private $errorsCorrected; - private $erasures; - private $other; - private $structuredAppendParity; - private $structuredAppendSequenceNumber; - - - public function __construct( - $rawBytes, - $text, - $byteSegments, - $ecLevel, - $saSequence = -1, - $saParity = -1 - ) { - $this->rawBytes = $rawBytes; - $this->text = $text; - $this->byteSegments = $byteSegments; - $this->ecLevel = $ecLevel; - $this->structuredAppendParity = $saParity; - $this->structuredAppendSequenceNumber = $saSequence; - } - - public function getRawBytes() - { - return $this->rawBytes; - } - - public function getText() - { - return $this->text; - } - - public function getByteSegments() - { - return $this->byteSegments; - } - - public function getECLevel() - { - return $this->ecLevel; - } - - public function getErrorsCorrected() - { - return $this->errorsCorrected; - } - - public function setErrorsCorrected($errorsCorrected) - { - $this->errorsCorrected = $errorsCorrected; - } - - public function getErasures() - { - return $this->erasures; - } - - public function setErasures($erasures) - { - $this->erasures = $erasures; - } - - public function getOther() - { - return $this->other; - } - - public function setOther($other) - { - $this->other = $other; - } - - public function hasStructuredAppend() - { - return $this->structuredAppendParity >= 0 && $this->structuredAppendSequenceNumber >= 0; - } - - public function getStructuredAppendParity() - { - return $this->structuredAppendParity; - } - - public function getStructuredAppendSequenceNumber() - { - return $this->structuredAppendSequenceNumber; - } - -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/DefaultGridSampler.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/DefaultGridSampler.php deleted file mode 100644 index d2326d3c..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/DefaultGridSampler.php +++ /dev/null @@ -1,93 +0,0 @@ -sampleGrid_($image, $dimensionX, $dimensionY, $transform); - } - -//@Override - public function sampleGrid_( - $image, - $dimensionX, - $dimensionY, - $transform - ) { - if ($dimensionX <= 0 || $dimensionY <= 0) { - throw NotFoundException::getNotFoundInstance(); - } - $bits = new BitMatrix($dimensionX, $dimensionY); - $points = fill_array(0, 2 * $dimensionX, 0.0); - for ($y = 0; $y < $dimensionY; $y++) { - $max = count($points); - $iValue = (float)$y + 0.5; - for ($x = 0; $x < $max; $x += 2) { - $points[$x] = (float)($x / 2) + 0.5; - $points[$x + 1] = $iValue; - } - $transform->transformPoints($points); -// Quick check to see if points transformed to something inside the image; -// sufficient to check the endpoints - $this->checkAndNudgePoints($image, $points); - try { - for ($x = 0; $x < $max; $x += 2) { - if ($image->get((int)$points[$x], (int)$points[$x + 1])) { -// Black(-ish) pixel - $bits->set($x / 2, $y); - } - } - } catch (\Exception $aioobe) {//ArrayIndexOutOfBoundsException -// This feels wrong, but, sometimes if the finder patterns are misidentified, the resulting -// transform gets "twisted" such that it maps a straight line of points to a set of points -// whose endpoints are in bounds, but others are not. There is probably some mathematical -// way to detect this about the transformation that I don't know yet. -// This results in an ugly runtime exception despite our clever checks above -- can't have -// that. We could check each point's coordinates but that feels duplicative. We settle for -// catching and wrapping ArrayIndexOutOfBoundsException. - throw NotFoundException::getNotFoundInstance(); - } - } - - return $bits; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Detector/MathUtils.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Detector/MathUtils.php deleted file mode 100644 index e88cfc86..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Detector/MathUtils.php +++ /dev/null @@ -1,49 +0,0 @@ -A somewhat generic detector that looks for a barcode-like rectangular region within an image. - * It looks within a mostly white region of an image for a region of black and white, but mostly - * black. It returns the four corners of the region, as best it can determine.

    - * - * @author Sean Owen - * @port Ashot Khanamiryan - */ -class MonochromeRectangleDetector -{ - private static $MAX_MODULES = 32; - private $image; - - public function __construct(BinaryBitmap $image) - { - $this->image = $image; - - } - - /** - *

    Detects a rectangular region of black and white -- mostly black -- with a region of mostly - * white, in an image.

    - * - * @return {@link ResultPoint}[] describing the corners of the rectangular region. The first and - * last points are opposed on the diagonal, as are the second and third. The first point will be - * the topmost point and the last, the bottommost. The second point will be leftmost and the - * third, the rightmost - * @throws NotFoundException if no Data Matrix Code can be found - */ - public function detect() - { - - $height = $this->image->getHeight(); - $width = $this->image->getWidth(); - $halfHeight = $height / 2; - $halfWidth = $width / 2; - - $deltaY = max(1, $height / (self::$MAX_MODULES * 8)); - $deltaX = max(1, $width / (self::$MAX_MODULES * 8)); - - - $top = 0; - $bottom = $height; - $left = 0; - $right = $width; - $pointA = $this->findCornerFromCenter($halfWidth, 0, $left, $right, - $halfHeight, -$deltaY, $top, $bottom, $halfWidth / 2); - $top = (int)$pointA->getY() - 1; - $pointB = $this->findCornerFromCenter($halfWidth, -$deltaX, $left, $right, - $halfHeight, 0, $top, $bottom, $halfHeight / 2); - $left = (int)$pointB->getX() - 1; - $pointC = $this->findCornerFromCenter($halfWidth, $deltaX, $left, $right, - $halfHeight, 0, $top, $bottom, $halfHeight / 2); - $right = (int)$pointC->getX() + 1; - $pointD = $this->findCornerFromCenter($halfWidth, 0, $left, $right, - $halfHeight, $deltaY, $top, $bottom, $halfWidth / 2); - $bottom = (int)$pointD->getY() + 1; - - // Go try to find po$A again with better information -- might have been off at first. - $pointA = $this->findCornerFromCenter($halfWidth, 0, $left, $right, - $halfHeight, -$deltaY, $top, $bottom, $halfWidth / 4); - - return new ResultPoint($pointA, $pointB, $pointC, $pointD); - - } - - - /** - * Attempts to locate a corner of the barcode by scanning up, down, left or right from a center - * point which should be within the barcode. - * - * @param float $centerX center's x component (horizontal) - * @param float $deltaX same as deltaY but change in x per step instead - * @param float $left minimum value of x - * @param float $right maximum value of x - * @param float $centerY center's y component (vertical) - * @param float $deltaY change in y per step. If scanning up this is negative; down, positive; - * left or right, 0 - * @param float $top minimum value of y to search through (meaningless when di == 0) - * @param float $bottom maximum value of y - * @param float $maxWhiteRun maximum run of white pixels that can still be considered to be within - * the barcode - * - * @return ResultPoint $a {@link com.google.zxing.ResultPoint} encapsulating the corner that was found - * @throws NotFoundException if such a point cannot be found - */ - private function findCornerFromCenter($centerX, - $deltaX, - $left, - $right, - $centerY, - $deltaY, - $top, - $bottom, - $maxWhiteRun) - { - $lastRange = null; - for ($y = $centerY, $x = $centerX; - $y < $bottom && $y >= $top && $x < $right && $x >= $left; - $y += $deltaY, $x += $deltaX) { - $range = 0; - if ($deltaX == 0) { - // horizontal slices, up and down - $range = $this->blackWhiteRange($y, $maxWhiteRun, $left, $right, true); - } else { - // vertical slices, left and right - $range = $this->blackWhiteRange($x, $maxWhiteRun, $top, $bottom, false); - } - if ($range == null) { - if ($lastRange == null) { - throw NotFoundException::getNotFoundInstance(); - } - // lastRange was found - if ($deltaX == 0) { - $lastY = $y - $deltaY; - if ($lastRange[0] < $centerX) { - if ($lastRange[1] > $centerX) { - // straddle, choose one or the other based on direction - return new ResultPoint($deltaY > 0 ? $lastRange[0] : $lastRange[1], $lastY); - } - - return new ResultPoint($lastRange[0], $lastY); - } else { - return new ResultPoint($lastRange[1], $lastY); - } - } else { - $lastX = $x - $deltaX; - if ($lastRange[0] < $centerY) { - if ($lastRange[1] > $centerY) { - return new ResultPoint($lastX, $deltaX < 0 ? $lastRange[0] : $lastRange[1]); - } - - return new ResultPoint($lastX, $lastRange[0]); - } else { - return new ResultPoint($lastX, $lastRange[1]); - } - } - } - $lastRange = $range; - } - throw NotFoundException::getNotFoundInstance(); - } - - - /** - * Computes the start and end of a region of pixels, either horizontally or vertically, that could - * be part of a Data Matrix barcode. - * - * @param fixedDimension if scanning horizontally, this is the row (the fixed vertical location) - * where we are scanning. If scanning vertically it's the column, the fixed horizontal location - * @param maxWhiteRun largest run of white pixels that can still be considered part of the - * barcode region - * @param minDim minimum pixel location, horizontally or vertically, to consider - * @param maxDim maximum pixel location, horizontally or vertically, to consider - * @param horizontal if true, we're scanning left-right, instead of up-down - * - * @return int[] with start and end of found range, or null if no such range is found - * (e.g. only white was found) - */ - - private function blackWhiteRange($fixedDimension, $maxWhiteRun, $minDim, $maxDim, $horizontal) - { - $center = ($minDim + $maxDim) / 2; - - // Scan left/up first - $start = $center; - while ($start >= $minDim) { - if ($horizontal ? $this->image->get($start, $fixedDimension) : $this->image->get($fixedDimension, $start)) { - $start--; - } else { - $whiteRunStart = $start; - do { - $start--; - } while ($start >= $minDim && !($horizontal ? $this->image->get($start, $fixedDimension) : - $this->image->get($fixedDimension, $start))); - $whiteRunSize = $whiteRunStart - $start; - if ($start < $minDim || $whiteRunSize > $maxWhiteRun) { - $start = $whiteRunStart; - break; - } - } - } - $start++; - - // Then try right/down - $end = $center; - while ($end < $maxDim) { - if ($horizontal ? $this->image->get($end, $fixedDimension) : $this->image->get($fixedDimension, $end)) { - $end++; - } else { - $whiteRunStart = $end; - do { - $end++; - } while ($end < $maxDim && !($horizontal ? $this->image->get($end, $fixedDimension) : - $this->image->get($fixedDimension, $end))); - $whiteRunSize = $end - $whiteRunStart; - if ($end >= $maxDim || $whiteRunSize > $maxWhiteRun) { - $end = $whiteRunStart; - break; - } - } - } - $end--; - - return $end > $start ? [$start, $end] : null; - } -} \ No newline at end of file diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/DetectorResult.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/DetectorResult.php deleted file mode 100644 index d2e9bc86..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/DetectorResult.php +++ /dev/null @@ -1,47 +0,0 @@ -Encapsulates the result of detecting a barcode in an image. This includes the raw - * matrix of black/white pixels corresponding to the barcode, and possibly points of interest - * in the image, like the location of finder patterns or corners of the barcode in the image.

    - * - * @author Sean Owen - */ -class DetectorResult -{ - private $bits; - private $points; - - public function __construct($bits, $points) - { - $this->bits = $bits; - $this->points = $points; - } - - public final function getBits() - { - return $this->bits; - } - - public final function getPoints() - { - return $this->points; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/GlobalHistogramBinarizer.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/GlobalHistogramBinarizer.php deleted file mode 100644 index 267c3f02..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/GlobalHistogramBinarizer.php +++ /dev/null @@ -1,207 +0,0 @@ -luminances = self::$EMPTY; - $this->buckets = fill_array(0, self::$LUMINANCE_BUCKETS, 0); - $this->source = $source; - } - - // Applies simple sharpening to the row data to improve performance of the 1D Readers. - public function getBlackRow($y, $row = null) - { - $this->source = $this->getLuminanceSource(); - $width = $this->source->getWidth(); - if ($row == null || $row->getSize() < $width) { - $row = new BitArray($width); - } else { - $row->clear(); - } - - $this->initArrays($width); - $localLuminances = $this->source->getRow($y, $this->luminances); - $localBuckets = $this->buckets; - for ($x = 0; $x < $width; $x++) { - $pixel = $localLuminances[$x] & 0xff; - $localBuckets[$pixel >> self::$LUMINANCE_SHIFT]++; - } - $blackPoint = self::estimateBlackPoint($localBuckets); - - $left = $localLuminances[0] & 0xff; - $center = $localLuminances[1] & 0xff; - for ($x = 1; $x < $width - 1; $x++) { - $right = $localLuminances[$x + 1] & 0xff; - // A simple -1 4 -1 box filter with a weight of 2. - $luminance = (($center * 4) - $left - $right) / 2; - if ($luminance < $blackPoint) { - $row->set($x); - } - $left = $center; - $center = $right; - } - - return $row; - } - - // Does not sharpen the data, as this call is intended to only be used by 2D Readers. - private function initArrays($luminanceSize) - { - if (count($this->luminances) < $luminanceSize) { - $this->luminances = []; - } - for ($x = 0; $x < self::$LUMINANCE_BUCKETS; $x++) { - $this->buckets[$x] = 0; - } - } - - private static function estimateBlackPoint($buckets) - { - // Find the tallest peak in the histogram. - $numBuckets = count($buckets); - $maxBucketCount = 0; - $firstPeak = 0; - $firstPeakSize = 0; - for ($x = 0; $x < $numBuckets; $x++) { - if ($buckets[$x] > $firstPeakSize) { - $firstPeak = $x; - $firstPeakSize = $buckets[$x]; - } - if ($buckets[$x] > $maxBucketCount) { - $maxBucketCount = $buckets[$x]; - } - } - - // Find the second-tallest peak which is somewhat far from the tallest peak. - $secondPeak = 0; - $secondPeakScore = 0; - for ($x = 0; $x < $numBuckets; $x++) { - $distanceToBiggest = $x - $firstPeak; - // Encourage more distant second peaks by multiplying by square of distance. - $score = $buckets[$x] * $distanceToBiggest * $distanceToBiggest; - if ($score > $secondPeakScore) { - $secondPeak = $x; - $secondPeakScore = $score; - } - } - - // Make sure firstPeak corresponds to the black peak. - if ($firstPeak > $secondPeak) { - $temp = $firstPeak; - $firstPeak = $secondPeak; - $secondPeak = $temp; - } - - // If there is too little contrast in the image to pick a meaningful black point, throw rather - // than waste time trying to decode the image, and risk false positives. - if ($secondPeak - $firstPeak <= $numBuckets / 16) { - throw NotFoundException::getNotFoundInstance(); - } - - // Find a valley between them that is low and closer to the white peak. - $bestValley = $secondPeak - 1; - $bestValleyScore = -1; - for ($x = $secondPeak - 1; $x > $firstPeak; $x--) { - $fromFirst = $x - $firstPeak; - $score = $fromFirst * $fromFirst * ($secondPeak - $x) * ($maxBucketCount - $buckets[$x]); - if ($score > $bestValleyScore) { - $bestValley = $x; - $bestValleyScore = $score; - } - } - - return ($bestValley << self::$LUMINANCE_SHIFT); - } - - public function getBlackMatrix() - { - $source = $this->getLuminanceSource(); - $width = $source->getWidth(); - $height = $source->getHeight(); - $matrix = new BitMatrix($width, $height); - - // Quickly calculates the histogram by sampling four rows from the image. This proved to be - // more robust on the blackbox tests than sampling a diagonal as we used to do. - $this->initArrays($width); - $localBuckets = $this->buckets; - for ($y = 1; $y < 5; $y++) { - $row = (int)($height * $y / 5); - $localLuminances = $source->getRow($row, $this->luminances); - $right = (int)(($width * 4) / 5); - for ($x = (int)($width / 5); $x < $right; $x++) { - $pixel = ($localLuminances[(int)($x)] & 0xff); - $localBuckets[($pixel >> self::$LUMINANCE_SHIFT)]++; - } - } - $blackPoint = self::estimateBlackPoint($localBuckets); - - // We delay reading the entire image luminance until the black point estimation succeeds. - // Although we end up reading four rows twice, it is consistent with our motto of - // "fail quickly" which is necessary for continuous scanning. - $localLuminances = $source->getMatrix(); - for ($y = 0; $y < $height; $y++) { - $offset = $y * $width; - for ($x = 0; $x < $width; $x++) { - $pixel = (int)($localLuminances[$offset + $x] & 0xff); - if ($pixel < $blackPoint) { - $matrix->set($x, $y); - } - } - } - - return $matrix; - } - - public function createBinarizer($source) - { - return new GlobalHistogramBinarizer($source); - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/GridSampler.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/GridSampler.php deleted file mode 100644 index affea31b..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/GridSampler.php +++ /dev/null @@ -1,188 +0,0 @@ -Checks a set of points that have been transformed to sample points on an image against - * the image's dimensions to see if the point are even within the image.

    - * - *

    This method will actually "nudge" the endpoints back onto the image if they are found to be - * barely (less than 1 pixel) off the image. This accounts for imperfect detection of finder - * patterns in an image where the QR Code runs all the way to the image border.

    - * - *

    For efficiency, the method will check points from either end of the line until one is found - * to be within the image. Because the set of points are assumed to be linear, this is valid.

    - * - * @param image image into which the points should map - * @param points actual points in x1,y1,...,xn,yn form - * - * @throws NotFoundException if an endpoint is lies outside the image boundaries - */ - protected static function checkAndNudgePoints( - $image, - $points - ) { - $width = $image->getWidth(); - $height = $image->getHeight(); -// Check and nudge points from start until we see some that are OK: - $nudged = true; - for ($offset = 0; $offset < count($points) && $nudged; $offset += 2) { - $x = (int)$points[$offset]; - $y = (int)$points[$offset + 1]; - if ($x < -1 || $x > $width || $y < -1 || $y > $height) { - throw NotFoundException::getNotFoundInstance(); - } - $nudged = false; - if ($x == -1) { - $points[$offset] = 0.0; - $nudged = true; - } else if ($x == $width) { - $points[$offset] = $width - 1; - $nudged = true; - } - if ($y == -1) { - $points[$offset + 1] = 0.0; - $nudged = true; - } else if ($y == $height) { - $points[$offset + 1] = $height - 1; - $nudged = true; - } - } -// Check and nudge points from end: - $nudged = true; - for ($offset = count($points) - 2; $offset >= 0 && $nudged; $offset -= 2) { - $x = (int)$points[$offset]; - $y = (int)$points[$offset + 1]; - if ($x < -1 || $x > $width || $y < -1 || $y > $height) { - throw NotFoundException::getNotFoundInstance(); - } - $nudged = false; - if ($x == -1) { - $points[$offset] = 0.0; - $nudged = true; - } else if ($x == $width) { - $points[$offset] = $width - 1; - $nudged = true; - } - if ($y == -1) { - $points[$offset + 1] = 0.0; - $nudged = true; - } else if ($y == $height) { - $points[$offset + 1] = $height - 1; - $nudged = true; - } - } - } - - /** - * Samples an image for a rectangular matrix of bits of the given dimension. The sampling - * transformation is determined by the coordinates of 4 points, in the original and transformed - * image space. - * - * @param image image to sample - * @param dimensionX width of {@link BitMatrix} to sample from image - * @param dimensionY height of {@link BitMatrix} to sample from image - * @param p1ToX point 1 preimage X - * @param p1ToY point 1 preimage Y - * @param p2ToX point 2 preimage X - * @param p2ToY point 2 preimage Y - * @param p3ToX point 3 preimage X - * @param p3ToY point 3 preimage Y - * @param p4ToX point 4 preimage X - * @param p4ToY point 4 preimage Y - * @param p1FromX point 1 image X - * @param p1FromY point 1 image Y - * @param p2FromX point 2 image X - * @param p2FromY point 2 image Y - * @param p3FromX point 3 image X - * @param p3FromY point 3 image Y - * @param p4FromX point 4 image X - * @param p4FromY point 4 image Y - * - * @return {@link BitMatrix} representing a grid of points sampled from the image within a region - * defined by the "from" parameters - * @throws NotFoundException if image can't be sampled, for example, if the transformation defined - * by the given points is invalid or results in sampling outside the image boundaries - */ - public abstract function sampleGrid( - $image, - $dimensionX, - $dimensionY, - $p1ToX, $p1ToY, - $p2ToX, $p2ToY, - $p3ToX, $p3ToY, - $p4ToX, $p4ToY, - $p1FromX, $p1FromY, - $p2FromX, $p2FromY, - $p3FromX, $p3FromY, - $p4FromX, $p4FromY - ); - - public abstract function sampleGrid_( - $image, - $dimensionX, - $dimensionY, - $transform - ); - -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/HybridBinarizer.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/HybridBinarizer.php deleted file mode 100644 index c71cc1b0..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/HybridBinarizer.php +++ /dev/null @@ -1,264 +0,0 @@ -matrix !== null) { - return $this->matrix; - } - $source = $this->getLuminanceSource(); - $width = $source->getWidth(); - $height = $source->getHeight(); - if ($width >= self::$MINIMUM_DIMENSION && $height >= self::$MINIMUM_DIMENSION) { - $luminances = $source->getMatrix(); - $subWidth = $width >> self::$BLOCK_SIZE_POWER; - if (($width & self::$BLOCK_SIZE_MASK) != 0) { - $subWidth++; - } - $subHeight = $height >> self::$BLOCK_SIZE_POWER; - if (($height & self::$BLOCK_SIZE_MASK) != 0) { - $subHeight++; - } - $blackPoints = self::calculateBlackPoints($luminances, $subWidth, $subHeight, $width, $height); - - $newMatrix = new BitMatrix($width, $height); - self::calculateThresholdForBlock($luminances, $subWidth, $subHeight, $width, $height, $blackPoints, $newMatrix); - $this->matrix = $newMatrix; - } else { - // If the image is too small, fall back to the global histogram approach. - $this->matrix = parent::getBlackMatrix(); - } - - return $this->matrix; - } - - /** - * Calculates a single black point for each block of pixels and saves it away. - * See the following thread for a discussion of this algorithm: - * http://groups.google.com/group/zxing/browse_thread/thread/d06efa2c35a7ddc0 - */ - private static function calculateBlackPoints( - $luminances, - $subWidth, - $subHeight, - $width, - $height - ) { - $blackPoints = fill_array(0, $subHeight, 0); - foreach ($blackPoints as $key => $point) { - $blackPoints[$key] = fill_array(0, $subWidth, 0); - } - for ($y = 0; $y < $subHeight; $y++) { - $yoffset = ($y << self::$BLOCK_SIZE_POWER); - $maxYOffset = $height - self::$BLOCK_SIZE; - if ($yoffset > $maxYOffset) { - $yoffset = $maxYOffset; - } - for ($x = 0; $x < $subWidth; $x++) { - $xoffset = ($x << self::$BLOCK_SIZE_POWER); - $maxXOffset = $width - self::$BLOCK_SIZE; - if ($xoffset > $maxXOffset) { - $xoffset = $maxXOffset; - } - $sum = 0; - $min = 0xFF; - $max = 0; - for ($yy = 0, $offset = $yoffset * $width + $xoffset; $yy < self::$BLOCK_SIZE; $yy++, $offset += $width) { - for ($xx = 0; $xx < self::$BLOCK_SIZE; $xx++) { - $pixel = ((int)($luminances[(int)($offset + $xx)]) & 0xFF); - $sum += $pixel; - // still looking for good contrast - if ($pixel < $min) { - $min = $pixel; - } - if ($pixel > $max) { - $max = $pixel; - } - } - // short-circuit min/max tests once dynamic range is met - if ($max - $min > self::$MIN_DYNAMIC_RANGE) { - // finish the rest of the rows quickly - for ($yy++, $offset += $width; $yy < self::$BLOCK_SIZE; $yy++, $offset += $width) { - for ($xx = 0; $xx < self::$BLOCK_SIZE; $xx++) { - $sum += ($luminances[$offset + $xx] & 0xFF); - } - } - } - } - - // The default estimate is the average of the values in the block. - $average = ($sum >> (self::$BLOCK_SIZE_POWER * 2)); - if ($max - $min <= self::$MIN_DYNAMIC_RANGE) { - // If variation within the block is low, assume this is a block with only light or only - // dark pixels. In that case we do not want to use the average, as it would divide this - // low contrast area into black and white pixels, essentially creating data out of noise. - // - // The default assumption is that the block is light/background. Since no estimate for - // the level of dark pixels exists locally, use half the min for the block. - $average = (int)($min / 2); - - if ($y > 0 && $x > 0) { - // Correct the "white background" assumption for blocks that have neighbors by comparing - // the pixels in this block to the previously calculated black points. This is based on - // the fact that dark barcode symbology is always surrounded by some amount of light - // background for which reasonable black point estimates were made. The bp estimated at - // the boundaries is used for the interior. - - // The (min < bp) is arbitrary but works better than other heuristics that were tried. - $averageNeighborBlackPoint = - (int)(($blackPoints[$y - 1][$x] + (2 * $blackPoints[$y][$x - 1]) + $blackPoints[$y - 1][$x - 1]) / 4); - if ($min < $averageNeighborBlackPoint) { - $average = $averageNeighborBlackPoint; - } - } - } - $blackPoints[$y][$x] = (int)($average); - } - } - - return $blackPoints; - } - - /** - * For each block in the image, calculate the average black point using a 5x5 grid - * of the blocks around it. Also handles the corner cases (fractional blocks are computed based - * on the last pixels in the row/column which are also used in the previous block). - */ - private static function calculateThresholdForBlock( - $luminances, - $subWidth, - $subHeight, - $width, - $height, - $blackPoints, - $matrix - ) { - for ($y = 0; $y < $subHeight; $y++) { - $yoffset = ($y << self::$BLOCK_SIZE_POWER); - $maxYOffset = $height - self::$BLOCK_SIZE; - if ($yoffset > $maxYOffset) { - $yoffset = $maxYOffset; - } - for ($x = 0; $x < $subWidth; $x++) { - $xoffset = ($x << self::$BLOCK_SIZE_POWER); - $maxXOffset = $width - self::$BLOCK_SIZE; - if ($xoffset > $maxXOffset) { - $xoffset = $maxXOffset; - } - $left = self::cap($x, 2, $subWidth - 3); - $top = self::cap($y, 2, $subHeight - 3); - $sum = 0; - for ($z = -2; $z <= 2; $z++) { - $blackRow = $blackPoints[$top + $z]; - $sum += $blackRow[$left - 2] + $blackRow[$left - 1] + $blackRow[$left] + $blackRow[$left + 1] + $blackRow[$left + 2]; - } - $average = (int)($sum / 25); - - self::thresholdBlock($luminances, $xoffset, $yoffset, $average, $width, $matrix); - } - } - } - - private static function cap($value, $min, $max) - { - if ($value < $min) { - return $min; - } elseif ($value > $max) { - return $max; - } else { - return $value; - } - } - - /** - * Applies a single threshold to a block of pixels. - */ - private static function thresholdBlock( - $luminances, - $xoffset, - $yoffset, - $threshold, - $stride, - $matrix - ) { - - for ($y = 0, $offset = $yoffset * $stride + $xoffset; $y < self::$BLOCK_SIZE; $y++, $offset += $stride) { - for ($x = 0; $x < self::$BLOCK_SIZE; $x++) { - // Comparison needs to be <= so that black == 0 pixels are black even if the threshold is 0. - if (($luminances[$offset + $x] & 0xFF) <= $threshold) { - $matrix->set($xoffset + $x, $yoffset + $y); - } - } - } - } - - public function createBinarizer($source) - { - return new HybridBinarizer($source); - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/PerspectiveTransform.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/PerspectiveTransform.php deleted file mode 100644 index a3a0b971..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/PerspectiveTransform.php +++ /dev/null @@ -1,175 +0,0 @@ -This class implements a perspective transform in two dimensions. Given four source and four - * destination points, it will compute the transformation implied between them. The code is based - * directly upon section 3.4.2 of George Wolberg's "Digital Image Warping"; see pages 54-56.

    - * - * @author Sean Owen - */ -final class PerspectiveTransform -{ - private $a11; - private $a12; - private $a13; - private $a21; - private $a22; - private $a23; - private $a31; - private $a32; - private $a33; - - private function __construct( - $a11, $a21, $a31, - $a12, $a22, $a32, - $a13, $a23, $a33 - ) { - $this->a11 = $a11; - $this->a12 = $a12; - $this->a13 = $a13; - $this->a21 = $a21; - $this->a22 = $a22; - $this->a23 = $a23; - $this->a31 = $a31; - $this->a32 = $a32; - $this->a33 = $a33; - } - - public static function quadrilateralToQuadrilateral( - $x0, $y0, - $x1, $y1, - $x2, $y2, - $x3, $y3, - $x0p, $y0p, - $x1p, $y1p, - $x2p, $y2p, - $x3p, $y3p - ) { - - $qToS = self::quadrilateralToSquare($x0, $y0, $x1, $y1, $x2, $y2, $x3, $y3); - $sToQ = self::squareToQuadrilateral($x0p, $y0p, $x1p, $y1p, $x2p, $y2p, $x3p, $y3p); - - return $sToQ->times($qToS); - } - - public static function quadrilateralToSquare( - $x0, $y0, - $x1, $y1, - $x2, $y2, - $x3, $y3 - ) { -// Here, the adjoint serves as the inverse: - return self::squareToQuadrilateral($x0, $y0, $x1, $y1, $x2, $y2, $x3, $y3)->buildAdjoint(); - } - - public function buildAdjoint() - { -// Adjoint is the transpose of the cofactor matrix: - return new PerspectiveTransform($this->a22 * $this->a33 - $this->a23 * $this->a32, - $this->a23 * $this->a31 - $this->a21 * $this->a33, - $this->a21 * $this->a32 - $this->a22 * $this->a31, - $this->a13 * $this->a32 - $this->a12 * $this->a33, - $this->a11 * $this->a33 - $this->a13 * $this->a31, - $this->a12 * $this->a31 - $this->a11 * $this->a32, - $this->a12 * $this->a23 - $this->a13 * $this->a22, - $this->a13 * $this->a21 - $this->a11 * $this->a23, - $this->a11 * $this->a22 - $this->a12 * $this->a21); - } - - public static function squareToQuadrilateral( - $x0, $y0, - $x1, $y1, - $x2, $y2, - $x3, $y3 - ) { - $dx3 = $x0 - $x1 + $x2 - $x3; - $dy3 = $y0 - $y1 + $y2 - $y3; - if ($dx3 == 0.0 && $dy3 == 0.0) { -// Affine - return new PerspectiveTransform($x1 - $x0, $x2 - $x1, $x0, - $y1 - $y0, $y2 - $y1, $y0, - 0.0, 0.0, 1.0); - } else { - $dx1 = $x1 - $x2; - $dx2 = $x3 - $x2; - $dy1 = $y1 - $y2; - $dy2 = $y3 - $y2; - $denominator = $dx1 * $dy2 - $dx2 * $dy1; - $a13 = ($dx3 * $dy2 - $dx2 * $dy3) / $denominator; - $a23 = ($dx1 * $dy3 - $dx3 * $dy1) / $denominator; - - return new PerspectiveTransform($x1 - $x0 + $a13 * $x1, $x3 - $x0 + $a23 * $x3, $x0, - $y1 - $y0 + $a13 * $y1, $y3 - $y0 + $a23 * $y3, $y0, - $a13, $a23, 1.0); - } - } - - public function times($other) - { - return new PerspectiveTransform($this->a11 * $other->a11 + $this->a21 * $other->a12 + $this->a31 * $other->a13, - $this->a11 * $other->a21 + $this->a21 * $other->a22 + $this->a31 * $other->a23, - $this->a11 * $other->a31 + $this->a21 * $other->a32 + $this->a31 * $other->a33, - $this->a12 * $other->a11 + $this->a22 * $other->a12 + $this->a32 * $other->a13, - $this->a12 * $other->a21 + $this->a22 * $other->a22 + $this->a32 * $other->a23, - $this->a12 * $other->a31 + $this->a22 * $other->a32 + $this->a32 * $other->a33, - $this->a13 * $other->a11 + $this->a23 * $other->a12 + $this->a33 * $other->a13, - $this->a13 * $other->a21 + $this->a23 * $other->a22 + $this->a33 * $other->a23, - $this->a13 * $other->a31 + $this->a23 * $other->a32 + $this->a33 * $other->a33); - - } - - public function transformPoints(&$points, &$yValues = 0) - { - if ($yValues) { - $this->transformPoints_($points, $yValues); - - return; - } - $max = count($points); - $a11 = $this->a11; - $a12 = $this->a12; - $a13 = $this->a13; - $a21 = $this->a21; - $a22 = $this->a22; - $a23 = $this->a23; - $a31 = $this->a31; - $a32 = $this->a32; - $a33 = $this->a33; - for ($i = 0; $i < $max; $i += 2) { - $x = $points[$i]; - $y = $points[$i + 1]; - $denominator = $a13 * $x + $a23 * $y + $a33; - $points[$i] = ($a11 * $x + $a21 * $y + $a31) / $denominator; - $points[$i + 1] = ($a12 * $x + $a22 * $y + $a32) / $denominator; - } - } - - public function transformPoints_(&$xValues, &$yValues) - { - $n = count($xValues); - for ($i = 0; $i < $n; $i++) { - $x = $xValues[$i]; - $y = $yValues[$i]; - $denominator = $this->a13 * $x + $this->a23 * $y + $this->a33; - $xValues[$i] = ($this->a11 * $x + $this->a21 * $y + $this->a31) / $denominator; - $yValues[$i] = ($this->a12 * $x + $this->a22 * $y + $this->a32) / $denominator; - } - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Reedsolomon/GenericGF.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Reedsolomon/GenericGF.php deleted file mode 100644 index 49d7b61b..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Reedsolomon/GenericGF.php +++ /dev/null @@ -1,198 +0,0 @@ -This class contains utility methods for performing mathematical operations over - * the Galois Fields. Operations use a given primitive polynomial in calculations.

    - * - *

    Throughout this package, elements of the GF are represented as an {@code int} - * for convenience and speed (but at the cost of memory). - *

    - * - * @author Sean Owen - * @author David Olivier - */ -final class GenericGF -{ - - public static $AZTEC_DATA_12; - public static $AZTEC_DATA_10; - public static $AZTEC_DATA_6; - public static $AZTEC_PARAM; - public static $QR_CODE_FIELD_256; - public static $DATA_MATRIX_FIELD_256; - public static $AZTEC_DATA_8; - public static $MAXICODE_FIELD_64; - - private $expTable; - private $logTable; - private $zero; - private $one; - private $size; - private $primitive; - private $generatorBase; - - /** - * Create a representation of GF(size) using the given primitive polynomial. - * - * @param primitive irreducible polynomial whose coefficients are represented by - * the bits of an int, where the least-significant bit represents the constant - * coefficient - * @param size the size of the field - * @param b the factor b in the generator polynomial can be 0- or 1-based - * (g(x) = (x+a^b)(x+a^(b+1))...(x+a^(b+2t-1))). - * In most cases it should be 1, but for QR code it is 0. - */ - public function __construct($primitive, $size, $b) - { - $this->primitive = $primitive; - $this->size = $size; - $this->generatorBase = $b; - - $this->expTable = []; - $this->logTable = []; - $x = 1; - for ($i = 0; $i < $size; $i++) { - $this->expTable[$i] = $x; - $x *= 2; // we're assuming the generator alpha is 2 - if ($x >= $size) { - $x ^= $primitive; - $x &= $size - 1; - } - } - for ($i = 0; $i < $size - 1; $i++) { - $this->logTable[$this->expTable[$i]] = $i; - } - // logTable[0] == 0 but this should never be used - $this->zero = new GenericGFPoly($this, [0]); - $this->one = new GenericGFPoly($this, [1]); - } - - public static function Init() - { - self::$AZTEC_DATA_12 = new GenericGF(0x1069, 4096, 1); // x^12 + x^6 + x^5 + x^3 + 1 - self::$AZTEC_DATA_10 = new GenericGF(0x409, 1024, 1); // x^10 + x^3 + 1 - self::$AZTEC_DATA_6 = new GenericGF(0x43, 64, 1); // x^6 + x + 1 - self::$AZTEC_PARAM = new GenericGF(0x13, 16, 1); // x^4 + x + 1 - self::$QR_CODE_FIELD_256 = new GenericGF(0x011D, 256, 0); // x^8 + x^4 + x^3 + x^2 + 1 - self::$DATA_MATRIX_FIELD_256 = new GenericGF(0x012D, 256, 1); // x^8 + x^5 + x^3 + x^2 + 1 - self::$AZTEC_DATA_8 = self::$DATA_MATRIX_FIELD_256; - self::$MAXICODE_FIELD_64 = self::$AZTEC_DATA_6; - } - - /** - * Implements both addition and subtraction -- they are the same in GF(size). - * - * @return sum/difference of a and b - */ - public static function addOrSubtract($a, $b) - { - return $a ^ $b; - } - - public function getZero() - { - return $this->zero; - } - - public function getOne() - { - return $this->one; - } - - /** - * @return the monomial representing coefficient * x^degree - */ - public function buildMonomial($degree, $coefficient) - { - if ($degree < 0) { - throw new \InvalidArgumentException(); - } - if ($coefficient == 0) { - return $this->zero; - } - $coefficients = fill_array(0, $degree + 1, 0);//new int[degree + 1]; - $coefficients[0] = $coefficient; - - return new GenericGFPoly($this, $coefficients); - } - - /** - * @return 2 to the power of a in GF(size) - */ - public function exp($a) - { - return $this->expTable[$a]; - } - - /** - * @return base 2 log of a in GF(size) - */ - public function log($a) - { - if ($a == 0) { - throw new \InvalidArgumentException(); - } - - return $this->logTable[$a]; - } - - /** - * @return multiplicative inverse of a - */ - public function inverse($a) - { - if ($a == 0) { - throw new \Exception(); - } - - return $this->expTable[$this->size - $this->logTable[$a] - 1]; - } - - /** - * @return int product of a and b in GF(size) - */ - public function multiply($a, $b) - { - if ($a == 0 || $b == 0) { - return 0; - } - - return $this->expTable[($this->logTable[$a] + $this->logTable[$b]) % ($this->size - 1)]; - } - - public function getSize() - { - return $this->size; - } - - public function getGeneratorBase() - { - return $this->generatorBase; - } - - // @Override - public function toString() - { - return "GF(0x" . dechex((int)($this->primitive)) . ',' . $this->size . ')'; - } - -} - -GenericGF::Init(); diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Reedsolomon/GenericGFPoly.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Reedsolomon/GenericGFPoly.php deleted file mode 100644 index 024af208..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Reedsolomon/GenericGFPoly.php +++ /dev/null @@ -1,289 +0,0 @@ -Represents a polynomial whose coefficients are elements of a GF. - * Instances of this class are immutable.

    - * - *

    Much credit is due to William Rucklidge since portions of this code are an indirect - * port of his C++ Reed-Solomon implementation.

    - * - * @author Sean Owen - */ -final class GenericGFPoly -{ - - private $field; - private $coefficients; - - /** - * @param field the {@link GenericGF} instance representing the field to use - * to perform computations - * @param coefficients array coefficients as ints representing elements of GF(size), arranged - * from most significant (highest-power term) coefficient to least significant - * - * @throws IllegalArgumentException if argument is null or empty, - * or if leading coefficient is 0 and this is not a - * constant polynomial (that is, it is not the monomial "0") - */ - public function __construct($field, $coefficients) - { - if (count($coefficients) == 0) { - throw new \InvalidArgumentException(); - } - $this->field = $field; - $coefficientsLength = count($coefficients); - if ($coefficientsLength > 1 && $coefficients[0] == 0) { - // Leading term must be non-zero for anything except the constant polynomial "0" - $firstNonZero = 1; - while ($firstNonZero < $coefficientsLength && $coefficients[$firstNonZero] == 0) { - $firstNonZero++; - } - if ($firstNonZero == $coefficientsLength) { - $this->coefficients = [0]; - } else { - $this->coefficients = fill_array(0, $coefficientsLength - $firstNonZero, 0); - $this->coefficients = arraycopy($coefficients, - $firstNonZero, - $this->coefficients, - 0, - count($this->coefficients)); - } - } else { - $this->coefficients = $coefficients; - } - } - - public function getCoefficients() - { - return $this->coefficients; - } - - /** - * @return evaluation of this polynomial at a given point - */ - public function evaluateAt($a) - { - if ($a == 0) { - // Just return the x^0 coefficient - return $this->getCoefficient(0); - } - $size = count($this->coefficients); - if ($a == 1) { - // Just the sum of the coefficients - $result = 0; - foreach ($this->coefficients as $coefficient) { - $result = GenericGF::addOrSubtract($result, $coefficient); - } - - return $result; - } - $result = $this->coefficients[0]; - for ($i = 1; $i < $size; $i++) { - $result = GenericGF::addOrSubtract($this->field->multiply($a, $result), $this->coefficients[$i]); - } - - return $result; - } - - /** - * @return coefficient of x^degree term in this polynomial - */ - public function getCoefficient($degree) - { - return $this->coefficients[count($this->coefficients) - 1 - $degree]; - } - - public function multiply($other) - { - if (is_int($other)) { - return $this->multiply_($other); - } - if ($this->field !== $other->field) { - throw new \InvalidArgumentException("GenericGFPolys do not have same GenericGF field"); - } - if ($this->isZero() || $other->isZero()) { - return $this->field->getZero(); - } - $aCoefficients = $this->coefficients; - $aLength = count($aCoefficients); - $bCoefficients = $other->coefficients; - $bLength = count($bCoefficients); - $product = fill_array(0, $aLength + $bLength - 1, 0); - for ($i = 0; $i < $aLength; $i++) { - $aCoeff = $aCoefficients[$i]; - for ($j = 0; $j < $bLength; $j++) { - $product[$i + $j] = GenericGF::addOrSubtract($product[$i + $j], - $this->field->multiply($aCoeff, $bCoefficients[$j])); - } - } - - return new GenericGFPoly($this->field, $product); - } - - public function multiply_($scalar) - { - if ($scalar == 0) { - return $this->field->getZero(); - } - if ($scalar == 1) { - return $this; - } - $size = count($this->coefficients); - $product = fill_array(0, $size, 0); - for ($i = 0; $i < $size; $i++) { - $product[$i] = $this->field->multiply($this->coefficients[$i], $scalar); - } - - return new GenericGFPoly($this->field, $product); - } - - /** - * @return true iff this polynomial is the monomial "0" - */ - public function isZero() - { - return $this->coefficients[0] == 0; - } - - public function multiplyByMonomial($degree, $coefficient) - { - if ($degree < 0) { - throw new \InvalidArgumentException(); - } - if ($coefficient == 0) { - return $this->field->getZero(); - } - $size = count($this->coefficients); - $product = fill_array(0, $size + $degree, 0); - for ($i = 0; $i < $size; $i++) { - $product[$i] = $this->field->multiply($this->coefficients[$i], $coefficient); - } - - return new GenericGFPoly($this->field, $product); - } - - public function divide($other) - { - if ($this->field !== $other->field) { - throw new \InvalidArgumentException("GenericGFPolys do not have same GenericGF field"); - } - if ($other->isZero()) { - throw new \InvalidArgumentException("Divide by 0"); - } - - $quotient = $this->field->getZero(); - $remainder = $this; - - $denominatorLeadingTerm = $other->getCoefficient($other->getDegree()); - $inverseDenominatorLeadingTerm = $this->field->inverse($denominatorLeadingTerm); - - while ($remainder->getDegree() >= $other->getDegree() && !$remainder->isZero()) { - $degreeDifference = $remainder->getDegree() - $other->getDegree(); - $scale = $this->field->multiply($remainder->getCoefficient($remainder->getDegree()), $inverseDenominatorLeadingTerm); - $term = $other->multiplyByMonomial($degreeDifference, $scale); - $iterationQuotient = $this->field->buildMonomial($degreeDifference, $scale); - $quotient = $quotient->addOrSubtract($iterationQuotient); - $remainder = $remainder->addOrSubtract($term); - } - - return [$quotient, $remainder]; - } - - /** - * @return degree of this polynomial - */ - public function getDegree() - { - return count($this->coefficients) - 1; - } - - public function addOrSubtract($other) - { - if ($this->field !== $other->field) { - throw new \InvalidArgumentException("GenericGFPolys do not have same GenericGF field"); - } - if ($this->isZero()) { - return $other; - } - if ($other->isZero()) { - return $this; - } - - $smallerCoefficients = $this->coefficients; - $largerCoefficients = $other->coefficients; - if (count($smallerCoefficients) > count($largerCoefficients)) { - $temp = $smallerCoefficients; - $smallerCoefficients = $largerCoefficients; - $largerCoefficients = $temp; - } - $sumDiff = fill_array(0, count($largerCoefficients), 0); - $lengthDiff = count($largerCoefficients) - count($smallerCoefficients); - // Copy high-order terms only found in higher-degree polynomial's coefficients - $sumDiff = arraycopy($largerCoefficients, 0, $sumDiff, 0, $lengthDiff); - - $countLargerCoefficients = count($largerCoefficients); - for ($i = $lengthDiff; $i < $countLargerCoefficients; $i++) { - $sumDiff[$i] = GenericGF::addOrSubtract($smallerCoefficients[$i - $lengthDiff], $largerCoefficients[$i]); - } - - return new GenericGFPoly($this->field, $sumDiff); - } - - //@Override - - public function toString() - { - $result = ''; - for ($degree = $this->getDegree(); $degree >= 0; $degree--) { - $coefficient = $this->getCoefficient($degree); - if ($coefficient != 0) { - if ($coefficient < 0) { - $result .= " - "; - $coefficient = -$coefficient; - } else { - if (strlen($result) > 0) { - $result .= " + "; - } - } - if ($degree == 0 || $coefficient != 1) { - $alphaPower = $this->field->log($coefficient); - if ($alphaPower == 0) { - $result .= '1'; - } else if ($alphaPower == 1) { - $result .= 'a'; - } else { - $result .= "a^"; - $result .= ($alphaPower); - } - } - if ($degree != 0) { - if ($degree == 1) { - $result .= 'x'; - } else { - $result .= "x^"; - $result .= $degree; - } - } - } - } - - return $result; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Reedsolomon/ReedSolomonDecoder.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Reedsolomon/ReedSolomonDecoder.php deleted file mode 100644 index f9a3e70a..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Reedsolomon/ReedSolomonDecoder.php +++ /dev/null @@ -1,201 +0,0 @@ -Implements Reed-Solomon decoding, as the name implies.

    - * - *

    The algorithm will not be explained here, but the following references were helpful - * in creating this implementation:

    - * - * - * - *

    Much credit is due to William Rucklidge since portions of this code are an indirect - * port of his C++ Reed-Solomon implementation.

    - * - * @author Sean Owen - * @author William Rucklidge - * @author sanfordsquires - */ -final class ReedSolomonDecoder -{ - - private $field; - - public function __construct($field) - { - $this->field = $field; - } - - /** - *

    Decodes given set of received codewords, which include both data and error-correction - * codewords. Really, this means it uses Reed-Solomon to detect and correct errors, in-place, - * in the input.

    - * - * @param received data and error-correction codewords - * @param twoS number of error-correction codewords available - * - * @throws ReedSolomonException if decoding fails for any reason - */ - public function decode(&$received, $twoS) - { - $poly = new GenericGFPoly($this->field, $received); - $syndromeCoefficients = fill_array(0, $twoS, 0); - $noError = true; - for ($i = 0; $i < $twoS; $i++) { - $eval = $poly->evaluateAt($this->field->exp($i + $this->field->getGeneratorBase())); - $syndromeCoefficients[count($syndromeCoefficients) - 1 - $i] = $eval; - if ($eval != 0) { - $noError = false; - } - } - if ($noError) { - return; - } - $syndrome = new GenericGFPoly($this->field, $syndromeCoefficients); - $sigmaOmega = - $this->runEuclideanAlgorithm($this->field->buildMonomial($twoS, 1), $syndrome, $twoS); - $sigma = $sigmaOmega[0]; - $omega = $sigmaOmega[1]; - $errorLocations = $this->findErrorLocations($sigma); - $errorMagnitudes = $this->findErrorMagnitudes($omega, $errorLocations); - $errorLocationsCount = count($errorLocations); - for ($i = 0; $i < $errorLocationsCount; $i++) { - $position = count($received) - 1 - $this->field->log($errorLocations[$i]); - if ($position < 0) { - throw new ReedSolomonException("Bad error location"); - } - $received[$position] = GenericGF::addOrSubtract($received[$position], $errorMagnitudes[$i]); - } - - } - - private function runEuclideanAlgorithm($a, $b, $R) - { - // Assume a's degree is >= b's - if ($a->getDegree() < $b->getDegree()) { - $temp = $a; - $a = $b; - $b = $temp; - } - - $rLast = $a; - $r = $b; - $tLast = $this->field->getZero(); - $t = $this->field->getOne(); - - // Run Euclidean algorithm until r's degree is less than R/2 - while ($r->getDegree() >= $R / 2) { - $rLastLast = $rLast; - $tLastLast = $tLast; - $rLast = $r; - $tLast = $t; - - // Divide rLastLast by rLast, with quotient in q and remainder in r - if ($rLast->isZero()) { - // Oops, Euclidean algorithm already terminated? - throw new ReedSolomonException("r_{i-1} was zero"); - } - $r = $rLastLast; - $q = $this->field->getZero(); - $denominatorLeadingTerm = $rLast->getCoefficient($rLast->getDegree()); - $dltInverse = $this->field->inverse($denominatorLeadingTerm); - while ($r->getDegree() >= $rLast->getDegree() && !$r->isZero()) { - $degreeDiff = $r->getDegree() - $rLast->getDegree(); - $scale = $this->field->multiply($r->getCoefficient($r->getDegree()), $dltInverse); - $q = $q->addOrSubtract($this->field->buildMonomial($degreeDiff, $scale)); - $r = $r->addOrSubtract($rLast->multiplyByMonomial($degreeDiff, $scale)); - } - - $t = $q->multiply($tLast)->addOrSubtract($tLastLast); - - if ($r->getDegree() >= $rLast->getDegree()) { - throw new IllegalStateException("Division algorithm failed to reduce polynomial?"); - } - } - - $sigmaTildeAtZero = $t->getCoefficient(0); - if ($sigmaTildeAtZero == 0) { - throw new ReedSolomonException("sigmaTilde(0) was zero"); - } - - $inverse = $this->field->inverse($sigmaTildeAtZero); - $sigma = $t->multiply($inverse); - $omega = $r->multiply($inverse); - - return [$sigma, $omega]; - } - - private function findErrorLocations($errorLocator) - { - // This is a direct application of Chien's search - $numErrors = $errorLocator->getDegree(); - if ($numErrors == 1) { // shortcut - return [$errorLocator->getCoefficient(1)]; - } - $result = fill_array(0, $numErrors, 0); - $e = 0; - for ($i = 1; $i < $this->field->getSize() && $e < $numErrors; $i++) { - if ($errorLocator->evaluateAt($i) == 0) { - $result[$e] = $this->field->inverse($i); - $e++; - } - } - if ($e != $numErrors) { - throw new ReedSolomonException("Error locator degree does not match number of roots"); - } - - return $result; - } - - private function findErrorMagnitudes($errorEvaluator, $errorLocations) - { - // This is directly applying Forney's Formula - $s = count($errorLocations); - $result = fill_array(0, $s, 0); - for ($i = 0; $i < $s; $i++) { - $xiInverse = $this->field->inverse($errorLocations[$i]); - $denominator = 1; - for ($j = 0; $j < $s; $j++) { - if ($i != $j) { - //denominator = field.multiply(denominator, - // GenericGF.addOrSubtract(1, field.multiply(errorLocations[j], xiInverse))); - // Above should work but fails on some Apple and Linux JDKs due to a Hotspot bug. - // Below is a funny-looking workaround from Steven Parkes - $term = $this->field->multiply($errorLocations[$j], $xiInverse); - $termPlus1 = ($term & 0x1) == 0 ? $term | 1 : $term & ~1; - $denominator = $this->field->multiply($denominator, $termPlus1); - } - } - $result[$i] = $this->field->multiply($errorEvaluator->evaluateAt($xiInverse), - $this->field->inverse($denominator)); - if ($this->field->getGeneratorBase() != 0) { - $result[$i] = $this->field->multiply($result[$i], $xiInverse); - } - } - - return $result; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Reedsolomon/ReedSolomonException.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Reedsolomon/ReedSolomonException.php deleted file mode 100644 index cd7babd7..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/Reedsolomon/ReedSolomonException.php +++ /dev/null @@ -1,28 +0,0 @@ -Thrown when an exception occurs during Reed-Solomon decoding, such as when - * there are too many errors to correct.

    - * - * @author Sean Owen - */ -final class ReedSolomonException extends \Exception -{ -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/customFunctions.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/customFunctions.php deleted file mode 100644 index c336f57c..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Common/customFunctions.php +++ /dev/null @@ -1,101 +0,0 @@ ->= 1; - $num++; - } - - return $num; - } -} - -if (!function_exists('uRShift')) { - function uRShift($a, $b) - { - static $mask = (8 * PHP_INT_SIZE - 1); - if ($b === 0) { - return $a; - } - - return ($a >> $b) & ~(1 << $mask >> ($b - 1)); - } -} - -/* -function sdvig3($num,$count=1){//>>> 32 bit - $s = decbin($num); - - $sarray = str_split($s,1); - $sarray = array_slice($sarray,-32);//32bit - - for($i=0;$i<=1;$i++) { - array_pop($sarray); - array_unshift($sarray, '0'); - } - return bindec(implode($sarray)); -} -*/ - -if (!function_exists('sdvig3')) { - function sdvig3($a, $b) - { - if ($a >= 0) { - return bindec(decbin($a >> $b)); //simply right shift for positive number - } - - $bin = decbin($a >> $b); - - $bin = substr($bin, $b); // zero fill on the left side - - return bindec($bin); - } -} - -if (!function_exists('floatToIntBits')) { - function floatToIntBits($float_val) - { - $int = unpack('i', pack('f', $float_val)); - - return $int[1]; - } -} - - -if (!function_exists('fill_array')) { - function fill_array($index, $count, $value) - { - if ($count <= 0) { - return [0]; - } - - return array_fill($index, $count, $value); - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/FormatException.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/FormatException.php deleted file mode 100644 index 64de6509..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/FormatException.php +++ /dev/null @@ -1,49 +0,0 @@ -GDLuminanceSource($gdImage, $dataWidth, $dataHeight); - - return; - } - parent::__construct($width, $height); - if ($left + $width > $dataWidth || $top + $height > $dataHeight) { - throw new \InvalidArgumentException("Crop rectangle does not fit within image data."); - } - $this->luminances = $gdImage; - $this->dataWidth = $dataWidth; - $this->dataHeight = $dataHeight; - $this->left = $left; - $this->top = $top; - } - - public function GDLuminanceSource($gdImage, $width, $height) - { - parent::__construct($width, $height); - - $this->dataWidth = $width; - $this->dataHeight = $height; - $this->left = 0; - $this->top = 0; - $this->$gdImage = $gdImage; - - -// In order to measure pure decoding speed, we convert the entire image to a greyscale array -// up front, which is the same as the Y channel of the YUVLuminanceSource in the real app. - $this->luminances = []; - //$this->luminances = $this->grayScaleToBitmap($this->grayscale()); - - $array = []; - $rgb = []; - - for ($j = 0; $j < $height; $j++) { - for ($i = 0; $i < $width; $i++) { - $argb = imagecolorat($this->$gdImage, $i, $j); - $pixel = imagecolorsforindex($this->$gdImage, $argb); - $r = $pixel['red']; - $g = $pixel['green']; - $b = $pixel['blue']; - if ($r == $g && $g == $b) { -// Image is already greyscale, so pick any channel. - - $this->luminances[] = $r;//(($r + 128) % 256) - 128; - } else { -// Calculate luminance cheaply, favoring green. - $this->luminances[] = ($r + 2 * $g + $b) / 4;//(((($r + 2 * $g + $b) / 4) + 128) % 256) - 128; - } - } - } - - /* - for ($y = 0; $y < $height; $y++) { - $offset = $y * $width; - for ($x = 0; $x < $width; $x++) { - $pixel = $pixels[$offset + $x]; - $r = ($pixel >> 16) & 0xff; - $g = ($pixel >> 8) & 0xff; - $b = $pixel & 0xff; - if ($r == $g && $g == $b) { -// Image is already greyscale, so pick any channel. - - $this->luminances[(int)($offset + $x)] = (($r+128) % 256) - 128; - } else { -// Calculate luminance cheaply, favoring green. - $this->luminances[(int)($offset + $x)] = (((($r + 2 * $g + $b) / 4)+128)%256) - 128; - } - - - - } - */ - //} - // $this->luminances = $this->grayScaleToBitmap($this->luminances); - } - -//@Override - public function getRow($y, $row = null) - { - if ($y < 0 || $y >= $this->getHeight()) { - throw new \InvalidArgumentException('Requested row is outside the image: ' . $y); - } - $width = $this->getWidth(); - if ($row == null || count($row) < $width) { - $row = []; - } - $offset = ($y + $this->top) * $this->dataWidth + $this->left; - $row = arraycopy($this->luminances, $offset, $row, 0, $width); - - return $row; - } - -//@Override - public function getMatrix() - { - $width = $this->getWidth(); - $height = $this->getHeight(); - -// If the caller asks for the entire underlying image, save the copy and give them the -// original data. The docs specifically warn that result.length must be ignored. - if ($width == $this->dataWidth && $height == $this->dataHeight) { - return $this->luminances; - } - - $area = $width * $height; - $matrix = []; - $inputOffset = $this->top * $this->dataWidth + $this->left; - -// If the width matches the full width of the underlying data, perform a single copy. - if ($width == $this->dataWidth) { - $matrix = arraycopy($this->luminances, $inputOffset, $matrix, 0, $area); - - return $matrix; - } - -// Otherwise copy one cropped row at a time. - $rgb = $this->luminances; - for ($y = 0; $y < $height; $y++) { - $outputOffset = $y * $width; - $matrix = arraycopy($rgb, $inputOffset, $matrix, $outputOffset, $width); - $inputOffset += $this->dataWidth; - } - - return $matrix; - } - -//@Override - public function isCropSupported() - { - return true; - } - -//@Override - public function crop($left, $top, $width, $height) - { - return new GDLuminanceSource($this->luminances, - $this->dataWidth, - $this->dataHeight, - $this->left + $left, - $this->top + $top, - $width, - $height); - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/IMagickLuminanceSource.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/IMagickLuminanceSource.php deleted file mode 100644 index aac6d541..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/IMagickLuminanceSource.php +++ /dev/null @@ -1,150 +0,0 @@ -_IMagickLuminanceSource($image, $dataWidth, $dataHeight); - - return; - } - parent::__construct($width, $height); - if ($left + $width > $dataWidth || $top + $height > $dataHeight) { - throw new \InvalidArgumentException("Crop rectangle does not fit within image data."); - } - $this->luminances = $image; - $this->dataWidth = $dataWidth; - $this->dataHeight = $dataHeight; - $this->left = $left; - $this->top = $top; - } - - public function _IMagickLuminanceSource(\Imagick $image, $width, $height) - { - parent::__construct($width, $height); - - $this->dataWidth = $width; - $this->dataHeight = $height; - $this->left = 0; - $this->top = 0; - $this->image = $image; - - -// In order to measure pure decoding speed, we convert the entire image to a greyscale array -// up front, which is the same as the Y channel of the YUVLuminanceSource in the real app. - $this->luminances = []; - - $image->setImageColorspace(\Imagick::COLORSPACE_GRAY); - // $image->newPseudoImage(0, 0, "magick:rose"); - $pixels = $image->exportImagePixels(1, 1, $width, $height, "RGB", \Imagick::PIXEL_CHAR); - - $array = []; - $rgb = []; - - $countPixels = count($pixels); - for ($i = 0; $i < $countPixels; $i += 3) { - $r = $pixels[$i] & 0xff; - $g = $pixels[$i + 1] & 0xff; - $b = $pixels[$i + 2] & 0xff; - if ($r == $g && $g == $b) { -// Image is already greyscale, so pick any channel. - - $this->luminances[] = $r;//(($r + 128) % 256) - 128; - } else { -// Calculate luminance cheaply, favoring green. - $this->luminances[] = ($r + 2 * $g + $b) / 4;//(((($r + 2 * $g + $b) / 4) + 128) % 256) - 128; - } - } - } - -//@Override - public function getRow($y, $row = null) - { - if ($y < 0 || $y >= $this->getHeight()) { - throw new \InvalidArgumentException('Requested row is outside the image: ' . $y); - } - $width = $this->getWidth(); - if ($row == null || count($row) < $width) { - $row = []; - } - $offset = ($y + $this->top) * $this->dataWidth + $this->left; - $row = arraycopy($this->luminances, $offset, $row, 0, $width); - - return $row; - } - -//@Override - public function getMatrix() - { - $width = $this->getWidth(); - $height = $this->getHeight(); - -// If the caller asks for the entire underlying image, save the copy and give them the -// original data. The docs specifically warn that result.length must be ignored. - if ($width == $this->dataWidth && $height == $this->dataHeight) { - return $this->luminances; - } - - $area = $width * $height; - $matrix = []; - $inputOffset = $this->top * $this->dataWidth + $this->left; - -// If the width matches the full width of the underlying data, perform a single copy. - if ($width == $this->dataWidth) { - $matrix = arraycopy($this->luminances, $inputOffset, $matrix, 0, $area); - - return $matrix; - } - -// Otherwise copy one cropped row at a time. - $rgb = $this->luminances; - for ($y = 0; $y < $height; $y++) { - $outputOffset = $y * $width; - $matrix = arraycopy($rgb, $inputOffset, $matrix, $outputOffset, $width); - $inputOffset += $this->dataWidth; - } - - return $matrix; - } - -//@Override - public function isCropSupported() - { - return true; - } - -//@Override - public function crop($left, $top, $width, $height) - { - return $this->luminances->cropImage($width, $height, $left, $top); - - return new GDLuminanceSource($this->luminances, - $this->dataWidth, - $this->dataHeight, - $this->left + $left, - $this->top + $top, - $width, - $height); - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/LuminanceSource.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/LuminanceSource.php deleted file mode 100644 index ab971cfd..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/LuminanceSource.php +++ /dev/null @@ -1,171 +0,0 @@ -width = $width; - $this->height = $height; - } - - /** - * Fetches luminance data for the underlying bitmap. Values should be fetched using: - * {@code int luminance = array[y * width + x] & 0xff} - * - * @return A row-major 2D array of luminance values. Do not use result.length as it may be - * larger than width * height bytes on some platforms. Do not modify the contents - * of the result. - */ - public abstract function getMatrix(); - - /** - * @return The width of the bitmap. - */ - public final function getWidth() - { - return $this->width; - } - - /** - * @return The height of the bitmap. - */ - public final function getHeight() - { - return $this->height; - } - - /** - * @return bool Whether this subclass supports cropping. - */ - public function isCropSupported() - { - return false; - } - - /** - * Returns a new object with cropped image data. Implementations may keep a reference to the - * original data rather than a copy. Only callable if isCropSupported() is true. - * - * @param left The left coordinate, which must be in [0,getWidth()) - * @param top The top coordinate, which must be in [0,getHeight()) - * @param width The width of the rectangle to crop. - * @param height The height of the rectangle to crop. - * - * @return A cropped version of this object. - */ - public function crop($left, $top, $width, $height) - { - throw new \Exception("This luminance source does not support cropping."); - } - - /** - * @return Whether this subclass supports counter-clockwise rotation. - */ - public function isRotateSupported() - { - return false; - } - - /** - * @return a wrapper of this {@code LuminanceSource} which inverts the luminances it returns -- black becomes - * white and vice versa, and each value becomes (255-value). - */ - public function invert() - { - return new InvertedLuminanceSource($this); - } - - /** - * Returns a new object with rotated image data by 90 degrees counterclockwise. - * Only callable if {@link #isRotateSupported()} is true. - * - * @return A rotated version of this object. - */ - public function rotateCounterClockwise() - { - throw new \Exception("This luminance source does not support rotation by 90 degrees."); - } - - /** - * Returns a new object with rotated image data by 45 degrees counterclockwise. - * Only callable if {@link #isRotateSupported()} is true. - * - * @return A rotated version of this object. - */ - public function rotateCounterClockwise45() - { - throw new \Exception("This luminance source does not support rotation by 45 degrees."); - } - - public final function toString() - { - $row = []; - $result = ''; - for ($y = 0; $y < $this->height; $y++) { - $row = $this->getRow($y, $row); - for ($x = 0; $x < $this->width; $x++) { - $luminance = $row[$x] & 0xFF; - $c = ''; - if ($luminance < 0x40) { - $c = '#'; - } else if ($luminance < 0x80) { - $c = '+'; - } else if ($luminance < 0xC0) { - $c = '.'; - } else { - $c = ' '; - } - $result .= ($c); - } - $result .= ('\n'); - } - - return $result; - } - - /** - * Fetches one row of luminance data from the underlying platform's bitmap. Values range from - * 0 (black) to 255 (white). Because Java does not have an unsigned byte type, callers will have - * to bitwise and with 0xff for each value. It is preferable for implementations of this method - * to only fetch this row rather than the whole image, since no 2D Readers may be installed and - * getMatrix() may never be called. - * - * @param $y ; The row to fetch, which must be in [0,getHeight()) - * @param $row ; An optional preallocated array. If null or too small, it will be ignored. - * Always use the returned object, and ignore the .length of the array. - * - * @return array - * An array containing the luminance data. - */ - public abstract function getRow($y, $row); -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/NotFoundException.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/NotFoundException.php deleted file mode 100644 index 0b3c4237..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/NotFoundException.php +++ /dev/null @@ -1,38 +0,0 @@ - $dataWidth || $top + $height > $dataHeight) { - throw new \InvalidArgumentException("Crop rectangle does not fit within image data."); - } - - $this->yuvData = $yuvData; - $this->dataWidth = $dataWidth; - $this->dataHeight = $dataHeight; - $this->left = $left; - $this->top = $top; - if ($reverseHorizontal) { - $this->reverseHorizontal($width, $height); - } - } - - //@Override - public function getRow($y, $row = null) - { - if ($y < 0 || $y >= getHeight()) { - throw new \InvalidArgumentException("Requested row is outside the image: " + y); - } - $width = $this->getWidth(); - if ($row == null || count($row) < $width) { - $row = [];//new byte[width]; - } - $offset = ($y + $this->top) * $this->dataWidth + $this->left; - $row = arraycopy($this->yuvData, $offset, $row, 0, $width); - - return $row; - } - - //@Override - public function getMatrix() - { - $width = $this->getWidth(); - $height = $this->getHeight(); - - // If the caller asks for the entire underlying image, save the copy and give them the - // original data. The docs specifically warn that result.length must be ignored. - if ($width == $this->dataWidth && $height == $this->dataHeight) { - return $this->yuvData; - } - - $area = $width * $height; - $matrix = [];//new byte[area]; - $inputOffset = $this->top * $this->dataWidth + $this->left; - - // If the width matches the full width of the underlying data, perform a single copy. - if ($width == $this->dataWidth) { - $matrix = arraycopy($this->yuvData, $inputOffset, $matrix, 0, $area); - - return $matrix; - } - - // Otherwise copy one cropped row at a time. - $yuv = $this->yuvData; - for ($y = 0; $y < $height; $y++) { - $outputOffset = $y * $width; - $matrix = arraycopy($this->yuvData, $inputOffset, $matrix, $outputOffset, $width); - $inputOffset += $this->dataWidth; - } - - return $matrix; - } - - // @Override - public function isCropSupported() - { - return true; - } - - // @Override - public function crop($left, $top, $width, $height) - { - return new PlanarYUVLuminanceSource($this->yuvData, - $this->dataWidth, - $this->dataHeight, - $this->left + $left, - $this->top + $top, - $width, - $height, - false); - } - - public function renderThumbnail() - { - $width = (int)($this->getWidth() / self::$THUMBNAIL_SCALE_FACTOR); - $height = (int)($this->getHeight() / self::$THUMBNAIL_SCALE_FACTOR); - $pixels = [];//new int[width * height]; - $yuv = $this->yuvData; - $inputOffset = $this->top * $this->dataWidth + $this->left; - - for ($y = 0; $y < $height; $y++) { - $outputOffset = $y * $width; - for ($x = 0; $x < $width; $x++) { - $grey = ($yuv[$inputOffset + $x * self::$THUMBNAIL_SCALE_FACTOR] & 0xff); - $pixels[$outputOffset + $x] = (0xFF000000 | ($grey * 0x00010101)); - } - $inputOffset += $this->dataWidth * self::$THUMBNAIL_SCALE_FACTOR; - } - - return $pixels; - } - - /** - * @return width of image from {@link #renderThumbnail()} - */ - /* - public int getThumbnailWidth() { - return getWidth() / THUMBNAIL_SCALE_FACTOR; - }*/ - - /** - * @return height of image from {@link #renderThumbnail()} - */ - /* - public int getThumbnailHeight() { - return getHeight() / THUMBNAIL_SCALE_FACTOR; - } - - private void reverseHorizontal(int width, int height) { - byte[] yuvData = this.yuvData; - for (int y = 0, rowStart = top * dataWidth + left; y < height; y++, rowStart += dataWidth) { - int middle = rowStart + width / 2; - for (int x1 = rowStart, x2 = rowStart + width - 1; x1 < middle; x1++, x2--) { - byte temp = yuvData[x1]; - yuvData[x1] = yuvData[x2]; - yuvData[x2] = temp; - } - } - } -*/ -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/QrReader.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/QrReader.php deleted file mode 100644 index 200f9105..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/QrReader.php +++ /dev/null @@ -1,105 +0,0 @@ -readImage($imgSource); - } else { - $image = file_get_contents($imgSource); - $im = imagecreatefromstring($image); - } - break; - - case QrReader::SOURCE_TYPE_BLOB: - if ($useImagickIfAvailable && extension_loaded('imagick')) { - $im = new \Imagick(); - $im->readImageBlob($imgSource); - } else { - $im = imagecreatefromstring($imgSource); - } - break; - - case QrReader::SOURCE_TYPE_RESOURCE: - $im = $imgSource; - if ($useImagickIfAvailable && extension_loaded('imagick')) { - $useImagickIfAvailable = true; - } else { - $useImagickIfAvailable = false; - } - break; - } - if ($useImagickIfAvailable && extension_loaded('imagick')) { - if (!$im instanceof \Imagick) { - throw new \InvalidArgumentException('Invalid image source.'); - } - $width = $im->getImageWidth(); - $height = $im->getImageHeight(); - $source = new IMagickLuminanceSource($im, $width, $height); - } else { - if (!is_resource($im)) { - throw new \InvalidArgumentException('Invalid image source.'); - } - $width = imagesx($im); - $height = imagesy($im); - $source = new GDLuminanceSource($im, $width, $height); - } - $histo = new HybridBinarizer($source); - $this->bitmap = new BinaryBitmap($histo); - $this->reader = new QRCodeReader(); - } - - public function decode() - { - try { - $this->result = $this->reader->decode($this->bitmap); - } catch (NotFoundException $er) { - $this->result = false; - } catch (FormatException $er) { - $this->result = false; - } catch (ChecksumException $er) { - $this->result = false; - } - } - - public function text() - { - $this->decode(); - - if (method_exists($this->result, 'toString')) { - return $this->result->toString(); - } - - return $this->result; - } - - public function getResult() - { - return $this->result; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/BitMatrixParser.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/BitMatrixParser.php deleted file mode 100644 index 80607209..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/BitMatrixParser.php +++ /dev/null @@ -1,263 +0,0 @@ -= 21 and 1 mod 4 - */ - public function __construct($bitMatrix) - { - $dimension = $bitMatrix->getHeight(); - if ($dimension < 21 || ($dimension & 0x03) != 1) { - throw FormatException::getFormatInstance(); - } - $this->bitMatrix = $bitMatrix; - } - - /** - *

    Reads the bits in the {@link BitMatrix} representing the finder pattern in the - * correct order in order to reconstruct the codewords bytes contained within the - * QR Code.

    - * - * @return bytes encoded within the QR Code - * @throws FormatException if the exact number of bytes expected is not read - */ - public function readCodewords() - { - - $formatInfo = $this->readFormatInformation(); - $version = $this->readVersion(); - - // Get the data mask for the format used in this QR Code. This will exclude - // some bits from reading as we wind through the bit matrix. - $dataMask = DataMask::forReference($formatInfo->getDataMask()); - $dimension = $this->bitMatrix->getHeight(); - $dataMask->unmaskBitMatrix($this->bitMatrix, $dimension); - - $functionPattern = $version->buildFunctionPattern(); - - $readingUp = true; - if ($version->getTotalCodewords()) { - $result = fill_array(0, $version->getTotalCodewords(), 0); - } else { - $result = []; - } - $resultOffset = 0; - $currentByte = 0; - $bitsRead = 0; - // Read columns in pairs, from right to left - for ($j = $dimension - 1; $j > 0; $j -= 2) { - if ($j == 6) { - // Skip whole column with vertical alignment pattern; - // saves time and makes the other code proceed more cleanly - $j--; - } - // Read alternatingly from bottom to top then top to bottom - for ($count = 0; $count < $dimension; $count++) { - $i = $readingUp ? $dimension - 1 - $count : $count; - for ($col = 0; $col < 2; $col++) { - // Ignore bits covered by the function pattern - if (!$functionPattern->get($j - $col, $i)) { - // Read a bit - $bitsRead++; - $currentByte <<= 1; - if ($this->bitMatrix->get($j - $col, $i)) { - $currentByte |= 1; - } - // If we've made a whole byte, save it off - if ($bitsRead == 8) { - $result[$resultOffset++] = $currentByte; //(byte) - $bitsRead = 0; - $currentByte = 0; - } - } - } - } - $readingUp ^= true; // readingUp = !readingUp; // switch directions - } - if ($resultOffset != $version->getTotalCodewords()) { - throw FormatException::getFormatInstance(); - } - - return $result; - } - - /** - *

    Reads format information from one of its two locations within the QR Code.

    - * - * @return {@link FormatInformation} encapsulating the QR Code's format info - * @throws FormatException if both format information locations cannot be parsed as - * the valid encoding of format information - */ - public function readFormatInformation() - { - - if ($this->parsedFormatInfo != null) { - return $this->parsedFormatInfo; - } - - // Read top-left format info bits - $formatInfoBits1 = 0; - for ($i = 0; $i < 6; $i++) { - $formatInfoBits1 = $this->copyBit($i, 8, $formatInfoBits1); - } - // .. and skip a bit in the timing pattern ... - $formatInfoBits1 = $this->copyBit(7, 8, $formatInfoBits1); - $formatInfoBits1 = $this->copyBit(8, 8, $formatInfoBits1); - $formatInfoBits1 = $this->copyBit(8, 7, $formatInfoBits1); - // .. and skip a bit in the timing pattern ... - for ($j = 5; $j >= 0; $j--) { - $formatInfoBits1 = $this->copyBit(8, $j, $formatInfoBits1); - } - - // Read the top-right/bottom-left pattern too - $dimension = $this->bitMatrix->getHeight(); - $formatInfoBits2 = 0; - $jMin = $dimension - 7; - for ($j = $dimension - 1; $j >= $jMin; $j--) { - $formatInfoBits2 = $this->copyBit(8, $j, $formatInfoBits2); - } - for ($i = $dimension - 8; $i < $dimension; $i++) { - $formatInfoBits2 = $this->copyBit($i, 8, $formatInfoBits2); - } - - $parsedFormatInfo = FormatInformation::decodeFormatInformation($formatInfoBits1, $formatInfoBits2); - if ($parsedFormatInfo != null) { - return $parsedFormatInfo; - } - throw FormatException::getFormatInstance(); - } - - private function copyBit($i, $j, $versionBits) - { - $bit = $this->mirror ? $this->bitMatrix->get($j, $i) : $this->bitMatrix->get($i, $j); - - return $bit ? ($versionBits << 1) | 0x1 : $versionBits << 1; - } - - /** - *

    Reads version information from one of its two locations within the QR Code.

    - * - * @return {@link Version} encapsulating the QR Code's version - * @throws FormatException if both version information locations cannot be parsed as - * the valid encoding of version information - */ - public function readVersion() - { - - if ($this->parsedVersion != null) { - return $this->parsedVersion; - } - - $dimension = $this->bitMatrix->getHeight(); - - $provisionalVersion = ($dimension - 17) / 4; - if ($provisionalVersion <= 6) { - return Version::getVersionForNumber($provisionalVersion); - } - - // Read top-right version info: 3 wide by 6 tall - $versionBits = 0; - $ijMin = $dimension - 11; - for ($j = 5; $j >= 0; $j--) { - for ($i = $dimension - 9; $i >= $ijMin; $i--) { - $versionBits = $this->copyBit($i, $j, $versionBits); - } - } - - $theParsedVersion = Version::decodeVersionInformation($versionBits); - if ($theParsedVersion != null && $theParsedVersion->getDimensionForVersion() == $dimension) { - $this->parsedVersion = $theParsedVersion; - - return $theParsedVersion; - } - - // Hmm, failed. Try bottom left: 6 wide by 3 tall - $versionBits = 0; - for ($i = 5; $i >= 0; $i--) { - for ($j = $dimension - 9; $j >= $ijMin; $j--) { - $versionBits = $this->copyBit($i, $j, $versionBits); - } - } - - $theParsedVersion = Version::decodeVersionInformation($versionBits); - if ($theParsedVersion != null && $theParsedVersion->getDimensionForVersion() == $dimension) { - $this->parsedVersion = $theParsedVersion; - - return $theParsedVersion; - } - throw FormatException::getFormatInstance(); - } - - /** - * Revert the mask removal done while reading the code words. The bit matrix should revert to its original state. - */ - public function remask() - { - if ($this->parsedFormatInfo == null) { - return; // We have no format information, and have no data mask - } - $dataMask = DataMask::forReference($this->parsedFormatInfo->getDataMask()); - $dimension = $this->bitMatrix->getHeight(); - $dataMask->unmaskBitMatrix($this->bitMatrix, $dimension); - } - - /** - * Prepare the parser for a mirrored operation. - * This flag has effect only on the {@link #readFormatInformation()} and the - * {@link #readVersion()}. Before proceeding with {@link #readCodewords()} the - * {@link #mirror()} method should be called. - * - * @param mirror Whether to read version and format information mirrored. - */ - public function setMirror($mirror) - { - $parsedVersion = null; - $parsedFormatInfo = null; - $this->mirror = $mirror; - } - - /** Mirror the bit matrix in order to attempt a second reading. */ - public function mirror() - { - for ($x = 0; $x < $this->bitMatrix->getWidth(); $x++) { - for ($y = $x + 1; $y < $this->bitMatrix->getHeight(); $y++) { - if ($this->bitMatrix->get($x, $y) != $this->bitMatrix->get($y, $x)) { - $this->bitMatrix->flip($y, $x); - $this->bitMatrix->flip($x, $y); - } - } - } - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/DataBlock.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/DataBlock.php deleted file mode 100644 index c845247e..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/DataBlock.php +++ /dev/null @@ -1,129 +0,0 @@ -Encapsulates a block of data within a QR Code. QR Codes may split their data into - * multiple blocks, each of which is a unit of data and error-correction codewords. Each - * is represented by an instance of this class.

    - * - * @author Sean Owen - */ -final class DataBlock -{ - private $numDataCodewords; - private $codewords; //byte[] - - private function __construct($numDataCodewords, $codewords) - { - $this->numDataCodewords = $numDataCodewords; - $this->codewords = $codewords; - } - - /** - *

    When QR Codes use multiple data blocks, they are actually interleaved. - * That is, the first byte of data block 1 to n is written, then the second bytes, and so on. This - * method will separate the data into original blocks.

    - * - * @param rawCodewords bytes as read directly from the QR Code - * @param version version of the QR Code - * @param ecLevel error-correction level of the QR Code - * - * @return array DataBlocks containing original bytes, "de-interleaved" from representation in the - * QR Code - */ - public static function getDataBlocks($rawCodewords, - $version, - $ecLevel) - { - - if (count($rawCodewords) != $version->getTotalCodewords()) { - throw new \InvalidArgumentException(); - } - - // Figure out the number and size of data blocks used by this version and - // error correction level - $ecBlocks = $version->getECBlocksForLevel($ecLevel); - - // First count the total number of data blocks - $totalBlocks = 0; - $ecBlockArray = $ecBlocks->getECBlocks(); - foreach ($ecBlockArray as $ecBlock) { - $totalBlocks += $ecBlock->getCount(); - } - - // Now establish DataBlocks of the appropriate size and number of data codewords - $result = [];//new DataBlock[$totalBlocks]; - $numResultBlocks = 0; - foreach ($ecBlockArray as $ecBlock) { - $ecBlockCount = $ecBlock->getCount(); - for ($i = 0; $i < $ecBlockCount; $i++) { - $numDataCodewords = $ecBlock->getDataCodewords(); - $numBlockCodewords = $ecBlocks->getECCodewordsPerBlock() + $numDataCodewords; - $result[$numResultBlocks++] = new DataBlock($numDataCodewords, fill_array(0, $numBlockCodewords, 0)); - } - } - - // All blocks have the same amount of data, except that the last n - // (where n may be 0) have 1 more byte. Figure out where these start. - $shorterBlocksTotalCodewords = count($result[0]->codewords); - $longerBlocksStartAt = count($result) - 1; - while ($longerBlocksStartAt >= 0) { - $numCodewords = count($result[$longerBlocksStartAt]->codewords); - if ($numCodewords == $shorterBlocksTotalCodewords) { - break; - } - $longerBlocksStartAt--; - } - $longerBlocksStartAt++; - - $shorterBlocksNumDataCodewords = $shorterBlocksTotalCodewords - $ecBlocks->getECCodewordsPerBlock(); - // The last elements of result may be 1 element longer; - // first fill out as many elements as all of them have - $rawCodewordsOffset = 0; - for ($i = 0; $i < $shorterBlocksNumDataCodewords; $i++) { - for ($j = 0; $j < $numResultBlocks; $j++) { - $result[$j]->codewords[$i] = $rawCodewords[$rawCodewordsOffset++]; - } - } - // Fill out the last data block in the longer ones - for ($j = $longerBlocksStartAt; $j < $numResultBlocks; $j++) { - $result[$j]->codewords[$shorterBlocksNumDataCodewords] = $rawCodewords[$rawCodewordsOffset++]; - } - // Now add in error correction blocks - $max = count($result[0]->codewords); - for ($i = $shorterBlocksNumDataCodewords; $i < $max; $i++) { - for ($j = 0; $j < $numResultBlocks; $j++) { - $iOffset = $j < $longerBlocksStartAt ? $i : $i + 1; - $result[$j]->codewords[$iOffset] = $rawCodewords[$rawCodewordsOffset++]; - } - } - - return $result; - } - - public function getNumDataCodewords() - { - return $this->numDataCodewords; - } - - public function getCodewords() - { - return $this->codewords; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/DataMask.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/DataMask.php deleted file mode 100644 index 5fa2098e..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/DataMask.php +++ /dev/null @@ -1,196 +0,0 @@ -Encapsulates data masks for the data bits in a QR code, per ISO 18004:2006 6.8. Implementations - * of this class can un-mask a raw BitMatrix. For simplicity, they will unmask the entire BitMatrix, - * including areas used for finder patterns, timing patterns, etc. These areas should be unused - * after the point they are unmasked anyway.

    - * - *

    Note that the diagram in section 6.8.1 is misleading since it indicates that i is column position - * and j is row position. In fact, as the text says, i is row position and j is column position.

    - * - * @author Sean Owen - */ -abstract class DataMask -{ - - /** - * See ISO 18004:2006 6.8.1 - */ - private static $DATA_MASKS = []; - - public function __construct() - { - - } - - public static function Init() - { - self::$DATA_MASKS = [ - new DataMask000(), - new DataMask001(), - new DataMask010(), - new DataMask011(), - new DataMask100(), - new DataMask101(), - new DataMask110(), - new DataMask111(), - ]; - } - - /** - * @param reference a value between 0 and 7 indicating one of the eight possible - * data mask patterns a QR Code may use - * - * @return DataMask encapsulating the data mask pattern - */ - public static function forReference($reference) - { - if ($reference < 0 || $reference > 7) { - throw new \InvalidArgumentException(); - } - - return self::$DATA_MASKS[$reference]; - } - - /** - *

    Implementations of this method reverse the data masking process applied to a QR Code and - * make its bits ready to read.

    - * - * @param bits representation of QR Code bits - * @param dimension dimension of QR Code, represented by bits, being unmasked - */ - final public function unmaskBitMatrix($bits, $dimension) - { - for ($i = 0; $i < $dimension; $i++) { - for ($j = 0; $j < $dimension; $j++) { - if ($this->isMasked($i, $j)) { - $bits->flip($j, $i); - } - } - } - } - - abstract public function isMasked($i, $j); -} - -DataMask::Init(); - -/** - * 000: mask bits for which (x + y) mod 2 == 0 - */ -final class DataMask000 extends DataMask -{ - // @Override - public function isMasked($i, $j) - { - return (($i + $j) & 0x01) == 0; - } -} - -/** - * 001: mask bits for which x mod 2 == 0 - */ -final class DataMask001 extends DataMask -{ - //@Override - public function isMasked($i, $j) - { - return ($i & 0x01) == 0; - } -} - -/** - * 010: mask bits for which y mod 3 == 0 - */ -final class DataMask010 extends DataMask -{ - //@Override - public function isMasked($i, $j) - { - return $j % 3 == 0; - } -} - -/** - * 011: mask bits for which (x + y) mod 3 == 0 - */ -final class DataMask011 extends DataMask -{ - //@Override - public function isMasked($i, $j) - { - return ($i + $j) % 3 == 0; - } -} - -/** - * 100: mask bits for which (x/2 + y/3) mod 2 == 0 - */ -final class DataMask100 extends DataMask -{ - //@Override - public function isMasked($i, $j) - { - return (int)(((int)($i / 2) + (int)($j / 3)) & 0x01) == 0; - } -} - -/** - * 101: mask bits for which xy mod 2 + xy mod 3 == 0 - */ -final class DataMask101 extends DataMask -{ - //@Override - public function isMasked($i, $j) - { - $temp = $i * $j; - - return ($temp & 0x01) + ($temp % 3) == 0; - } -} - -/** - * 110: mask bits for which (xy mod 2 + xy mod 3) mod 2 == 0 - */ -final class DataMask110 extends DataMask -{ - //@Override - public function isMasked($i, $j) - { - $temp = $i * $j; - - return ((($temp & 0x01) + ($temp % 3)) & 0x01) == 0; - } -} - -/** - * 111: mask bits for which ((x+y)mod 2 + xy mod 3) mod 2 == 0 - */ -final class DataMask111 extends DataMask -{ - //@Override - public function isMasked($i, $j) - { - return (((($i + $j) & 0x01) + (($i * $j) % 3)) & 0x01) == 0; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/DecodedBitStreamParser.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/DecodedBitStreamParser.php deleted file mode 100644 index 75e59420..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/DecodedBitStreamParser.php +++ /dev/null @@ -1,355 +0,0 @@ -QR Codes can encode text as bits in one of several modes, and can use multiple modes - * in one QR Code. This class decodes the bits back into text.

    - * - *

    See ISO 18004:2006, 6.4.3 - 6.4.7

    - * - * @author Sean Owen - */ -final class DecodedBitStreamParser -{ - - /** - * See ISO 18004:2006, 6.4.4 Table 5 - */ - private static $ALPHANUMERIC_CHARS = [ - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', - 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', - 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', - ' ', '$', '%', '*', '+', '-', '.', '/', ':', - ]; - private static $GB2312_SUBSET = 1; - - public static function decode($bytes, - $version, - $ecLevel, - $hints) - { - $bits = new BitSource($bytes); - $result = '';//new StringBuilder(50); - $byteSegments = []; - $symbolSequence = -1; - $parityData = -1; - - try { - $currentCharacterSetECI = null; - $fc1InEffect = false; - $mode = ''; - do { - // While still another segment to read... - if ($bits->available() < 4) { - // OK, assume we're done. Really, a TERMINATOR mode should have been recorded here - $mode = Mode::$TERMINATOR; - } else { - $mode = Mode::forBits($bits->readBits(4)); // mode is encoded by 4 bits - } - if ($mode != Mode::$TERMINATOR) { - if ($mode == Mode::$FNC1_FIRST_POSITION || $mode == Mode::$FNC1_SECOND_POSITION) { - // We do little with FNC1 except alter the parsed result a bit according to the spec - $fc1InEffect = true; - } else if ($mode == Mode::$STRUCTURED_APPEND) { - if ($bits->available() < 16) { - throw FormatException::getFormatInstance(); - } - // sequence number and parity is added later to the result metadata - // Read next 8 bits (symbol sequence #) and 8 bits (parity data), then continue - $symbolSequence = $bits->readBits(8); - $parityData = $bits->readBits(8); - } else if ($mode == Mode::$ECI) { - // Count doesn't apply to ECI - $value = self::parseECIValue($bits); - $currentCharacterSetECI = CharacterSetECI::getCharacterSetECIByValue($value); - if ($currentCharacterSetECI == null) { - throw FormatException::getFormatInstance(); - } - } else { - // First handle Hanzi mode which does not start with character count - if ($mode == Mode::$HANZI) { - //chinese mode contains a sub set indicator right after mode indicator - $subset = $bits->readBits(4); - $countHanzi = $bits->readBits($mode->getCharacterCountBits($version)); - if ($subset == self::$GB2312_SUBSET) { - self::decodeHanziSegment($bits, $result, $countHanzi); - } - } else { - // "Normal" QR code modes: - // How many characters will follow, encoded in this mode? - $count = $bits->readBits($mode->getCharacterCountBits($version)); - if ($mode == Mode::$NUMERIC) { - self::decodeNumericSegment($bits, $result, $count); - } else if ($mode == Mode::$ALPHANUMERIC) { - self::decodeAlphanumericSegment($bits, $result, $count, $fc1InEffect); - } else if ($mode == Mode::$BYTE) { - self::decodeByteSegment($bits, $result, $count, $currentCharacterSetECI, $byteSegments, $hints); - } else if ($mode == Mode::$KANJI) { - self::decodeKanjiSegment($bits, $result, $count); - } else { - throw FormatException::getFormatInstance(); - } - } - } - } - } while ($mode != Mode::$TERMINATOR); - } catch (\InvalidArgumentException $iae) { - // from readBits() calls - throw FormatException::getFormatInstance(); - } - - return new DecoderResult($bytes, - $result, - empty($byteSegments) ? null : $byteSegments, - $ecLevel == null ? null : 'L',//ErrorCorrectionLevel::toString($ecLevel), - $symbolSequence, - $parityData); - } - - private static function parseECIValue($bits) - { - $firstByte = $bits->readBits(8); - if (($firstByte & 0x80) == 0) { - // just one byte - return $firstByte & 0x7F; - } - if (($firstByte & 0xC0) == 0x80) { - // two bytes - $secondByte = $bits->readBits(8); - - return (($firstByte & 0x3F) << 8) | $secondByte; - } - if (($firstByte & 0xE0) == 0xC0) { - // three bytes - $secondThirdBytes = $bits->readBits(16); - - return (($firstByte & 0x1F) << 16) | $secondThirdBytes; - } - throw FormatException::getFormatInstance(); - } - - /** - * See specification GBT 18284-2000 - */ - private static function decodeHanziSegment($bits, - &$result, - $count) - { - // Don't crash trying to read more bits than we have available. - if ($count * 13 > $bits->available()) { - throw FormatException::getFormatInstance(); - } - - // Each character will require 2 bytes. Read the characters as 2-byte pairs - // and decode as GB2312 afterwards - $buffer = fill_array(0, 2 * $count, 0); - $offset = 0; - while ($count > 0) { - // Each 13 bits encodes a 2-byte character - $twoBytes = $bits->readBits(13); - $assembledTwoBytes = (($twoBytes / 0x060) << 8) | ($twoBytes % 0x060); - if ($assembledTwoBytes < 0x003BF) { - // In the 0xA1A1 to 0xAAFE range - $assembledTwoBytes += 0x0A1A1; - } else { - // In the 0xB0A1 to 0xFAFE range - $assembledTwoBytes += 0x0A6A1; - } - $buffer[$offset] = (($assembledTwoBytes >> 8) & 0xFF);//(byte) - $buffer[$offset + 1] = ($assembledTwoBytes & 0xFF);//(byte) - $offset += 2; - $count--; - } - $result .= iconv('GB2312', 'UTF-8', implode($buffer)); - } - - private static function decodeNumericSegment($bits, - &$result, - $count) - { - // Read three digits at a time - while ($count >= 3) { - // Each 10 bits encodes three digits - if ($bits->available() < 10) { - throw FormatException::getFormatInstance(); - } - $threeDigitsBits = $bits->readBits(10); - if ($threeDigitsBits >= 1000) { - throw FormatException::getFormatInstance(); - } - $result .= (self::toAlphaNumericChar($threeDigitsBits / 100)); - $result .= (self::toAlphaNumericChar(($threeDigitsBits / 10) % 10)); - $result .= (self::toAlphaNumericChar($threeDigitsBits % 10)); - $count -= 3; - } - if ($count == 2) { - // Two digits left over to read, encoded in 7 bits - if ($bits->available() < 7) { - throw FormatException::getFormatInstance(); - } - $twoDigitsBits = $bits->readBits(7); - if ($twoDigitsBits >= 100) { - throw FormatException::getFormatInstance(); - } - $result .= (self::toAlphaNumericChar($twoDigitsBits / 10)); - $result .= (self::toAlphaNumericChar($twoDigitsBits % 10)); - } else if ($count == 1) { - // One digit left over to read - if ($bits->available() < 4) { - throw FormatException::getFormatInstance(); - } - $digitBits = $bits->readBits(4); - if ($digitBits >= 10) { - throw FormatException::getFormatInstance(); - } - $result .= (self::toAlphaNumericChar($digitBits)); - } - } - - private static function toAlphaNumericChar($value) - { - if ($value >= count(self::$ALPHANUMERIC_CHARS)) { - throw FormatException::getFormatInstance(); - } - - return self::$ALPHANUMERIC_CHARS[$value]; - } - - private static function decodeAlphanumericSegment($bits, - &$result, - $count, - $fc1InEffect) - { - // Read two characters at a time - $start = strlen($result); - while ($count > 1) { - if ($bits->available() < 11) { - throw FormatException::getFormatInstance(); - } - $nextTwoCharsBits = $bits->readBits(11); - $result .= (self::toAlphaNumericChar($nextTwoCharsBits / 45)); - $result .= (self::toAlphaNumericChar($nextTwoCharsBits % 45)); - $count -= 2; - } - if ($count == 1) { - // special case: one character left - if ($bits->available() < 6) { - throw FormatException::getFormatInstance(); - } - $result .= self::toAlphaNumericChar($bits->readBits(6)); - } - // See section 6.4.8.1, 6.4.8.2 - if ($fc1InEffect) { - // We need to massage the result a bit if in an FNC1 mode: - for ($i = $start; $i < strlen($result); $i++) { - if ($result{$i} == '%') { - if ($i < strlen($result) - 1 && $result{$i + 1} == '%') { - // %% is rendered as % - $result = substr_replace($result, '', $i + 1, 1);//deleteCharAt(i + 1); - } else { - // In alpha mode, % should be converted to FNC1 separator 0x1D - $result . setCharAt($i, chr(0x1D)); - } - } - } - } - } - - private static function decodeByteSegment($bits, - &$result, - $count, - $currentCharacterSetECI, - &$byteSegments, - $hints) - { - // Don't crash trying to read more bits than we have available. - if (8 * $count > $bits->available()) { - throw FormatException::getFormatInstance(); - } - - $readBytes = fill_array(0, $count, 0); - for ($i = 0; $i < $count; $i++) { - $readBytes[$i] = $bits->readBits(8);//(byte) - } - $text = implode(array_map('chr', $readBytes)); - $encoding = ''; - if ($currentCharacterSetECI == null) { - // The spec isn't clear on this mode; see - // section 6.4.5: t does not say which encoding to assuming - // upon decoding. I have seen ISO-8859-1 used as well as - // Shift_JIS -- without anything like an ECI designator to - // give a hint. - - $encoding = mb_detect_encoding($text, $hints); - } else { - $encoding = $currentCharacterSetECI->name(); - } - // $result.= mb_convert_encoding($text ,$encoding);//(new String(readBytes, encoding)); - $result .= $text;//(new String(readBytes, encoding)); - - $byteSegments = array_merge($byteSegments, $readBytes); - } - - private static function decodeKanjiSegment($bits, - &$result, - $count) - { - // Don't crash trying to read more bits than we have available. - if ($count * 13 > $bits->available()) { - throw FormatException::getFormatInstance(); - } - - // Each character will require 2 bytes. Read the characters as 2-byte pairs - // and decode as Shift_JIS afterwards - $buffer = [0, 2 * $count, 0]; - $offset = 0; - while ($count > 0) { - // Each 13 bits encodes a 2-byte character - $twoBytes = $bits->readBits(13); - $assembledTwoBytes = (($twoBytes / 0x0C0) << 8) | ($twoBytes % 0x0C0); - if ($assembledTwoBytes < 0x01F00) { - // In the 0x8140 to 0x9FFC range - $assembledTwoBytes += 0x08140; - } else { - // In the 0xE040 to 0xEBBF range - $assembledTwoBytes += 0x0C140; - } - $buffer[$offset] = ($assembledTwoBytes >> 8);//(byte) - $buffer[$offset + 1] = $assembledTwoBytes; //(byte) - $offset += 2; - $count--; - } - // Shift_JIS may not be supported in some environments: - - $result .= iconv('shift-jis', 'utf-8', implode($buffer)); - } - - private function DecodedBitStreamParser() - { - - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/Decoder.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/Decoder.php deleted file mode 100644 index ff181ec8..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/Decoder.php +++ /dev/null @@ -1,213 +0,0 @@ -The main class which implements QR Code decoding -- as opposed to locating and extracting - * the QR Code from an image.

    - * - * @author Sean Owen - */ -final class Decoder -{ - - private $rsDecoder; - - public function __construct() - { - $this->rsDecoder = new ReedSolomonDecoder(GenericGF::$QR_CODE_FIELD_256); - } - - public function decode($variable, $hints = null) - { - if (is_array($variable)) { - return $this->decodeImage($variable, $hints); - } elseif ($variable instanceof BitMatrix) { - return $this->decodeBits($variable, $hints); - } elseif ($variable instanceof BitMatrixParser) { - return $this->decodeParser($variable, $hints); - } - die('decode error Decoder.php'); - } - - /** - *

    Convenience method that can decode a QR Code represented as a 2D array of booleans. - * "true" is taken to mean a black module.

    - * - * @param array $image booleans representing white/black QR Code modules - * @param hints decoding hints that should be used to influence decoding - * - * @return text and bytes encoded within the QR Code - * @throws FormatException if the QR Code cannot be decoded - * @throws ChecksumException if error correction fails - */ - public function decodeImage($image, $hints = null) - { - $dimension = count($image); - $bits = new BitMatrix($dimension); - for ($i = 0; $i < $dimension; $i++) { - for ($j = 0; $j < $dimension; $j++) { - if ($image[$i][$j]) { - $bits->set($j, $i); - } - } - } - - return $this->decode($bits, $hints); - } - - - /** - *

    Decodes a QR Code represented as a {@link BitMatrix}. A 1 or "true" is taken to mean a black module.

    - * - * @param BitMatrix $bits booleans representing white/black QR Code modules - * @param hints decoding hints that should be used to influence decoding - * - * @return text and bytes encoded within the QR Code - * @throws FormatException if the QR Code cannot be decoded - * @throws ChecksumException if error correction fails - */ - public function decodeBits($bits, $hints = null) - { - -// Construct a parser and read version, error-correction level - $parser = new BitMatrixParser($bits); - $fe = null; - $ce = null; - try { - return $this->decode($parser, $hints); - } catch (FormatException $e) { - $fe = $e; - } catch (ChecksumException $e) { - $ce = $e; - } - - try { - - // Revert the bit matrix - $parser->remask(); - - // Will be attempting a mirrored reading of the version and format info. - $parser->setMirror(true); - - // Preemptively read the version. - $parser->readVersion(); - - // Preemptively read the format information. - $parser->readFormatInformation(); - - /* - * Since we're here, this means we have successfully detected some kind - * of version and format information when mirrored. This is a good sign, - * that the QR code may be mirrored, and we should try once more with a - * mirrored content. - */ - // Prepare for a mirrored reading. - $parser->mirror(); - - $result = $this->decode($parser, $hints); - - // Success! Notify the caller that the code was mirrored. - $result->setOther(new QRCodeDecoderMetaData(true)); - - return $result; - - } catch (FormatException $e) {// catch (FormatException | ChecksumException e) { - // Throw the exception from the original reading - if ($fe != null) { - throw $fe; - } - if ($ce != null) { - throw $ce; - } - throw $e; - - } - } - - private function decodeParser($parser, $hints = null) - { - $version = $parser->readVersion(); - $ecLevel = $parser->readFormatInformation()->getErrorCorrectionLevel(); - -// Read codewords - $codewords = $parser->readCodewords(); -// Separate into data blocks - $dataBlocks = DataBlock::getDataBlocks($codewords, $version, $ecLevel); - -// Count total number of data bytes - $totalBytes = 0; - foreach ($dataBlocks as $dataBlock) { - $totalBytes += $dataBlock->getNumDataCodewords(); - } - $resultBytes = fill_array(0, $totalBytes, 0); - $resultOffset = 0; - -// Error-correct and copy data blocks together into a stream of bytes - foreach ($dataBlocks as $dataBlock) { - $codewordBytes = $dataBlock->getCodewords(); - $numDataCodewords = $dataBlock->getNumDataCodewords(); - $this->correctErrors($codewordBytes, $numDataCodewords); - for ($i = 0; $i < $numDataCodewords; $i++) { - $resultBytes[$resultOffset++] = $codewordBytes[$i]; - } - } - -// Decode the contents of that stream of bytes - return DecodedBitStreamParser::decode($resultBytes, $version, $ecLevel, $hints); - } - - /** - *

    Given data and error-correction codewords received, possibly corrupted by errors, attempts to - * correct the errors in-place using Reed-Solomon error correction.

    - * - * @param codewordBytes data and error correction codewords - * @param numDataCodewords number of codewords that are data bytes - * - * @throws ChecksumException if error correction fails - */ - private function correctErrors(&$codewordBytes, $numDataCodewords) - { - $numCodewords = count($codewordBytes); -// First read into an array of ints - $codewordsInts = fill_array(0, $numCodewords, 0); - for ($i = 0; $i < $numCodewords; $i++) { - $codewordsInts[$i] = $codewordBytes[$i] & 0xFF; - } - $numECCodewords = count($codewordBytes) - $numDataCodewords; - try { - $this->rsDecoder->decode($codewordsInts, $numECCodewords); - } catch (ReedSolomonException $ignored) { - throw ChecksumException::getChecksumInstance(); - } -// Copy back into array of bytes -- only need to worry about the bytes that were data -// We don't care about errors in the error-correction codewords - for ($i = 0; $i < $numDataCodewords; $i++) { - $codewordBytes[$i] = $codewordsInts[$i]; - } - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/ErrorCorrectionLevel.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/ErrorCorrectionLevel.php deleted file mode 100644 index 38ae6a66..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/ErrorCorrectionLevel.php +++ /dev/null @@ -1,91 +0,0 @@ -See ISO 18004:2006, 6.5.1. This enum encapsulates the four error correction levels - * defined by the QR code standard.

    - * - * @author Sean Owen - */ -class ErrorCorrectionLevel -{ - private static $FOR_BITS; - private $bits; - private $ordinal; - - public function __construct($bits, $ordinal = 0) - { - $this->bits = $bits; - $this->ordinal = $ordinal; - } - - public static function Init() - { - self::$FOR_BITS = [ - - - new ErrorCorrectionLevel(0x00, 1), //M - new ErrorCorrectionLevel(0x01, 0), //L - new ErrorCorrectionLevel(0x02, 3), //H - new ErrorCorrectionLevel(0x03, 2), //Q - - ]; - } - /** L = ~7% correction */ - // self::$L = new ErrorCorrectionLevel(0x01); - /** M = ~15% correction */ - //self::$M = new ErrorCorrectionLevel(0x00); - /** Q = ~25% correction */ - //self::$Q = new ErrorCorrectionLevel(0x03); - /** H = ~30% correction */ - //self::$H = new ErrorCorrectionLevel(0x02); - /** - * @param bits int containing the two bits encoding a QR Code's error correction level - * - * @return ErrorCorrectionLevel representing the encoded error correction level - */ - public static function forBits($bits) - { - if ($bits < 0 || $bits >= count(self::$FOR_BITS)) { - throw new \InvalidArgumentException(); - } - $level = self::$FOR_BITS[$bits]; - - // $lev = self::$$bit; - return $level; - } - - - public function getBits() - { - return $this->bits; - } - - public function toString() - { - return $this->bits; - } - - public function getOrdinal() - { - return $this->ordinal; - } -} - -ErrorCorrectionLevel::Init(); diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/FormatInformation.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/FormatInformation.php deleted file mode 100644 index fedcb638..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/FormatInformation.php +++ /dev/null @@ -1,190 +0,0 @@ -Encapsulates a QR Code's format information, including the data mask used and - * error correction level.

    - * - * @author Sean Owen - * @see DataMask - * @see ErrorCorrectionLevel - */ -final class FormatInformation -{ - public static $FORMAT_INFO_MASK_QR; - - /** - * See ISO 18004:2006, Annex C, Table C.1 - */ - public static $FORMAT_INFO_DECODE_LOOKUP; - /** - * Offset i holds the number of 1 bits in the binary representation of i - */ - private static $BITS_SET_IN_HALF_BYTE; - - private $errorCorrectionLevel; - private $dataMask; - - private function __construct($formatInfo) - { - // Bits 3,4 - $this->errorCorrectionLevel = ErrorCorrectionLevel::forBits(($formatInfo >> 3) & 0x03); - // Bottom 3 bits - $this->dataMask = ($formatInfo & 0x07);//(byte) - } - - public static function Init() - { - self::$FORMAT_INFO_MASK_QR = 0x5412; - self::$BITS_SET_IN_HALF_BYTE = [0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4]; - self::$FORMAT_INFO_DECODE_LOOKUP = [ - [0x5412, 0x00], - [0x5125, 0x01], - [0x5E7C, 0x02], - [0x5B4B, 0x03], - [0x45F9, 0x04], - [0x40CE, 0x05], - [0x4F97, 0x06], - [0x4AA0, 0x07], - [0x77C4, 0x08], - [0x72F3, 0x09], - [0x7DAA, 0x0A], - [0x789D, 0x0B], - [0x662F, 0x0C], - [0x6318, 0x0D], - [0x6C41, 0x0E], - [0x6976, 0x0F], - [0x1689, 0x10], - [0x13BE, 0x11], - [0x1CE7, 0x12], - [0x19D0, 0x13], - [0x0762, 0x14], - [0x0255, 0x15], - [0x0D0C, 0x16], - [0x083B, 0x17], - [0x355F, 0x18], - [0x3068, 0x19], - [0x3F31, 0x1A], - [0x3A06, 0x1B], - [0x24B4, 0x1C], - [0x2183, 0x1D], - [0x2EDA, 0x1E], - [0x2BED, 0x1F], - ]; - } - - /** - * @param maskedFormatInfo1 ; format info indicator, with mask still applied - * @param maskedFormatInfo2 ; second copy of same info; both are checked at the same time - * to establish best match - * - * @return information about the format it specifies, or {@code null} - * if doesn't seem to match any known pattern - */ - public static function decodeFormatInformation($maskedFormatInfo1, $maskedFormatInfo2) - { - $formatInfo = self::doDecodeFormatInformation($maskedFormatInfo1, $maskedFormatInfo2); - if ($formatInfo != null) { - return $formatInfo; - } - // Should return null, but, some QR codes apparently - // do not mask this info. Try again by actually masking the pattern - // first - return self::doDecodeFormatInformation($maskedFormatInfo1 ^ self::$FORMAT_INFO_MASK_QR, - $maskedFormatInfo2 ^ self::$FORMAT_INFO_MASK_QR); - } - - private static function doDecodeFormatInformation($maskedFormatInfo1, $maskedFormatInfo2) - { - // Find the int in FORMAT_INFO_DECODE_LOOKUP with fewest bits differing - $bestDifference = PHP_INT_MAX; - $bestFormatInfo = 0; - foreach (self::$FORMAT_INFO_DECODE_LOOKUP as $decodeInfo) { - $targetInfo = $decodeInfo[0]; - if ($targetInfo == $maskedFormatInfo1 || $targetInfo == $maskedFormatInfo2) { - // Found an exact match - return new FormatInformation($decodeInfo[1]); - } - $bitsDifference = self::numBitsDiffering($maskedFormatInfo1, $targetInfo); - if ($bitsDifference < $bestDifference) { - $bestFormatInfo = $decodeInfo[1]; - $bestDifference = $bitsDifference; - } - if ($maskedFormatInfo1 != $maskedFormatInfo2) { - // also try the other option - $bitsDifference = self::numBitsDiffering($maskedFormatInfo2, $targetInfo); - if ($bitsDifference < $bestDifference) { - $bestFormatInfo = $decodeInfo[1]; - $bestDifference = $bitsDifference; - } - } - } - // Hamming distance of the 32 masked codes is 7, by construction, so <= 3 bits - // differing means we found a match - if ($bestDifference <= 3) { - return new FormatInformation($bestFormatInfo); - } - - return null; - } - - public static function numBitsDiffering($a, $b) - { - $a ^= $b; // a now has a 1 bit exactly where its bit differs with b's - // Count bits set quickly with a series of lookups: - return self::$BITS_SET_IN_HALF_BYTE[$a & 0x0F] + - self::$BITS_SET_IN_HALF_BYTE[(int)(uRShift($a, 4) & 0x0F)] + - self::$BITS_SET_IN_HALF_BYTE[(uRShift($a, 8) & 0x0F)] + - self::$BITS_SET_IN_HALF_BYTE[(uRShift($a, 12) & 0x0F)] + - self::$BITS_SET_IN_HALF_BYTE[(uRShift($a, 16) & 0x0F)] + - self::$BITS_SET_IN_HALF_BYTE[(uRShift($a, 20) & 0x0F)] + - self::$BITS_SET_IN_HALF_BYTE[(uRShift($a, 24) & 0x0F)] + - self::$BITS_SET_IN_HALF_BYTE[(uRShift($a, 28) & 0x0F)]; - } - - public function getErrorCorrectionLevel() - { - return $this->errorCorrectionLevel; - } - - public function getDataMask() - { - return $this->dataMask; - } - - //@Override - public function hashCode() - { - return ($this->errorCorrectionLevel->ordinal() << 3) | (int)($this->dataMask); - } - - //@Override - public function equals($o) - { - if (!($o instanceof FormatInformation)) { - return false; - } - $other = $o; - - return $this->errorCorrectionLevel == $other->errorCorrectionLevel && - $this->dataMask == $other->dataMask; - } -} - -FormatInformation::Init(); diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/Mode.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/Mode.php deleted file mode 100644 index 5047279d..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/Mode.php +++ /dev/null @@ -1,128 +0,0 @@ -See ISO 18004:2006, 6.4.1, Tables 2 and 3. This enum encapsulates the various modes in which - * data can be encoded to bits in the QR code standard.

    - * - * @author Sean Owen - */ -class Mode -{ - public static $TERMINATOR; - public static $NUMERIC; - public static $ALPHANUMERIC; - public static $STRUCTURED_APPEND; - public static $BYTE; - public static $ECI; - public static $KANJI; - public static $FNC1_FIRST_POSITION; - public static $FNC1_SECOND_POSITION; - public static $HANZI; - - private $characterCountBitsForVersions; - private $bits; - - public function __construct($characterCountBitsForVersions, $bits) - { - $this->characterCountBitsForVersions = $characterCountBitsForVersions; - $this->bits = $bits; - } - - public static function Init() - { - - - self::$TERMINATOR = new Mode([0, 0, 0], 0x00); // Not really a mode... - self::$NUMERIC = new Mode([10, 12, 14], 0x01); - self::$ALPHANUMERIC = new Mode([9, 11, 13], 0x02); - self::$STRUCTURED_APPEND = new Mode([0, 0, 0], 0x03); // Not supported - self::$BYTE = new Mode([8, 16, 16], 0x04); - self::$ECI = new Mode([0, 0, 0], 0x07); // character counts don't apply - self::$KANJI = new Mode([8, 10, 12], 0x08); - self::$FNC1_FIRST_POSITION = new Mode([0, 0, 0], 0x05); - self::$FNC1_SECOND_POSITION = new Mode([0, 0, 0], 0x09); - /** See GBT 18284-2000; "Hanzi" is a transliteration of this mode name. */ - self::$HANZI = new Mode([8, 10, 12], 0x0D); - } - - /** - * @param bits four bits encoding a QR Code data mode - * - * @return Mode encoded by these bits - * @throws IllegalArgumentException if bits do not correspond to a known mode - */ - public static function forBits($bits) - { - switch ($bits) { - case 0x0: - return self::$TERMINATOR; - case 0x1: - return self::$NUMERIC; - case 0x2: - return self::$ALPHANUMERIC; - case 0x3: - return self::$STRUCTURED_APPEND; - case 0x4: - return self::$BYTE; - case 0x5: - return self::$FNC1_FIRST_POSITION; - case 0x7: - return self::$ECI; - case 0x8: - return self::$KANJI; - case 0x9: - return self::$FNC1_SECOND_POSITION; - case 0xD: - // 0xD is defined in GBT 18284-2000, may not be supported in foreign country - return self::$HANZI; - default: - throw new \InvalidArgumentException(); - } - } - - /** - * @param version version in question - * - * @return number of bits used, in this QR Code symbol {@link Version}, to encode the - * count of characters that will follow encoded in this Mode - */ - public function getCharacterCountBits($version) - { - $number = $version->getVersionNumber(); - $offset = 0; - if ($number <= 9) { - $offset = 0; - } else if ($number <= 26) { - $offset = 1; - } else { - $offset = 2; - } - - return $this->characterCountBitsForVersions[$offset]; - } - - public function getBits() - { - return $this->bits; - } - -} - -Mode::Init(); \ No newline at end of file diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/Version.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/Version.php deleted file mode 100644 index a3cc03f3..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Decoder/Version.php +++ /dev/null @@ -1,619 +0,0 @@ -versionNumber = $versionNumber; - $this->alignmentPatternCenters = $alignmentPatternCenters; - $this->ecBlocks = $ecBlocks; - $total = 0; - if(is_array($ecBlocks)) { - $ecCodewords = $ecBlocks[0]->getECCodewordsPerBlock(); - $ecbArray = $ecBlocks[0]->getECBlocks(); - }else{ - $ecCodewords = $ecBlocks->getECCodewordsPerBlock(); - $ecbArray = $ecBlocks->getECBlocks(); - } - foreach ($ecbArray as $ecBlock) { - $total += $ecBlock->getCount() * ($ecBlock->getDataCodewords() + $ecCodewords); - } - $this->totalCodewords = $total; - } - public function getVersionNumber() - { - return $this->versionNumber; - } - - public function getAlignmentPatternCenters() - { - return $this->alignmentPatternCenters; - } - - public function getTotalCodewords() - { - return $this->totalCodewords; - } - - public function getDimensionForVersion() - { - return 17 + 4 * $this->versionNumber; - } - - public function getECBlocksForLevel($ecLevel) - { - return $this->ecBlocks[$ecLevel->getOrdinal()]; - } - - /** - *

    Deduces version information purely from QR Code dimensions.

    - * - * @param dimension dimension in modules - * @return Version for a QR Code of that dimension - * @throws FormatException if dimension is not 1 mod 4 - */ - public static function getProvisionalVersionForDimension($dimension) - { - if ($dimension % 4 != 1) { - throw FormatException::getFormatInstance(); - } - try { - return self::getVersionForNumber(($dimension - 17) / 4); - } catch (InvalidArgumentException $ignored) { - throw FormatException::getFormatInstance(); - } - } - - public static function getVersionForNumber($versionNumber) - { - if ($versionNumber < 1 || $versionNumber > 40) { - throw new \InvalidArgumentException(); - } - if(!self::$VERSIONS){ - - self::$VERSIONS = self::buildVersions(); - - } - return self::$VERSIONS[$versionNumber - 1]; - } - - static function decodeVersionInformation($versionBits) - { - $bestDifference = PHP_INT_MAX; - $bestVersion = 0; - for ($i = 0; $i < count(self::$VERSION_DECODE_INFO); $i++) { - $targetVersion = self::$VERSION_DECODE_INFO[$i]; -// Do the version info bits match exactly? done. - if ($targetVersion == $versionBits) { - return self::getVersionForNumber($i + 7); - } -// Otherwise see if this is the closest to a real version info bit string -// we have seen so far - $bitsDifference = FormatInformation::numBitsDiffering($versionBits, $targetVersion); - if ($bitsDifference < $bestDifference) { - $bestVersion = $i + 7; - $bestDifference = $bitsDifference; - } - } -// We can tolerate up to 3 bits of error since no two version info codewords will -// differ in less than 8 bits. - if ($bestDifference <= 3) { - return self::getVersionForNumber($bestVersion); - } -// If we didn't find a close enough match, fail - return null; - } - - /** - * See ISO 18004:2006 Annex E - */ - function buildFunctionPattern() - { - $dimension = self::getDimensionForVersion(); - $bitMatrix = new BitMatrix($dimension); - -// Top left finder pattern + separator + format - $bitMatrix->setRegion(0, 0, 9, 9); -// Top right finder pattern + separator + format - $bitMatrix->setRegion($dimension - 8, 0, 8, 9); -// Bottom left finder pattern + separator + format - $bitMatrix->setRegion(0, $dimension - 8, 9, 8); - -// Alignment patterns - $max = count($this->alignmentPatternCenters); - for ($x = 0; $x < $max; $x++) { - $i = $this->alignmentPatternCenters[$x] - 2; - for ($y = 0; $y < $max; $y++) { - if (($x == 0 && ($y == 0 || $y == $max - 1)) || ($x == $max - 1 && $y == 0)) { -// No alignment patterns near the three finder paterns - continue; - } - $bitMatrix->setRegion($this->alignmentPatternCenters[$y] - 2, $i, 5, 5); - } - } - -// Vertical timing pattern - $bitMatrix->setRegion(6, 9, 1, $dimension - 17); -// Horizontal timing pattern - $bitMatrix->setRegion(9, 6, $dimension - 17, 1); - - if ($this->versionNumber > 6) { -// Version info, top right - $bitMatrix->setRegion($dimension - 11, 0, 3, 6); -// Version info, bottom left - $bitMatrix->setRegion(0, $dimension - 11, 6, 3); - } - - return $bitMatrix; - } - /** - * See ISO 18004:2006 6.5.1 Table 9 - */ - private static function buildVersions() - { - - - return array( - new Version(1, array(), - array(new ECBlocks(7, array(new ECB(1, 19))), - new ECBlocks(10, array(new ECB(1, 16))), - new ECBlocks(13, array(new ECB(1, 13))), - new ECBlocks(17, array(new ECB(1, 9))))), - new Version(2, array(6, 18), - array(new ECBlocks(10, array(new ECB(1, 34))), - new ECBlocks(16, array(new ECB(1, 28))), - new ECBlocks(22, array(new ECB(1, 22))), - new ECBlocks(28, array(new ECB(1, 16))))), - new Version(3, array(6, 22), - array( new ECBlocks(15, array(new ECB(1, 55))), - new ECBlocks(26, array(new ECB(1, 44))), - new ECBlocks(18, array(new ECB(2, 17))), - new ECBlocks(22, array(new ECB(2, 13))))), - new Version(4, array(6, 26), - array(new ECBlocks(20, array(new ECB(1, 80))), - new ECBlocks(18, array(new ECB(2, 32))), - new ECBlocks(26, array(new ECB(2, 24))), - new ECBlocks(16, array(new ECB(4, 9))))), - new Version(5, array(6, 30), - array(new ECBlocks(26, array(new ECB(1, 108))), - new ECBlocks(24, array(new ECB(2, 43))), - new ECBlocks(18, array(new ECB(2, 15), - new ECB(2, 16))), - new ECBlocks(22, array(new ECB(2, 11), - new ECB(2, 12))))), - new Version(6, array(6, 34), - array(new ECBlocks(18, array(new ECB(2, 68))), - new ECBlocks(16, array(new ECB(4, 27))), - new ECBlocks(24, array(new ECB(4, 19))), - new ECBlocks(28, array(new ECB(4, 15))))), - new Version(7, array(6, 22, 38), - array(new ECBlocks(20, array(new ECB(2, 78))), - new ECBlocks(18, array(new ECB(4, 31))), - new ECBlocks(18, array(new ECB(2, 14), - new ECB(4, 15))), - new ECBlocks(26, array(new ECB(4, 13), - new ECB(1, 14))))), - new Version(8, array(6, 24, 42), - array(new ECBlocks(24, array(new ECB(2, 97))), - new ECBlocks(22, array(new ECB(2, 38), - new ECB(2, 39))), - new ECBlocks(22, array(new ECB(4, 18), - new ECB(2, 19))), - new ECBlocks(26, array(new ECB(4, 14), - new ECB(2, 15))))), - new Version(9, array(6, 26, 46), - array(new ECBlocks(30, array(new ECB(2, 116))), - new ECBlocks(22, array(new ECB(3, 36), - new ECB(2, 37))), - new ECBlocks(20, array(new ECB(4, 16), - new ECB(4, 17))), - new ECBlocks(24, array(new ECB(4, 12), - new ECB(4, 13))))), - new Version(10, array(6, 28, 50), - array(new ECBlocks(18, array(new ECB(2, 68), - new ECB(2, 69))), - new ECBlocks(26, array(new ECB(4, 43), - new ECB(1, 44))), - new ECBlocks(24, array(new ECB(6, 19), - new ECB(2, 20))), - new ECBlocks(28, array(new ECB(6, 15), - new ECB(2, 16))))), - new Version(11, array(6, 30, 54), - array(new ECBlocks(20, array(new ECB(4, 81))), - new ECBlocks(30, array(new ECB(1, 50), - new ECB(4, 51))), - new ECBlocks(28, array(new ECB(4, 22), - new ECB(4, 23))), - new ECBlocks(24, array(new ECB(3, 12), - new ECB(8, 13))))), - new Version(12, array(6, 32, 58), - array(new ECBlocks(24, array(new ECB(2, 92), - new ECB(2, 93))), - new ECBlocks(22, array(new ECB(6, 36), - new ECB(2, 37))), - new ECBlocks(26, array(new ECB(4, 20), - new ECB(6, 21))), - new ECBlocks(28, array(new ECB(7, 14), - new ECB(4, 15))))), - new Version(13, array(6, 34, 62), - array(new ECBlocks(26, array(new ECB(4, 107))), - new ECBlocks(22, array(new ECB(8, 37), - new ECB(1, 38))), - new ECBlocks(24, array(new ECB(8, 20), - new ECB(4, 21))), - new ECBlocks(22, array(new ECB(12, 11), - new ECB(4, 12))))), - new Version(14, array(6, 26, 46, 66), - array(new ECBlocks(30, array(new ECB(3, 115), - new ECB(1, 116))), - new ECBlocks(24, array(new ECB(4, 40), - new ECB(5, 41))), - new ECBlocks(20, array(new ECB(11, 16), - new ECB(5, 17))), - new ECBlocks(24, array(new ECB(11, 12), - new ECB(5, 13))))), - new Version(15, array(6, 26, 48, 70), - array(new ECBlocks(22, array(new ECB(5, 87), - new ECB(1, 88))), - new ECBlocks(24, array(new ECB(5, 41), - new ECB(5, 42))), - new ECBlocks(30, array(new ECB(5, 24), - new ECB(7, 25))), - new ECBlocks(24, array(new ECB(11, 12), - new ECB(7, 13))))), - new Version(16, array(6, 26, 50, 74), - array(new ECBlocks(24, array(new ECB(5, 98), - new ECB(1, 99))), - new ECBlocks(28, array(new ECB(7, 45), - new ECB(3, 46))), - new ECBlocks(24, array(new ECB(15, 19), - new ECB(2, 20))), - new ECBlocks(30, array(new ECB(3, 15), - new ECB(13, 16))))), - new Version(17, array(6, 30, 54, 78), - array(new ECBlocks(28, array(new ECB(1, 107), - new ECB(5, 108))), - new ECBlocks(28, array(new ECB(10, 46), - new ECB(1, 47))), - new ECBlocks(28, array(new ECB(1, 22), - new ECB(15, 23))), - new ECBlocks(28, array(new ECB(2, 14), - new ECB(17, 15))))), - new Version(18, array(6, 30, 56, 82), - array(new ECBlocks(30, array(new ECB(5, 120), - new ECB(1, 121))), - new ECBlocks(26, array(new ECB(9, 43), - new ECB(4, 44))), - new ECBlocks(28, array(new ECB(17, 22), - new ECB(1, 23))), - new ECBlocks(28, array(new ECB(2, 14), - new ECB(19, 15))))), - new Version(19, array(6, 30, 58, 86), - array(new ECBlocks(28, array(new ECB(3, 113), - new ECB(4, 114))), - new ECBlocks(26, array(new ECB(3, 44), - new ECB(11, 45))), - new ECBlocks(26, array(new ECB(17, 21), - new ECB(4, 22))), - new ECBlocks(26, array(new ECB(9, 13), - new ECB(16, 14))))), - new Version(20, array(6, 34, 62, 90), - array(new ECBlocks(28, array(new ECB(3, 107), - new ECB(5, 108))), - new ECBlocks(26, array(new ECB(3, 41), - new ECB(13, 42))), - new ECBlocks(30, array(new ECB(15, 24), - new ECB(5, 25))), - new ECBlocks(28, array(new ECB(15, 15), - new ECB(10, 16))))), - new Version(21, array(6, 28, 50, 72, 94), - array( new ECBlocks(28, array(new ECB(4, 116), - new ECB(4, 117))), - new ECBlocks(26, array(new ECB(17, 42))), - new ECBlocks(28, array(new ECB(17, 22), - new ECB(6, 23))), - new ECBlocks(30, array(new ECB(19, 16), - new ECB(6, 17))))), - new Version(22, array(6, 26, 50, 74, 98), - array(new ECBlocks(28, array(new ECB(2, 111), - new ECB(7, 112))), - new ECBlocks(28, array(new ECB(17, 46))), - new ECBlocks(30, array(new ECB(7, 24), - new ECB(16, 25))), - new ECBlocks(24, array(new ECB(34, 13))))), - new Version(23, array(6, 30, 54, 78, 102), - new ECBlocks(30, array(new ECB(4, 121), - new ECB(5, 122))), - new ECBlocks(28, array(new ECB(4, 47), - new ECB(14, 48))), - new ECBlocks(30, array(new ECB(11, 24), - new ECB(14, 25))), - new ECBlocks(30, array(new ECB(16, 15), - new ECB(14, 16)))), - new Version(24, array(6, 28, 54, 80, 106), - array(new ECBlocks(30, array(new ECB(6, 117), - new ECB(4, 118))), - new ECBlocks(28, array(new ECB(6, 45), - new ECB(14, 46))), - new ECBlocks(30, array(new ECB(11, 24), - new ECB(16, 25))), - new ECBlocks(30, array(new ECB(30, 16), - new ECB(2, 17))))), - new Version(25, array(6, 32, 58, 84, 110), - array(new ECBlocks(26, array(new ECB(8, 106), - new ECB(4, 107))), - new ECBlocks(28, array(new ECB(8, 47), - new ECB(13, 48))), - new ECBlocks(30, array(new ECB(7, 24), - new ECB(22, 25))), - new ECBlocks(30, array(new ECB(22, 15), - new ECB(13, 16))))), - new Version(26, array(6, 30, 58, 86, 114), - array(new ECBlocks(28, array(new ECB(10, 114), - new ECB(2, 115))), - new ECBlocks(28, array(new ECB(19, 46), - new ECB(4, 47))), - new ECBlocks(28, array(new ECB(28, 22), - new ECB(6, 23))), - new ECBlocks(30, array(new ECB(33, 16), - new ECB(4, 17))))), - new Version(27, array(6, 34, 62, 90, 118), - array(new ECBlocks(30, array(new ECB(8, 122), - new ECB(4, 123))), - new ECBlocks(28, array(new ECB(22, 45), - new ECB(3, 46))), - new ECBlocks(30, array(new ECB(8, 23), - new ECB(26, 24))), - new ECBlocks(30, array(new ECB(12, 15), - new ECB(28, 16))))), - new Version(28, array(6, 26, 50, 74, 98, 122), - array(new ECBlocks(30, array(new ECB(3, 117), - new ECB(10, 118))), - new ECBlocks(28, array(new ECB(3, 45), - new ECB(23, 46))), - new ECBlocks(30, array(new ECB(4, 24), - new ECB(31, 25))), - new ECBlocks(30, array(new ECB(11, 15), - new ECB(31, 16))))), - new Version(29, array(6, 30, 54, 78, 102, 126), - array(new ECBlocks(30, array(new ECB(7, 116), - new ECB(7, 117))), - new ECBlocks(28, array(new ECB(21, 45), - new ECB(7, 46))), - new ECBlocks(30, array(new ECB(1, 23), - new ECB(37, 24))), - new ECBlocks(30, array(new ECB(19, 15), - new ECB(26, 16))))), - new Version(30, array(6, 26, 52, 78, 104, 130), - array(new ECBlocks(30, array(new ECB(5, 115), - new ECB(10, 116))), - new ECBlocks(28, array(new ECB(19, 47), - new ECB(10, 48))), - new ECBlocks(30, array(new ECB(15, 24), - new ECB(25, 25))), - new ECBlocks(30, array(new ECB(23, 15), - new ECB(25, 16))))), - new Version(31, array(6, 30, 56, 82, 108, 134), - array(new ECBlocks(30, array(new ECB(13, 115), - new ECB(3, 116))), - new ECBlocks(28, array(new ECB(2, 46), - new ECB(29, 47))), - new ECBlocks(30, array(new ECB(42, 24), - new ECB(1, 25))), - new ECBlocks(30, array(new ECB(23, 15), - new ECB(28, 16))))), - new Version(32, array(6, 34, 60, 86, 112, 138), - array(new ECBlocks(30, array(new ECB(17, 115))), - new ECBlocks(28, array(new ECB(10, 46), - new ECB(23, 47))), - new ECBlocks(30, array(new ECB(10, 24), - new ECB(35, 25))), - new ECBlocks(30, array(new ECB(19, 15), - new ECB(35, 16))))), - new Version(33, array(6, 30, 58, 86, 114, 142), - array(new ECBlocks(30, array(new ECB(17, 115), - new ECB(1, 116))), - new ECBlocks(28, array(new ECB(14, 46), - new ECB(21, 47))), - new ECBlocks(30, array(new ECB(29, 24), - new ECB(19, 25))), - new ECBlocks(30, array(new ECB(11, 15), - new ECB(46, 16))))), - new Version(34, array(6, 34, 62, 90, 118, 146), - array(new ECBlocks(30, array(new ECB(13, 115), - new ECB(6, 116))), - new ECBlocks(28, array(new ECB(14, 46), - new ECB(23, 47))), - new ECBlocks(30, array(new ECB(44, 24), - new ECB(7, 25))), - new ECBlocks(30, array(new ECB(59, 16), - new ECB(1, 17))))), - new Version(35, array(6, 30, 54, 78, 102, 126, 150), - array(new ECBlocks(30, array(new ECB(12, 121), - new ECB(7, 122))), - new ECBlocks(28, array(new ECB(12, 47), - new ECB(26, 48))), - new ECBlocks(30, array(new ECB(39, 24), - new ECB(14, 25))), - new ECBlocks(30, array(new ECB(22, 15), - new ECB(41, 16))))), - new Version(36, array(6, 24, 50, 76, 102, 128, 154), - array(new ECBlocks(30, array(new ECB(6, 121), - new ECB(14, 122))), - new ECBlocks(28, array(new ECB(6, 47), - new ECB(34, 48))), - new ECBlocks(30, array(new ECB(46, 24), - new ECB(10, 25))), - new ECBlocks(30, array(new ECB(2, 15), - new ECB(64, 16))))), - new Version(37, array(6, 28, 54, 80, 106, 132, 158), - array(new ECBlocks(30, array(new ECB(17, 122), - new ECB(4, 123))), - new ECBlocks(28, array(new ECB(29, 46), - new ECB(14, 47))), - new ECBlocks(30, array(new ECB(49, 24), - new ECB(10, 25))), - new ECBlocks(30, array(new ECB(24, 15), - new ECB(46, 16))))), - new Version(38, array(6, 32, 58, 84, 110, 136, 162), - array(new ECBlocks(30, array(new ECB(4, 122), - new ECB(18, 123))), - new ECBlocks(28, array(new ECB(13, 46), - new ECB(32, 47))), - new ECBlocks(30, array(new ECB(48, 24), - new ECB(14, 25))), - new ECBlocks(30, array(new ECB(42, 15), - new ECB(32, 16))))), - new Version(39, array(6, 26, 54, 82, 110, 138, 166), - array(new ECBlocks(30, array(new ECB(20, 117), - new ECB(4, 118))), - new ECBlocks(28, array(new ECB(40, 47), - new ECB(7, 48))), - new ECBlocks(30, array(new ECB(43, 24), - new ECB(22, 25))), - new ECBlocks(30, array(new ECB(10, 15), - new ECB(67, 16))))), - new Version(40, array(6, 30, 58, 86, 114, 142, 170), - array(new ECBlocks(30, array(new ECB(19, 118), - new ECB(6, 119))), - new ECBlocks(28, array(new ECB(18, 47), - new ECB(31, 48))), - new ECBlocks(30, array(new ECB(34, 24), - new ECB(34, 25))), - new ECBlocks(30, array(new ECB(20, 15), - new ECB(61, 16))))) - ); - } -} - -/** - *

    Encapsulates a set of error-correction blocks in one symbol version. Most versions will - * use blocks of differing sizes within one version, so, this encapsulates the parameters for - * each set of blocks. It also holds the number of error-correction codewords per block since it - * will be the same across all blocks within one version.

    - */ -final class ECBlocks -{ - private $ecCodewordsPerBlock; - private $ecBlocks; - - function __construct($ecCodewordsPerBlock, $ecBlocks) - { - $this->ecCodewordsPerBlock = $ecCodewordsPerBlock; - $this->ecBlocks = $ecBlocks; - } - - public function getECCodewordsPerBlock() - { - return $this->ecCodewordsPerBlock; - } - - public function getNumBlocks() - { - $total = 0; - foreach ($this->ecBlocks as $ecBlock) { - $total += $ecBlock->getCount(); - } - return $total; - } - - public function getTotalECCodewords() - { - return $this->ecCodewordsPerBlock * $this->getNumBlocks(); - } - - public function getECBlocks() - { - return $this->ecBlocks; - } -} - -/** - *

    Encapsualtes the parameters for one error-correction block in one symbol version. - * This includes the number of data codewords, and the number of times a block with these - * parameters is used consecutively in the QR code version's format.

    - */ -final class ECB -{ - private $count; - private $dataCodewords; - - function __construct($count, $dataCodewords) - { - $this->count = $count; - $this->dataCodewords = $dataCodewords; - } - - public function getCount() - { - return $this->count; - } - - public function getDataCodewords() - { - return $this->dataCodewords; - } - - -//@Override - public function toString() - { - die('Version ECB toString()'); - // return parent::$versionNumber; - } - - -} - - diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/AlignmentPattern.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/AlignmentPattern.php deleted file mode 100644 index 9c3091ac..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/AlignmentPattern.php +++ /dev/null @@ -1,65 +0,0 @@ -Encapsulates an alignment pattern, which are the smaller square patterns found in - * all but the simplest QR Codes.

    - * - * @author Sean Owen - */ -final class AlignmentPattern extends ResultPoint -{ - private $estimatedModuleSize; - - public function __construct($posX, $posY, $estimatedModuleSize) - { - parent::__construct($posX, $posY); - $this->estimatedModuleSize = $estimatedModuleSize; - } - - /** - *

    Determines if this alignment pattern "about equals" an alignment pattern at the stated - * position and size -- meaning, it is at nearly the same center with nearly the same size.

    - */ - public function aboutEquals($moduleSize, $i, $j) - { - if (abs($i - $this->getY()) <= $moduleSize && abs($j - $this->getX()) <= $moduleSize) { - $moduleSizeDiff = abs($moduleSize - $this->estimatedModuleSize); - - return $moduleSizeDiff <= 1.0 || $moduleSizeDiff <= $this->estimatedModuleSize; - } - - return false; - } - - /** - * Combines this object's current estimate of a finder pattern position and module size - * with a new estimate. It returns a new {@code FinderPattern} containing an average of the two. - */ - public function combineEstimate($i, $j, $newModuleSize) - { - $combinedX = ($this->getX() + $j) / 2.0; - $combinedY = ($this->getY() + $i) / 2.0; - $combinedModuleSize = ($this->estimatedModuleSize + $newModuleSize) / 2.0; - - return new AlignmentPattern($combinedX, $combinedY, $combinedModuleSize); - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/AlignmentPatternFinder.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/AlignmentPatternFinder.php deleted file mode 100644 index 499c6b41..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/AlignmentPatternFinder.php +++ /dev/null @@ -1,286 +0,0 @@ -This class attempts to find alignment patterns in a QR Code. Alignment patterns look like finder - * patterns but are smaller and appear at regular intervals throughout the image.

    - * - *

    At the moment this only looks for the bottom-right alignment pattern.

    - * - *

    This is mostly a simplified copy of {@link FinderPatternFinder}. It is copied, - * pasted and stripped down here for maximum performance but does unfortunately duplicate - * some code.

    - * - *

    This class is thread-safe but not reentrant. Each thread must allocate its own object.

    - * - * @author Sean Owen - */ -final class AlignmentPatternFinder -{ - private $image; - private $possibleCenters; - private $startX; - private $startY; - private $width; - private $height; - private $moduleSize; - private $crossCheckStateCount; - private $resultPointCallback; - - /** - *

    Creates a finder that will look in a portion of the whole image.

    - * - * @param image image to search - * @param startX left column from which to start searching - * @param startY top row from which to start searching - * @param width width of region to search - * @param height height of region to search - * @param moduleSize estimated module size so far - */ - public function __construct($image, - $startX, - $startY, - $width, - $height, - $moduleSize, - $resultPointCallback) - { - $this->image = $image; - $this->possibleCenters = []; - $this->startX = $startX; - $this->startY = $startY; - $this->width = $width; - $this->height = $height; - $this->moduleSize = $moduleSize; - $this->crossCheckStateCount = []; - $this->resultPointCallback = $resultPointCallback; - } - - /** - *

    This method attempts to find the bottom-right alignment pattern in the image. It is a bit messy since - * it's pretty performance-critical and so is written to be fast foremost.

    - * - * @return {@link AlignmentPattern} if found - * @throws NotFoundException if not found - */ - public function find() - { - $startX = $this->startX; - $height = $this->height; - $maxJ = $startX + $this->width; - $middleI = $this->startY + ($height / 2); - // We are looking for black/white/black modules in 1:1:1 ratio; - // this tracks the number of black/white/black modules seen so far - $stateCount = []; - for ($iGen = 0; $iGen < $height; $iGen++) { - // Search from middle outwards - $i = $middleI + (($iGen & 0x01) == 0 ? ($iGen + 1) / 2 : -(($iGen + 1) / 2)); - $i = (int)($i); - $stateCount[0] = 0; - $stateCount[1] = 0; - $stateCount[2] = 0; - $j = $startX; - // Burn off leading white pixels before anything else; if we start in the middle of - // a white run, it doesn't make sense to count its length, since we don't know if the - // white run continued to the left of the start point - while ($j < $maxJ && !$this->image->get($j, $i)) { - $j++; - } - $currentState = 0; - while ($j < $maxJ) { - if ($this->image->get($j, $i)) { - // Black pixel - if ($currentState == 1) { // Counting black pixels - $stateCount[$currentState]++; - } else { // Counting white pixels - if ($currentState == 2) { // A winner? - if ($this->foundPatternCross($stateCount)) { // Yes - $confirmed = $this->handlePossibleCenter($stateCount, $i, $j); - if ($confirmed != null) { - return $confirmed; - } - } - $stateCount[0] = $stateCount[2]; - $stateCount[1] = 1; - $stateCount[2] = 0; - $currentState = 1; - } else { - $stateCount[++$currentState]++; - } - } - } else { // White pixel - if ($currentState == 1) { // Counting black pixels - $currentState++; - } - $stateCount[$currentState]++; - } - $j++; - } - if ($this->foundPatternCross($stateCount)) { - $confirmed = $this->handlePossibleCenter($stateCount, $i, $maxJ); - if ($confirmed != null) { - return $confirmed; - } - } - - } - - // Hmm, nothing we saw was observed and confirmed twice. If we had - // any guess at all, return it. - if (count($this->possibleCenters)) { - return $this->possibleCenters[0]; - } - - throw NotFoundException::getNotFoundInstance(); - } - - /** - * @param stateCount count of black/white/black pixels just read - * - * @return true iff the proportions of the counts is close enough to the 1/1/1 ratios - * used by alignment patterns to be considered a match - */ - private function foundPatternCross($stateCount) - { - $moduleSize = $this->moduleSize; - $maxVariance = $moduleSize / 2.0; - for ($i = 0; $i < 3; $i++) { - if (abs($moduleSize - $stateCount[$i]) >= $maxVariance) { - return false; - } - } - - return true; - } - - /** - *

    This is called when a horizontal scan finds a possible alignment pattern. It will - * cross check with a vertical scan, and if successful, will see if this pattern had been - * found on a previous horizontal scan. If so, we consider it confirmed and conclude we have - * found the alignment pattern.

    - * - * @param stateCount reading state module counts from horizontal scan - * @param i row where alignment pattern may be found - * @param j end of possible alignment pattern in row - * - * @return {@link AlignmentPattern} if we have found the same pattern twice, or null if not - */ - private function handlePossibleCenter($stateCount, $i, $j) - { - $stateCountTotal = $stateCount[0] + $stateCount[1] + $stateCount[2]; - $centerJ = $this->centerFromEnd($stateCount, $j); - $centerI = $this->crossCheckVertical($i, (int)$centerJ, 2 * $stateCount[1], $stateCountTotal); - if (!is_nan($centerI)) { - $estimatedModuleSize = (float)($stateCount[0] + $stateCount[1] + $stateCount[2]) / 3.0; - foreach ($this->possibleCenters as $center) { - // Look for about the same center and module size: - if ($center->aboutEquals($estimatedModuleSize, $centerI, $centerJ)) { - return $center->combineEstimate($centerI, $centerJ, $estimatedModuleSize); - } - } - // Hadn't found this before; save it - $point = new AlignmentPattern($centerJ, $centerI, $estimatedModuleSize); - $this->possibleCenters[] = $point; - if ($this->resultPointCallback != null) { - $this->resultPointCallback->foundPossibleResultPoint($point); - } - } - - return null; - } - - /** - * Given a count of black/white/black pixels just seen and an end position, - * figures the location of the center of this black/white/black run. - */ - private static function centerFromEnd($stateCount, $end) - { - return (float)($end - $stateCount[2]) - $stateCount[1] / 2.0; - } - - /** - *

    After a horizontal scan finds a potential alignment pattern, this method - * "cross-checks" by scanning down vertically through the center of the possible - * alignment pattern to see if the same proportion is detected.

    - * - * @param startI row where an alignment pattern was detected - * @param centerJ center of the section that appears to cross an alignment pattern - * @param maxCount maximum reasonable number of modules that should be - * observed in any reading state, based on the results of the horizontal scan - * - * @return vertical center of alignment pattern, or {@link Float#NaN} if not found - */ - private function crossCheckVertical($startI, $centerJ, $maxCount, - $originalStateCountTotal) - { - $image = $this->image; - - $maxI = $image->getHeight(); - $stateCount = $this->crossCheckStateCount; - $stateCount[0] = 0; - $stateCount[1] = 0; - $stateCount[2] = 0; - - // Start counting up from center - $i = $startI; - while ($i >= 0 && $image->get($centerJ, $i) && $stateCount[1] <= $maxCount) { - $stateCount[1]++; - $i--; - } - // If already too many modules in this state or ran off the edge: - if ($i < 0 || $stateCount[1] > $maxCount) { - return NAN; - } - while ($i >= 0 && !$image->get($centerJ, $i) && $stateCount[0] <= $maxCount) { - $stateCount[0]++; - $i--; - } - if ($stateCount[0] > $maxCount) { - return NAN; - } - - // Now also count down from center - $i = $startI + 1; - while ($i < $maxI && $image->get($centerJ, $i) && $stateCount[1] <= $maxCount) { - $stateCount[1]++; - $i++; - } - if ($i == $maxI || $stateCount[1] > $maxCount) { - return NAN; - } - while ($i < $maxI && !$image->get($centerJ, $i) && $stateCount[2] <= $maxCount) { - $stateCount[2]++; - $i++; - } - if ($stateCount[2] > $maxCount) { - return NAN; - } - - $stateCountTotal = $stateCount[0] + $stateCount[1] + $stateCount[2]; - if (5 * abs($stateCountTotal - $originalStateCountTotal) >= 2 * $originalStateCountTotal) { - return NAN; - } - - return $this->foundPatternCross($stateCount) ? $this->centerFromEnd($stateCount, $i) : NAN; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/Detector.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/Detector.php deleted file mode 100644 index 897dbb2c..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/Detector.php +++ /dev/null @@ -1,420 +0,0 @@ -Encapsulates logic that can detect a QR Code in an image, even if the QR Code - * is rotated or skewed, or partially obscured.

    - * - * @author Sean Owen - */ -class Detector -{ - - private $image; - private $resultPointCallback; - - public function __construct($image) - { - $this->image = $image; - } - - /** - *

    Detects a QR Code in an image.

    - * - * @param hints optional hints to detector - * - * @return {@link DetectorResult} encapsulating results of detecting a QR Code - * @throws NotFoundException if QR Code cannot be found - * @throws FormatException if a QR Code cannot be decoded - */ - public final function detect($hints = null) - {/*Map*/ - - $resultPointCallback = $hints == null ? null : - $hints->get('NEED_RESULT_POINT_CALLBACK'); - /* resultPointCallback = hints == null ? null : - (ResultPointCallback) hints.get(DecodeHintType.NEED_RESULT_POINT_CALLBACK);*/ - $finder = new FinderPatternFinder($this->image, $resultPointCallback); - $info = $finder->find($hints); - - return $this->processFinderPatternInfo($info); - } - - protected final function processFinderPatternInfo($info) - { - - $topLeft = $info->getTopLeft(); - $topRight = $info->getTopRight(); - $bottomLeft = $info->getBottomLeft(); - - $moduleSize = (float)$this->calculateModuleSize($topLeft, $topRight, $bottomLeft); - if ($moduleSize < 1.0) { - throw NotFoundException::getNotFoundInstance(); - } - $dimension = (int)self::computeDimension($topLeft, $topRight, $bottomLeft, $moduleSize); - $provisionalVersion = \Zxing\Qrcode\Decoder\Version::getProvisionalVersionForDimension($dimension); - $modulesBetweenFPCenters = $provisionalVersion->getDimensionForVersion() - 7; - - $alignmentPattern = null; -// Anything above version 1 has an alignment pattern - if (count($provisionalVersion->getAlignmentPatternCenters()) > 0) { - -// Guess where a "bottom right" finder pattern would have been - $bottomRightX = $topRight->getX() - $topLeft->getX() + $bottomLeft->getX(); - $bottomRightY = $topRight->getY() - $topLeft->getY() + $bottomLeft->getY(); - -// Estimate that alignment pattern is closer by 3 modules -// from "bottom right" to known top left location - $correctionToTopLeft = 1.0 - 3.0 / (float)$modulesBetweenFPCenters; - $estAlignmentX = (int)($topLeft->getX() + $correctionToTopLeft * ($bottomRightX - $topLeft->getX())); - $estAlignmentY = (int)($topLeft->getY() + $correctionToTopLeft * ($bottomRightY - $topLeft->getY())); - -// Kind of arbitrary -- expand search radius before giving up - for ($i = 4; $i <= 16; $i <<= 1) {//?????????? - try { - $alignmentPattern = $this->findAlignmentInRegion( - $moduleSize, - $estAlignmentX, - $estAlignmentY, - (float)$i - ); - break; - } catch (NotFoundException $re) { -// try next round - } - } -// If we didn't find alignment pattern... well try anyway without it - } - - $transform = self::createTransform($topLeft, $topRight, $bottomLeft, $alignmentPattern, $dimension); - - $bits = self::sampleGrid($this->image, $transform, $dimension); - - $points = []; - if ($alignmentPattern == null) { - $points = [$bottomLeft, $topLeft, $topRight]; - } else { - // die('$points = new ResultPoint[]{bottomLeft, topLeft, topRight, alignmentPattern};'); - $points = [$bottomLeft, $topLeft, $topRight, $alignmentPattern]; - } - - return new DetectorResult($bits, $points); - } - - /** - *

    Detects a QR Code in an image.

    - * - * @return {@link DetectorResult} encapsulating results of detecting a QR Code - * @throws NotFoundException if QR Code cannot be found - * @throws FormatException if a QR Code cannot be decoded - */ - - /** - *

    Computes an average estimated module size based on estimated derived from the positions - * of the three finder patterns.

    - * - * @param topLeft detected top-left finder pattern center - * @param topRight detected top-right finder pattern center - * @param bottomLeft detected bottom-left finder pattern center - * - * @return estimated module size - */ - protected final function calculateModuleSize($topLeft, $topRight, $bottomLeft) - { -// Take the average - return ($this->calculateModuleSizeOneWay($topLeft, $topRight) + - $this->calculateModuleSizeOneWay($topLeft, $bottomLeft)) / 2.0; - } - - /** - *

    Estimates module size based on two finder patterns -- it uses - * {@link #sizeOfBlackWhiteBlackRunBothWays(int, int, int, int)} to figure the - * width of each, measuring along the axis between their centers.

    - */ - private function calculateModuleSizeOneWay($pattern, $otherPattern) - { - $moduleSizeEst1 = $this->sizeOfBlackWhiteBlackRunBothWays($pattern->getX(), - (int)$pattern->getY(), - (int)$otherPattern->getX(), - (int)$otherPattern->getY()); - $moduleSizeEst2 = $this->sizeOfBlackWhiteBlackRunBothWays((int)$otherPattern->getX(), - (int)$otherPattern->getY(), - (int)$pattern->getX(), - (int)$pattern->getY()); - if (is_nan($moduleSizeEst1)) { - return $moduleSizeEst2 / 7.0; - } - if (is_nan($moduleSizeEst2)) { - return $moduleSizeEst1 / 7.0; - } -// Average them, and divide by 7 since we've counted the width of 3 black modules, -// and 1 white and 1 black module on either side. Ergo, divide sum by 14. - return ($moduleSizeEst1 + $moduleSizeEst2) / 14.0; - } - - /** - * See {@link #sizeOfBlackWhiteBlackRun(int, int, int, int)}; computes the total width of - * a finder pattern by looking for a black-white-black run from the center in the direction - * of another po$(another finder pattern center), and in the opposite direction too.

    - */ - private function sizeOfBlackWhiteBlackRunBothWays($fromX, $fromY, $toX, $toY) - { - - $result = $this->sizeOfBlackWhiteBlackRun($fromX, $fromY, $toX, $toY); - -// Now count other way -- don't run off image though of course - $scale = 1.0; - $otherToX = $fromX - ($toX - $fromX); - if ($otherToX < 0) { - $scale = (float)$fromX / (float)($fromX - $otherToX); - $otherToX = 0; - } else if ($otherToX >= $this->image->getWidth()) { - $scale = (float)($this->image->getWidth() - 1 - $fromX) / (float)($otherToX - $fromX); - $otherToX = $this->image->getWidth() - 1; - } - $otherToY = (int)($fromY - ($toY - $fromY) * $scale); - - $scale = 1.0; - if ($otherToY < 0) { - $scale = (float)$fromY / (float)($fromY - $otherToY); - $otherToY = 0; - } else if ($otherToY >= $this->image->getHeight()) { - $scale = (float)($this->image->getHeight() - 1 - $fromY) / (float)($otherToY - $fromY); - $otherToY = $this->image->getHeight() - 1; - } - $otherToX = (int)($fromX + ($otherToX - $fromX) * $scale); - - $result += $this->sizeOfBlackWhiteBlackRun($fromX, $fromY, $otherToX, $otherToY); - -// Middle pixel is double-counted this way; subtract 1 - return $result - 1.0; - } - - /** - *

    This method traces a line from a po$in the image, in the direction towards another point. - * It begins in a black region, and keeps going until it finds white, then black, then white again. - * It reports the distance from the start to this point.

    - * - *

    This is used when figuring out how wide a finder pattern is, when the finder pattern - * may be skewed or rotated.

    - */ - private function sizeOfBlackWhiteBlackRun($fromX, $fromY, $toX, $toY) - { -// Mild variant of Bresenham's algorithm; -// see http://en.wikipedia.org/wiki/Bresenham's_line_algorithm - $steep = abs($toY - $fromY) > abs($toX - $fromX); - if ($steep) { - $temp = $fromX; - $fromX = $fromY; - $fromY = $temp; - $temp = $toX; - $toX = $toY; - $toY = $temp; - } - - $dx = abs($toX - $fromX); - $dy = abs($toY - $fromY); - $error = -$dx / 2; - $xstep = $fromX < $toX ? 1 : -1; - $ystep = $fromY < $toY ? 1 : -1; - -// In black pixels, looking for white, first or second time. - $state = 0; -// Loop up until x == toX, but not beyond - $xLimit = $toX + $xstep; - for ($x = $fromX, $y = $fromY; $x != $xLimit; $x += $xstep) { - $realX = $steep ? $y : $x; - $realY = $steep ? $x : $y; - -// Does current pixel mean we have moved white to black or vice versa? -// Scanning black in state 0,2 and white in state 1, so if we find the wrong -// color, advance to next state or end if we are in state 2 already - if (($state == 1) == $this->image->get($realX, $realY)) { - if ($state == 2) { - return MathUtils::distance($x, $y, $fromX, $fromY); - } - $state++; - } - - $error += $dy; - if ($error > 0) { - if ($y == $toY) { - break; - } - $y += $ystep; - $error -= $dx; - } - } -// Found black-white-black; give the benefit of the doubt that the next pixel outside the image -// is "white" so this last po$at (toX+xStep,toY) is the right ending. This is really a -// small approximation; (toX+xStep,toY+yStep) might be really correct. Ignore this. - if ($state == 2) { - return MathUtils::distance($toX + $xstep, $toY, $fromX, $fromY); - } - -// else we didn't find even black-white-black; no estimate is really possible - return NAN; - } - - /** - *

    Computes the dimension (number of modules on a size) of the QR Code based on the position - * of the finder patterns and estimated module size.

    - */ - private static function computeDimension($topLeft, - $topRight, - $bottomLeft, - $moduleSize) - { - $tltrCentersDimension = MathUtils::round(ResultPoint::distance($topLeft, $topRight) / $moduleSize); - $tlblCentersDimension = MathUtils::round(ResultPoint::distance($topLeft, $bottomLeft) / $moduleSize); - $dimension = (($tltrCentersDimension + $tlblCentersDimension) / 2) + 7; - switch ($dimension & 0x03) { // mod 4 - case 0: - $dimension++; - break; -// 1? do nothing - case 2: - $dimension--; - break; - case 3: - throw NotFoundException::getNotFoundInstance(); - } - - return $dimension; - } - - /** - *

    Attempts to locate an alignment pattern in a limited region of the image, which is - * guessed to contain it. This method uses {@link AlignmentPattern}.

    - * - * @param overallEstModuleSize estimated module size so far - * @param estAlignmentX x coordinate of center of area probably containing alignment pattern - * @param estAlignmentY y coordinate of above - * @param allowanceFactor number of pixels in all directions to search from the center - * - * @return {@link AlignmentPattern} if found, or null otherwise - * @throws NotFoundException if an unexpected error occurs during detection - */ - protected final function findAlignmentInRegion($overallEstModuleSize, - $estAlignmentX, - $estAlignmentY, - $allowanceFactor) - { -// Look for an alignment pattern (3 modules in size) around where it -// should be - $allowance = (int)($allowanceFactor * $overallEstModuleSize); - $alignmentAreaLeftX = max(0, $estAlignmentX - $allowance); - $alignmentAreaRightX = min($this->image->getWidth() - 1, $estAlignmentX + $allowance); - if ($alignmentAreaRightX - $alignmentAreaLeftX < $overallEstModuleSize * 3) { - throw NotFoundException::getNotFoundInstance(); - } - - $alignmentAreaTopY = max(0, $estAlignmentY - $allowance); - $alignmentAreaBottomY = min($this->image->getHeight() - 1, $estAlignmentY + $allowance); - if ($alignmentAreaBottomY - $alignmentAreaTopY < $overallEstModuleSize * 3) { - throw NotFoundException::getNotFoundInstance(); - } - - $alignmentFinder = - new AlignmentPatternFinder( - $this->image, - $alignmentAreaLeftX, - $alignmentAreaTopY, - $alignmentAreaRightX - $alignmentAreaLeftX, - $alignmentAreaBottomY - $alignmentAreaTopY, - $overallEstModuleSize, - $this->resultPointCallback); - - return $alignmentFinder->find(); - } - - private static function createTransform($topLeft, - $topRight, - $bottomLeft, - $alignmentPattern, - $dimension) - { - $dimMinusThree = (float)$dimension - 3.5; - $bottomRightX = 0.0; - $bottomRightY = 0.0; - $sourceBottomRightX = 0.0; - $sourceBottomRightY = 0.0; - if ($alignmentPattern != null) { - $bottomRightX = $alignmentPattern->getX(); - $bottomRightY = $alignmentPattern->getY(); - $sourceBottomRightX = $dimMinusThree - 3.0; - $sourceBottomRightY = $sourceBottomRightX; - } else { -// Don't have an alignment pattern, just make up the bottom-right point - $bottomRightX = ($topRight->getX() - $topLeft->getX()) + $bottomLeft->getX(); - $bottomRightY = ($topRight->getY() - $topLeft->getY()) + $bottomLeft->getY(); - $sourceBottomRightX = $dimMinusThree; - $sourceBottomRightY = $dimMinusThree; - } - - return PerspectiveTransform::quadrilateralToQuadrilateral( - 3.5, - 3.5, - $dimMinusThree, - 3.5, - $sourceBottomRightX, - $sourceBottomRightY, - 3.5, - $dimMinusThree, - $topLeft->getX(), - $topLeft->getY(), - $topRight->getX(), - $topRight->getY(), - $bottomRightX, - $bottomRightY, - $bottomLeft->getX(), - $bottomLeft->getY()); - } - - private static function sampleGrid($image, $transform, - $dimension) - { - $sampler = GridSampler::getInstance(); - - return $sampler->sampleGrid_($image, $dimension, $dimension, $transform); - } - - protected final function getImage() - { - return $this->image; - } - - protected final function getResultPointCallback() - { - return $this->resultPointCallback; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/FinderPattern.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/FinderPattern.php deleted file mode 100644 index ac93d386..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/FinderPattern.php +++ /dev/null @@ -1,86 +0,0 @@ -Encapsulates a finder pattern, which are the three square patterns found in - * the corners of QR Codes. It also encapsulates a count of similar finder patterns, - * as a convenience to the finder's bookkeeping.

    - * - * @author Sean Owen - */ -final class FinderPattern extends ResultPoint -{ - private $estimatedModuleSize; - private $count; - - public function __construct($posX, $posY, $estimatedModuleSize, $count = 1) - { - parent::__construct($posX, $posY); - $this->estimatedModuleSize = $estimatedModuleSize; - $this->count = $count; - } - - public function getEstimatedModuleSize() - { - return $this->estimatedModuleSize; - } - - public function getCount() - { - return $this->count; - } - - /* - void incrementCount() { - this.count++; - } - */ - - /** - *

    Determines if this finder pattern "about equals" a finder pattern at the stated - * position and size -- meaning, it is at nearly the same center with nearly the same size.

    - */ - public function aboutEquals($moduleSize, $i, $j) - { - if (abs($i - $this->getY()) <= $moduleSize && abs($j - $this->getX()) <= $moduleSize) { - $moduleSizeDiff = abs($moduleSize - $this->estimatedModuleSize); - - return $moduleSizeDiff <= 1.0 || $moduleSizeDiff <= $this->estimatedModuleSize; - } - - return false; - } - - /** - * Combines this object's current estimate of a finder pattern position and module size - * with a new estimate. It returns a new {@code FinderPattern} containing a weighted average - * based on count. - */ - public function combineEstimate($i, $j, $newModuleSize) - { - $combinedCount = $this->count + 1; - $combinedX = ($this->count * $this->getX() + $j) / $combinedCount; - $combinedY = ($this->count * $this->getY() + $i) / $combinedCount; - $combinedModuleSize = ($this->count * $this->estimatedModuleSize + $newModuleSize) / $combinedCount; - - return new FinderPattern($combinedX, $combinedY, $combinedModuleSize, $combinedCount); - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/FinderPatternFinder.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/FinderPatternFinder.php deleted file mode 100644 index 1fe030fb..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/FinderPatternFinder.php +++ /dev/null @@ -1,699 +0,0 @@ -This class attempts to find finder patterns in a QR Code. Finder patterns are the square - * markers at three corners of a QR Code.

    - * - *

    This class is thread-safe but not reentrant. Each thread must allocate its own object. - * - * @author Sean Owen - */ -class FinderPatternFinder -{ - protected static $MIN_SKIP = 3; - protected static $MAX_MODULES = 57; // 1 pixel/module times 3 modules/center - private static $CENTER_QUORUM = 2; // support up to version 10 for mobile clients - private $image; - private $average; - private $possibleCenters; //private final List possibleCenters; - private $hasSkipped = false; - private $crossCheckStateCount; - private $resultPointCallback; - - /** - *

    Creates a finder that will search the image for three finder patterns.

    - * - * @param BitMatrix $image image to search - */ - public function __construct($image, $resultPointCallback = null) - { - $this->image = $image; - - - $this->possibleCenters = [];//new ArrayList<>(); - $this->crossCheckStateCount = fill_array(0, 5, 0); - $this->resultPointCallback = $resultPointCallback; - } - - final public function find($hints) - {/*final FinderPatternInfo find(Map hints) throws NotFoundException {*/ - $tryHarder = true;//$hints != null && $hints['TRY_HARDER']; - $pureBarcode = $hints != null && $hints['PURE_BARCODE']; - $maxI = $this->image->getHeight(); - $maxJ = $this->image->getWidth(); - // We are looking for black/white/black/white/black modules in - // 1:1:3:1:1 ratio; this tracks the number of such modules seen so far - - // Let's assume that the maximum version QR Code we support takes up 1/4 the height of the - // image, and then account for the center being 3 modules in size. This gives the smallest - // number of pixels the center could be, so skip this often. When trying harder, look for all - // QR versions regardless of how dense they are. - $iSkip = (int)((3 * $maxI) / (4 * self::$MAX_MODULES)); - if ($iSkip < self::$MIN_SKIP || $tryHarder) { - $iSkip = self::$MIN_SKIP; - } - - $done = false; - $stateCount = []; - for ($i = $iSkip - 1; $i < $maxI && !$done; $i += $iSkip) { - // Get a row of black/white values - $stateCount[0] = 0; - $stateCount[1] = 0; - $stateCount[2] = 0; - $stateCount[3] = 0; - $stateCount[4] = 0; - $currentState = 0; - for ($j = 0; $j < $maxJ; $j++) { - if ($this->image->get($j, $i)) { - // Black pixel - if (($currentState & 1) == 1) { // Counting white pixels - $currentState++; - } - $stateCount[$currentState]++; - } else { // White pixel - if (($currentState & 1) == 0) { // Counting black pixels - if ($currentState == 4) { // A winner? - if (self::foundPatternCross($stateCount)) { // Yes - $confirmed = $this->handlePossibleCenter($stateCount, $i, $j, $pureBarcode); - if ($confirmed) { - // Start examining every other line. Checking each line turned out to be too - // expensive and didn't improve performance. - $iSkip = 3; - if ($this->hasSkipped) { - $done = $this->haveMultiplyConfirmedCenters(); - } else { - $rowSkip = $this->findRowSkip(); - if ($rowSkip > $stateCount[2]) { - // Skip rows between row of lower confirmed center - // and top of presumed third confirmed center - // but back up a bit to get a full chance of detecting - // it, entire width of center of finder pattern - - // Skip by rowSkip, but back off by $stateCount[2] (size of last center - // of pattern we saw) to be conservative, and also back off by iSkip which - // is about to be re-added - $i += $rowSkip - $stateCount[2] - $iSkip; - $j = $maxJ - 1; - } - } - } else { - $stateCount[0] = $stateCount[2]; - $stateCount[1] = $stateCount[3]; - $stateCount[2] = $stateCount[4]; - $stateCount[3] = 1; - $stateCount[4] = 0; - $currentState = 3; - continue; - } - // Clear state to start looking again - $currentState = 0; - $stateCount[0] = 0; - $stateCount[1] = 0; - $stateCount[2] = 0; - $stateCount[3] = 0; - $stateCount[4] = 0; - } else { // No, shift counts back by two - $stateCount[0] = $stateCount[2]; - $stateCount[1] = $stateCount[3]; - $stateCount[2] = $stateCount[4]; - $stateCount[3] = 1; - $stateCount[4] = 0; - $currentState = 3; - } - } else { - $stateCount[++$currentState]++; - } - } else { // Counting white pixels - $stateCount[$currentState]++; - } - } - } - if (self::foundPatternCross($stateCount)) { - $confirmed = $this->handlePossibleCenter($stateCount, $i, $maxJ, $pureBarcode); - if ($confirmed) { - $iSkip = $stateCount[0]; - if ($this->hasSkipped) { - // Found a third one - $done = $this->haveMultiplyConfirmedCenters(); - } - } - } - } - - $patternInfo = $this->selectBestPatterns(); - $patternInfo = ResultPoint::orderBestPatterns($patternInfo); - - return new FinderPatternInfo($patternInfo); - } - - /** - * @param $stateCount ; count of black/white/black/white/black pixels just read - * - * @return true iff the proportions of the counts is close enough to the 1/1/3/1/1 ratios - * used by finder patterns to be considered a match - */ - protected static function foundPatternCross($stateCount) - { - $totalModuleSize = 0; - for ($i = 0; $i < 5; $i++) { - $count = $stateCount[$i]; - if ($count == 0) { - return false; - } - $totalModuleSize += $count; - } - if ($totalModuleSize < 7) { - return false; - } - $moduleSize = $totalModuleSize / 7.0; - $maxVariance = $moduleSize / 2.0; - - // Allow less than 50% variance from 1-1-3-1-1 proportions - return - abs($moduleSize - $stateCount[0]) < $maxVariance && - abs($moduleSize - $stateCount[1]) < $maxVariance && - abs(3.0 * $moduleSize - $stateCount[2]) < 3 * $maxVariance && - abs($moduleSize - $stateCount[3]) < $maxVariance && - abs($moduleSize - $stateCount[4]) < $maxVariance; - } - - /** - *

    This is called when a horizontal scan finds a possible alignment pattern. It will - * cross check with a vertical scan, and if successful, will, ah, cross-cross-check - * with another horizontal scan. This is needed primarily to locate the real horizontal - * center of the pattern in cases of extreme skew. - * And then we cross-cross-cross check with another diagonal scan.

    - * - *

    If that succeeds the finder pattern location is added to a list that tracks - * the number of times each location has been nearly-matched as a finder pattern. - * Each additional find is more evidence that the location is in fact a finder - * pattern center - * - * @param $stateCount reading state module counts from horizontal scan - * @param i row where finder pattern may be found - * @param j end of possible finder pattern in row - * @param pureBarcode true if in "pure barcode" mode - * - * @return true if a finder pattern candidate was found this time - */ - protected final function handlePossibleCenter($stateCount, $i, $j, $pureBarcode) - { - $stateCountTotal = $stateCount[0] + $stateCount[1] + $stateCount[2] + $stateCount[3] + - $stateCount[4]; - $centerJ = $this->centerFromEnd($stateCount, $j); - $centerI = $this->crossCheckVertical($i, (int)($centerJ), $stateCount[2], $stateCountTotal); - if (!is_nan($centerI)) { - // Re-cross check - $centerJ = $this->crossCheckHorizontal((int)($centerJ), (int)($centerI), $stateCount[2], $stateCountTotal); - if (!is_nan($centerJ) && - (!$pureBarcode || $this->crossCheckDiagonal((int)($centerI), (int)($centerJ), $stateCount[2], $stateCountTotal)) - ) { - $estimatedModuleSize = (float)$stateCountTotal / 7.0; - $found = false; - for ($index = 0; $index < count($this->possibleCenters); $index++) { - $center = $this->possibleCenters[$index]; - // Look for about the same center and module size: - if ($center->aboutEquals($estimatedModuleSize, $centerI, $centerJ)) { - $this->possibleCenters[$index] = $center->combineEstimate($centerI, $centerJ, $estimatedModuleSize); - $found = true; - break; - } - } - if (!$found) { - $point = new FinderPattern($centerJ, $centerI, $estimatedModuleSize); - $this->possibleCenters[] = $point; - if ($this->resultPointCallback != null) { - $this->resultPointCallback->foundPossibleResultPoint($point); - } - } - - return true; - } - } - - return false; - } - - /** - * Given a count of black/white/black/white/black pixels just seen and an end position, - * figures the location of the center of this run. - */ - private static function centerFromEnd($stateCount, $end) - { - return (float)($end - $stateCount[4] - $stateCount[3]) - $stateCount[2] / 2.0; - } - - /** - *

    After a horizontal scan finds a potential finder pattern, this method - * "cross-checks" by scanning down vertically through the center of the possible - * finder pattern to see if the same proportion is detected.

    - * - * @param $startI ; row where a finder pattern was detected - * @param centerJ ; center of the section that appears to cross a finder pattern - * @param $maxCount ; maximum reasonable number of modules that should be - * observed in any reading state, based on the results of the horizontal scan - * - * @return vertical center of finder pattern, or {@link Float#NaN} if not found - */ - private function crossCheckVertical($startI, $centerJ, $maxCount, - $originalStateCountTotal) - { - $image = $this->image; - - $maxI = $image->getHeight(); - $stateCount = $this->getCrossCheckStateCount(); - - // Start counting up from center - $i = $startI; - while ($i >= 0 && $image->get($centerJ, $i)) { - $stateCount[2]++; - $i--; - } - if ($i < 0) { - return NAN; - } - while ($i >= 0 && !$image->get($centerJ, $i) && $stateCount[1] <= $maxCount) { - $stateCount[1]++; - $i--; - } - // If already too many modules in this state or ran off the edge: - if ($i < 0 || $stateCount[1] > $maxCount) { - return NAN; - } - while ($i >= 0 && $image->get($centerJ, $i) && $stateCount[0] <= $maxCount) { - $stateCount[0]++; - $i--; - } - if ($stateCount[0] > $maxCount) { - return NAN; - } - - // Now also count down from center - $i = $startI + 1; - while ($i < $maxI && $image->get($centerJ, $i)) { - $stateCount[2]++; - $i++; - } - if ($i == $maxI) { - return NAN; - } - while ($i < $maxI && !$image->get($centerJ, $i) && $stateCount[3] < $maxCount) { - $stateCount[3]++; - $i++; - } - if ($i == $maxI || $stateCount[3] >= $maxCount) { - return NAN; - } - while ($i < $maxI && $image->get($centerJ, $i) && $stateCount[4] < $maxCount) { - $stateCount[4]++; - $i++; - } - if ($stateCount[4] >= $maxCount) { - return NAN; - } - - // If we found a finder-pattern-like section, but its size is more than 40% different than - // the original, assume it's a false positive - $stateCountTotal = $stateCount[0] + $stateCount[1] + $stateCount[2] + $stateCount[3] + - $stateCount[4]; - if (5 * abs($stateCountTotal - $originalStateCountTotal) >= 2 * $originalStateCountTotal) { - return NAN; - } - - return self::foundPatternCross($stateCount) ? $this->centerFromEnd($stateCount, $i) : NAN; - } - - private function getCrossCheckStateCount() - { - $this->crossCheckStateCount[0] = 0; - $this->crossCheckStateCount[1] = 0; - $this->crossCheckStateCount[2] = 0; - $this->crossCheckStateCount[3] = 0; - $this->crossCheckStateCount[4] = 0; - - return $this->crossCheckStateCount; - } - - /** - *

    Like {@link #crossCheckVertical(int, int, int, int)}, and in fact is basically identical, - * except it reads horizontally instead of vertically. This is used to cross-cross - * check a vertical cross check and locate the real center of the alignment pattern.

    - */ - private function crossCheckHorizontal($startJ, $centerI, $maxCount, - $originalStateCountTotal) - { - $image = $this->image; - - $maxJ = $this->image->getWidth(); - $stateCount = $this->getCrossCheckStateCount(); - - $j = $startJ; - while ($j >= 0 && $image->get($j, $centerI)) { - $stateCount[2]++; - $j--; - } - if ($j < 0) { - return NAN; - } - while ($j >= 0 && !$image->get($j, $centerI) && $stateCount[1] <= $maxCount) { - $stateCount[1]++; - $j--; - } - if ($j < 0 || $stateCount[1] > $maxCount) { - return NAN; - } - while ($j >= 0 && $image->get($j, $centerI) && $stateCount[0] <= $maxCount) { - $stateCount[0]++; - $j--; - } - if ($stateCount[0] > $maxCount) { - return NAN; - } - - $j = $startJ + 1; - while ($j < $maxJ && $image->get($j, $centerI)) { - $stateCount[2]++; - $j++; - } - if ($j == $maxJ) { - return NAN; - } - while ($j < $maxJ && !$image->get($j, $centerI) && $stateCount[3] < $maxCount) { - $stateCount[3]++; - $j++; - } - if ($j == $maxJ || $stateCount[3] >= $maxCount) { - return NAN; - } - while ($j < $maxJ && $this->image->get($j, $centerI) && $stateCount[4] < $maxCount) { - $stateCount[4]++; - $j++; - } - if ($stateCount[4] >= $maxCount) { - return NAN; - } - - // If we found a finder-pattern-like section, but its size is significantly different than - // the original, assume it's a false positive - $stateCountTotal = $stateCount[0] + $stateCount[1] + $stateCount[2] + $stateCount[3] + - $stateCount[4]; - if (5 * abs($stateCountTotal - $originalStateCountTotal) >= $originalStateCountTotal) { - return NAN; - } - - return $this->foundPatternCross($stateCount) ? $this->centerFromEnd($stateCount, $j) : NAN; - } - - /** - * After a vertical and horizontal scan finds a potential finder pattern, this method - * "cross-cross-cross-checks" by scanning down diagonally through the center of the possible - * finder pattern to see if the same proportion is detected. - * - * @param $startI ; row where a finder pattern was detected - * @param centerJ ; center of the section that appears to cross a finder pattern - * @param $maxCount ; maximum reasonable number of modules that should be - * observed in any reading state, based on the results of the horizontal scan - * @param originalStateCountTotal ; The original state count total. - * - * @return true if proportions are withing expected limits - */ - private function crossCheckDiagonal($startI, $centerJ, $maxCount, $originalStateCountTotal) - { - $stateCount = $this->getCrossCheckStateCount(); - - // Start counting up, left from center finding black center mass - $i = 0; - $startI = (int)($startI); - $centerJ = (int)($centerJ); - while ($startI >= $i && $centerJ >= $i && $this->image->get($centerJ - $i, $startI - $i)) { - $stateCount[2]++; - $i++; - } - - if ($startI < $i || $centerJ < $i) { - return false; - } - - // Continue up, left finding white space - while ($startI >= $i && $centerJ >= $i && !$this->image->get($centerJ - $i, $startI - $i) && - $stateCount[1] <= $maxCount) { - $stateCount[1]++; - $i++; - } - - // If already too many modules in this state or ran off the edge: - if ($startI < $i || $centerJ < $i || $stateCount[1] > $maxCount) { - return false; - } - - // Continue up, left finding black border - while ($startI >= $i && $centerJ >= $i && $this->image->get($centerJ - $i, $startI - $i) && - $stateCount[0] <= $maxCount) { - $stateCount[0]++; - $i++; - } - if ($stateCount[0] > $maxCount) { - return false; - } - - $maxI = $this->image->getHeight(); - $maxJ = $this->image->getWidth(); - - // Now also count down, right from center - $i = 1; - while ($startI + $i < $maxI && $centerJ + $i < $maxJ && $this->image->get($centerJ + $i, $startI + $i)) { - $stateCount[2]++; - $i++; - } - - // Ran off the edge? - if ($startI + $i >= $maxI || $centerJ + $i >= $maxJ) { - return false; - } - - while ($startI + $i < $maxI && $centerJ + $i < $maxJ && !$this->image->get($centerJ + $i, $startI + $i) && - $stateCount[3] < $maxCount) { - $stateCount[3]++; - $i++; - } - - if ($startI + $i >= $maxI || $centerJ + $i >= $maxJ || $stateCount[3] >= $maxCount) { - return false; - } - - while ($startI + $i < $maxI && $centerJ + $i < $maxJ && $this->image->get($centerJ + $i, $startI + $i) && - $stateCount[4] < $maxCount) { - $stateCount[4]++; - $i++; - } - - if ($stateCount[4] >= $maxCount) { - return false; - } - - // If we found a finder-pattern-like section, but its size is more than 100% different than - // the original, assume it's a false positive - $stateCountTotal = $stateCount[0] + $stateCount[1] + $stateCount[2] + $stateCount[3] + $stateCount[4]; - - return - abs($stateCountTotal - $originalStateCountTotal) < 2 * $originalStateCountTotal && - self::foundPatternCross($stateCount); - } - - /** - * @return true iff we have found at least 3 finder patterns that have been detected - * at least {@link #CENTER_QUORUM} times each, and, the estimated module size of the - * candidates is "pretty similar" - */ - private function haveMultiplyConfirmedCenters() - { - $confirmedCount = 0; - $totalModuleSize = 0.0; - $max = count($this->possibleCenters); - foreach ($this->possibleCenters as $pattern) { - if ($pattern->getCount() >= self::$CENTER_QUORUM) { - $confirmedCount++; - $totalModuleSize += $pattern->getEstimatedModuleSize(); - } - } - if ($confirmedCount < 3) { - return false; - } - // OK, we have at least 3 confirmed centers, but, it's possible that one is a "false positive" - // and that we need to keep looking. We detect this by asking if the estimated module sizes - // vary too much. We arbitrarily say that when the total deviation from average exceeds - // 5% of the total module size estimates, it's too much. - $average = $totalModuleSize / (float)$max; - $totalDeviation = 0.0; - foreach ($this->possibleCenters as $pattern) { - $totalDeviation += abs($pattern->getEstimatedModuleSize() - $average); - } - - return $totalDeviation <= 0.05 * $totalModuleSize; - } - - /** - * @return number of rows we could safely skip during scanning, based on the first - * two finder patterns that have been located. In some cases their position will - * allow us to infer that the third pattern must lie below a certain point farther - * down in the image. - */ - private function findRowSkip() - { - $max = count($this->possibleCenters); - if ($max <= 1) { - return 0; - } - $firstConfirmedCenter = null; - foreach ($this->possibleCenters as $center) { - - - if ($center->getCount() >= self::$CENTER_QUORUM) { - if ($firstConfirmedCenter == null) { - $firstConfirmedCenter = $center; - } else { - // We have two confirmed centers - // How far down can we skip before resuming looking for the next - // pattern? In the worst case, only the difference between the - // difference in the x / y coordinates of the two centers. - // This is the case where you find top left last. - $this->hasSkipped = true; - - return (int)((abs($firstConfirmedCenter->getX() - $center->getX()) - - abs($firstConfirmedCenter->getY() - $center->getY())) / 2); - } - } - } - - return 0; - } - - /** - * @return array the 3 best {@link FinderPattern}s from our list of candidates. The "best" are - * those that have been detected at least {@link #CENTER_QUORUM} times, and whose module - * size differs from the average among those patterns the least - * @throws NotFoundException if 3 such finder patterns do not exist - */ - private function selectBestPatterns() - { - $startSize = count($this->possibleCenters); - if ($startSize < 3) { - // Couldn't find enough finder patterns - throw new NotFoundException; - } - - // Filter outlier possibilities whose module size is too different - if ($startSize > 3) { - // But we can only afford to do so if we have at least 4 possibilities to choose from - $totalModuleSize = 0.0; - $square = 0.0; - foreach ($this->possibleCenters as $center) { - $size = $center->getEstimatedModuleSize(); - $totalModuleSize += $size; - $square += $size * $size; - } - $this->average = $totalModuleSize / (float)$startSize; - $stdDev = (float)sqrt($square / $startSize - $this->average * $this->average); - - usort($this->possibleCenters, [$this, 'FurthestFromAverageComparator']); - - $limit = max(0.2 * $this->average, $stdDev); - - for ($i = 0; $i < count($this->possibleCenters) && count($this->possibleCenters) > 3; $i++) { - $pattern = $this->possibleCenters[$i]; - if (abs($pattern->getEstimatedModuleSize() - $this->average) > $limit) { - unset($this->possibleCenters[$i]);//возможно что ключи меняются в java при вызове .remove(i) ??? - $this->possibleCenters = array_values($this->possibleCenters); - $i--; - } - } - } - - if (count($this->possibleCenters) > 3) { - // Throw away all but those first size candidate points we found. - - $totalModuleSize = 0.0; - foreach ($this->possibleCenters as $possibleCenter) { - $totalModuleSize += $possibleCenter->getEstimatedModuleSize(); - } - - $this->average = $totalModuleSize / (float)count($this->possibleCenters); - - usort($this->possibleCenters, [$this, 'CenterComparator']); - - array_slice($this->possibleCenters, 3, count($this->possibleCenters) - 3); - } - - return [$this->possibleCenters[0], $this->possibleCenters[1], $this->possibleCenters[2]]; - } - - /** - *

    Orders by furthest from average

    - */ - public function FurthestFromAverageComparator($center1, $center2) - { - - $dA = abs($center2->getEstimatedModuleSize() - $this->average); - $dB = abs($center1->getEstimatedModuleSize() - $this->average); - if ($dA < $dB) { - return -1; - } elseif ($dA == $dB) { - return 0; - } else { - return 1; - } - } - - public function CenterComparator($center1, $center2) - { - if ($center2->getCount() == $center1->getCount()) { - $dA = abs($center2->getEstimatedModuleSize() - $this->average); - $dB = abs($center1->getEstimatedModuleSize() - $this->average); - if ($dA < $dB) { - return 1; - } elseif ($dA == $dB) { - return 0; - } else { - return -1; - } - } else { - return $center2->getCount() - $center1->getCount(); - } - } - - protected final function getImage() - { - return $this->image; - } - /** - *

    Orders by {@link FinderPattern#getCount()}, descending.

    - */ - - //@Override - protected final function getPossibleCenters() - { //List getPossibleCenters() - return $this->possibleCenters; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/FinderPatternInfo.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/FinderPatternInfo.php deleted file mode 100644 index 28091a43..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/Detector/FinderPatternInfo.php +++ /dev/null @@ -1,53 +0,0 @@ -Encapsulates information about finder patterns in an image, including the location of - * the three finder patterns, and their estimated module size.

    - * - * @author Sean Owen - */ -final class FinderPatternInfo -{ - private $bottomLeft; - private $topLeft; - private $topRight; - - public function __construct($patternCenters) - { - $this->bottomLeft = $patternCenters[0]; - $this->topLeft = $patternCenters[1]; - $this->topRight = $patternCenters[2]; - } - - public function getBottomLeft() - { - return $this->bottomLeft; - } - - public function getTopLeft() - { - return $this->topLeft; - } - - public function getTopRight() - { - return $this->topRight; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/QRCodeReader.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/QRCodeReader.php deleted file mode 100644 index 2fd1c468..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Qrcode/QRCodeReader.php +++ /dev/null @@ -1,222 +0,0 @@ -decoder = new Decoder(); - } - - /** - * @param BinaryBitmap $image - * @param null $hints - * - * @return Result - * @throws \Zxing\FormatException - * @throws \Zxing\NotFoundException - */ - public function decode(BinaryBitmap $image, $hints = null) - { - $decoderResult = null; - if ($hints !== null && $hints['PURE_BARCODE']) { - $bits = self::extractPureBits($image->getBlackMatrix()); - $decoderResult = $this->decoder->decode($bits, $hints); - $points = self::$NO_POINTS; - } else { - $detector = new Detector($image->getBlackMatrix()); - $detectorResult = $detector->detect($hints); - - $decoderResult = $this->decoder->decode($detectorResult->getBits(), $hints); - $points = $detectorResult->getPoints(); - } - $result = new Result($decoderResult->getText(), $decoderResult->getRawBytes(), $points, 'QR_CODE');//BarcodeFormat.QR_CODE - - $byteSegments = $decoderResult->getByteSegments(); - if ($byteSegments !== null) { - $result->putMetadata('BYTE_SEGMENTS', $byteSegments);//ResultMetadataType.BYTE_SEGMENTS - } - $ecLevel = $decoderResult->getECLevel(); - if ($ecLevel !== null) { - $result->putMetadata('ERROR_CORRECTION_LEVEL', $ecLevel);//ResultMetadataType.ERROR_CORRECTION_LEVEL - } - if ($decoderResult->hasStructuredAppend()) { - $result->putMetadata( - 'STRUCTURED_APPEND_SEQUENCE',//ResultMetadataType.STRUCTURED_APPEND_SEQUENCE - $decoderResult->getStructuredAppendSequenceNumber() - ); - $result->putMetadata( - 'STRUCTURED_APPEND_PARITY',//ResultMetadataType.STRUCTURED_APPEND_PARITY - $decoderResult->getStructuredAppendParity() - ); - } - - return $result; - } - - /** - * Locates and decodes a QR code in an image. - * - * @return a String representing the content encoded by the QR code - * @throws NotFoundException if a QR code cannot be found - * @throws FormatException if a QR code cannot be decoded - * @throws ChecksumException if error correction fails - */ - - /** - * This method detects a code in a "pure" image -- that is, pure monochrome image - * which contains only an unrotated, unskewed, image of a code, with some white border - * around it. This is a specialized method that works exceptionally fast in this special - * case. - * - * @see com.google.zxing.datamatrix.DataMatrixReader#extractPureBits(BitMatrix) - */ - private static function extractPureBits(BitMatrix $image) - { - $leftTopBlack = $image->getTopLeftOnBit(); - $rightBottomBlack = $image->getBottomRightOnBit(); - if ($leftTopBlack === null || $rightBottomBlack == null) { - throw NotFoundException::getNotFoundInstance(); - } - - $moduleSize = self::moduleSize($leftTopBlack, $image); - - $top = $leftTopBlack[1]; - $bottom = $rightBottomBlack[1]; - $left = $leftTopBlack[0]; - $right = $rightBottomBlack[0]; - - // Sanity check! - if ($left >= $right || $top >= $bottom) { - throw NotFoundException::getNotFoundInstance(); - } - - if ($bottom - $top != $right - $left) { - // Special case, where bottom-right module wasn't black so we found something else in the last row - // Assume it's a square, so use height as the width - $right = $left + ($bottom - $top); - } - - $matrixWidth = round(($right - $left + 1) / $moduleSize); - $matrixHeight = round(($bottom - $top + 1) / $moduleSize); - if ($matrixWidth <= 0 || $matrixHeight <= 0) { - throw NotFoundException::getNotFoundInstance(); - } - if ($matrixHeight != $matrixWidth) { - // Only possibly decode square regions - throw NotFoundException::getNotFoundInstance(); - } - - // Push in the "border" by half the module width so that we start - // sampling in the middle of the module. Just in case the image is a - // little off, this will help recover. - $nudge = (int)($moduleSize / 2.0);// $nudge = (int) ($moduleSize / 2.0f); - $top += $nudge; - $left += $nudge; - - // But careful that this does not sample off the edge - // "right" is the farthest-right valid pixel location -- right+1 is not necessarily - // This is positive by how much the inner x loop below would be too large - $nudgedTooFarRight = $left + (int)(($matrixWidth - 1) * $moduleSize) - $right; - if ($nudgedTooFarRight > 0) { - if ($nudgedTooFarRight > $nudge) { - // Neither way fits; abort - throw NotFoundException::getNotFoundInstance(); - } - $left -= $nudgedTooFarRight; - } - // See logic above - $nudgedTooFarDown = $top + (int)(($matrixHeight - 1) * $moduleSize) - $bottom; - if ($nudgedTooFarDown > 0) { - if ($nudgedTooFarDown > $nudge) { - // Neither way fits; abort - throw NotFoundException::getNotFoundInstance(); - } - $top -= $nudgedTooFarDown; - } - - // Now just read off the bits - $bits = new BitMatrix($matrixWidth, $matrixHeight); - for ($y = 0; $y < $matrixHeight; $y++) { - $iOffset = $top + (int)($y * $moduleSize); - for ($x = 0; $x < $matrixWidth; $x++) { - if ($image->get($left + (int)($x * $moduleSize), $iOffset)) { - $bits->set($x, $y); - } - } - } - - return $bits; - } - - private static function moduleSize($leftTopBlack, BitMatrix $image) - { - $height = $image->getHeight(); - $width = $image->getWidth(); - $x = $leftTopBlack[0]; - $y = $leftTopBlack[1]; - /*$x = $leftTopBlack[0]; - $y = $leftTopBlack[1];*/ - $inBlack = true; - $transitions = 0; - while ($x < $width && $y < $height) { - if ($inBlack != $image->get($x, $y)) { - if (++$transitions == 5) { - break; - } - $inBlack = !$inBlack; - } - $x++; - $y++; - } - if ($x == $width || $y == $height) { - throw NotFoundException::getNotFoundInstance(); - } - - return ($x - $leftTopBlack[0]) / 7.0; //return ($x - $leftTopBlack[0]) / 7.0f; - } - - public function reset() - { - // do nothing - } - - protected final function getDecoder() - { - return $this->decoder; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/RGBLuminanceSource.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/RGBLuminanceSource.php deleted file mode 100644 index e3fe2229..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/RGBLuminanceSource.php +++ /dev/null @@ -1,309 +0,0 @@ -RGBLuminanceSource_($pixels, $dataWidth, $dataHeight); - - return; - } - parent::__construct($width, $height); - if ($left + $width > $dataWidth || $top + $height > $dataHeight) { - throw new \InvalidArgumentException("Crop rectangle does not fit within image data."); - } - $this->luminances = $pixels; - $this->dataWidth = $dataWidth; - $this->dataHeight = $dataHeight; - $this->left = $left; - $this->top = $top; - } - - public function RGBLuminanceSource_($width, $height, $pixels) - { - parent::__construct($width, $height); - - $this->dataWidth = $width; - $this->dataHeight = $height; - $this->left = 0; - $this->top = 0; - $this->pixels = $pixels; - - -// In order to measure pure decoding speed, we convert the entire image to a greyscale array -// up front, which is the same as the Y channel of the YUVLuminanceSource in the real app. - $this->luminances = []; - //$this->luminances = $this->grayScaleToBitmap($this->grayscale()); - - foreach ($pixels as $key => $pixel) { - $r = $pixel['red']; - $g = $pixel['green']; - $b = $pixel['blue']; - - /* if (($pixel & 0xFF000000) == 0) { - $pixel = 0xFFFFFFFF; // = white - } - - // .229R + 0.587G + 0.114B (YUV/YIQ for PAL and NTSC) - - $this->luminances[$key] = - (306 * (($pixel >> 16) & 0xFF) + - 601 * (($pixel >> 8) & 0xFF) + - 117 * ($pixel & 0xFF) + - 0x200) >> 10; - - */ - //$r = ($pixel >> 16) & 0xff; - //$g = ($pixel >> 8) & 0xff; - //$b = $pixel & 0xff; - if ($r == $g && $g == $b) { -// Image is already greyscale, so pick any channel. - - $this->luminances[$key] = $r;//(($r + 128) % 256) - 128; - } else { -// Calculate luminance cheaply, favoring green. - $this->luminances[$key] = ($r + 2 * $g + $b) / 4;//(((($r + 2 * $g + $b) / 4) + 128) % 256) - 128; - } - - } - - /* - - for ($y = 0; $y < $height; $y++) { - $offset = $y * $width; - for ($x = 0; $x < $width; $x++) { - $pixel = $pixels[$offset + $x]; - $r = ($pixel >> 16) & 0xff; - $g = ($pixel >> 8) & 0xff; - $b = $pixel & 0xff; - if ($r == $g && $g == $b) { -// Image is already greyscale, so pick any channel. - - $this->luminances[(int)($offset + $x)] = (($r+128) % 256) - 128; - } else { -// Calculate luminance cheaply, favoring green. - $this->luminances[(int)($offset + $x)] = (((($r + 2 * $g + $b) / 4)+128)%256) - 128; - } - - - - } - */ - //} - // $this->luminances = $this->grayScaleToBitmap($this->luminances); - - } - - public function grayscale() - { - $width = $this->dataWidth; - $height = $this->dataHeight; - - $ret = fill_array(0, $width * $height, 0); - for ($y = 0; $y < $height; $y++) { - for ($x = 0; $x < $width; $x++) { - $gray = $this->getPixel($x, $y, $width, $height); - - $ret[$x + $y * $width] = $gray; - } - } - - return $ret; - } - - public function getPixel($x, $y, $width, $height) - { - $image = $this->pixels; - if ($width < $x) { - die('error'); - } - if ($height < $y) { - die('error'); - } - $point = ($x) + ($y * $width); - - $r = $image[$point]['red'];//($image[$point] >> 16) & 0xff; - $g = $image[$point]['green'];//($image[$point] >> 8) & 0xff; - $b = $image[$point]['blue'];//$image[$point] & 0xff; - - $p = (int)(($r * 33 + $g * 34 + $b * 33) / 100); - - - return $p; - - } - - public function grayScaleToBitmap($grayScale) - { - $middle = $this->getMiddleBrightnessPerArea($grayScale); - $sqrtNumArea = count($middle); - $areaWidth = floor($this->dataWidth / $sqrtNumArea); - $areaHeight = floor($this->dataHeight / $sqrtNumArea); - $bitmap = fill_array(0, $this->dataWidth * $this->dataHeight, 0); - - for ($ay = 0; $ay < $sqrtNumArea; $ay++) { - for ($ax = 0; $ax < $sqrtNumArea; $ax++) { - for ($dy = 0; $dy < $areaHeight; $dy++) { - for ($dx = 0; $dx < $areaWidth; $dx++) { - $bitmap[(int)($areaWidth * $ax + $dx + ($areaHeight * $ay + $dy) * $this->dataWidth)] = ($grayScale[(int)($areaWidth * $ax + $dx + ($areaHeight * $ay + $dy) * $this->dataWidth)] < $middle[$ax][$ay]) ? 0 : 255; - } - } - } - } - - return $bitmap; - } - - public function getMiddleBrightnessPerArea($image) - { - $numSqrtArea = 4; - //obtain middle brightness((min + max) / 2) per area - $areaWidth = floor($this->dataWidth / $numSqrtArea); - $areaHeight = floor($this->dataHeight / $numSqrtArea); - $minmax = fill_array(0, $numSqrtArea, 0); - for ($i = 0; $i < $numSqrtArea; $i++) { - $minmax[$i] = fill_array(0, $numSqrtArea, 0); - for ($i2 = 0; $i2 < $numSqrtArea; $i2++) { - $minmax[$i][$i2] = [0, 0]; - } - } - for ($ay = 0; $ay < $numSqrtArea; $ay++) { - for ($ax = 0; $ax < $numSqrtArea; $ax++) { - $minmax[$ax][$ay][0] = 0xFF; - for ($dy = 0; $dy < $areaHeight; $dy++) { - for ($dx = 0; $dx < $areaWidth; $dx++) { - $target = $image[(int)($areaWidth * $ax + $dx + ($areaHeight * $ay + $dy) * $this->dataWidth)]; - if ($target < $minmax[$ax][$ay][0]) - $minmax[$ax][$ay][0] = $target; - if ($target > $minmax[$ax][$ay][1]) - $minmax[$ax][$ay][1] = $target; - } - } - //minmax[ax][ay][0] = (minmax[ax][ay][0] + minmax[ax][ay][1]) / 2; - } - } - $middle = []; - for ($i3 = 0; $i3 < $numSqrtArea; $i3++) { - $middle[$i3] = []; - } - for ($ay = 0; $ay < $numSqrtArea; $ay++) { - for ($ax = 0; $ax < $numSqrtArea; $ax++) { - $middle[$ax][$ay] = floor(($minmax[$ax][$ay][0] + $minmax[$ax][$ay][1]) / 2); - //Console.out.print(middle[ax][ay] + ","); - } - //Console.out.println(""); - } - - //Console.out.println(""); - - return $middle; - } - -//@Override - public function getRow($y, $row = null) - { - if ($y < 0 || $y >= $this->getHeight()) { - throw new \InvalidArgumentException("Requested row is outside the image: " + y); - } - $width = $this->getWidth(); - if ($row == null || count($row) < $width) { - $row = []; - } - $offset = ($y + $this->top) * $this->dataWidth + $this->left; - $row = arraycopy($this->luminances, $offset, $row, 0, $width); - - return $row; - } - -//@Override - public function getMatrix() - { - $width = $this->getWidth(); - $height = $this->getHeight(); - -// If the caller asks for the entire underlying image, save the copy and give them the -// original data. The docs specifically warn that result.length must be ignored. - if ($width == $this->dataWidth && $height == $this->dataHeight) { - return $this->luminances; - } - - $area = $width * $height; - $matrix = []; - $inputOffset = $this->top * $this->dataWidth + $this->left; - -// If the width matches the full width of the underlying data, perform a single copy. - if ($width == $this->dataWidth) { - $matrix = arraycopy($this->luminances, $inputOffset, $matrix, 0, $area); - - return $matrix; - } - -// Otherwise copy one cropped row at a time. - $rgb = $this->luminances; - for ($y = 0; $y < $height; $y++) { - $outputOffset = $y * $width; - $matrix = arraycopy($rgb, $inputOffset, $matrix, $outputOffset, $width); - $inputOffset += $this->dataWidth; - } - - return $matrix; - } - -//@Override - public function isCropSupported() - { - return true; - } - -//@Override - public function crop($left, $top, $width, $height) - { - return new RGBLuminanceSource($this->luminances, - $this->dataWidth, - $this->dataHeight, - $this->left + $left, - $this->top + $top, - $width, - $height); - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/Reader.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/Reader.php deleted file mode 100644 index cc18ccc1..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/Reader.php +++ /dev/null @@ -1,10 +0,0 @@ -Encapsulates the result of decoding a barcode within an image.

    - * - * @author Sean Owen - */ -final class Result -{ - private $text; - private $rawBytes; - private $resultPoints; - private $format; - private $resultMetadata; - private $timestamp; - - public function __construct( - $text, - $rawBytes, - $resultPoints, - $format, - $timestamp = '' - ) { - - $this->text = $text; - $this->rawBytes = $rawBytes; - $this->resultPoints = $resultPoints; - $this->format = $format; - $this->resultMetadata = null; - $this->timestamp = $timestamp ?: time(); - } - - /** - * @return raw text encoded by the barcode - */ - public function getText() - { - return $this->text; - } - - /** - * @return raw bytes encoded by the barcode, if applicable, otherwise {@code null} - */ - public function getRawBytes() - { - return $this->rawBytes; - } - - /** - * @return points related to the barcode in the image. These are typically points - * identifying finder patterns or the corners of the barcode. The exact meaning is - * specific to the type of barcode that was decoded. - */ - public function getResultPoints() - { - return $this->resultPoints; - } - - /** - * @return {@link BarcodeFormat} representing the format of the barcode that was decoded - */ - public function getBarcodeFormat() - { - return $this->format; - } - - /** - * @return {@link Map} mapping {@link ResultMetadataType} keys to values. May be - * {@code null}. This contains optional metadata about what was detected about the barcode, - * like orientation. - */ - public function getResultMetadata() - { - return $this->resultMetadata; - } - - public function putMetadata($type, $value) - { - if ($this->resultMetadata === null) { - $this->resultMetadata = []; - } - $resultMetadata[$type] = $value; - } - - public function putAllMetadata($metadata) - { - if ($metadata !== null) { - if ($this->resultMetadata === null) { - $this->resultMetadata = $metadata; - } else { - $this->resultMetadata = array_merge($this->resultMetadata, $metadata); - } - } - } - - public function addResultPoints($newPoints) - { - $oldPoints = $this->resultPoints; - if ($oldPoints === null) { - $this->resultPoints = $newPoints; - } else if ($newPoints !== null && count($newPoints) > 0) { - $allPoints = fill_array(0, count($oldPoints) + count($newPoints), 0); - $allPoints = arraycopy($oldPoints, 0, $allPoints, 0, count($oldPoints)); - $allPoints = arraycopy($newPoints, 0, $allPoints, count($oldPoints), count($newPoints)); - $this->resultPoints = $allPoints; - } - } - - public function getTimestamp() - { - return $this->timestamp; - } - - public function toString() - { - return $this->text; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/lib/ResultPoint.php b/vendor/khanamiryan/qrcode-detector-decoder/lib/ResultPoint.php deleted file mode 100644 index f0720b3c..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/lib/ResultPoint.php +++ /dev/null @@ -1,155 +0,0 @@ -Encapsulates a point of interest in an image containing a barcode. Typically, this - * would be the location of a finder pattern or the corner of the barcode, for example.

    - * - * @author Sean Owen - */ -class ResultPoint -{ - private $x; - private $y; - - public function __construct($x, $y) - { - $this->x = (float)($x); - $this->y = (float)($y); - } - - /** - * Orders an array of three ResultPoints in an order [A,B,C] such that AB is less than AC - * and BC is less than AC, and the angle between BC and BA is less than 180 degrees. - * - * @param patterns array of three {@code ResultPoint} to order - */ - public static function orderBestPatterns($patterns) - { - -// Find distances between pattern centers - $zeroOneDistance = self::distance($patterns[0], $patterns[1]); - $oneTwoDistance = self::distance($patterns[1], $patterns[2]); - $zeroTwoDistance = self::distance($patterns[0], $patterns[2]); - - $pointA = ''; - $pointB = ''; - $pointC = ''; -// Assume one closest to other two is B; A and C will just be guesses at first - if ($oneTwoDistance >= $zeroOneDistance && $oneTwoDistance >= $zeroTwoDistance) { - $pointB = $patterns[0]; - $pointA = $patterns[1]; - $pointC = $patterns[2]; - } else if ($zeroTwoDistance >= $oneTwoDistance && $zeroTwoDistance >= $zeroOneDistance) { - $pointB = $patterns[1]; - $pointA = $patterns[0]; - $pointC = $patterns[2]; - } else { - $pointB = $patterns[2]; - $pointA = $patterns[0]; - $pointC = $patterns[1]; - } - -// Use cross product to figure out whether A and C are correct or flipped. -// This asks whether BC x BA has a positive z component, which is the arrangement -// we want for A, B, C. If it's negative, then we've got it flipped around and -// should swap A and C. - if (self::crossProductZ($pointA, $pointB, $pointC) < 0.0) { - $temp = $pointA; - $pointA = $pointC; - $pointC = $temp; - } - - $patterns[0] = $pointA; - $patterns[1] = $pointB; - $patterns[2] = $pointC; - - return $patterns; - } - - /** - * @param pattern1 first pattern - * @param pattern2 second pattern - * - * @return distance between two points - */ - public static function distance($pattern1, $pattern2) - { - return MathUtils::distance($pattern1->x, $pattern1->y, $pattern2->x, $pattern2->y); - } - -//@Override - - /** - * Returns the z component of the cross product between vectors BC and BA. - */ - private static function crossProductZ($pointA, - $pointB, - $pointC) - { - $bX = $pointB->x; - $bY = $pointB->y; - - return (($pointC->x - $bX) * ($pointA->y - $bY)) - (($pointC->y - $bY) * ($pointA->x - $bX)); - } - -//@Override - - public final function getX() - { - return (float)($this->x); - } - -//@Override - - public final function getY() - { - return (float)($this->y); - } - - public final function equals($other) - { - if ($other instanceof ResultPoint) { - $otherPoint = $other; - - return $this->x == $otherPoint->x && $this->y == $otherPoint->y; - } - - return false; - } - - public final function hashCode() - { - return 31 * floatToIntBits($this->x) + floatToIntBits($this->y); - } - - public final function toString() - { - $result = ''; - $result .= ('('); - $result .= ($this->x); - $result .= (','); - $result .= ($this->y); - $result .= (')'); - - return $result; - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/phpunit.xml.dist b/vendor/khanamiryan/qrcode-detector-decoder/phpunit.xml.dist deleted file mode 100644 index 7c557c8c..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/phpunit.xml.dist +++ /dev/null @@ -1,10 +0,0 @@ - - - tests - - - - src - - - diff --git a/vendor/khanamiryan/qrcode-detector-decoder/tests/QrReaderTest.php b/vendor/khanamiryan/qrcode-detector-decoder/tests/QrReaderTest.php deleted file mode 100644 index c5ac9c2a..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/tests/QrReaderTest.php +++ /dev/null @@ -1,17 +0,0 @@ -assertSame("Hello world!", $qrcode->text()); - } -} diff --git a/vendor/khanamiryan/qrcode-detector-decoder/tests/bootstrap.php b/vendor/khanamiryan/qrcode-detector-decoder/tests/bootstrap.php deleted file mode 100644 index 9d0835e4..00000000 --- a/vendor/khanamiryan/qrcode-detector-decoder/tests/bootstrap.php +++ /dev/null @@ -1,15 +0,0 @@ -add($complexString2); -``` -or pass all values to the appropriate function -``` -$complexString1 = '1.23-4.56i'; -$complexString2 = '2.34+5.67i'; - -echo Complex\add($complexString1, $complexString2); -``` -If you want to perform the same operation against multiple values (e.g. to add three or more complex numbers), then you can pass multiple arguments to any of the operations. - -You can pass these arguments as Complex objects, or as an array or string that will parse to a complex object. - -## Using functions - -When calling any of the available functions for a complex value, you can either call the relevant method for the Complex object -``` -$complexString = '1.23-4.56i'; - -$complexObject = new Complex\Complex($complexString); -echo $complexObject->sinh(); -``` -or you can call the function as you would in procedural code, passing the Complex object as an argument -``` -$complexString = '1.23-4.56i'; - -$complexObject = new Complex\Complex($complexString); -echo Complex\sinh($complexObject); -``` -When called procedurally using the function, you can pass in the argument as a Complex object, or as an array or string that will parse to a complex object. -``` -$complexString = '1.23-4.56i'; - -echo Complex\sinh($complexString); -``` - -In the case of the `pow()` function (the only implemented function that requires an additional argument) you need to pass both arguments when calling the function procedurally - -``` -$complexString = '1.23-4.56i'; - -$complexObject = new Complex\Complex($complexString); -echo Complex\pow($complexObject, 2); -``` -or pass the additional argument when calling the method -``` -$complexString = '1.23-4.56i'; - -$complexObject = new Complex\Complex($complexString); -echo $complexObject->pow(2); -``` diff --git a/vendor/markbaker/complex/classes/Autoloader.php b/vendor/markbaker/complex/classes/Autoloader.php deleted file mode 100644 index e6e03ac0..00000000 --- a/vendor/markbaker/complex/classes/Autoloader.php +++ /dev/null @@ -1,53 +0,0 @@ -regex = $regex; - parent::__construct($it, $regex); - } -} - -class FilenameFilter extends FilesystemRegexFilter -{ - // Filter files against the regex - public function accept() - { - return (!$this->isFile() || preg_match($this->regex, $this->getFilename())); - } -} - - -$srcFolder = __DIR__ . DIRECTORY_SEPARATOR . 'src'; -$srcDirectory = new RecursiveDirectoryIterator($srcFolder); - -$filteredFileList = new FilenameFilter($srcDirectory, '/(?:php)$/i'); -$filteredFileList = new FilenameFilter($filteredFileList, '/^(?!.*(Complex|Exception)\.php).*$/i'); - -foreach (new RecursiveIteratorIterator($filteredFileList) as $file) { - if ($file->isFile()) { - include_once $file; - } -} diff --git a/vendor/markbaker/complex/classes/src/Complex.php b/vendor/markbaker/complex/classes/src/Complex.php deleted file mode 100644 index 5671eb28..00000000 --- a/vendor/markbaker/complex/classes/src/Complex.php +++ /dev/null @@ -1,387 +0,0 @@ - 0.0 && empty($suffix)) { - $suffix = 'i'; - } - - // Set parsed values in our properties - $this->realPart = (float) $realPart; - $this->imaginaryPart = (float) $imaginaryPart; - $this->suffix = strtolower($suffix); - } - - /** - * Gets the real part of this complex number - * - * @return Float - */ - public function getReal() - { - return $this->realPart; - } - - /** - * Gets the imaginary part of this complex number - * - * @return Float - */ - public function getImaginary() - { - return $this->imaginaryPart; - } - - /** - * Gets the suffix of this complex number - * - * @return String - */ - public function getSuffix() - { - return $this->suffix; - } - - /** - * Returns true if this is a real value, false if a complex value - * - * @return Bool - */ - public function isReal() - { - return $this->imaginaryPart == 0.0; - } - - /** - * Returns true if this is a complex value, false if a real value - * - * @return Bool - */ - public function isComplex() - { - return !$this->isReal(); - } - - public function format() - { - $str = ""; - if ($this->imaginaryPart != 0.0) { - if (\abs($this->imaginaryPart) != 1.0) { - $str .= $this->imaginaryPart . $this->suffix; - } else { - $str .= (($this->imaginaryPart < 0.0) ? '-' : '') . $this->suffix; - } - } - if ($this->realPart != 0.0) { - if (($str) && ($this->imaginaryPart > 0.0)) { - $str = "+" . $str; - } - $str = $this->realPart . $str; - } - if (!$str) { - $str = "0.0"; - } - - return $str; - } - - public function __toString() - { - return $this->format(); - } - - /** - * Validates whether the argument is a valid complex number, converting scalar or array values if possible - * - * @param mixed $complex The value to validate - * @return Complex - * @throws Exception If the argument isn't a Complex number or cannot be converted to one - */ - public static function validateComplexArgument($complex) - { - if (is_scalar($complex) || is_array($complex)) { - $complex = new Complex($complex); - } elseif (!is_object($complex) || !($complex instanceof Complex)) { - throw new Exception('Value is not a valid complex number'); - } - - return $complex; - } - - /** - * Returns the reverse of this complex number - * - * @return Complex - */ - public function reverse() - { - return new Complex( - $this->imaginaryPart, - $this->realPart, - ($this->realPart == 0.0) ? null : $this->suffix - ); - } - - public function invertImaginary() - { - return new Complex( - $this->realPart, - $this->imaginaryPart * -1, - ($this->imaginaryPart == 0.0) ? null : $this->suffix - ); - } - - public function invertReal() - { - return new Complex( - $this->realPart * -1, - $this->imaginaryPart, - ($this->imaginaryPart == 0.0) ? null : $this->suffix - ); - } - - protected static $functions = [ - 'abs', - 'acos', - 'acosh', - 'acot', - 'acoth', - 'acsc', - 'acsch', - 'argument', - 'asec', - 'asech', - 'asin', - 'asinh', - 'atan', - 'atanh', - 'conjugate', - 'cos', - 'cosh', - 'cot', - 'coth', - 'csc', - 'csch', - 'exp', - 'inverse', - 'ln', - 'log2', - 'log10', - 'negative', - 'pow', - 'rho', - 'sec', - 'sech', - 'sin', - 'sinh', - 'sqrt', - 'tan', - 'tanh', - 'theta', - ]; - - protected static $operations = [ - 'add', - 'subtract', - 'multiply', - 'divideby', - 'divideinto', - ]; - - /** - * Returns the result of the function call or operation - * - * @return Complex|float - * @throws Exception|\InvalidArgumentException - */ - public function __call($functionName, $arguments) - { - $functionName = strtolower(str_replace('_', '', $functionName)); - - // Test for function calls - if (in_array($functionName, self::$functions)) { - $functionName = "\\" . __NAMESPACE__ . "\\{$functionName}"; - return $functionName($this, ...$arguments); - } - // Test for operation calls - if (in_array($functionName, self::$operations)) { - $functionName = "\\" . __NAMESPACE__ . "\\{$functionName}"; - return $functionName($this, ...$arguments); - } - throw new Exception('Function or Operation does not exist'); - } -} diff --git a/vendor/markbaker/complex/classes/src/Exception.php b/vendor/markbaker/complex/classes/src/Exception.php deleted file mode 100644 index a2beb732..00000000 --- a/vendor/markbaker/complex/classes/src/Exception.php +++ /dev/null @@ -1,13 +0,0 @@ -getReal() - $invsqrt->getImaginary(), - $complex->getImaginary() + $invsqrt->getReal() - ); - $log = ln($adjust); - - return new Complex( - $log->getImaginary(), - -1 * $log->getReal() - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/acosh.php b/vendor/markbaker/complex/classes/src/functions/acosh.php deleted file mode 100644 index 18a992e4..00000000 --- a/vendor/markbaker/complex/classes/src/functions/acosh.php +++ /dev/null @@ -1,34 +0,0 @@ -isReal() && ($complex->getReal() > 1)) { - return new Complex(\acosh($complex->getReal())); - } - - $acosh = acos($complex) - ->reverse(); - if ($acosh->getReal() < 0.0) { - $acosh = $acosh->invertReal(); - } - - return $acosh; -} diff --git a/vendor/markbaker/complex/classes/src/functions/acot.php b/vendor/markbaker/complex/classes/src/functions/acot.php deleted file mode 100644 index 11bee466..00000000 --- a/vendor/markbaker/complex/classes/src/functions/acot.php +++ /dev/null @@ -1,25 +0,0 @@ -getReal() == 0.0 && $complex->getImaginary() == 0.0) { - return INF; - } - - return asin(inverse($complex)); -} diff --git a/vendor/markbaker/complex/classes/src/functions/acsch.php b/vendor/markbaker/complex/classes/src/functions/acsch.php deleted file mode 100644 index bb45d347..00000000 --- a/vendor/markbaker/complex/classes/src/functions/acsch.php +++ /dev/null @@ -1,29 +0,0 @@ -getReal() == 0.0 && $complex->getImaginary() == 0.0) { - return INF; - } - - return asinh(inverse($complex)); -} diff --git a/vendor/markbaker/complex/classes/src/functions/argument.php b/vendor/markbaker/complex/classes/src/functions/argument.php deleted file mode 100644 index d7209cc4..00000000 --- a/vendor/markbaker/complex/classes/src/functions/argument.php +++ /dev/null @@ -1,28 +0,0 @@ -getReal() == 0.0 && $complex->getImaginary() == 0.0) { - return INF; - } - - return acos(inverse($complex)); -} diff --git a/vendor/markbaker/complex/classes/src/functions/asech.php b/vendor/markbaker/complex/classes/src/functions/asech.php deleted file mode 100644 index b36c40e2..00000000 --- a/vendor/markbaker/complex/classes/src/functions/asech.php +++ /dev/null @@ -1,29 +0,0 @@ -getReal() == 0.0 && $complex->getImaginary() == 0.0) { - return INF; - } - - return acosh(inverse($complex)); -} diff --git a/vendor/markbaker/complex/classes/src/functions/asin.php b/vendor/markbaker/complex/classes/src/functions/asin.php deleted file mode 100644 index 9c982aca..00000000 --- a/vendor/markbaker/complex/classes/src/functions/asin.php +++ /dev/null @@ -1,37 +0,0 @@ -getReal() - $complex->getImaginary(), - $invsqrt->getImaginary() + $complex->getReal() - ); - $log = ln($adjust); - - return new Complex( - $log->getImaginary(), - -1 * $log->getReal() - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/asinh.php b/vendor/markbaker/complex/classes/src/functions/asinh.php deleted file mode 100644 index c1243fd7..00000000 --- a/vendor/markbaker/complex/classes/src/functions/asinh.php +++ /dev/null @@ -1,33 +0,0 @@ -isReal() && ($complex->getReal() > 1)) { - return new Complex(\asinh($complex->getReal())); - } - - $asinh = clone $complex; - $asinh = $asinh->reverse() - ->invertReal(); - $asinh = asin($asinh); - return $asinh->reverse() - ->invertImaginary(); -} diff --git a/vendor/markbaker/complex/classes/src/functions/atan.php b/vendor/markbaker/complex/classes/src/functions/atan.php deleted file mode 100644 index 2c75dcf8..00000000 --- a/vendor/markbaker/complex/classes/src/functions/atan.php +++ /dev/null @@ -1,45 +0,0 @@ -isReal()) { - return new Complex(\atan($complex->getReal())); - } - - $t1Value = new Complex(-1 * $complex->getImaginary(), $complex->getReal()); - $uValue = new Complex(1, 0); - - $d1Value = clone $uValue; - $d1Value = subtract($d1Value, $t1Value); - $d2Value = add($t1Value, $uValue); - $uResult = $d1Value->divideBy($d2Value); - $uResult = ln($uResult); - - return new Complex( - (($uResult->getImaginary() == M_PI) ? -M_PI : $uResult->getImaginary()) * -0.5, - $uResult->getReal() * 0.5, - $complex->getSuffix() - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/atanh.php b/vendor/markbaker/complex/classes/src/functions/atanh.php deleted file mode 100644 index c53f2a9a..00000000 --- a/vendor/markbaker/complex/classes/src/functions/atanh.php +++ /dev/null @@ -1,38 +0,0 @@ -isReal()) { - $real = $complex->getReal(); - if ($real >= -1.0 && $real <= 1.0) { - return new Complex(\atanh($real)); - } else { - return new Complex(\atanh(1 / $real), (($real < 0.0) ? M_PI_2 : -1 * M_PI_2)); - } - } - - $iComplex = clone $complex; - $iComplex = $iComplex->invertImaginary() - ->reverse(); - return atan($iComplex) - ->invertReal() - ->reverse(); -} diff --git a/vendor/markbaker/complex/classes/src/functions/conjugate.php b/vendor/markbaker/complex/classes/src/functions/conjugate.php deleted file mode 100644 index bd1984b7..00000000 --- a/vendor/markbaker/complex/classes/src/functions/conjugate.php +++ /dev/null @@ -1,28 +0,0 @@ -getReal(), - -1 * $complex->getImaginary(), - $complex->getSuffix() - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/cos.php b/vendor/markbaker/complex/classes/src/functions/cos.php deleted file mode 100644 index 80a4683d..00000000 --- a/vendor/markbaker/complex/classes/src/functions/cos.php +++ /dev/null @@ -1,34 +0,0 @@ -isReal()) { - return new Complex(\cos($complex->getReal())); - } - - return conjugate( - new Complex( - \cos($complex->getReal()) * \cosh($complex->getImaginary()), - \sin($complex->getReal()) * \sinh($complex->getImaginary()), - $complex->getSuffix() - ) - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/cosh.php b/vendor/markbaker/complex/classes/src/functions/cosh.php deleted file mode 100644 index a4bea653..00000000 --- a/vendor/markbaker/complex/classes/src/functions/cosh.php +++ /dev/null @@ -1,32 +0,0 @@ -isReal()) { - return new Complex(\cosh($complex->getReal())); - } - - return new Complex( - \cosh($complex->getReal()) * \cos($complex->getImaginary()), - \sinh($complex->getReal()) * \sin($complex->getImaginary()), - $complex->getSuffix() - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/cot.php b/vendor/markbaker/complex/classes/src/functions/cot.php deleted file mode 100644 index 339101e1..00000000 --- a/vendor/markbaker/complex/classes/src/functions/cot.php +++ /dev/null @@ -1,29 +0,0 @@ -getReal() == 0.0 && $complex->getImaginary() == 0.0) { - return new Complex(INF); - } - - return inverse(tan($complex)); -} diff --git a/vendor/markbaker/complex/classes/src/functions/coth.php b/vendor/markbaker/complex/classes/src/functions/coth.php deleted file mode 100644 index 7fe705a4..00000000 --- a/vendor/markbaker/complex/classes/src/functions/coth.php +++ /dev/null @@ -1,24 +0,0 @@ -getReal() == 0.0 && $complex->getImaginary() == 0.0) { - return INF; - } - - return inverse(sin($complex)); -} diff --git a/vendor/markbaker/complex/classes/src/functions/csch.php b/vendor/markbaker/complex/classes/src/functions/csch.php deleted file mode 100644 index f4500981..00000000 --- a/vendor/markbaker/complex/classes/src/functions/csch.php +++ /dev/null @@ -1,29 +0,0 @@ -getReal() == 0.0 && $complex->getImaginary() == 0.0) { - return INF; - } - - return inverse(sinh($complex)); -} diff --git a/vendor/markbaker/complex/classes/src/functions/exp.php b/vendor/markbaker/complex/classes/src/functions/exp.php deleted file mode 100644 index 4cac6967..00000000 --- a/vendor/markbaker/complex/classes/src/functions/exp.php +++ /dev/null @@ -1,34 +0,0 @@ -getReal() == 0.0) && (\abs($complex->getImaginary()) == M_PI)) { - return new Complex(-1.0, 0.0); - } - - $rho = \exp($complex->getReal()); - - return new Complex( - $rho * \cos($complex->getImaginary()), - $rho * \sin($complex->getImaginary()), - $complex->getSuffix() - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/inverse.php b/vendor/markbaker/complex/classes/src/functions/inverse.php deleted file mode 100644 index 7d3182ad..00000000 --- a/vendor/markbaker/complex/classes/src/functions/inverse.php +++ /dev/null @@ -1,29 +0,0 @@ -getReal() == 0.0 && $complex->getImaginary() == 0.0) { - throw new \InvalidArgumentException('Division by zero'); - } - - return $complex->divideInto(1.0); -} diff --git a/vendor/markbaker/complex/classes/src/functions/ln.php b/vendor/markbaker/complex/classes/src/functions/ln.php deleted file mode 100644 index 39071cf6..00000000 --- a/vendor/markbaker/complex/classes/src/functions/ln.php +++ /dev/null @@ -1,33 +0,0 @@ -getReal() == 0.0) && ($complex->getImaginary() == 0.0)) { - throw new \InvalidArgumentException(); - } - - return new Complex( - \log(rho($complex)), - theta($complex), - $complex->getSuffix() - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/log10.php b/vendor/markbaker/complex/classes/src/functions/log10.php deleted file mode 100644 index 694d3d08..00000000 --- a/vendor/markbaker/complex/classes/src/functions/log10.php +++ /dev/null @@ -1,32 +0,0 @@ -getReal() == 0.0) && ($complex->getImaginary() == 0.0)) { - throw new \InvalidArgumentException(); - } elseif (($complex->getReal() > 0.0) && ($complex->getImaginary() == 0.0)) { - return new Complex(\log10($complex->getReal()), 0.0, $complex->getSuffix()); - } - - return ln($complex) - ->multiply(\log10(Complex::EULER)); -} diff --git a/vendor/markbaker/complex/classes/src/functions/log2.php b/vendor/markbaker/complex/classes/src/functions/log2.php deleted file mode 100644 index 081f2c49..00000000 --- a/vendor/markbaker/complex/classes/src/functions/log2.php +++ /dev/null @@ -1,32 +0,0 @@ -getReal() == 0.0) && ($complex->getImaginary() == 0.0)) { - throw new \InvalidArgumentException(); - } elseif (($complex->getReal() > 0.0) && ($complex->getImaginary() == 0.0)) { - return new Complex(\log($complex->getReal(), 2), 0.0, $complex->getSuffix()); - } - - return ln($complex) - ->multiply(\log(Complex::EULER, 2)); -} diff --git a/vendor/markbaker/complex/classes/src/functions/negative.php b/vendor/markbaker/complex/classes/src/functions/negative.php deleted file mode 100644 index dbd11922..00000000 --- a/vendor/markbaker/complex/classes/src/functions/negative.php +++ /dev/null @@ -1,31 +0,0 @@ -getReal(), - -1 * $complex->getImaginary(), - $complex->getSuffix() - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/pow.php b/vendor/markbaker/complex/classes/src/functions/pow.php deleted file mode 100644 index 18ee2690..00000000 --- a/vendor/markbaker/complex/classes/src/functions/pow.php +++ /dev/null @@ -1,40 +0,0 @@ -getImaginary() == 0.0 && $complex->getReal() >= 0.0) { - return new Complex(\pow($complex->getReal(), $power)); - } - - $rValue = \sqrt(($complex->getReal() * $complex->getReal()) + ($complex->getImaginary() * $complex->getImaginary())); - $rPower = \pow($rValue, $power); - $theta = $complex->argument() * $power; - if ($theta == 0) { - return new Complex(1); - } - - return new Complex($rPower * \cos($theta), $rPower * \sin($theta), $complex->getSuffix()); -} diff --git a/vendor/markbaker/complex/classes/src/functions/rho.php b/vendor/markbaker/complex/classes/src/functions/rho.php deleted file mode 100644 index 750f3f99..00000000 --- a/vendor/markbaker/complex/classes/src/functions/rho.php +++ /dev/null @@ -1,28 +0,0 @@ -getReal() * $complex->getReal()) + - ($complex->getImaginary() * $complex->getImaginary()) - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/sec.php b/vendor/markbaker/complex/classes/src/functions/sec.php deleted file mode 100644 index 7dd43eaf..00000000 --- a/vendor/markbaker/complex/classes/src/functions/sec.php +++ /dev/null @@ -1,25 +0,0 @@ -isReal()) { - return new Complex(\sin($complex->getReal())); - } - - return new Complex( - \sin($complex->getReal()) * \cosh($complex->getImaginary()), - \cos($complex->getReal()) * \sinh($complex->getImaginary()), - $complex->getSuffix() - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/sinh.php b/vendor/markbaker/complex/classes/src/functions/sinh.php deleted file mode 100644 index 4c0f6503..00000000 --- a/vendor/markbaker/complex/classes/src/functions/sinh.php +++ /dev/null @@ -1,32 +0,0 @@ -isReal()) { - return new Complex(\sinh($complex->getReal())); - } - - return new Complex( - \sinh($complex->getReal()) * \cos($complex->getImaginary()), - \cosh($complex->getReal()) * \sin($complex->getImaginary()), - $complex->getSuffix() - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/sqrt.php b/vendor/markbaker/complex/classes/src/functions/sqrt.php deleted file mode 100644 index 9c171b88..00000000 --- a/vendor/markbaker/complex/classes/src/functions/sqrt.php +++ /dev/null @@ -1,29 +0,0 @@ -getSuffix()); -} diff --git a/vendor/markbaker/complex/classes/src/functions/tan.php b/vendor/markbaker/complex/classes/src/functions/tan.php deleted file mode 100644 index 014d7981..00000000 --- a/vendor/markbaker/complex/classes/src/functions/tan.php +++ /dev/null @@ -1,40 +0,0 @@ -isReal()) { - return new Complex(\tan($complex->getReal())); - } - - $real = $complex->getReal(); - $imaginary = $complex->getImaginary(); - $divisor = 1 + \pow(\tan($real), 2) * \pow(\tanh($imaginary), 2); - if ($divisor == 0.0) { - throw new \InvalidArgumentException('Division by zero'); - } - - return new Complex( - \pow(sech($imaginary)->getReal(), 2) * \tan($real) / $divisor, - \pow(sec($real)->getReal(), 2) * \tanh($imaginary) / $divisor, - $complex->getSuffix() - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/tanh.php b/vendor/markbaker/complex/classes/src/functions/tanh.php deleted file mode 100644 index 028741d6..00000000 --- a/vendor/markbaker/complex/classes/src/functions/tanh.php +++ /dev/null @@ -1,35 +0,0 @@ -getReal(); - $imaginary = $complex->getImaginary(); - $divisor = \cos($imaginary) * \cos($imaginary) + \sinh($real) * \sinh($real); - if ($divisor == 0.0) { - throw new \InvalidArgumentException('Division by zero'); - } - - return new Complex( - \sinh($real) * \cosh($real) / $divisor, - 0.5 * \sin(2 * $imaginary) / $divisor, - $complex->getSuffix() - ); -} diff --git a/vendor/markbaker/complex/classes/src/functions/theta.php b/vendor/markbaker/complex/classes/src/functions/theta.php deleted file mode 100644 index d12866cd..00000000 --- a/vendor/markbaker/complex/classes/src/functions/theta.php +++ /dev/null @@ -1,38 +0,0 @@ -getReal() == 0.0) { - if ($complex->isReal()) { - return 0.0; - } elseif ($complex->getImaginary() < 0.0) { - return M_PI / -2; - } - return M_PI / 2; - } elseif ($complex->getReal() > 0.0) { - return \atan($complex->getImaginary() / $complex->getReal()); - } elseif ($complex->getImaginary() < 0.0) { - return -(M_PI - \atan(\abs($complex->getImaginary()) / \abs($complex->getReal()))); - } - - return M_PI - \atan($complex->getImaginary() / \abs($complex->getReal())); -} diff --git a/vendor/markbaker/complex/classes/src/operations/add.php b/vendor/markbaker/complex/classes/src/operations/add.php deleted file mode 100644 index 10bd42f4..00000000 --- a/vendor/markbaker/complex/classes/src/operations/add.php +++ /dev/null @@ -1,46 +0,0 @@ -isComplex() && $complex->isComplex() && - $result->getSuffix() !== $complex->getSuffix()) { - throw new Exception('Suffix Mismatch'); - } - - $real = $result->getReal() + $complex->getReal(); - $imaginary = $result->getImaginary() + $complex->getImaginary(); - - $result = new Complex( - $real, - $imaginary, - ($imaginary == 0.0) ? null : max($result->getSuffix(), $complex->getSuffix()) - ); - } - - return $result; -} diff --git a/vendor/markbaker/complex/classes/src/operations/divideby.php b/vendor/markbaker/complex/classes/src/operations/divideby.php deleted file mode 100644 index 089e0ef9..00000000 --- a/vendor/markbaker/complex/classes/src/operations/divideby.php +++ /dev/null @@ -1,56 +0,0 @@ -isComplex() && $complex->isComplex() && - $result->getSuffix() !== $complex->getSuffix()) { - throw new Exception('Suffix Mismatch'); - } - if ($complex->getReal() == 0.0 && $complex->getImaginary() == 0.0) { - throw new \InvalidArgumentException('Division by zero'); - } - - $delta1 = ($result->getReal() * $complex->getReal()) + - ($result->getImaginary() * $complex->getImaginary()); - $delta2 = ($result->getImaginary() * $complex->getReal()) - - ($result->getReal() * $complex->getImaginary()); - $delta3 = ($complex->getReal() * $complex->getReal()) + - ($complex->getImaginary() * $complex->getImaginary()); - - $real = $delta1 / $delta3; - $imaginary = $delta2 / $delta3; - - $result = new Complex( - $real, - $imaginary, - ($imaginary == 0.0) ? null : max($result->getSuffix(), $complex->getSuffix()) - ); - } - - return $result; -} diff --git a/vendor/markbaker/complex/classes/src/operations/divideinto.php b/vendor/markbaker/complex/classes/src/operations/divideinto.php deleted file mode 100644 index 3dfe085e..00000000 --- a/vendor/markbaker/complex/classes/src/operations/divideinto.php +++ /dev/null @@ -1,56 +0,0 @@ -isComplex() && $complex->isComplex() && - $result->getSuffix() !== $complex->getSuffix()) { - throw new Exception('Suffix Mismatch'); - } - if ($result->getReal() == 0.0 && $result->getImaginary() == 0.0) { - throw new \InvalidArgumentException('Division by zero'); - } - - $delta1 = ($complex->getReal() * $result->getReal()) + - ($complex->getImaginary() * $result->getImaginary()); - $delta2 = ($complex->getImaginary() * $result->getReal()) - - ($complex->getReal() * $result->getImaginary()); - $delta3 = ($result->getReal() * $result->getReal()) + - ($result->getImaginary() * $result->getImaginary()); - - $real = $delta1 / $delta3; - $imaginary = $delta2 / $delta3; - - $result = new Complex( - $real, - $imaginary, - ($imaginary == 0.0) ? null : max($result->getSuffix(), $complex->getSuffix()) - ); - } - - return $result; -} diff --git a/vendor/markbaker/complex/classes/src/operations/multiply.php b/vendor/markbaker/complex/classes/src/operations/multiply.php deleted file mode 100644 index bf2473ea..00000000 --- a/vendor/markbaker/complex/classes/src/operations/multiply.php +++ /dev/null @@ -1,48 +0,0 @@ -isComplex() && $complex->isComplex() && - $result->getSuffix() !== $complex->getSuffix()) { - throw new Exception('Suffix Mismatch'); - } - - $real = ($result->getReal() * $complex->getReal()) - - ($result->getImaginary() * $complex->getImaginary()); - $imaginary = ($result->getReal() * $complex->getImaginary()) + - ($result->getImaginary() * $complex->getReal()); - - $result = new Complex( - $real, - $imaginary, - ($imaginary == 0.0) ? null : max($result->getSuffix(), $complex->getSuffix()) - ); - } - - return $result; -} diff --git a/vendor/markbaker/complex/classes/src/operations/subtract.php b/vendor/markbaker/complex/classes/src/operations/subtract.php deleted file mode 100644 index 075ef443..00000000 --- a/vendor/markbaker/complex/classes/src/operations/subtract.php +++ /dev/null @@ -1,46 +0,0 @@ -isComplex() && $complex->isComplex() && - $result->getSuffix() !== $complex->getSuffix()) { - throw new Exception('Suffix Mismatch'); - } - - $real = $result->getReal() - $complex->getReal(); - $imaginary = $result->getImaginary() - $complex->getImaginary(); - - $result = new Complex( - $real, - $imaginary, - ($imaginary == 0.0) ? null : max($result->getSuffix(), $complex->getSuffix()) - ); - } - - return $result; -} diff --git a/vendor/markbaker/complex/composer.json b/vendor/markbaker/complex/composer.json deleted file mode 100644 index 91e9e231..00000000 --- a/vendor/markbaker/complex/composer.json +++ /dev/null @@ -1,91 +0,0 @@ -{ - "name": "markbaker/complex", - "type": "library", - "description": "PHP Class for working with complex numbers", - "keywords": ["complex", "mathematics"], - "homepage": "https://github.com/MarkBaker/PHPComplex", - "license": "MIT", - "authors": [ - { - "name": "Mark Baker", - "email": "mark@lange.demon.co.uk" - } - ], - "require": { - "php": "^5.6.0|^7.0.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35|^5.4.0", - "phpdocumentor/phpdocumentor":"2.*", - "phpmd/phpmd": "2.*", - "sebastian/phpcpd": "2.*", - "phploc/phploc": "2.*", - "squizlabs/php_codesniffer": "^3.3.0", - "phpcompatibility/php-compatibility": "^8.0", - "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3" - }, - "autoload": { - "psr-4": { - "Complex\\": "classes/src/" - }, - "files": [ - "classes/src/functions/abs.php", - "classes/src/functions/acos.php", - "classes/src/functions/acosh.php", - "classes/src/functions/acot.php", - "classes/src/functions/acoth.php", - "classes/src/functions/acsc.php", - "classes/src/functions/acsch.php", - "classes/src/functions/argument.php", - "classes/src/functions/asec.php", - "classes/src/functions/asech.php", - "classes/src/functions/asin.php", - "classes/src/functions/asinh.php", - "classes/src/functions/atan.php", - "classes/src/functions/atanh.php", - "classes/src/functions/conjugate.php", - "classes/src/functions/cos.php", - "classes/src/functions/cosh.php", - "classes/src/functions/cot.php", - "classes/src/functions/coth.php", - "classes/src/functions/csc.php", - "classes/src/functions/csch.php", - "classes/src/functions/exp.php", - "classes/src/functions/inverse.php", - "classes/src/functions/ln.php", - "classes/src/functions/log2.php", - "classes/src/functions/log10.php", - "classes/src/functions/negative.php", - "classes/src/functions/pow.php", - "classes/src/functions/rho.php", - "classes/src/functions/sec.php", - "classes/src/functions/sech.php", - "classes/src/functions/sin.php", - "classes/src/functions/sinh.php", - "classes/src/functions/sqrt.php", - "classes/src/functions/tan.php", - "classes/src/functions/tanh.php", - "classes/src/functions/theta.php", - "classes/src/operations/add.php", - "classes/src/operations/subtract.php", - "classes/src/operations/multiply.php", - "classes/src/operations/divideby.php", - "classes/src/operations/divideinto.php" - ] - }, - "scripts": { - "style": [ - "phpcs --report-width=200 --report-summary --report-full classes/src/ --standard=PSR2 -n" - ], - "mess": [ - "phpmd classes/src/ xml codesize,unusedcode,design,naming -n" - ], - "lines": [ - "phploc classes/src/ -n" - ], - "cpd": [ - "phpcpd classes/src/ -n" - ] - }, - "minimum-stability": "dev" -} \ No newline at end of file diff --git a/vendor/markbaker/complex/examples/complexTest.php b/vendor/markbaker/complex/examples/complexTest.php deleted file mode 100644 index 7dafd8a6..00000000 --- a/vendor/markbaker/complex/examples/complexTest.php +++ /dev/null @@ -1,154 +0,0 @@ -add(456); -echo $x, PHP_EOL; - -$x = new Complex(123.456); -$x->add(789.012); -echo $x, PHP_EOL; - -$x = new Complex(123.456, 78.90); -$x->add(new Complex(-987.654, -32.1)); -echo $x, PHP_EOL; - -$x = new Complex(123.456, 78.90); -$x->add(-987.654); -echo $x, PHP_EOL; - -$x = new Complex(-987.654, -32.1); -$x->add(new Complex(0, 1)); -echo $x, PHP_EOL; - -$x = new Complex(-987.654, -32.1); -$x->add(new Complex(0, -1)); -echo $x, PHP_EOL; - - -echo PHP_EOL, 'Subtract', PHP_EOL; - -$x = new Complex(123); -$x->subtract(456); -echo $x, PHP_EOL; - -$x = new Complex(123.456); -$x->subtract(789.012); -echo $x, PHP_EOL; - -$x = new Complex(123.456, 78.90); -$x->subtract(new Complex(-987.654, -32.1)); -echo $x, PHP_EOL; - -$x = new Complex(123.456, 78.90); -$x->subtract(-987.654); -echo $x, PHP_EOL; - -$x = new Complex(-987.654, -32.1); -$x->subtract(new Complex(0, 1)); -echo $x, PHP_EOL; - -$x = new Complex(-987.654, -32.1); -$x->subtract(new Complex(0, -1)); -echo $x, PHP_EOL; - - -echo PHP_EOL, 'Multiply', PHP_EOL; - -$x = new Complex(123); -$x->multiply(456); -echo $x, PHP_EOL; - -$x = new Complex(123.456); -$x->multiply(789.012); -echo $x, PHP_EOL; - -$x = new Complex(123.456, 78.90); -$x->multiply(new Complex(-987.654, -32.1)); -echo $x, PHP_EOL; - -$x = new Complex(123.456, 78.90); -$x->multiply(-987.654); -echo $x, PHP_EOL; - -$x = new Complex(-987.654, -32.1); -$x->multiply(new Complex(0, 1)); -echo $x, PHP_EOL; - -$x = new Complex(-987.654, -32.1); -$x->multiply(new Complex(0, -1)); -echo $x, PHP_EOL; - - -echo PHP_EOL, 'Divide By', PHP_EOL; - -$x = new Complex(123); -$x->divideBy(456); -echo $x, PHP_EOL; - -$x = new Complex(123.456); -$x->divideBy(789.012); -echo $x, PHP_EOL; - -$x = new Complex(123.456, 78.90); -$x->divideBy(new Complex(-987.654, -32.1)); -echo $x, PHP_EOL; - -$x = new Complex(123.456, 78.90); -$x->divideBy(-987.654); -echo $x, PHP_EOL; - -$x = new Complex(-987.654, -32.1); -$x->divideBy(new Complex(0, 1)); -echo $x, PHP_EOL; - -$x = new Complex(-987.654, -32.1); -$x->divideBy(new Complex(0, -1)); -echo $x, PHP_EOL; - - -echo PHP_EOL, 'Divide Into', PHP_EOL; - -$x = new Complex(123); -$x->divideInto(456); -echo $x, PHP_EOL; - -$x = new Complex(123.456); -$x->divideInto(789.012); -echo $x, PHP_EOL; - -$x = new Complex(123.456, 78.90); -$x->divideInto(new Complex(-987.654, -32.1)); -echo $x, PHP_EOL; - -$x = new Complex(123.456, 78.90); -$x->divideInto(-987.654); -echo $x, PHP_EOL; - -$x = new Complex(-987.654, -32.1); -$x->divideInto(new Complex(0, 1)); -echo $x, PHP_EOL; - -$x = new Complex(-987.654, -32.1); -$x->divideInto(new Complex(0, -1)); -echo $x, PHP_EOL; diff --git a/vendor/markbaker/complex/examples/testFunctions.php b/vendor/markbaker/complex/examples/testFunctions.php deleted file mode 100644 index 4d5ed735..00000000 --- a/vendor/markbaker/complex/examples/testFunctions.php +++ /dev/null @@ -1,52 +0,0 @@ -getMessage(), PHP_EOL; - } - } - echo PHP_EOL; - } -} diff --git a/vendor/markbaker/complex/examples/testOperations.php b/vendor/markbaker/complex/examples/testOperations.php deleted file mode 100644 index f791263e..00000000 --- a/vendor/markbaker/complex/examples/testOperations.php +++ /dev/null @@ -1,34 +0,0 @@ - ', $result, PHP_EOL; - -echo PHP_EOL; - -echo 'Subtraction', PHP_EOL; - -$result = \Complex\subtract(...$values); -echo '=> ', $result, PHP_EOL; - -echo PHP_EOL; - -echo 'Multiplication', PHP_EOL; - -$result = \Complex\multiply(...$values); -echo '=> ', $result, PHP_EOL; diff --git a/vendor/markbaker/complex/license.md b/vendor/markbaker/complex/license.md deleted file mode 100644 index 5b4b1561..00000000 --- a/vendor/markbaker/complex/license.md +++ /dev/null @@ -1,25 +0,0 @@ -The MIT License (MIT) -===================== - -Copyright © `2017` `Mark Baker` - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the “Software”), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/vendor/myclabs/php-enum/.gitattributes b/vendor/myclabs/php-enum/.gitattributes deleted file mode 100644 index 50b8b8a9..00000000 --- a/vendor/myclabs/php-enum/.gitattributes +++ /dev/null @@ -1,6 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto - -tests/ export-ignore -phpunit.xml export-ignore -.travis.yml export-ignore diff --git a/vendor/myclabs/php-enum/.gitignore b/vendor/myclabs/php-enum/.gitignore deleted file mode 100644 index ad5190c9..00000000 --- a/vendor/myclabs/php-enum/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -.DS_Store -nbproject/* -.idea/* -vendor/* -composer.phar -composer.lock diff --git a/vendor/myclabs/php-enum/LICENSE b/vendor/myclabs/php-enum/LICENSE deleted file mode 100644 index accd5a0f..00000000 --- a/vendor/myclabs/php-enum/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -php-enum - PHP Enum implementation http://github.com/myclabs/php-enum - -Copyright (C) 2015 My C-Labs - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and -associated documentation files (the "Software"), to deal in the Software without restriction, -including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial -portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT -NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/myclabs/php-enum/README.md b/vendor/myclabs/php-enum/README.md deleted file mode 100644 index 6a08e0ad..00000000 --- a/vendor/myclabs/php-enum/README.md +++ /dev/null @@ -1,128 +0,0 @@ -# PHP Enum implementation inspired from SplEnum - -[![Build Status](https://travis-ci.org/myclabs/php-enum.png?branch=master)](https://travis-ci.org/myclabs/php-enum) -[![Latest Stable Version](https://poser.pugx.org/myclabs/php-enum/version.png)](https://packagist.org/packages/myclabs/php-enum) -[![Total Downloads](https://poser.pugx.org/myclabs/php-enum/downloads.png)](https://packagist.org/packages/myclabs/php-enum) - -## Why? - -First, and mainly, `SplEnum` is not integrated to PHP, you have to install it separately. - -Using an enum instead of class constants provides the following advantages: - -- You can type-hint: `function setAction(Action $action) {` -- You can enrich the enum with methods (e.g. `format`, `parse`, …) -- You can extend the enum to add new values (make your enum `final` to prevent it) -- You can get a list of all the possible values (see below) - -This Enum class is not intended to replace class constants, but only to be used when it makes sense. - -## Installation - -``` -composer require myclabs/php-enum -``` - -## Declaration - -```php -use MyCLabs\Enum\Enum; - -/** - * Action enum - */ -class Action extends Enum -{ - private const VIEW = 'view'; - private const EDIT = 'edit'; -} -``` - -Note the `private` keyword requires PHP > 7.1, you can omit it on PHP 7.0. - -## Usage - -```php -$action = new Action(Action::VIEW); - -// or -$action = Action::VIEW(); -``` - -As you can see, static methods are automatically implemented to provide quick access to an enum value. - -One advantage over using class constants is to be able to type-hint enum values: - -```php -function setAction(Action $action) { - // ... -} -``` - -## Documentation - -- `__construct()` The constructor checks that the value exist in the enum -- `__toString()` You can `echo $myValue`, it will display the enum value (value of the constant) -- `getValue()` Returns the current value of the enum -- `getKey()` Returns the key of the current value on Enum -- `equals()` Tests whether enum instances are equal (returns `true` if enum values are equal, `false` otherwise) - -Static methods: - -- `toArray()` method Returns all possible values as an array (constant name in key, constant value in value) -- `keys()` Returns the names (keys) of all constants in the Enum class -- `values()` Returns instances of the Enum class of all Enum constants (constant name in key, Enum instance in value) -- `isValid()` Check if tested value is valid on enum set -- `isValidKey()` Check if tested key is valid on enum set -- `search()` Return key for searched value - -### Static methods - -```php -class Action extends Enum -{ - private const VIEW = 'view'; - private const EDIT = 'edit'; -} - -// Static method: -$action = Action::VIEW(); -$action = Action::EDIT(); -``` - -Static method helpers are implemented using [`__callStatic()`](http://www.php.net/manual/en/language.oop5.overloading.php#object.callstatic). - -If you care about IDE autocompletion, you can either implement the static methods yourself: - -```php -class Action extends Enum -{ - private const VIEW = 'view'; - - /** - * @return Action - */ - public static function VIEW() { - return new Action(self::VIEW); - } -} -``` - -or you can use phpdoc (this is supported in PhpStorm for example): - -```php -/** - * @method static Action VIEW() - * @method static Action EDIT() - */ -class Action extends Enum -{ - private const VIEW = 'view'; - private const EDIT = 'edit'; -} -``` - -## Related projects - -- [Doctrine enum mapping](https://github.com/acelaya/doctrine-enum-type) -- [Symfony 2/3 ParamConverter integration](https://github.com/Ex3v/MyCLabsEnumParamConverter) diff --git a/vendor/myclabs/php-enum/composer.json b/vendor/myclabs/php-enum/composer.json deleted file mode 100644 index 1395658c..00000000 --- a/vendor/myclabs/php-enum/composer.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "myclabs/php-enum", - "type": "library", - "description": "PHP Enum implementation", - "keywords": ["enum"], - "homepage": "http://github.com/myclabs/php-enum", - "license": "MIT", - "authors": [ - { - "name": "PHP Enum contributors", - "homepage": "https://github.com/myclabs/php-enum/graphs/contributors" - } - ], - "autoload": { - "psr-4": { - "MyCLabs\\Enum\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "MyCLabs\\Tests\\Enum\\": "tests/" - } - }, - "require": { - "php": ">=5.4" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35|^5.7|^6.0", - "squizlabs/php_codesniffer": "1.*" - } -} diff --git a/vendor/myclabs/php-enum/src/Enum.php b/vendor/myclabs/php-enum/src/Enum.php deleted file mode 100644 index d1bc5169..00000000 --- a/vendor/myclabs/php-enum/src/Enum.php +++ /dev/null @@ -1,198 +0,0 @@ - - * @author Daniel Costa - * @author Mirosław Filip - */ -abstract class Enum implements \JsonSerializable -{ - /** - * Enum value - * - * @var mixed - */ - protected $value; - - /** - * Store existing constants in a static cache per object. - * - * @var array - */ - protected static $cache = []; - - /** - * Creates a new value of some type - * - * @param mixed $value - * - * @throws \UnexpectedValueException if incompatible type is given. - */ - public function __construct($value) - { - if (!$this->isValid($value)) { - throw new \UnexpectedValueException("Value '$value' is not part of the enum " . \get_called_class()); - } - - $this->value = $value; - } - - /** - * @return mixed - */ - public function getValue() - { - return $this->value; - } - - /** - * Returns the enum key (i.e. the constant name). - * - * @return mixed - */ - public function getKey() - { - return static::search($this->value); - } - - /** - * @return string - */ - public function __toString() - { - return (string)$this->value; - } - - /** - * Compares one Enum with another. - * - * This method is final, for more information read https://github.com/myclabs/php-enum/issues/4 - * - * @return bool True if Enums are equal, false if not equal - */ - final public function equals(Enum $enum = null) - { - return $enum !== null && $this->getValue() === $enum->getValue() && \get_called_class() === \get_class($enum); - } - - /** - * Returns the names (keys) of all constants in the Enum class - * - * @return array - */ - public static function keys() - { - return \array_keys(static::toArray()); - } - - /** - * Returns instances of the Enum class of all Enum constants - * - * @return static[] Constant name in key, Enum instance in value - */ - public static function values() - { - $values = array(); - - foreach (static::toArray() as $key => $value) { - $values[$key] = new static($value); - } - - return $values; - } - - /** - * Returns all possible values as an array - * - * @return array Constant name in key, constant value in value - */ - public static function toArray() - { - $class = \get_called_class(); - if (!isset(static::$cache[$class])) { - $reflection = new \ReflectionClass($class); - static::$cache[$class] = $reflection->getConstants(); - } - - return static::$cache[$class]; - } - - /** - * Check if is valid enum value - * - * @param $value - * - * @return bool - */ - public static function isValid($value) - { - return \in_array($value, static::toArray(), true); - } - - /** - * Check if is valid enum key - * - * @param $key - * - * @return bool - */ - public static function isValidKey($key) - { - $array = static::toArray(); - - return isset($array[$key]) || \array_key_exists($key, $array); - } - - /** - * Return key for value - * - * @param $value - * - * @return mixed - */ - public static function search($value) - { - return \array_search($value, static::toArray(), true); - } - - /** - * Returns a value when called statically like so: MyEnum::SOME_VALUE() given SOME_VALUE is a class constant - * - * @param string $name - * @param array $arguments - * - * @return static - * @throws \BadMethodCallException - */ - public static function __callStatic($name, $arguments) - { - $array = static::toArray(); - if (isset($array[$name]) || \array_key_exists($name, $array)) { - return new static($array[$name]); - } - - throw new \BadMethodCallException("No static method or enum constant '$name' in class " . \get_called_class()); - } - - /** - * Specify data which should be serialized to JSON. This method returns data that can be serialized by json_encode() - * natively. - * - * @return mixed - * @link http://php.net/manual/en/jsonserializable.jsonserialize.php - */ - public function jsonSerialize() - { - return $this->getValue(); - } -} diff --git a/vendor/pclzip/pclzip/composer.json b/vendor/pclzip/pclzip/composer.json deleted file mode 100644 index a4df7fb6..00000000 --- a/vendor/pclzip/pclzip/composer.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "pclzip/pclzip", - "type": "library", - "description": "A PHP library that offers compression and extraction functions for Zip formatted archives", - "keywords": ["php", "zip"], - "homepage": "http://www.phpconcept.net/pclzip", - "license": ["LGPL-2.1"], - "authors": [ - { - "name": "Vincent Blavet" - } - ], - "autoload": { - "classmap": ["pclzip.lib.php"] - } -} diff --git a/vendor/pclzip/pclzip/gnu-lgpl.txt b/vendor/pclzip/pclzip/gnu-lgpl.txt deleted file mode 100644 index 583509c7..00000000 --- a/vendor/pclzip/pclzip/gnu-lgpl.txt +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/vendor/pclzip/pclzip/pclzip.lib.php b/vendor/pclzip/pclzip/pclzip.lib.php deleted file mode 100644 index 33be0d78..00000000 --- a/vendor/pclzip/pclzip/pclzip.lib.php +++ /dev/null @@ -1,5414 +0,0 @@ -zipname = $p_zipname; - $this->zip_fd = 0; - $this->magic_quotes_status = -1; - - // ----- Return - return; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : - // create($p_filelist, $p_add_dir="", $p_remove_dir="") - // create($p_filelist, $p_option, $p_option_value, ...) - // Description : - // This method supports two different synopsis. The first one is historical. - // This method creates a Zip Archive. The Zip file is created in the - // filesystem. The files and directories indicated in $p_filelist - // are added in the archive. See the parameters description for the - // supported format of $p_filelist. - // When a directory is in the list, the directory and its content is added - // in the archive. - // In this synopsis, the function takes an optional variable list of - // options. See bellow the supported options. - // Parameters : - // $p_filelist : An array containing file or directory names, or - // a string containing one filename or one directory name, or - // a string containing a list of filenames and/or directory - // names separated by spaces. - // $p_add_dir : A path to add before the real path of the archived file, - // in order to have it memorized in the archive. - // $p_remove_dir : A path to remove from the real path of the file to archive, - // in order to have a shorter path memorized in the archive. - // When $p_add_dir and $p_remove_dir are set, $p_remove_dir - // is removed first, before $p_add_dir is added. - // Options : - // PCLZIP_OPT_ADD_PATH : - // PCLZIP_OPT_REMOVE_PATH : - // PCLZIP_OPT_REMOVE_ALL_PATH : - // PCLZIP_OPT_COMMENT : - // PCLZIP_CB_PRE_ADD : - // PCLZIP_CB_POST_ADD : - // Return Values : - // 0 on failure, - // The list of the added files, with a status of the add action. - // (see PclZip::listContent() for list entry format) - // -------------------------------------------------------------------------------- - public function create($p_filelist) - { - $v_result = 1; - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Set default values - $v_options = array(); - $v_options[PCLZIP_OPT_NO_COMPRESSION] = false; - - // ----- Look for variable options arguments - $v_size = func_num_args(); - - // ----- Look for arguments - if ($v_size > 1) { - // ----- Get the arguments - $v_arg_list = func_get_args(); - - // ----- Remove from the options list the first argument - array_shift($v_arg_list); - $v_size--; - - // ----- Look for first arg - if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { - - // ----- Parse the options - $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array( - PCLZIP_OPT_REMOVE_PATH => 'optional', - PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', - PCLZIP_OPT_ADD_PATH => 'optional', - PCLZIP_CB_PRE_ADD => 'optional', - PCLZIP_CB_POST_ADD => 'optional', - PCLZIP_OPT_NO_COMPRESSION => 'optional', - PCLZIP_OPT_COMMENT => 'optional', - PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', - PCLZIP_OPT_TEMP_FILE_ON => 'optional', - PCLZIP_OPT_TEMP_FILE_OFF => 'optional' - //, PCLZIP_OPT_CRYPT => 'optional' - )); - if ($v_result != 1) { - return 0; - } - - // ----- Look for 2 args - // Here we need to support the first historic synopsis of the - // method. - } else { - - // ----- Get the first argument - $v_options[PCLZIP_OPT_ADD_PATH] = $v_arg_list[0]; - - // ----- Look for the optional second argument - if ($v_size == 2) { - $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1]; - } elseif ($v_size > 2) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); - - return 0; - } - } - } - - // ----- Look for default option values - $this->privOptionDefaultThreshold($v_options); - - // ----- Init - $v_string_list = array(); - $v_att_list = array(); - $v_filedescr_list = array(); - $p_result_list = array(); - - // ----- Look if the $p_filelist is really an array - if (is_array($p_filelist)) { - - // ----- Look if the first element is also an array - // This will mean that this is a file description entry - if (isset($p_filelist[0]) && is_array($p_filelist[0])) { - $v_att_list = $p_filelist; - - // ----- The list is a list of string names - } else { - $v_string_list = $p_filelist; - } - - // ----- Look if the $p_filelist is a string - } elseif (is_string($p_filelist)) { - // ----- Create a list from the string - $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist); - - // ----- Invalid variable type for $p_filelist - } else { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_filelist"); - - return 0; - } - - // ----- Reformat the string list - if (sizeof($v_string_list) != 0) { - foreach ($v_string_list as $v_string) { - if ($v_string != '') { - $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string; - } else { - } - } - } - - // ----- For each file in the list check the attributes - $v_supported_attributes = array( - PCLZIP_ATT_FILE_NAME => 'mandatory', - PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional', - PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional', - PCLZIP_ATT_FILE_MTIME => 'optional', - PCLZIP_ATT_FILE_CONTENT => 'optional', - PCLZIP_ATT_FILE_COMMENT => 'optional' - ); - foreach ($v_att_list as $v_entry) { - $v_result = $this->privFileDescrParseAtt($v_entry, $v_filedescr_list[], $v_options, $v_supported_attributes); - if ($v_result != 1) { - return 0; - } - } - - // ----- Expand the filelist (expand directories) - $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options); - if ($v_result != 1) { - return 0; - } - - // ----- Call the create fct - $v_result = $this->privCreate($v_filedescr_list, $p_result_list, $v_options); - if ($v_result != 1) { - return 0; - } - - // ----- Return - return $p_result_list; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : - // add($p_filelist, $p_add_dir="", $p_remove_dir="") - // add($p_filelist, $p_option, $p_option_value, ...) - // Description : - // This method supports two synopsis. The first one is historical. - // This methods add the list of files in an existing archive. - // If a file with the same name already exists, it is added at the end of the - // archive, the first one is still present. - // If the archive does not exist, it is created. - // Parameters : - // $p_filelist : An array containing file or directory names, or - // a string containing one filename or one directory name, or - // a string containing a list of filenames and/or directory - // names separated by spaces. - // $p_add_dir : A path to add before the real path of the archived file, - // in order to have it memorized in the archive. - // $p_remove_dir : A path to remove from the real path of the file to archive, - // in order to have a shorter path memorized in the archive. - // When $p_add_dir and $p_remove_dir are set, $p_remove_dir - // is removed first, before $p_add_dir is added. - // Options : - // PCLZIP_OPT_ADD_PATH : - // PCLZIP_OPT_REMOVE_PATH : - // PCLZIP_OPT_REMOVE_ALL_PATH : - // PCLZIP_OPT_COMMENT : - // PCLZIP_OPT_ADD_COMMENT : - // PCLZIP_OPT_PREPEND_COMMENT : - // PCLZIP_CB_PRE_ADD : - // PCLZIP_CB_POST_ADD : - // Return Values : - // 0 on failure, - // The list of the added files, with a status of the add action. - // (see PclZip::listContent() for list entry format) - // -------------------------------------------------------------------------------- - public function add($p_filelist) - { - $v_result = 1; - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Set default values - $v_options = array(); - $v_options[PCLZIP_OPT_NO_COMPRESSION] = false; - - // ----- Look for variable options arguments - $v_size = func_num_args(); - - // ----- Look for arguments - if ($v_size > 1) { - // ----- Get the arguments - $v_arg_list = func_get_args(); - - // ----- Remove form the options list the first argument - array_shift($v_arg_list); - $v_size--; - - // ----- Look for first arg - if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { - - // ----- Parse the options - $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array( - PCLZIP_OPT_REMOVE_PATH => 'optional', - PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', - PCLZIP_OPT_ADD_PATH => 'optional', - PCLZIP_CB_PRE_ADD => 'optional', - PCLZIP_CB_POST_ADD => 'optional', - PCLZIP_OPT_NO_COMPRESSION => 'optional', - PCLZIP_OPT_COMMENT => 'optional', - PCLZIP_OPT_ADD_COMMENT => 'optional', - PCLZIP_OPT_PREPEND_COMMENT => 'optional', - PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', - PCLZIP_OPT_TEMP_FILE_ON => 'optional', - PCLZIP_OPT_TEMP_FILE_OFF => 'optional' - //, PCLZIP_OPT_CRYPT => 'optional' - )); - if ($v_result != 1) { - return 0; - } - - // ----- Look for 2 args - // Here we need to support the first historic synopsis of the - // method. - } else { - - // ----- Get the first argument - $v_options[PCLZIP_OPT_ADD_PATH] = $v_add_path = $v_arg_list[0]; - - // ----- Look for the optional second argument - if ($v_size == 2) { - $v_options[PCLZIP_OPT_REMOVE_PATH] = $v_arg_list[1]; - } elseif ($v_size > 2) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); - - // ----- Return - return 0; - } - } - } - - // ----- Look for default option values - $this->privOptionDefaultThreshold($v_options); - - // ----- Init - $v_string_list = array(); - $v_att_list = array(); - $v_filedescr_list = array(); - $p_result_list = array(); - - // ----- Look if the $p_filelist is really an array - if (is_array($p_filelist)) { - - // ----- Look if the first element is also an array - // This will mean that this is a file description entry - if (isset($p_filelist[0]) && is_array($p_filelist[0])) { - $v_att_list = $p_filelist; - - // ----- The list is a list of string names - } else { - $v_string_list = $p_filelist; - } - - // ----- Look if the $p_filelist is a string - } elseif (is_string($p_filelist)) { - // ----- Create a list from the string - $v_string_list = explode(PCLZIP_SEPARATOR, $p_filelist); - - // ----- Invalid variable type for $p_filelist - } else { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type '" . gettype($p_filelist) . "' for p_filelist"); - - return 0; - } - - // ----- Reformat the string list - if (sizeof($v_string_list) != 0) { - foreach ($v_string_list as $v_string) { - $v_att_list[][PCLZIP_ATT_FILE_NAME] = $v_string; - } - } - - // ----- For each file in the list check the attributes - $v_supported_attributes = array( - PCLZIP_ATT_FILE_NAME => 'mandatory', - PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional', - PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional', - PCLZIP_ATT_FILE_MTIME => 'optional', - PCLZIP_ATT_FILE_CONTENT => 'optional', - PCLZIP_ATT_FILE_COMMENT => 'optional' - ); - foreach ($v_att_list as $v_entry) { - $v_result = $this->privFileDescrParseAtt($v_entry, $v_filedescr_list[], $v_options, $v_supported_attributes); - if ($v_result != 1) { - return 0; - } - } - - // ----- Expand the filelist (expand directories) - $v_result = $this->privFileDescrExpand($v_filedescr_list, $v_options); - if ($v_result != 1) { - return 0; - } - - // ----- Call the create fct - $v_result = $this->privAdd($v_filedescr_list, $p_result_list, $v_options); - if ($v_result != 1) { - return 0; - } - - // ----- Return - return $p_result_list; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : listContent() - // Description : - // This public method, gives the list of the files and directories, with their - // properties. - // The properties of each entries in the list are (used also in other functions) : - // filename : Name of the file. For a create or add action it is the filename - // given by the user. For an extract function it is the filename - // of the extracted file. - // stored_filename : Name of the file / directory stored in the archive. - // size : Size of the stored file. - // compressed_size : Size of the file's data compressed in the archive - // (without the headers overhead) - // mtime : Last known modification date of the file (UNIX timestamp) - // comment : Comment associated with the file - // folder : true | false - // index : index of the file in the archive - // status : status of the action (depending of the action) : - // Values are : - // ok : OK ! - // filtered : the file / dir is not extracted (filtered by user) - // already_a_directory : the file can not be extracted because a - // directory with the same name already exists - // write_protected : the file can not be extracted because a file - // with the same name already exists and is - // write protected - // newer_exist : the file was not extracted because a newer file exists - // path_creation_fail : the file is not extracted because the folder - // does not exist and can not be created - // write_error : the file was not extracted because there was a - // error while writing the file - // read_error : the file was not extracted because there was a error - // while reading the file - // invalid_header : the file was not extracted because of an archive - // format error (bad file header) - // Note that each time a method can continue operating when there - // is an action error on a file, the error is only logged in the file status. - // Return Values : - // 0 on an unrecoverable failure, - // The list of the files in the archive. - // -------------------------------------------------------------------------------- - public function listContent() - { - $v_result = 1; - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Check archive - if (!$this->privCheckFormat()) { - return (0); - } - - // ----- Call the extracting fct - $p_list = array(); - if (($v_result = $this->privList($p_list)) != 1) { - unset($p_list); - - return (0); - } - - // ----- Return - return $p_list; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : - // extract($p_path="./", $p_remove_path="") - // extract([$p_option, $p_option_value, ...]) - // Description : - // This method supports two synopsis. The first one is historical. - // This method extract all the files / directories from the archive to the - // folder indicated in $p_path. - // If you want to ignore the 'root' part of path of the memorized files - // you can indicate this in the optional $p_remove_path parameter. - // By default, if a newer file with the same name already exists, the - // file is not extracted. - // - // If both PCLZIP_OPT_PATH and PCLZIP_OPT_ADD_PATH aoptions - // are used, the path indicated in PCLZIP_OPT_ADD_PATH is append - // at the end of the path value of PCLZIP_OPT_PATH. - // Parameters : - // $p_path : Path where the files and directories are to be extracted - // $p_remove_path : First part ('root' part) of the memorized path - // (if any similar) to remove while extracting. - // Options : - // PCLZIP_OPT_PATH : - // PCLZIP_OPT_ADD_PATH : - // PCLZIP_OPT_REMOVE_PATH : - // PCLZIP_OPT_REMOVE_ALL_PATH : - // PCLZIP_CB_PRE_EXTRACT : - // PCLZIP_CB_POST_EXTRACT : - // Return Values : - // 0 or a negative value on failure, - // The list of the extracted files, with a status of the action. - // (see PclZip::listContent() for list entry format) - // -------------------------------------------------------------------------------- - public function extract() - { - $v_result = 1; - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Check archive - if (!$this->privCheckFormat()) { - return (0); - } - - // ----- Set default values - $v_options = array(); - // $v_path = "./"; - $v_path = ''; - $v_remove_path = ""; - $v_remove_all_path = false; - - // ----- Look for variable options arguments - $v_size = func_num_args(); - - // ----- Default values for option - $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = false; - - // ----- Look for arguments - if ($v_size > 0) { - // ----- Get the arguments - $v_arg_list = func_get_args(); - - // ----- Look for first arg - if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { - - // ----- Parse the options - $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array( - PCLZIP_OPT_PATH => 'optional', - PCLZIP_OPT_REMOVE_PATH => 'optional', - PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', - PCLZIP_OPT_ADD_PATH => 'optional', - PCLZIP_CB_PRE_EXTRACT => 'optional', - PCLZIP_CB_POST_EXTRACT => 'optional', - PCLZIP_OPT_SET_CHMOD => 'optional', - PCLZIP_OPT_BY_NAME => 'optional', - PCLZIP_OPT_BY_EREG => 'optional', - PCLZIP_OPT_BY_PREG => 'optional', - PCLZIP_OPT_BY_INDEX => 'optional', - PCLZIP_OPT_EXTRACT_AS_STRING => 'optional', - PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional', - PCLZIP_OPT_REPLACE_NEWER => 'optional', - PCLZIP_OPT_STOP_ON_ERROR => 'optional', - PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional', - PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', - PCLZIP_OPT_TEMP_FILE_ON => 'optional', - PCLZIP_OPT_TEMP_FILE_OFF => 'optional' - )); - if ($v_result != 1) { - return 0; - } - - // ----- Set the arguments - if (isset($v_options[PCLZIP_OPT_PATH])) { - $v_path = $v_options[PCLZIP_OPT_PATH]; - } - if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) { - $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH]; - } - if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) { - $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH]; - } - if (isset($v_options[PCLZIP_OPT_ADD_PATH])) { - // ----- Check for '/' in last path char - if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) { - $v_path .= '/'; - } - $v_path .= $v_options[PCLZIP_OPT_ADD_PATH]; - } - - // ----- Look for 2 args - // Here we need to support the first historic synopsis of the - // method. - } else { - - // ----- Get the first argument - $v_path = $v_arg_list[0]; - - // ----- Look for the optional second argument - if ($v_size == 2) { - $v_remove_path = $v_arg_list[1]; - } elseif ($v_size > 2) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); - - // ----- Return - return 0; - } - } - } - - // ----- Look for default option values - $this->privOptionDefaultThreshold($v_options); - - // ----- Trace - - // ----- Call the extracting fct - $p_list = array(); - $v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options); - if ($v_result < 1) { - unset($p_list); - - return (0); - } - - // ----- Return - return $p_list; - } - // -------------------------------------------------------------------------------- - - - // -------------------------------------------------------------------------------- - // Function : - // extractByIndex($p_index, $p_path="./", $p_remove_path="") - // extractByIndex($p_index, [$p_option, $p_option_value, ...]) - // Description : - // This method supports two synopsis. The first one is historical. - // This method is doing a partial extract of the archive. - // The extracted files or folders are identified by their index in the - // archive (from 0 to n). - // Note that if the index identify a folder, only the folder entry is - // extracted, not all the files included in the archive. - // Parameters : - // $p_index : A single index (integer) or a string of indexes of files to - // extract. The form of the string is "0,4-6,8-12" with only numbers - // and '-' for range or ',' to separate ranges. No spaces or ';' - // are allowed. - // $p_path : Path where the files and directories are to be extracted - // $p_remove_path : First part ('root' part) of the memorized path - // (if any similar) to remove while extracting. - // Options : - // PCLZIP_OPT_PATH : - // PCLZIP_OPT_ADD_PATH : - // PCLZIP_OPT_REMOVE_PATH : - // PCLZIP_OPT_REMOVE_ALL_PATH : - // PCLZIP_OPT_EXTRACT_AS_STRING : The files are extracted as strings and - // not as files. - // The resulting content is in a new field 'content' in the file - // structure. - // This option must be used alone (any other options are ignored). - // PCLZIP_CB_PRE_EXTRACT : - // PCLZIP_CB_POST_EXTRACT : - // Return Values : - // 0 on failure, - // The list of the extracted files, with a status of the action. - // (see PclZip::listContent() for list entry format) - // -------------------------------------------------------------------------------- - //function extractByIndex($p_index, options...) - public function extractByIndex($p_index) - { - $v_result = 1; - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Check archive - if (!$this->privCheckFormat()) { - return (0); - } - - // ----- Set default values - $v_options = array(); - // $v_path = "./"; - $v_path = ''; - $v_remove_path = ""; - $v_remove_all_path = false; - - // ----- Look for variable options arguments - $v_size = func_num_args(); - - // ----- Default values for option - $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = false; - - // ----- Look for arguments - if ($v_size > 1) { - // ----- Get the arguments - $v_arg_list = func_get_args(); - - // ----- Remove form the options list the first argument - array_shift($v_arg_list); - $v_size--; - - // ----- Look for first arg - if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { - - // ----- Parse the options - $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array( - PCLZIP_OPT_PATH => 'optional', - PCLZIP_OPT_REMOVE_PATH => 'optional', - PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', - PCLZIP_OPT_EXTRACT_AS_STRING => 'optional', - PCLZIP_OPT_ADD_PATH => 'optional', - PCLZIP_CB_PRE_EXTRACT => 'optional', - PCLZIP_CB_POST_EXTRACT => 'optional', - PCLZIP_OPT_SET_CHMOD => 'optional', - PCLZIP_OPT_REPLACE_NEWER => 'optional', - PCLZIP_OPT_STOP_ON_ERROR => 'optional', - PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional', - PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', - PCLZIP_OPT_TEMP_FILE_ON => 'optional', - PCLZIP_OPT_TEMP_FILE_OFF => 'optional' - )); - if ($v_result != 1) { - return 0; - } - - // ----- Set the arguments - if (isset($v_options[PCLZIP_OPT_PATH])) { - $v_path = $v_options[PCLZIP_OPT_PATH]; - } - if (isset($v_options[PCLZIP_OPT_REMOVE_PATH])) { - $v_remove_path = $v_options[PCLZIP_OPT_REMOVE_PATH]; - } - if (isset($v_options[PCLZIP_OPT_REMOVE_ALL_PATH])) { - $v_remove_all_path = $v_options[PCLZIP_OPT_REMOVE_ALL_PATH]; - } - if (isset($v_options[PCLZIP_OPT_ADD_PATH])) { - // ----- Check for '/' in last path char - if ((strlen($v_path) > 0) && (substr($v_path, -1) != '/')) { - $v_path .= '/'; - } - $v_path .= $v_options[PCLZIP_OPT_ADD_PATH]; - } - if (!isset($v_options[PCLZIP_OPT_EXTRACT_AS_STRING])) { - $v_options[PCLZIP_OPT_EXTRACT_AS_STRING] = false; - } else { - } - - // ----- Look for 2 args - // Here we need to support the first historic synopsis of the - // method. - } else { - - // ----- Get the first argument - $v_path = $v_arg_list[0]; - - // ----- Look for the optional second argument - if ($v_size == 2) { - $v_remove_path = $v_arg_list[1]; - } elseif ($v_size > 2) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid number / type of arguments"); - - // ----- Return - return 0; - } - } - } - - // ----- Trace - - // ----- Trick - // Here I want to reuse extractByRule(), so I need to parse the $p_index - // with privParseOptions() - $v_arg_trick = array( - PCLZIP_OPT_BY_INDEX, - $p_index - ); - $v_options_trick = array(); - $v_result = $this->privParseOptions($v_arg_trick, sizeof($v_arg_trick), $v_options_trick, array( - PCLZIP_OPT_BY_INDEX => 'optional' - )); - if ($v_result != 1) { - return 0; - } - $v_options[PCLZIP_OPT_BY_INDEX] = $v_options_trick[PCLZIP_OPT_BY_INDEX]; - - // ----- Look for default option values - $this->privOptionDefaultThreshold($v_options); - - // ----- Call the extracting fct - if (($v_result = $this->privExtractByRule($p_list, $v_path, $v_remove_path, $v_remove_all_path, $v_options)) < 1) { - return (0); - } - - // ----- Return - return $p_list; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : - // delete([$p_option, $p_option_value, ...]) - // Description : - // This method removes files from the archive. - // If no parameters are given, then all the archive is emptied. - // Parameters : - // None or optional arguments. - // Options : - // PCLZIP_OPT_BY_INDEX : - // PCLZIP_OPT_BY_NAME : - // PCLZIP_OPT_BY_EREG : - // PCLZIP_OPT_BY_PREG : - // Return Values : - // 0 on failure, - // The list of the files which are still present in the archive. - // (see PclZip::listContent() for list entry format) - // -------------------------------------------------------------------------------- - public function delete() - { - $v_result = 1; - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Check archive - if (!$this->privCheckFormat()) { - return (0); - } - - // ----- Set default values - $v_options = array(); - - // ----- Look for variable options arguments - $v_size = func_num_args(); - - // ----- Look for arguments - if ($v_size > 0) { - // ----- Get the arguments - $v_arg_list = func_get_args(); - - // ----- Parse the options - $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, array( - PCLZIP_OPT_BY_NAME => 'optional', - PCLZIP_OPT_BY_EREG => 'optional', - PCLZIP_OPT_BY_PREG => 'optional', - PCLZIP_OPT_BY_INDEX => 'optional' - )); - if ($v_result != 1) { - return 0; - } - } - - // ----- Magic quotes trick - $this->privDisableMagicQuotes(); - - // ----- Call the delete fct - $v_list = array(); - if (($v_result = $this->privDeleteByRule($v_list, $v_options)) != 1) { - $this->privSwapBackMagicQuotes(); - unset($v_list); - - return (0); - } - - // ----- Magic quotes trick - $this->privSwapBackMagicQuotes(); - - // ----- Return - return $v_list; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : deleteByIndex() - // Description : - // ***** Deprecated ***** - // delete(PCLZIP_OPT_BY_INDEX, $p_index) should be prefered. - // -------------------------------------------------------------------------------- - public function deleteByIndex($p_index) - { - - $p_list = $this->delete(PCLZIP_OPT_BY_INDEX, $p_index); - - // ----- Return - return $p_list; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : properties() - // Description : - // This method gives the properties of the archive. - // The properties are : - // nb : Number of files in the archive - // comment : Comment associated with the archive file - // status : not_exist, ok - // Parameters : - // None - // Return Values : - // 0 on failure, - // An array with the archive properties. - // -------------------------------------------------------------------------------- - public function properties() - { - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Magic quotes trick - $this->privDisableMagicQuotes(); - - // ----- Check archive - if (!$this->privCheckFormat()) { - $this->privSwapBackMagicQuotes(); - - return (0); - } - - // ----- Default properties - $v_prop = array(); - $v_prop['comment'] = ''; - $v_prop['nb'] = 0; - $v_prop['status'] = 'not_exist'; - - // ----- Look if file exists - if (@is_file($this->zipname)) { - // ----- Open the zip file - if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0) { - $this->privSwapBackMagicQuotes(); - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \'' . $this->zipname . '\' in binary read mode'); - - // ----- Return - return 0; - } - - // ----- Read the central directory informations - $v_central_dir = array(); - if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { - $this->privSwapBackMagicQuotes(); - - return 0; - } - - // ----- Close the zip file - $this->privCloseFd(); - - // ----- Set the user attributes - $v_prop['comment'] = $v_central_dir['comment']; - $v_prop['nb'] = $v_central_dir['entries']; - $v_prop['status'] = 'ok'; - } - - // ----- Magic quotes trick - $this->privSwapBackMagicQuotes(); - - // ----- Return - return $v_prop; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : duplicate() - // Description : - // This method creates an archive by copying the content of an other one. If - // the archive already exist, it is replaced by the new one without any warning. - // Parameters : - // $p_archive : The filename of a valid archive, or - // a valid PclZip object. - // Return Values : - // 1 on success. - // 0 or a negative value on error (error code). - // -------------------------------------------------------------------------------- - public function duplicate($p_archive) - { - $v_result = 1; - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Look if the $p_archive is a PclZip object - if ((is_object($p_archive)) && (get_class($p_archive) == 'pclzip')) { - - // ----- Duplicate the archive - $v_result = $this->privDuplicate($p_archive->zipname); - - // ----- Look if the $p_archive is a string (so a filename) - } elseif (is_string($p_archive)) { - - // ----- Check that $p_archive is a valid zip file - // TBC : Should also check the archive format - if (!is_file($p_archive)) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "No file with filename '" . $p_archive . "'"); - $v_result = PCLZIP_ERR_MISSING_FILE; - } else { - // ----- Duplicate the archive - $v_result = $this->privDuplicate($p_archive); - } - - // ----- Invalid variable - } else { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add"); - $v_result = PCLZIP_ERR_INVALID_PARAMETER; - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : merge() - // Description : - // This method merge the $p_archive_to_add archive at the end of the current - // one ($this). - // If the archive ($this) does not exist, the merge becomes a duplicate. - // If the $p_archive_to_add archive does not exist, the merge is a success. - // Parameters : - // $p_archive_to_add : It can be directly the filename of a valid zip archive, - // or a PclZip object archive. - // Return Values : - // 1 on success, - // 0 or negative values on error (see below). - // -------------------------------------------------------------------------------- - public function merge($p_archive_to_add) - { - $v_result = 1; - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Check archive - if (!$this->privCheckFormat()) { - return (0); - } - - // ----- Look if the $p_archive_to_add is a PclZip object - if ((is_object($p_archive_to_add)) && (get_class($p_archive_to_add) == 'pclzip')) { - - // ----- Merge the archive - $v_result = $this->privMerge($p_archive_to_add); - - // ----- Look if the $p_archive_to_add is a string (so a filename) - } elseif (is_string($p_archive_to_add)) { - - // ----- Create a temporary archive - $v_object_archive = new PclZip($p_archive_to_add); - - // ----- Merge the archive - $v_result = $this->privMerge($v_object_archive); - - // ----- Invalid variable - } else { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid variable type p_archive_to_add"); - $v_result = PCLZIP_ERR_INVALID_PARAMETER; - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : errorCode() - // Description : - // Parameters : - // -------------------------------------------------------------------------------- - public function errorCode() - { - if (PCLZIP_ERROR_EXTERNAL == 1) { - return (PclErrorCode()); - } else { - return ($this->error_code); - } - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : errorName() - // Description : - // Parameters : - // -------------------------------------------------------------------------------- - public function errorName($p_with_code = false) - { - $v_name = array( - PCLZIP_ERR_NO_ERROR => 'PCLZIP_ERR_NO_ERROR', - PCLZIP_ERR_WRITE_OPEN_FAIL => 'PCLZIP_ERR_WRITE_OPEN_FAIL', - PCLZIP_ERR_READ_OPEN_FAIL => 'PCLZIP_ERR_READ_OPEN_FAIL', - PCLZIP_ERR_INVALID_PARAMETER => 'PCLZIP_ERR_INVALID_PARAMETER', - PCLZIP_ERR_MISSING_FILE => 'PCLZIP_ERR_MISSING_FILE', - PCLZIP_ERR_FILENAME_TOO_LONG => 'PCLZIP_ERR_FILENAME_TOO_LONG', - PCLZIP_ERR_INVALID_ZIP => 'PCLZIP_ERR_INVALID_ZIP', - PCLZIP_ERR_BAD_EXTRACTED_FILE => 'PCLZIP_ERR_BAD_EXTRACTED_FILE', - PCLZIP_ERR_DIR_CREATE_FAIL => 'PCLZIP_ERR_DIR_CREATE_FAIL', - PCLZIP_ERR_BAD_EXTENSION => 'PCLZIP_ERR_BAD_EXTENSION', - PCLZIP_ERR_BAD_FORMAT => 'PCLZIP_ERR_BAD_FORMAT', - PCLZIP_ERR_DELETE_FILE_FAIL => 'PCLZIP_ERR_DELETE_FILE_FAIL', - PCLZIP_ERR_RENAME_FILE_FAIL => 'PCLZIP_ERR_RENAME_FILE_FAIL', - PCLZIP_ERR_BAD_CHECKSUM => 'PCLZIP_ERR_BAD_CHECKSUM', - PCLZIP_ERR_INVALID_ARCHIVE_ZIP => 'PCLZIP_ERR_INVALID_ARCHIVE_ZIP', - PCLZIP_ERR_MISSING_OPTION_VALUE => 'PCLZIP_ERR_MISSING_OPTION_VALUE', - PCLZIP_ERR_INVALID_OPTION_VALUE => 'PCLZIP_ERR_INVALID_OPTION_VALUE', - PCLZIP_ERR_UNSUPPORTED_COMPRESSION => 'PCLZIP_ERR_UNSUPPORTED_COMPRESSION', - PCLZIP_ERR_UNSUPPORTED_ENCRYPTION => 'PCLZIP_ERR_UNSUPPORTED_ENCRYPTION', - PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE => 'PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE', - PCLZIP_ERR_DIRECTORY_RESTRICTION => 'PCLZIP_ERR_DIRECTORY_RESTRICTION' - ); - - if (isset($v_name[$this->error_code])) { - $v_value = $v_name[$this->error_code]; - } else { - $v_value = 'NoName'; - } - - if ($p_with_code) { - return ($v_value . ' (' . $this->error_code . ')'); - } else { - return ($v_value); - } - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : errorInfo() - // Description : - // Parameters : - // -------------------------------------------------------------------------------- - public function errorInfo($p_full = false) - { - if (PCLZIP_ERROR_EXTERNAL == 1) { - return (PclErrorString()); - } else { - if ($p_full) { - return ($this->errorName(true) . " : " . $this->error_string); - } else { - return ($this->error_string . " [code " . $this->error_code . "]"); - } - } - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // ***** UNDER THIS LINE ARE DEFINED PRIVATE INTERNAL FUNCTIONS ***** - // ***** ***** - // ***** THESES FUNCTIONS MUST NOT BE USED DIRECTLY ***** - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privCheckFormat() - // Description : - // This method check that the archive exists and is a valid zip archive. - // Several level of check exists. (futur) - // Parameters : - // $p_level : Level of check. Default 0. - // 0 : Check the first bytes (magic codes) (default value)) - // 1 : 0 + Check the central directory (futur) - // 2 : 1 + Check each file header (futur) - // Return Values : - // true on success, - // false on error, the error code is set. - // -------------------------------------------------------------------------------- - public function privCheckFormat($p_level = 0) - { - $v_result = true; - - // ----- Reset the file system cache - clearstatcache(); - - // ----- Reset the error handler - $this->privErrorReset(); - - // ----- Look if the file exits - if (!is_file($this->zipname)) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "Missing archive file '" . $this->zipname . "'"); - - return (false); - } - - // ----- Check that the file is readeable - if (!is_readable($this->zipname)) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to read archive '" . $this->zipname . "'"); - - return (false); - } - - // ----- Check the magic code - // TBC - - // ----- Check the central header - // TBC - - // ----- Check each file header - // TBC - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privParseOptions() - // Description : - // This internal methods reads the variable list of arguments ($p_options_list, - // $p_size) and generate an array with the options and values ($v_result_list). - // $v_requested_options contains the options that can be present and those that - // must be present. - // $v_requested_options is an array, with the option value as key, and 'optional', - // or 'mandatory' as value. - // Parameters : - // See above. - // Return Values : - // 1 on success. - // 0 on failure. - // -------------------------------------------------------------------------------- - public function privParseOptions(&$p_options_list, $p_size, &$v_result_list, $v_requested_options = false) - { - $v_result = 1; - - // ----- Read the options - $i = 0; - while ($i < $p_size) { - - // ----- Check if the option is supported - if (!isset($v_requested_options[$p_options_list[$i]])) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid optional parameter '" . $p_options_list[$i] . "' for this method"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Look for next option - switch ($p_options_list[$i]) { - // ----- Look for options that request a path value - case PCLZIP_OPT_PATH: - case PCLZIP_OPT_REMOVE_PATH: - case PCLZIP_OPT_ADD_PATH: - // ----- Check the number of parameters - if (($i + 1) >= $p_size) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Get the value - $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i + 1], false); - $i++; - break; - - case PCLZIP_OPT_TEMP_FILE_THRESHOLD: - // ----- Check the number of parameters - if (($i + 1) >= $p_size) { - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); - - return PclZip::errorCode(); - } - - // ----- Check for incompatible options - if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '" . PclZipUtilOptionText($p_options_list[$i]) . "' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'"); - - return PclZip::errorCode(); - } - - // ----- Check the value - $v_value = $p_options_list[$i + 1]; - if ((!is_integer($v_value)) || ($v_value < 0)) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Integer expected for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); - - return PclZip::errorCode(); - } - - // ----- Get the value (and convert it in bytes) - $v_result_list[$p_options_list[$i]] = $v_value * 1048576; - $i++; - break; - - case PCLZIP_OPT_TEMP_FILE_ON: - // ----- Check for incompatible options - if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_OFF])) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '" . PclZipUtilOptionText($p_options_list[$i]) . "' can not be used with option 'PCLZIP_OPT_TEMP_FILE_OFF'"); - - return PclZip::errorCode(); - } - - $v_result_list[$p_options_list[$i]] = true; - break; - - case PCLZIP_OPT_TEMP_FILE_OFF: - // ----- Check for incompatible options - if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_ON])) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '" . PclZipUtilOptionText($p_options_list[$i]) . "' can not be used with option 'PCLZIP_OPT_TEMP_FILE_ON'"); - - return PclZip::errorCode(); - } - // ----- Check for incompatible options - if (isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Option '" . PclZipUtilOptionText($p_options_list[$i]) . "' can not be used with option 'PCLZIP_OPT_TEMP_FILE_THRESHOLD'"); - - return PclZip::errorCode(); - } - - $v_result_list[$p_options_list[$i]] = true; - break; - - case PCLZIP_OPT_EXTRACT_DIR_RESTRICTION: - // ----- Check the number of parameters - if (($i + 1) >= $p_size) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Get the value - if (is_string($p_options_list[$i + 1]) && ($p_options_list[$i + 1] != '')) { - $v_result_list[$p_options_list[$i]] = PclZipUtilTranslateWinPath($p_options_list[$i + 1], false); - $i++; - } else { - } - break; - - // ----- Look for options that request an array of string for value - case PCLZIP_OPT_BY_NAME: - // ----- Check the number of parameters - if (($i + 1) >= $p_size) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Get the value - if (is_string($p_options_list[$i + 1])) { - $v_result_list[$p_options_list[$i]][0] = $p_options_list[$i + 1]; - } elseif (is_array($p_options_list[$i + 1])) { - $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1]; - } else { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); - - // ----- Return - return PclZip::errorCode(); - } - $i++; - break; - - // ----- Look for options that request an EREG or PREG expression - case PCLZIP_OPT_BY_EREG: - $p_options_list[$i] = PCLZIP_OPT_BY_PREG; - // ereg() is deprecated starting with PHP 5.3. Move PCLZIP_OPT_BY_EREG - // to PCLZIP_OPT_BY_PREG - case PCLZIP_OPT_BY_PREG: - //case PCLZIP_OPT_CRYPT : - // ----- Check the number of parameters - if (($i + 1) >= $p_size) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Get the value - if (is_string($p_options_list[$i + 1])) { - $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1]; - } else { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); - - // ----- Return - return PclZip::errorCode(); - } - $i++; - break; - - // ----- Look for options that takes a string - case PCLZIP_OPT_COMMENT: - case PCLZIP_OPT_ADD_COMMENT: - case PCLZIP_OPT_PREPEND_COMMENT: - // ----- Check the number of parameters - if (($i + 1) >= $p_size) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Get the value - if (is_string($p_options_list[$i + 1])) { - $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1]; - } else { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Wrong parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); - - // ----- Return - return PclZip::errorCode(); - } - $i++; - break; - - // ----- Look for options that request an array of index - case PCLZIP_OPT_BY_INDEX: - // ----- Check the number of parameters - if (($i + 1) >= $p_size) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Get the value - $v_work_list = array(); - if (is_string($p_options_list[$i + 1])) { - - // ----- Remove spaces - $p_options_list[$i + 1] = strtr($p_options_list[$i + 1], ' ', ''); - - // ----- Parse items - $v_work_list = explode(",", $p_options_list[$i + 1]); - } elseif (is_integer($p_options_list[$i + 1])) { - $v_work_list[0] = $p_options_list[$i + 1] . '-' . $p_options_list[$i + 1]; - } elseif (is_array($p_options_list[$i + 1])) { - $v_work_list = $p_options_list[$i + 1]; - } else { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Value must be integer, string or array for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Reduce the index list - // each index item in the list must be a couple with a start and - // an end value : [0,3], [5-5], [8-10], ... - // ----- Check the format of each item - $v_sort_flag = false; - $v_sort_value = 0; - for ($j = 0; $j < sizeof($v_work_list); $j++) { - // ----- Explode the item - $v_item_list = explode("-", $v_work_list[$j]); - $v_size_item_list = sizeof($v_item_list); - - // ----- TBC : Here we might check that each item is a - // real integer ... - - // ----- Look for single value - if ($v_size_item_list == 1) { - // ----- Set the option value - $v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0]; - $v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[0]; - } elseif ($v_size_item_list == 2) { - // ----- Set the option value - $v_result_list[$p_options_list[$i]][$j]['start'] = $v_item_list[0]; - $v_result_list[$p_options_list[$i]][$j]['end'] = $v_item_list[1]; - } else { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Too many values in index range for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Look for list sort - if ($v_result_list[$p_options_list[$i]][$j]['start'] < $v_sort_value) { - $v_sort_flag = true; - - // ----- TBC : An automatic sort should be writen ... - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Invalid order of index range for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); - - // ----- Return - return PclZip::errorCode(); - } - $v_sort_value = $v_result_list[$p_options_list[$i]][$j]['start']; - } - - // ----- Sort the items - if ($v_sort_flag) { - // TBC : To Be Completed - } - - // ----- Next option - $i++; - break; - - // ----- Look for options that request no value - case PCLZIP_OPT_REMOVE_ALL_PATH: - case PCLZIP_OPT_EXTRACT_AS_STRING: - case PCLZIP_OPT_NO_COMPRESSION: - case PCLZIP_OPT_EXTRACT_IN_OUTPUT: - case PCLZIP_OPT_REPLACE_NEWER: - case PCLZIP_OPT_STOP_ON_ERROR: - $v_result_list[$p_options_list[$i]] = true; - break; - - // ----- Look for options that request an octal value - case PCLZIP_OPT_SET_CHMOD: - // ----- Check the number of parameters - if (($i + 1) >= $p_size) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Get the value - $v_result_list[$p_options_list[$i]] = $p_options_list[$i + 1]; - $i++; - break; - - // ----- Look for options that request a call-back - case PCLZIP_CB_PRE_EXTRACT: - case PCLZIP_CB_POST_EXTRACT: - case PCLZIP_CB_PRE_ADD: - case PCLZIP_CB_POST_ADD: - /* for futur use - case PCLZIP_CB_PRE_DELETE : - case PCLZIP_CB_POST_DELETE : - case PCLZIP_CB_PRE_LIST : - case PCLZIP_CB_POST_LIST : - */ - // ----- Check the number of parameters - if (($i + 1) >= $p_size) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_OPTION_VALUE, "Missing parameter value for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Get the value - $v_function_name = $p_options_list[$i + 1]; - - // ----- Check that the value is a valid existing function - if (!function_exists($v_function_name)) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_OPTION_VALUE, "Function '" . $v_function_name . "()' is not an existing function for option '" . PclZipUtilOptionText($p_options_list[$i]) . "'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Set the attribute - $v_result_list[$p_options_list[$i]] = $v_function_name; - $i++; - break; - - default: - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Unknown parameter '" . $p_options_list[$i] . "'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Next options - $i++; - } - - // ----- Look for mandatory options - if ($v_requested_options !== false) { - for ($key = reset($v_requested_options); $key = key($v_requested_options); $key = next($v_requested_options)) { - // ----- Look for mandatory option - if ($v_requested_options[$key] == 'mandatory') { - // ----- Look if present - if (!isset($v_result_list[$key])) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter " . PclZipUtilOptionText($key) . "(" . $key . ")"); - - // ----- Return - return PclZip::errorCode(); - } - } - } - } - - // ----- Look for default values - if (!isset($v_result_list[PCLZIP_OPT_TEMP_FILE_THRESHOLD])) { - - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privOptionDefaultThreshold() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - public function privOptionDefaultThreshold(&$p_options) - { - $v_result = 1; - - if (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) || isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) { - return $v_result; - } - - // ----- Get 'memory_limit' configuration value - $v_memory_limit = ini_get('memory_limit'); - $v_memory_limit = trim($v_memory_limit); - $last = strtolower(substr($v_memory_limit, -1)); - - if ($last == 'g') { - //$v_memory_limit = $v_memory_limit*1024*1024*1024; - $v_memory_limit = $v_memory_limit * 1073741824; - } - if ($last == 'm') { - //$v_memory_limit = $v_memory_limit*1024*1024; - $v_memory_limit = $v_memory_limit * 1048576; - } - if ($last == 'k') { - $v_memory_limit = $v_memory_limit * 1024; - } - - $p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] = floor($v_memory_limit * PCLZIP_TEMPORARY_FILE_RATIO); - - // ----- Sanity check : No threshold if value lower than 1M - if ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] < 1048576) { - unset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]); - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privFileDescrParseAtt() - // Description : - // Parameters : - // Return Values : - // 1 on success. - // 0 on failure. - // -------------------------------------------------------------------------------- - public function privFileDescrParseAtt(&$p_file_list, &$p_filedescr, $v_options, $v_requested_options = false) - { - $v_result = 1; - - // ----- For each file in the list check the attributes - foreach ($p_file_list as $v_key => $v_value) { - - // ----- Check if the option is supported - if (!isset($v_requested_options[$v_key])) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file attribute '" . $v_key . "' for this file"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Look for attribute - switch ($v_key) { - case PCLZIP_ATT_FILE_NAME: - if (!is_string($v_value)) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type " . gettype($v_value) . ". String expected for attribute '" . PclZipUtilOptionText($v_key) . "'"); - - return PclZip::errorCode(); - } - - $p_filedescr['filename'] = PclZipUtilPathReduction($v_value); - - if ($p_filedescr['filename'] == '') { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty filename for attribute '" . PclZipUtilOptionText($v_key) . "'"); - - return PclZip::errorCode(); - } - - break; - - case PCLZIP_ATT_FILE_NEW_SHORT_NAME: - if (!is_string($v_value)) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type " . gettype($v_value) . ". String expected for attribute '" . PclZipUtilOptionText($v_key) . "'"); - - return PclZip::errorCode(); - } - - $p_filedescr['new_short_name'] = PclZipUtilPathReduction($v_value); - - if ($p_filedescr['new_short_name'] == '') { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty short filename for attribute '" . PclZipUtilOptionText($v_key) . "'"); - - return PclZip::errorCode(); - } - break; - - case PCLZIP_ATT_FILE_NEW_FULL_NAME: - if (!is_string($v_value)) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type " . gettype($v_value) . ". String expected for attribute '" . PclZipUtilOptionText($v_key) . "'"); - - return PclZip::errorCode(); - } - - $p_filedescr['new_full_name'] = PclZipUtilPathReduction($v_value); - - if ($p_filedescr['new_full_name'] == '') { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid empty full filename for attribute '" . PclZipUtilOptionText($v_key) . "'"); - - return PclZip::errorCode(); - } - break; - - // ----- Look for options that takes a string - case PCLZIP_ATT_FILE_COMMENT: - if (!is_string($v_value)) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type " . gettype($v_value) . ". String expected for attribute '" . PclZipUtilOptionText($v_key) . "'"); - - return PclZip::errorCode(); - } - - $p_filedescr['comment'] = $v_value; - break; - - case PCLZIP_ATT_FILE_MTIME: - if (!is_integer($v_value)) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE, "Invalid type " . gettype($v_value) . ". Integer expected for attribute '" . PclZipUtilOptionText($v_key) . "'"); - - return PclZip::errorCode(); - } - - $p_filedescr['mtime'] = $v_value; - break; - - case PCLZIP_ATT_FILE_CONTENT: - $p_filedescr['content'] = $v_value; - break; - - default: - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Unknown parameter '" . $v_key . "'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Look for mandatory options - if ($v_requested_options !== false) { - for ($key = reset($v_requested_options); $key = key($v_requested_options); $key = next($v_requested_options)) { - // ----- Look for mandatory option - if ($v_requested_options[$key] == 'mandatory') { - // ----- Look if present - if (!isset($p_file_list[$key])) { - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Missing mandatory parameter " . PclZipUtilOptionText($key) . "(" . $key . ")"); - - return PclZip::errorCode(); - } - } - } - } - - // end foreach - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privFileDescrExpand() - // Description : - // This method look for each item of the list to see if its a file, a folder - // or a string to be added as file. For any other type of files (link, other) - // just ignore the item. - // Then prepare the information that will be stored for that file. - // When its a folder, expand the folder with all the files that are in that - // folder (recursively). - // Parameters : - // Return Values : - // 1 on success. - // 0 on failure. - // -------------------------------------------------------------------------------- - public function privFileDescrExpand(&$p_filedescr_list, &$p_options) - { - $v_result = 1; - - // ----- Create a result list - $v_result_list = array(); - - // ----- Look each entry - for ($i = 0; $i < sizeof($p_filedescr_list); $i++) { - - // ----- Get filedescr - $v_descr = $p_filedescr_list[$i]; - - // ----- Reduce the filename - $v_descr['filename'] = PclZipUtilTranslateWinPath($v_descr['filename'], false); - $v_descr['filename'] = PclZipUtilPathReduction($v_descr['filename']); - - // ----- Look for real file or folder - if (file_exists($v_descr['filename'])) { - if (@is_file($v_descr['filename'])) { - $v_descr['type'] = 'file'; - } elseif (@is_dir($v_descr['filename'])) { - $v_descr['type'] = 'folder'; - } elseif (@is_link($v_descr['filename'])) { - // skip - continue; - } else { - // skip - continue; - } - - // ----- Look for string added as file - } elseif (isset($v_descr['content'])) { - $v_descr['type'] = 'virtual_file'; - - // ----- Missing file - } else { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '" . $v_descr['filename'] . "' does not exist"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Calculate the stored filename - $this->privCalculateStoredFilename($v_descr, $p_options); - - // ----- Add the descriptor in result list - $v_result_list[sizeof($v_result_list)] = $v_descr; - - // ----- Look for folder - if ($v_descr['type'] == 'folder') { - // ----- List of items in folder - $v_dirlist_descr = array(); - $v_dirlist_nb = 0; - if ($v_folder_handler = @opendir($v_descr['filename'])) { - while (($v_item_handler = @readdir($v_folder_handler)) !== false) { - - // ----- Skip '.' and '..' - if (($v_item_handler == '.') || ($v_item_handler == '..')) { - continue; - } - - // ----- Compose the full filename - $v_dirlist_descr[$v_dirlist_nb]['filename'] = $v_descr['filename'] . '/' . $v_item_handler; - - // ----- Look for different stored filename - // Because the name of the folder was changed, the name of the - // files/sub-folders also change - if (($v_descr['stored_filename'] != $v_descr['filename']) && (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) { - if ($v_descr['stored_filename'] != '') { - $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_descr['stored_filename'] . '/' . $v_item_handler; - } else { - $v_dirlist_descr[$v_dirlist_nb]['new_full_name'] = $v_item_handler; - } - } - - $v_dirlist_nb++; - } - - @closedir($v_folder_handler); - } else { - // TBC : unable to open folder in read mode - } - - // ----- Expand each element of the list - if ($v_dirlist_nb != 0) { - // ----- Expand - if (($v_result = $this->privFileDescrExpand($v_dirlist_descr, $p_options)) != 1) { - return $v_result; - } - - // ----- Concat the resulting list - $v_result_list = array_merge($v_result_list, $v_dirlist_descr); - } else { - } - - // ----- Free local array - unset($v_dirlist_descr); - } - } - - // ----- Get the result list - $p_filedescr_list = $v_result_list; - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privCreate() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - public function privCreate($p_filedescr_list, &$p_result_list, &$p_options) - { - $v_result = 1; - $v_list_detail = array(); - - // ----- Magic quotes trick - $this->privDisableMagicQuotes(); - - // ----- Open the file in write mode - if (($v_result = $this->privOpenFd('wb')) != 1) { - // ----- Return - return $v_result; - } - - // ----- Add the list of files - $v_result = $this->privAddList($p_filedescr_list, $p_result_list, $p_options); - - // ----- Close - $this->privCloseFd(); - - // ----- Magic quotes trick - $this->privSwapBackMagicQuotes(); - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privAdd() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - public function privAdd($p_filedescr_list, &$p_result_list, &$p_options) - { - $v_result = 1; - $v_list_detail = array(); - - // ----- Look if the archive exists or is empty - if ((!is_file($this->zipname)) || (filesize($this->zipname) == 0)) { - - // ----- Do a create - $v_result = $this->privCreate($p_filedescr_list, $p_result_list, $p_options); - - // ----- Return - return $v_result; - } - // ----- Magic quotes trick - $this->privDisableMagicQuotes(); - - // ----- Open the zip file - if (($v_result = $this->privOpenFd('rb')) != 1) { - // ----- Magic quotes trick - $this->privSwapBackMagicQuotes(); - - // ----- Return - return $v_result; - } - - // ----- Read the central directory informations - $v_central_dir = array(); - if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - - return $v_result; - } - - // ----- Go to beginning of File - @rewind($this->zip_fd); - - // ----- Creates a temporay file - $v_zip_temp_name = PCLZIP_TEMPORARY_DIR . uniqid('pclzip-') . '.tmp'; - - // ----- Open the temporary file in write mode - if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0) { - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \'' . $v_zip_temp_name . '\' in binary write mode'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Copy the files from the archive to the temporary file - // TBC : Here I should better append the file and go back to erase the central dir - $v_size = $v_central_dir['offset']; - while ($v_size != 0) { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = fread($this->zip_fd, $v_read_size); - @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Swap the file descriptor - // Here is a trick : I swap the temporary fd with the zip fd, in order to use - // the following methods on the temporary fil and not the real archive - $v_swap = $this->zip_fd; - $this->zip_fd = $v_zip_temp_fd; - $v_zip_temp_fd = $v_swap; - - // ----- Add the files - $v_header_list = array(); - if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1) { - fclose($v_zip_temp_fd); - $this->privCloseFd(); - @unlink($v_zip_temp_name); - $this->privSwapBackMagicQuotes(); - - // ----- Return - return $v_result; - } - - // ----- Store the offset of the central dir - $v_offset = @ftell($this->zip_fd); - - // ----- Copy the block of file headers from the old archive - $v_size = $v_central_dir['size']; - while ($v_size != 0) { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @fread($v_zip_temp_fd, $v_read_size); - @fwrite($this->zip_fd, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Create the Central Dir files header - for ($i = 0, $v_count = 0; $i < sizeof($v_header_list); $i++) { - // ----- Create the file header - if ($v_header_list[$i]['status'] == 'ok') { - if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) { - fclose($v_zip_temp_fd); - $this->privCloseFd(); - @unlink($v_zip_temp_name); - $this->privSwapBackMagicQuotes(); - - // ----- Return - return $v_result; - } - $v_count++; - } - - // ----- Transform the header to a 'usable' info - $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]); - } - - // ----- Zip file comment - $v_comment = $v_central_dir['comment']; - if (isset($p_options[PCLZIP_OPT_COMMENT])) { - $v_comment = $p_options[PCLZIP_OPT_COMMENT]; - } - if (isset($p_options[PCLZIP_OPT_ADD_COMMENT])) { - $v_comment = $v_comment . $p_options[PCLZIP_OPT_ADD_COMMENT]; - } - if (isset($p_options[PCLZIP_OPT_PREPEND_COMMENT])) { - $v_comment = $p_options[PCLZIP_OPT_PREPEND_COMMENT] . $v_comment; - } - - // ----- Calculate the size of the central header - $v_size = @ftell($this->zip_fd) - $v_offset; - - // ----- Create the central dir footer - if (($v_result = $this->privWriteCentralHeader($v_count + $v_central_dir['entries'], $v_size, $v_offset, $v_comment)) != 1) { - // ----- Reset the file list - unset($v_header_list); - $this->privSwapBackMagicQuotes(); - - // ----- Return - return $v_result; - } - - // ----- Swap back the file descriptor - $v_swap = $this->zip_fd; - $this->zip_fd = $v_zip_temp_fd; - $v_zip_temp_fd = $v_swap; - - // ----- Close - $this->privCloseFd(); - - // ----- Close the temporary file - @fclose($v_zip_temp_fd); - - // ----- Magic quotes trick - $this->privSwapBackMagicQuotes(); - - // ----- Delete the zip file - // TBC : I should test the result ... - @unlink($this->zipname); - - // ----- Rename the temporary file - // TBC : I should test the result ... - //@rename($v_zip_temp_name, $this->zipname); - PclZipUtilRename($v_zip_temp_name, $this->zipname); - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privOpenFd() - // Description : - // Parameters : - // -------------------------------------------------------------------------------- - public function privOpenFd($p_mode) - { - $v_result = 1; - - // ----- Look if already open - if ($this->zip_fd != 0) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Zip file \'' . $this->zipname . '\' already open'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Open the zip file - if (($this->zip_fd = @fopen($this->zipname, $p_mode)) == 0) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \'' . $this->zipname . '\' in ' . $p_mode . ' mode'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privCloseFd() - // Description : - // Parameters : - // -------------------------------------------------------------------------------- - public function privCloseFd() - { - $v_result = 1; - - if ($this->zip_fd != 0) { - @fclose($this->zip_fd); - } - $this->zip_fd = 0; - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privAddList() - // Description : - // $p_add_dir and $p_remove_dir will give the ability to memorize a path which is - // different from the real path of the file. This is usefull if you want to have PclTar - // running in any directory, and memorize relative path from an other directory. - // Parameters : - // $p_list : An array containing the file or directory names to add in the tar - // $p_result_list : list of added files with their properties (specially the status field) - // $p_add_dir : Path to add in the filename path archived - // $p_remove_dir : Path to remove in the filename path archived - // Return Values : - // -------------------------------------------------------------------------------- - // function privAddList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options) - public function privAddList($p_filedescr_list, &$p_result_list, &$p_options) - { - $v_result = 1; - - // ----- Add the files - $v_header_list = array(); - if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1) { - // ----- Return - return $v_result; - } - - // ----- Store the offset of the central dir - $v_offset = @ftell($this->zip_fd); - - // ----- Create the Central Dir files header - for ($i = 0, $v_count = 0; $i < sizeof($v_header_list); $i++) { - // ----- Create the file header - if ($v_header_list[$i]['status'] == 'ok') { - if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) { - // ----- Return - return $v_result; - } - $v_count++; - } - - // ----- Transform the header to a 'usable' info - $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]); - } - - // ----- Zip file comment - $v_comment = ''; - if (isset($p_options[PCLZIP_OPT_COMMENT])) { - $v_comment = $p_options[PCLZIP_OPT_COMMENT]; - } - - // ----- Calculate the size of the central header - $v_size = @ftell($this->zip_fd) - $v_offset; - - // ----- Create the central dir footer - if (($v_result = $this->privWriteCentralHeader($v_count, $v_size, $v_offset, $v_comment)) != 1) { - // ----- Reset the file list - unset($v_header_list); - - // ----- Return - return $v_result; - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privAddFileList() - // Description : - // Parameters : - // $p_filedescr_list : An array containing the file description - // or directory names to add in the zip - // $p_result_list : list of added files with their properties (specially the status field) - // Return Values : - // -------------------------------------------------------------------------------- - public function privAddFileList($p_filedescr_list, &$p_result_list, &$p_options) - { - $v_result = 1; - $v_header = array(); - - // ----- Recuperate the current number of elt in list - $v_nb = sizeof($p_result_list); - - // ----- Loop on the files - for ($j = 0; ($j < sizeof($p_filedescr_list)) && ($v_result == 1); $j++) { - // ----- Format the filename - $p_filedescr_list[$j]['filename'] = PclZipUtilTranslateWinPath($p_filedescr_list[$j]['filename'], false); - - // ----- Skip empty file names - // TBC : Can this be possible ? not checked in DescrParseAtt ? - if ($p_filedescr_list[$j]['filename'] == "") { - continue; - } - - // ----- Check the filename - if (($p_filedescr_list[$j]['type'] != 'virtual_file') && (!file_exists($p_filedescr_list[$j]['filename']))) { - PclZip::privErrorLog(PCLZIP_ERR_MISSING_FILE, "File '" . $p_filedescr_list[$j]['filename'] . "' does not exist"); - - return PclZip::errorCode(); - } - - // ----- Look if it is a file or a dir with no all path remove option - // or a dir with all its path removed - // if ( (is_file($p_filedescr_list[$j]['filename'])) - // || ( is_dir($p_filedescr_list[$j]['filename']) - if (($p_filedescr_list[$j]['type'] == 'file') || ($p_filedescr_list[$j]['type'] == 'virtual_file') || (($p_filedescr_list[$j]['type'] == 'folder') && (!isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH]) || !$p_options[PCLZIP_OPT_REMOVE_ALL_PATH]))) { - - // ----- Add the file - $v_result = $this->privAddFile($p_filedescr_list[$j], $v_header, $p_options); - if ($v_result != 1) { - return $v_result; - } - - // ----- Store the file infos - $p_result_list[$v_nb++] = $v_header; - } - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privAddFile() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - public function privAddFile($p_filedescr, &$p_header, &$p_options) - { - $v_result = 1; - - // ----- Working variable - $p_filename = $p_filedescr['filename']; - - // TBC : Already done in the fileAtt check ... ? - if ($p_filename == "") { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_PARAMETER, "Invalid file list parameter (invalid or empty list)"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Look for a stored different filename - /* TBC : Removed - if (isset($p_filedescr['stored_filename'])) { - $v_stored_filename = $p_filedescr['stored_filename']; - } else { - $v_stored_filename = $p_filedescr['stored_filename']; - } - */ - - // ----- Set the file properties - clearstatcache(); - $p_header['version'] = 20; - $p_header['version_extracted'] = 10; - $p_header['flag'] = 0; - $p_header['compression'] = 0; - $p_header['crc'] = 0; - $p_header['compressed_size'] = 0; - $p_header['filename_len'] = strlen($p_filename); - $p_header['extra_len'] = 0; - $p_header['disk'] = 0; - $p_header['internal'] = 0; - $p_header['offset'] = 0; - $p_header['filename'] = $p_filename; - // TBC : Removed $p_header['stored_filename'] = $v_stored_filename; - $p_header['stored_filename'] = $p_filedescr['stored_filename']; - $p_header['extra'] = ''; - $p_header['status'] = 'ok'; - $p_header['index'] = -1; - - // ----- Look for regular file - if ($p_filedescr['type'] == 'file') { - $p_header['external'] = 0x00000000; - $p_header['size'] = filesize($p_filename); - - // ----- Look for regular folder - } elseif ($p_filedescr['type'] == 'folder') { - $p_header['external'] = 0x00000010; - $p_header['mtime'] = filemtime($p_filename); - $p_header['size'] = filesize($p_filename); - - // ----- Look for virtual file - } elseif ($p_filedescr['type'] == 'virtual_file') { - $p_header['external'] = 0x00000000; - $p_header['size'] = strlen($p_filedescr['content']); - } - - // ----- Look for filetime - if (isset($p_filedescr['mtime'])) { - $p_header['mtime'] = $p_filedescr['mtime']; - } elseif ($p_filedescr['type'] == 'virtual_file') { - $p_header['mtime'] = time(); - } else { - $p_header['mtime'] = filemtime($p_filename); - } - - // ------ Look for file comment - if (isset($p_filedescr['comment'])) { - $p_header['comment_len'] = strlen($p_filedescr['comment']); - $p_header['comment'] = $p_filedescr['comment']; - } else { - $p_header['comment_len'] = 0; - $p_header['comment'] = ''; - } - - // ----- Look for pre-add callback - if (isset($p_options[PCLZIP_CB_PRE_ADD])) { - - // ----- Generate a local information - $v_local_header = array(); - $this->privConvertHeader2FileInfo($p_header, $v_local_header); - - // ----- Call the callback - // Here I do not use call_user_func() because I need to send a reference to the - // header. - // eval('$v_result = '.$p_options[PCLZIP_CB_PRE_ADD].'(PCLZIP_CB_PRE_ADD, $v_local_header);'); - $v_result = $p_options[PCLZIP_CB_PRE_ADD](PCLZIP_CB_PRE_ADD, $v_local_header); - if ($v_result == 0) { - // ----- Change the file status - $p_header['status'] = "skipped"; - $v_result = 1; - } - - // ----- Update the informations - // Only some fields can be modified - if ($p_header['stored_filename'] != $v_local_header['stored_filename']) { - $p_header['stored_filename'] = PclZipUtilPathReduction($v_local_header['stored_filename']); - } - } - - // ----- Look for empty stored filename - if ($p_header['stored_filename'] == "") { - $p_header['status'] = "filtered"; - } - - // ----- Check the path length - if (strlen($p_header['stored_filename']) > 0xFF) { - $p_header['status'] = 'filename_too_long'; - } - - // ----- Look if no error, or file not skipped - if ($p_header['status'] == 'ok') { - - // ----- Look for a file - if ($p_filedescr['type'] == 'file') { - // ----- Look for using temporary file to zip - if ((!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_header['size'])))) { - $v_result = $this->privAddFileUsingTempFile($p_filedescr, $p_header, $p_options); - if ($v_result < PCLZIP_ERR_NO_ERROR) { - return $v_result; - } - - // ----- Use "in memory" zip algo - } else { - - // ----- Open the source file - if (($v_file = @fopen($p_filename, "rb")) == 0) { - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode"); - - return PclZip::errorCode(); - } - - // ----- Read the file content - $v_content = @fread($v_file, $p_header['size']); - - // ----- Close the file - @fclose($v_file); - - // ----- Calculate the CRC - $p_header['crc'] = @crc32($v_content); - - // ----- Look for no compression - if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) { - // ----- Set header parameters - $p_header['compressed_size'] = $p_header['size']; - $p_header['compression'] = 0; - - // ----- Look for normal compression - } else { - // ----- Compress the content - $v_content = @gzdeflate($v_content); - - // ----- Set header parameters - $p_header['compressed_size'] = strlen($v_content); - $p_header['compression'] = 8; - } - - // ----- Call the header generation - if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { - @fclose($v_file); - - return $v_result; - } - - // ----- Write the compressed (or not) content - @fwrite($this->zip_fd, $v_content, $p_header['compressed_size']); - - } - - // ----- Look for a virtual file (a file from string) - } elseif ($p_filedescr['type'] == 'virtual_file') { - - $v_content = $p_filedescr['content']; - - // ----- Calculate the CRC - $p_header['crc'] = @crc32($v_content); - - // ----- Look for no compression - if ($p_options[PCLZIP_OPT_NO_COMPRESSION]) { - // ----- Set header parameters - $p_header['compressed_size'] = $p_header['size']; - $p_header['compression'] = 0; - - // ----- Look for normal compression - } else { - // ----- Compress the content - $v_content = @gzdeflate($v_content); - - // ----- Set header parameters - $p_header['compressed_size'] = strlen($v_content); - $p_header['compression'] = 8; - } - - // ----- Call the header generation - if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { - @fclose($v_file); - - return $v_result; - } - - // ----- Write the compressed (or not) content - @fwrite($this->zip_fd, $v_content, $p_header['compressed_size']); - - // ----- Look for a directory - } elseif ($p_filedescr['type'] == 'folder') { - // ----- Look for directory last '/' - if (@substr($p_header['stored_filename'], -1) != '/') { - $p_header['stored_filename'] .= '/'; - } - - // ----- Set the file properties - $p_header['size'] = 0; - //$p_header['external'] = 0x41FF0010; // Value for a folder : to be checked - $p_header['external'] = 0x00000010; // Value for a folder : to be checked - - // ----- Call the header generation - if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { - return $v_result; - } - } - } - - // ----- Look for post-add callback - if (isset($p_options[PCLZIP_CB_POST_ADD])) { - - // ----- Generate a local information - $v_local_header = array(); - $this->privConvertHeader2FileInfo($p_header, $v_local_header); - - // ----- Call the callback - // Here I do not use call_user_func() because I need to send a reference to the - // header. - // eval('$v_result = '.$p_options[PCLZIP_CB_POST_ADD].'(PCLZIP_CB_POST_ADD, $v_local_header);'); - $v_result = $p_options[PCLZIP_CB_POST_ADD](PCLZIP_CB_POST_ADD, $v_local_header); - if ($v_result == 0) { - // ----- Ignored - $v_result = 1; - } - - // ----- Update the informations - // Nothing can be modified - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privAddFileUsingTempFile() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - public function privAddFileUsingTempFile($p_filedescr, &$p_header, &$p_options) - { - $v_result = PCLZIP_ERR_NO_ERROR; - - // ----- Working variable - $p_filename = $p_filedescr['filename']; - - // ----- Open the source file - if (($v_file = @fopen($p_filename, "rb")) == 0) { - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode"); - - return PclZip::errorCode(); - } - - // ----- Creates a compressed temporary file - $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR . uniqid('pclzip-') . '.gz'; - if (($v_file_compressed = @gzopen($v_gzip_temp_name, "wb")) == 0) { - fclose($v_file); - PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \'' . $v_gzip_temp_name . '\' in binary write mode'); - - return PclZip::errorCode(); - } - - // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks - $v_size = filesize($p_filename); - while ($v_size != 0) { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @fread($v_file, $v_read_size); - //$v_binary_data = pack('a'.$v_read_size, $v_buffer); - @gzputs($v_file_compressed, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Close the file - @fclose($v_file); - @gzclose($v_file_compressed); - - // ----- Check the minimum file size - if (filesize($v_gzip_temp_name) < 18) { - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'gzip temporary file \'' . $v_gzip_temp_name . '\' has invalid filesize - should be minimum 18 bytes'); - - return PclZip::errorCode(); - } - - // ----- Extract the compressed attributes - if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) { - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \'' . $v_gzip_temp_name . '\' in binary read mode'); - - return PclZip::errorCode(); - } - - // ----- Read the gzip file header - $v_binary_data = @fread($v_file_compressed, 10); - $v_data_header = unpack('a1id1/a1id2/a1cm/a1flag/Vmtime/a1xfl/a1os', $v_binary_data); - - // ----- Check some parameters - $v_data_header['os'] = bin2hex($v_data_header['os']); - - // ----- Read the gzip file footer - @fseek($v_file_compressed, filesize($v_gzip_temp_name) - 8); - $v_binary_data = @fread($v_file_compressed, 8); - $v_data_footer = unpack('Vcrc/Vcompressed_size', $v_binary_data); - - // ----- Set the attributes - $p_header['compression'] = ord($v_data_header['cm']); - //$p_header['mtime'] = $v_data_header['mtime']; - $p_header['crc'] = $v_data_footer['crc']; - $p_header['compressed_size'] = filesize($v_gzip_temp_name) - 18; - - // ----- Close the file - @fclose($v_file_compressed); - - // ----- Call the header generation - if (($v_result = $this->privWriteFileHeader($p_header)) != 1) { - return $v_result; - } - - // ----- Add the compressed data - if (($v_file_compressed = @fopen($v_gzip_temp_name, "rb")) == 0) { - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \'' . $v_gzip_temp_name . '\' in binary read mode'); - - return PclZip::errorCode(); - } - - // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks - fseek($v_file_compressed, 10); - $v_size = $p_header['compressed_size']; - while ($v_size != 0) { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @fread($v_file_compressed, $v_read_size); - //$v_binary_data = pack('a'.$v_read_size, $v_buffer); - @fwrite($this->zip_fd, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Close the file - @fclose($v_file_compressed); - - // ----- Unlink the temporary file - @unlink($v_gzip_temp_name); - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privCalculateStoredFilename() - // Description : - // Based on file descriptor properties and global options, this method - // calculate the filename that will be stored in the archive. - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - public function privCalculateStoredFilename(&$p_filedescr, &$p_options) - { - $v_result = 1; - - // ----- Working variables - $p_filename = $p_filedescr['filename']; - if (isset($p_options[PCLZIP_OPT_ADD_PATH])) { - $p_add_dir = $p_options[PCLZIP_OPT_ADD_PATH]; - } else { - $p_add_dir = ''; - } - if (isset($p_options[PCLZIP_OPT_REMOVE_PATH])) { - $p_remove_dir = $p_options[PCLZIP_OPT_REMOVE_PATH]; - } else { - $p_remove_dir = ''; - } - if (isset($p_options[PCLZIP_OPT_REMOVE_ALL_PATH])) { - $p_remove_all_dir = $p_options[PCLZIP_OPT_REMOVE_ALL_PATH]; - } else { - $p_remove_all_dir = 0; - } - - // ----- Look for full name change - if (isset($p_filedescr['new_full_name'])) { - // ----- Remove drive letter if any - $v_stored_filename = PclZipUtilTranslateWinPath($p_filedescr['new_full_name']); - - // ----- Look for path and/or short name change - } else { - - // ----- Look for short name change - // Its when we cahnge just the filename but not the path - if (isset($p_filedescr['new_short_name'])) { - $v_path_info = pathinfo($p_filename); - $v_dir = ''; - if ($v_path_info['dirname'] != '') { - $v_dir = $v_path_info['dirname'] . '/'; - } - $v_stored_filename = $v_dir . $p_filedescr['new_short_name']; - } else { - // ----- Calculate the stored filename - $v_stored_filename = $p_filename; - } - - // ----- Look for all path to remove - if ($p_remove_all_dir) { - $v_stored_filename = basename($p_filename); - - // ----- Look for partial path remove - } elseif ($p_remove_dir != "") { - if (substr($p_remove_dir, -1) != '/') { - $p_remove_dir .= "/"; - } - - if ((substr($p_filename, 0, 2) == "./") || (substr($p_remove_dir, 0, 2) == "./")) { - - if ((substr($p_filename, 0, 2) == "./") && (substr($p_remove_dir, 0, 2) != "./")) { - $p_remove_dir = "./" . $p_remove_dir; - } - if ((substr($p_filename, 0, 2) != "./") && (substr($p_remove_dir, 0, 2) == "./")) { - $p_remove_dir = substr($p_remove_dir, 2); - } - } - - $v_compare = PclZipUtilPathInclusion($p_remove_dir, $v_stored_filename); - if ($v_compare > 0) { - if ($v_compare == 2) { - $v_stored_filename = ""; - } else { - $v_stored_filename = substr($v_stored_filename, strlen($p_remove_dir)); - } - } - } - - // ----- Remove drive letter if any - $v_stored_filename = PclZipUtilTranslateWinPath($v_stored_filename); - - // ----- Look for path to add - if ($p_add_dir != "") { - if (substr($p_add_dir, -1) == "/") { - $v_stored_filename = $p_add_dir . $v_stored_filename; - } else { - $v_stored_filename = $p_add_dir . "/" . $v_stored_filename; - } - } - } - - // ----- Filename (reduce the path of stored name) - $v_stored_filename = PclZipUtilPathReduction($v_stored_filename); - $p_filedescr['stored_filename'] = $v_stored_filename; - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privWriteFileHeader() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - public function privWriteFileHeader(&$p_header) - { - $v_result = 1; - - // ----- Store the offset position of the file - $p_header['offset'] = ftell($this->zip_fd); - - // ----- Transform UNIX mtime to DOS format mdate/mtime - $v_date = getdate($p_header['mtime']); - $v_mtime = ($v_date['hours'] << 11) + ($v_date['minutes'] << 5) + $v_date['seconds'] / 2; - $v_mdate = (($v_date['year'] - 1980) << 9) + ($v_date['mon'] << 5) + $v_date['mday']; - - // ----- Packed data - $v_binary_data = pack("VvvvvvVVVvv", 0x04034b50, $p_header['version_extracted'], $p_header['flag'], $p_header['compression'], $v_mtime, $v_mdate, $p_header['crc'], $p_header['compressed_size'], $p_header['size'], strlen($p_header['stored_filename']), $p_header['extra_len']); - - // ----- Write the first 148 bytes of the header in the archive - fputs($this->zip_fd, $v_binary_data, 30); - - // ----- Write the variable fields - if (strlen($p_header['stored_filename']) != 0) { - fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename'])); - } - if ($p_header['extra_len'] != 0) { - fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']); - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privWriteCentralFileHeader() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - public function privWriteCentralFileHeader(&$p_header) - { - $v_result = 1; - - // TBC - //for (reset($p_header); $key = key($p_header); next($p_header)) { - //} - - // ----- Transform UNIX mtime to DOS format mdate/mtime - $v_date = getdate($p_header['mtime']); - $v_mtime = ($v_date['hours'] << 11) + ($v_date['minutes'] << 5) + $v_date['seconds'] / 2; - $v_mdate = (($v_date['year'] - 1980) << 9) + ($v_date['mon'] << 5) + $v_date['mday']; - - // ----- Packed data - $v_binary_data = pack("VvvvvvvVVVvvvvvVV", 0x02014b50, $p_header['version'], $p_header['version_extracted'], $p_header['flag'], $p_header['compression'], $v_mtime, $v_mdate, $p_header['crc'], $p_header['compressed_size'], $p_header['size'], strlen($p_header['stored_filename']), $p_header['extra_len'], $p_header['comment_len'], $p_header['disk'], $p_header['internal'], $p_header['external'], $p_header['offset']); - - // ----- Write the 42 bytes of the header in the zip file - fputs($this->zip_fd, $v_binary_data, 46); - - // ----- Write the variable fields - if (strlen($p_header['stored_filename']) != 0) { - fputs($this->zip_fd, $p_header['stored_filename'], strlen($p_header['stored_filename'])); - } - if ($p_header['extra_len'] != 0) { - fputs($this->zip_fd, $p_header['extra'], $p_header['extra_len']); - } - if ($p_header['comment_len'] != 0) { - fputs($this->zip_fd, $p_header['comment'], $p_header['comment_len']); - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privWriteCentralHeader() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - public function privWriteCentralHeader($p_nb_entries, $p_size, $p_offset, $p_comment) - { - $v_result = 1; - - // ----- Packed data - $v_binary_data = pack("VvvvvVVv", 0x06054b50, 0, 0, $p_nb_entries, $p_nb_entries, $p_size, $p_offset, strlen($p_comment)); - - // ----- Write the 22 bytes of the header in the zip file - fputs($this->zip_fd, $v_binary_data, 22); - - // ----- Write the variable fields - if (strlen($p_comment) != 0) { - fputs($this->zip_fd, $p_comment, strlen($p_comment)); - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privList() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - public function privList(&$p_list) - { - $v_result = 1; - - // ----- Magic quotes trick - $this->privDisableMagicQuotes(); - - // ----- Open the zip file - if (($this->zip_fd = @fopen($this->zipname, 'rb')) == 0) { - // ----- Magic quotes trick - $this->privSwapBackMagicQuotes(); - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive \'' . $this->zipname . '\' in binary read mode'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Read the central directory informations - $v_central_dir = array(); - if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { - $this->privSwapBackMagicQuotes(); - - return $v_result; - } - - // ----- Go to beginning of Central Dir - @rewind($this->zip_fd); - if (@fseek($this->zip_fd, $v_central_dir['offset'])) { - $this->privSwapBackMagicQuotes(); - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Read each entry - for ($i = 0; $i < $v_central_dir['entries']; $i++) { - // ----- Read the file header - if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1) { - $this->privSwapBackMagicQuotes(); - - return $v_result; - } - $v_header['index'] = $i; - - // ----- Get the only interesting attributes - $this->privConvertHeader2FileInfo($v_header, $p_list[$i]); - unset($v_header); - } - - // ----- Close the zip file - $this->privCloseFd(); - - // ----- Magic quotes trick - $this->privSwapBackMagicQuotes(); - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privConvertHeader2FileInfo() - // Description : - // This function takes the file informations from the central directory - // entries and extract the interesting parameters that will be given back. - // The resulting file infos are set in the array $p_info - // $p_info['filename'] : Filename with full path. Given by user (add), - // extracted in the filesystem (extract). - // $p_info['stored_filename'] : Stored filename in the archive. - // $p_info['size'] = Size of the file. - // $p_info['compressed_size'] = Compressed size of the file. - // $p_info['mtime'] = Last modification date of the file. - // $p_info['comment'] = Comment associated with the file. - // $p_info['folder'] = true/false : indicates if the entry is a folder or not. - // $p_info['status'] = status of the action on the file. - // $p_info['crc'] = CRC of the file content. - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - public function privConvertHeader2FileInfo($p_header, &$p_info) - { - $v_result = 1; - - // ----- Get the interesting attributes - $v_temp_path = PclZipUtilPathReduction($p_header['filename']); - $p_info['filename'] = $v_temp_path; - $v_temp_path = PclZipUtilPathReduction($p_header['stored_filename']); - $p_info['stored_filename'] = $v_temp_path; - $p_info['size'] = $p_header['size']; - $p_info['compressed_size'] = $p_header['compressed_size']; - $p_info['mtime'] = $p_header['mtime']; - $p_info['comment'] = $p_header['comment']; - $p_info['folder'] = (($p_header['external'] & 0x00000010) == 0x00000010); - $p_info['index'] = $p_header['index']; - $p_info['status'] = $p_header['status']; - $p_info['crc'] = $p_header['crc']; - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privExtractByRule() - // Description : - // Extract a file or directory depending of rules (by index, by name, ...) - // Parameters : - // $p_file_list : An array where will be placed the properties of each - // extracted file - // $p_path : Path to add while writing the extracted files - // $p_remove_path : Path to remove (from the file memorized path) while writing the - // extracted files. If the path does not match the file path, - // the file is extracted with its memorized path. - // $p_remove_path does not apply to 'list' mode. - // $p_path and $p_remove_path are commulative. - // Return Values : - // 1 on success,0 or less on error (see error code list) - // -------------------------------------------------------------------------------- - public function privExtractByRule(&$p_file_list, $p_path, $p_remove_path, $p_remove_all_path, &$p_options) - { - $v_result = 1; - - // ----- Magic quotes trick - $this->privDisableMagicQuotes(); - - // ----- Check the path - if (($p_path == "") || ((substr($p_path, 0, 1) != "/") && (substr($p_path, 0, 3) != "../") && (substr($p_path, 1, 2) != ":/"))) { - $p_path = "./" . $p_path; - } - - // ----- Reduce the path last (and duplicated) '/' - if (($p_path != "./") && ($p_path != "/")) { - // ----- Look for the path end '/' - while (substr($p_path, -1) == "/") { - $p_path = substr($p_path, 0, strlen($p_path) - 1); - } - } - - // ----- Look for path to remove format (should end by /) - if (($p_remove_path != "") && (substr($p_remove_path, -1) != '/')) { - $p_remove_path .= '/'; - } - $p_remove_path_size = strlen($p_remove_path); - - // ----- Open the zip file - if (($v_result = $this->privOpenFd('rb')) != 1) { - $this->privSwapBackMagicQuotes(); - - return $v_result; - } - - // ----- Read the central directory informations - $v_central_dir = array(); - if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { - // ----- Close the zip file - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - - return $v_result; - } - - // ----- Start at beginning of Central Dir - $v_pos_entry = $v_central_dir['offset']; - - // ----- Read each entry - $j_start = 0; - for ($i = 0, $v_nb_extracted = 0; $i < $v_central_dir['entries']; $i++) { - - // ----- Read next Central dir entry - @rewind($this->zip_fd); - if (@fseek($this->zip_fd, $v_pos_entry)) { - // ----- Close the zip file - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Read the file header - $v_header = array(); - if (($v_result = $this->privReadCentralFileHeader($v_header)) != 1) { - // ----- Close the zip file - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - - return $v_result; - } - - // ----- Store the index - $v_header['index'] = $i; - - // ----- Store the file position - $v_pos_entry = ftell($this->zip_fd); - - // ----- Look for the specific extract rules - $v_extract = false; - - // ----- Look for extract by name rule - if ((isset($p_options[PCLZIP_OPT_BY_NAME])) && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) { - - // ----- Look if the filename is in the list - for ($j = 0; ($j < sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_extract); $j++) { - - // ----- Look for a directory - if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") { - - // ----- Look if the directory is in the filename path - if ((strlen($v_header['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) && (substr($v_header['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) { - $v_extract = true; - } - - // ----- Look for a filename - } elseif ($v_header['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) { - $v_extract = true; - } - } - // ----- Look for extract by ereg rule - // ereg() is deprecated with PHP 5.3 - /* - elseif ( (isset($p_options[PCLZIP_OPT_BY_EREG])) - && ($p_options[PCLZIP_OPT_BY_EREG] != "")) { - - if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header['stored_filename'])) { - $v_extract = true; - } - } - */ - - // ----- Look for extract by preg rule - } elseif ((isset($p_options[PCLZIP_OPT_BY_PREG])) && ($p_options[PCLZIP_OPT_BY_PREG] != "")) { - - if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header['stored_filename'])) { - $v_extract = true; - } - - // ----- Look for extract by index rule - } elseif ((isset($p_options[PCLZIP_OPT_BY_INDEX])) && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { - - // ----- Look if the index is in the list - for ($j = $j_start; ($j < sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_extract); $j++) { - - if (($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i <= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { - $v_extract = true; - } - if ($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { - $j_start = $j + 1; - } - - if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start'] > $i) { - break; - } - } - - // ----- Look for no rule, which means extract all the archive - } else { - $v_extract = true; - } - - // ----- Check compression method - if (($v_extract) && (($v_header['compression'] != 8) && ($v_header['compression'] != 0))) { - $v_header['status'] = 'unsupported_compression'; - - // ----- Look for PCLZIP_OPT_STOP_ON_ERROR - if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { - - $this->privSwapBackMagicQuotes(); - - PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_COMPRESSION, "Filename '" . $v_header['stored_filename'] . "' is " . "compressed by an unsupported compression " . "method (" . $v_header['compression'] . ") "); - - return PclZip::errorCode(); - } - } - - // ----- Check encrypted files - if (($v_extract) && (($v_header['flag'] & 1) == 1)) { - $v_header['status'] = 'unsupported_encryption'; - - // ----- Look for PCLZIP_OPT_STOP_ON_ERROR - if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { - - $this->privSwapBackMagicQuotes(); - - PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, "Unsupported encryption for " . " filename '" . $v_header['stored_filename'] . "'"); - - return PclZip::errorCode(); - } - } - - // ----- Look for real extraction - if (($v_extract) && ($v_header['status'] != 'ok')) { - $v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++]); - if ($v_result != 1) { - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - - return $v_result; - } - - $v_extract = false; - } - - // ----- Look for real extraction - if ($v_extract) { - - // ----- Go to the file position - @rewind($this->zip_fd); - if (@fseek($this->zip_fd, $v_header['offset'])) { - // ----- Close the zip file - $this->privCloseFd(); - - $this->privSwapBackMagicQuotes(); - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Look for extraction as string - if ($p_options[PCLZIP_OPT_EXTRACT_AS_STRING]) { - - $v_string = ''; - - // ----- Extracting the file - $v_result1 = $this->privExtractFileAsString($v_header, $v_string, $p_options); - if ($v_result1 < 1) { - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - - return $v_result1; - } - - // ----- Get the only interesting attributes - if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted])) != 1) { - // ----- Close the zip file - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - - return $v_result; - } - - // ----- Set the file content - $p_file_list[$v_nb_extracted]['content'] = $v_string; - - // ----- Next extracted file - $v_nb_extracted++; - - // ----- Look for user callback abort - if ($v_result1 == 2) { - break; - } - - // ----- Look for extraction in standard output - } elseif ((isset($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) && ($p_options[PCLZIP_OPT_EXTRACT_IN_OUTPUT])) { - // ----- Extracting the file in standard output - $v_result1 = $this->privExtractFileInOutput($v_header, $p_options); - if ($v_result1 < 1) { - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - - return $v_result1; - } - - // ----- Get the only interesting attributes - if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) { - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - - return $v_result; - } - - // ----- Look for user callback abort - if ($v_result1 == 2) { - break; - } - - // ----- Look for normal extraction - } else { - // ----- Extracting the file - $v_result1 = $this->privExtractFile($v_header, $p_path, $p_remove_path, $p_remove_all_path, $p_options); - if ($v_result1 < 1) { - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - - return $v_result1; - } - - // ----- Get the only interesting attributes - if (($v_result = $this->privConvertHeader2FileInfo($v_header, $p_file_list[$v_nb_extracted++])) != 1) { - // ----- Close the zip file - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - - return $v_result; - } - - // ----- Look for user callback abort - if ($v_result1 == 2) { - break; - } - } - } - } - - // ----- Close the zip file - $this->privCloseFd(); - $this->privSwapBackMagicQuotes(); - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privExtractFile() - // Description : - // Parameters : - // Return Values : - // - // 1 : ... ? - // PCLZIP_ERR_USER_ABORTED(2) : User ask for extraction stop in callback - // -------------------------------------------------------------------------------- - public function privExtractFile(&$p_entry, $p_path, $p_remove_path, $p_remove_all_path, &$p_options) - { - $v_result = 1; - - // ----- Read the file header - if (($v_result = $this->privReadFileHeader($v_header)) != 1) { - // ----- Return - return $v_result; - } - - // ----- Check that the file header is coherent with $p_entry info - if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) { - // TBC - } - - // ----- Look for all path to remove - if ($p_remove_all_path == true) { - // ----- Look for folder entry that not need to be extracted - if (($p_entry['external'] & 0x00000010) == 0x00000010) { - - $p_entry['status'] = "filtered"; - - return $v_result; - } - - // ----- Get the basename of the path - $p_entry['filename'] = basename($p_entry['filename']); - - // ----- Look for path to remove - } elseif ($p_remove_path != "") { - if (PclZipUtilPathInclusion($p_remove_path, $p_entry['filename']) == 2) { - - // ----- Change the file status - $p_entry['status'] = "filtered"; - - // ----- Return - return $v_result; - } - - $p_remove_path_size = strlen($p_remove_path); - if (substr($p_entry['filename'], 0, $p_remove_path_size) == $p_remove_path) { - - // ----- Remove the path - $p_entry['filename'] = substr($p_entry['filename'], $p_remove_path_size); - - } - } - - // ----- Add the path - if ($p_path != '') { - $p_entry['filename'] = $p_path . "/" . $p_entry['filename']; - } - - // ----- Check a base_dir_restriction - if (isset($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION])) { - $v_inclusion = PclZipUtilPathInclusion($p_options[PCLZIP_OPT_EXTRACT_DIR_RESTRICTION], $p_entry['filename']); - if ($v_inclusion == 0) { - - PclZip::privErrorLog(PCLZIP_ERR_DIRECTORY_RESTRICTION, "Filename '" . $p_entry['filename'] . "' is " . "outside PCLZIP_OPT_EXTRACT_DIR_RESTRICTION"); - - return PclZip::errorCode(); - } - } - - // ----- Look for pre-extract callback - if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) { - - // ----- Generate a local information - $v_local_header = array(); - $this->privConvertHeader2FileInfo($p_entry, $v_local_header); - - // ----- Call the callback - // Here I do not use call_user_func() because I need to send a reference to the - // header. - // eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);'); - $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header); - if ($v_result == 0) { - // ----- Change the file status - $p_entry['status'] = "skipped"; - $v_result = 1; - } - - // ----- Look for abort result - if ($v_result == 2) { - // ----- This status is internal and will be changed in 'skipped' - $p_entry['status'] = "aborted"; - $v_result = PCLZIP_ERR_USER_ABORTED; - } - - // ----- Update the informations - // Only some fields can be modified - $p_entry['filename'] = $v_local_header['filename']; - } - - // ----- Look if extraction should be done - if ($p_entry['status'] == 'ok') { - - // ----- Look for specific actions while the file exist - if (file_exists($p_entry['filename'])) { - - // ----- Look if file is a directory - if (is_dir($p_entry['filename'])) { - - // ----- Change the file status - $p_entry['status'] = "already_a_directory"; - - // ----- Look for PCLZIP_OPT_STOP_ON_ERROR - // For historical reason first PclZip implementation does not stop - // when this kind of error occurs. - if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { - - PclZip::privErrorLog(PCLZIP_ERR_ALREADY_A_DIRECTORY, "Filename '" . $p_entry['filename'] . "' is " . "already used by an existing directory"); - - return PclZip::errorCode(); - } - - // ----- Look if file is write protected - } elseif (!is_writeable($p_entry['filename'])) { - - // ----- Change the file status - $p_entry['status'] = "write_protected"; - - // ----- Look for PCLZIP_OPT_STOP_ON_ERROR - // For historical reason first PclZip implementation does not stop - // when this kind of error occurs. - if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { - - PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, "Filename '" . $p_entry['filename'] . "' exists " . "and is write protected"); - - return PclZip::errorCode(); - } - - // ----- Look if the extracted file is older - } elseif (filemtime($p_entry['filename']) > $p_entry['mtime']) { - // ----- Change the file status - if ((isset($p_options[PCLZIP_OPT_REPLACE_NEWER])) && ($p_options[PCLZIP_OPT_REPLACE_NEWER] === true)) { - } else { - $p_entry['status'] = "newer_exist"; - - // ----- Look for PCLZIP_OPT_STOP_ON_ERROR - // For historical reason first PclZip implementation does not stop - // when this kind of error occurs. - if ((isset($p_options[PCLZIP_OPT_STOP_ON_ERROR])) && ($p_options[PCLZIP_OPT_STOP_ON_ERROR] === true)) { - - PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, "Newer version of '" . $p_entry['filename'] . "' exists " . "and option PCLZIP_OPT_REPLACE_NEWER is not selected"); - - return PclZip::errorCode(); - } - } - } else { - } - - // ----- Check the directory availability and create it if necessary - } else { - if ((($p_entry['external'] & 0x00000010) == 0x00000010) || (substr($p_entry['filename'], -1) == '/')) { - $v_dir_to_check = $p_entry['filename']; - } elseif (!strstr($p_entry['filename'], "/")) { - $v_dir_to_check = ""; - } else { - $v_dir_to_check = dirname($p_entry['filename']); - } - - if (($v_result = $this->privDirCheck($v_dir_to_check, (($p_entry['external'] & 0x00000010) == 0x00000010))) != 1) { - - // ----- Change the file status - $p_entry['status'] = "path_creation_fail"; - - // ----- Return - //return $v_result; - $v_result = 1; - } - } - } - - // ----- Look if extraction should be done - if ($p_entry['status'] == 'ok') { - - // ----- Do the extraction (if not a folder) - if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) { - // ----- Look for not compressed file - if ($p_entry['compression'] == 0) { - - // ----- Opening destination file - if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { - - // ----- Change the file status - $p_entry['status'] = "write_error"; - - // ----- Return - return $v_result; - } - - // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks - $v_size = $p_entry['compressed_size']; - while ($v_size != 0) { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @fread($this->zip_fd, $v_read_size); - /* Try to speed up the code - $v_binary_data = pack('a'.$v_read_size, $v_buffer); - @fwrite($v_dest_file, $v_binary_data, $v_read_size); - */ - @fwrite($v_dest_file, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Closing the destination file - fclose($v_dest_file); - - // ----- Change the file mtime - touch($p_entry['filename'], $p_entry['mtime']); - - } else { - // ----- TBC - // Need to be finished - if (($p_entry['flag'] & 1) == 1) { - PclZip::privErrorLog(PCLZIP_ERR_UNSUPPORTED_ENCRYPTION, 'File \'' . $p_entry['filename'] . '\' is encrypted. Encrypted files are not supported.'); - - return PclZip::errorCode(); - } - - // ----- Look for using temporary file to unzip - if ((!isset($p_options[PCLZIP_OPT_TEMP_FILE_OFF])) && (isset($p_options[PCLZIP_OPT_TEMP_FILE_ON]) || (isset($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD]) && ($p_options[PCLZIP_OPT_TEMP_FILE_THRESHOLD] <= $p_entry['size'])))) { - $v_result = $this->privExtractFileUsingTempFile($p_entry, $p_options); - if ($v_result < PCLZIP_ERR_NO_ERROR) { - return $v_result; - } - - // ----- Look for extract in memory - } else { - - // ----- Read the compressed file in a buffer (one shot) - $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); - - // ----- Decompress the file - $v_file_content = @gzinflate($v_buffer); - unset($v_buffer); - if ($v_file_content === false) { - - // ----- Change the file status - // TBC - $p_entry['status'] = "error"; - - return $v_result; - } - - // ----- Opening destination file - if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { - - // ----- Change the file status - $p_entry['status'] = "write_error"; - - return $v_result; - } - - // ----- Write the uncompressed data - @fwrite($v_dest_file, $v_file_content, $p_entry['size']); - unset($v_file_content); - - // ----- Closing the destination file - @fclose($v_dest_file); - - } - - // ----- Change the file mtime - @touch($p_entry['filename'], $p_entry['mtime']); - } - - // ----- Look for chmod option - if (isset($p_options[PCLZIP_OPT_SET_CHMOD])) { - - // ----- Change the mode of the file - @chmod($p_entry['filename'], $p_options[PCLZIP_OPT_SET_CHMOD]); - } - - } - } - - // ----- Change abort status - if ($p_entry['status'] == "aborted") { - $p_entry['status'] = "skipped"; - - // ----- Look for post-extract callback - } elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { - - // ----- Generate a local information - $v_local_header = array(); - $this->privConvertHeader2FileInfo($p_entry, $v_local_header); - - // ----- Call the callback - // Here I do not use call_user_func() because I need to send a reference to the - // header. - // eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);'); - $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header); - - // ----- Look for abort result - if ($v_result == 2) { - $v_result = PCLZIP_ERR_USER_ABORTED; - } - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privExtractFileUsingTempFile() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - public function privExtractFileUsingTempFile(&$p_entry, &$p_options) - { - $v_result = 1; - - // ----- Creates a temporary file - $v_gzip_temp_name = PCLZIP_TEMPORARY_DIR . uniqid('pclzip-') . '.gz'; - if (($v_dest_file = @fopen($v_gzip_temp_name, "wb")) == 0) { - fclose($v_file); - PclZip::privErrorLog(PCLZIP_ERR_WRITE_OPEN_FAIL, 'Unable to open temporary file \'' . $v_gzip_temp_name . '\' in binary write mode'); - - return PclZip::errorCode(); - } - - // ----- Write gz file format header - $v_binary_data = pack('va1a1Va1a1', 0x8b1f, Chr($p_entry['compression']), Chr(0x00), time(), Chr(0x00), Chr(3)); - @fwrite($v_dest_file, $v_binary_data, 10); - - // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks - $v_size = $p_entry['compressed_size']; - while ($v_size != 0) { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @fread($this->zip_fd, $v_read_size); - //$v_binary_data = pack('a'.$v_read_size, $v_buffer); - @fwrite($v_dest_file, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Write gz file format footer - $v_binary_data = pack('VV', $p_entry['crc'], $p_entry['size']); - @fwrite($v_dest_file, $v_binary_data, 8); - - // ----- Close the temporary file - @fclose($v_dest_file); - - // ----- Opening destination file - if (($v_dest_file = @fopen($p_entry['filename'], 'wb')) == 0) { - $p_entry['status'] = "write_error"; - - return $v_result; - } - - // ----- Open the temporary gz file - if (($v_src_file = @gzopen($v_gzip_temp_name, 'rb')) == 0) { - @fclose($v_dest_file); - $p_entry['status'] = "read_error"; - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \'' . $v_gzip_temp_name . '\' in binary read mode'); - - return PclZip::errorCode(); - } - - // ----- Read the file by PCLZIP_READ_BLOCK_SIZE octets blocks - $v_size = $p_entry['size']; - while ($v_size != 0) { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @gzread($v_src_file, $v_read_size); - //$v_binary_data = pack('a'.$v_read_size, $v_buffer); - @fwrite($v_dest_file, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - @fclose($v_dest_file); - @gzclose($v_src_file); - - // ----- Delete the temporary file - @unlink($v_gzip_temp_name); - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privExtractFileInOutput() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - public function privExtractFileInOutput(&$p_entry, &$p_options) - { - $v_result = 1; - - // ----- Read the file header - if (($v_result = $this->privReadFileHeader($v_header)) != 1) { - return $v_result; - } - - // ----- Check that the file header is coherent with $p_entry info - if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) { - // TBC - } - - // ----- Look for pre-extract callback - if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) { - - // ----- Generate a local information - $v_local_header = array(); - $this->privConvertHeader2FileInfo($p_entry, $v_local_header); - - // ----- Call the callback - // Here I do not use call_user_func() because I need to send a reference to the - // header. - // eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);'); - $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header); - if ($v_result == 0) { - // ----- Change the file status - $p_entry['status'] = "skipped"; - $v_result = 1; - } - - // ----- Look for abort result - if ($v_result == 2) { - // ----- This status is internal and will be changed in 'skipped' - $p_entry['status'] = "aborted"; - $v_result = PCLZIP_ERR_USER_ABORTED; - } - - // ----- Update the informations - // Only some fields can be modified - $p_entry['filename'] = $v_local_header['filename']; - } - - // ----- Trace - - // ----- Look if extraction should be done - if ($p_entry['status'] == 'ok') { - - // ----- Do the extraction (if not a folder) - if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) { - // ----- Look for not compressed file - if ($p_entry['compressed_size'] == $p_entry['size']) { - - // ----- Read the file in a buffer (one shot) - $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); - - // ----- Send the file to the output - echo $v_buffer; - unset($v_buffer); - } else { - - // ----- Read the compressed file in a buffer (one shot) - $v_buffer = @fread($this->zip_fd, $p_entry['compressed_size']); - - // ----- Decompress the file - $v_file_content = gzinflate($v_buffer); - unset($v_buffer); - - // ----- Send the file to the output - echo $v_file_content; - unset($v_file_content); - } - } - } - - // ----- Change abort status - if ($p_entry['status'] == "aborted") { - $p_entry['status'] = "skipped"; - - // ----- Look for post-extract callback - } elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { - - // ----- Generate a local information - $v_local_header = array(); - $this->privConvertHeader2FileInfo($p_entry, $v_local_header); - - // ----- Call the callback - // Here I do not use call_user_func() because I need to send a reference to the - // header. - // eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);'); - $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header); - - // ----- Look for abort result - if ($v_result == 2) { - $v_result = PCLZIP_ERR_USER_ABORTED; - } - } - - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privExtractFileAsString() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - public function privExtractFileAsString(&$p_entry, &$p_string, &$p_options) - { - $v_result = 1; - - // ----- Read the file header - $v_header = array(); - if (($v_result = $this->privReadFileHeader($v_header)) != 1) { - // ----- Return - return $v_result; - } - - // ----- Check that the file header is coherent with $p_entry info - if ($this->privCheckFileHeaders($v_header, $p_entry) != 1) { - // TBC - } - - // ----- Look for pre-extract callback - if (isset($p_options[PCLZIP_CB_PRE_EXTRACT])) { - - // ----- Generate a local information - $v_local_header = array(); - $this->privConvertHeader2FileInfo($p_entry, $v_local_header); - - // ----- Call the callback - // Here I do not use call_user_func() because I need to send a reference to the - // header. - // eval('$v_result = '.$p_options[PCLZIP_CB_PRE_EXTRACT].'(PCLZIP_CB_PRE_EXTRACT, $v_local_header);'); - $v_result = $p_options[PCLZIP_CB_PRE_EXTRACT](PCLZIP_CB_PRE_EXTRACT, $v_local_header); - if ($v_result == 0) { - // ----- Change the file status - $p_entry['status'] = "skipped"; - $v_result = 1; - } - - // ----- Look for abort result - if ($v_result == 2) { - // ----- This status is internal and will be changed in 'skipped' - $p_entry['status'] = "aborted"; - $v_result = PCLZIP_ERR_USER_ABORTED; - } - - // ----- Update the informations - // Only some fields can be modified - $p_entry['filename'] = $v_local_header['filename']; - } - - // ----- Look if extraction should be done - if ($p_entry['status'] == 'ok') { - - // ----- Do the extraction (if not a folder) - if (!(($p_entry['external'] & 0x00000010) == 0x00000010)) { - // ----- Look for not compressed file - // if ($p_entry['compressed_size'] == $p_entry['size']) - if ($p_entry['compression'] == 0) { - - // ----- Reading the file - $p_string = @fread($this->zip_fd, $p_entry['compressed_size']); - } else { - - // ----- Reading the file - $v_data = @fread($this->zip_fd, $p_entry['compressed_size']); - - // ----- Decompress the file - if (($p_string = @gzinflate($v_data)) === false) { - // TBC - } - } - - // ----- Trace - } else { - // TBC : error : can not extract a folder in a string - } - - } - - // ----- Change abort status - if ($p_entry['status'] == "aborted") { - $p_entry['status'] = "skipped"; - - // ----- Look for post-extract callback - } elseif (isset($p_options[PCLZIP_CB_POST_EXTRACT])) { - - // ----- Generate a local information - $v_local_header = array(); - $this->privConvertHeader2FileInfo($p_entry, $v_local_header); - - // ----- Swap the content to header - $v_local_header['content'] = $p_string; - $p_string = ''; - - // ----- Call the callback - // Here I do not use call_user_func() because I need to send a reference to the - // header. - // eval('$v_result = '.$p_options[PCLZIP_CB_POST_EXTRACT].'(PCLZIP_CB_POST_EXTRACT, $v_local_header);'); - $v_result = $p_options[PCLZIP_CB_POST_EXTRACT](PCLZIP_CB_POST_EXTRACT, $v_local_header); - - // ----- Swap back the content to header - $p_string = $v_local_header['content']; - unset($v_local_header['content']); - - // ----- Look for abort result - if ($v_result == 2) { - $v_result = PCLZIP_ERR_USER_ABORTED; - } - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privReadFileHeader() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - public function privReadFileHeader(&$p_header) - { - $v_result = 1; - - // ----- Read the 4 bytes signature - $v_binary_data = @fread($this->zip_fd, 4); - $v_data = unpack('Vid', $v_binary_data); - - // ----- Check signature - if ($v_data['id'] != 0x04034b50) { - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Read the first 42 bytes of the header - $v_binary_data = fread($this->zip_fd, 26); - - // ----- Look for invalid block size - if (strlen($v_binary_data) != 26) { - $p_header['filename'] = ""; - $p_header['status'] = "invalid_header"; - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : " . strlen($v_binary_data)); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Extract the values - $v_data = unpack('vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len', $v_binary_data); - - // ----- Get filename - $p_header['filename'] = fread($this->zip_fd, $v_data['filename_len']); - - // ----- Get extra_fields - if ($v_data['extra_len'] != 0) { - $p_header['extra'] = fread($this->zip_fd, $v_data['extra_len']); - } else { - $p_header['extra'] = ''; - } - - // ----- Extract properties - $p_header['version_extracted'] = $v_data['version']; - $p_header['compression'] = $v_data['compression']; - $p_header['size'] = $v_data['size']; - $p_header['compressed_size'] = $v_data['compressed_size']; - $p_header['crc'] = $v_data['crc']; - $p_header['flag'] = $v_data['flag']; - $p_header['filename_len'] = $v_data['filename_len']; - - // ----- Recuperate date in UNIX format - $p_header['mdate'] = $v_data['mdate']; - $p_header['mtime'] = $v_data['mtime']; - if ($p_header['mdate'] && $p_header['mtime']) { - // ----- Extract time - $v_hour = ($p_header['mtime'] & 0xF800) >> 11; - $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; - $v_seconde = ($p_header['mtime'] & 0x001F) * 2; - - // ----- Extract date - $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; - $v_month = ($p_header['mdate'] & 0x01E0) >> 5; - $v_day = $p_header['mdate'] & 0x001F; - - // ----- Get UNIX date format - $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year); - - } else { - $p_header['mtime'] = time(); - } - - // TBC - //for (reset($v_data); $key = key($v_data); next($v_data)) { - //} - - // ----- Set the stored filename - $p_header['stored_filename'] = $p_header['filename']; - - // ----- Set the status field - $p_header['status'] = "ok"; - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privReadCentralFileHeader() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - public function privReadCentralFileHeader(&$p_header) - { - $v_result = 1; - - // ----- Read the 4 bytes signature - $v_binary_data = @fread($this->zip_fd, 4); - $v_data = unpack('Vid', $v_binary_data); - - // ----- Check signature - if ($v_data['id'] != 0x02014b50) { - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Read the first 42 bytes of the header - $v_binary_data = fread($this->zip_fd, 42); - - // ----- Look for invalid block size - if (strlen($v_binary_data) != 42) { - $p_header['filename'] = ""; - $p_header['status'] = "invalid_header"; - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : " . strlen($v_binary_data)); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Extract the values - $p_header = unpack('vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset', $v_binary_data); - - // ----- Get filename - if ($p_header['filename_len'] != 0) { - $p_header['filename'] = fread($this->zip_fd, $p_header['filename_len']); - } else { - $p_header['filename'] = ''; - } - - // ----- Get extra - if ($p_header['extra_len'] != 0) { - $p_header['extra'] = fread($this->zip_fd, $p_header['extra_len']); - } else { - $p_header['extra'] = ''; - } - - // ----- Get comment - if ($p_header['comment_len'] != 0) { - $p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']); - } else { - $p_header['comment'] = ''; - } - - // ----- Extract properties - - // ----- Recuperate date in UNIX format - //if ($p_header['mdate'] && $p_header['mtime']) - // TBC : bug : this was ignoring time with 0/0/0 - if (1) { - // ----- Extract time - $v_hour = ($p_header['mtime'] & 0xF800) >> 11; - $v_minute = ($p_header['mtime'] & 0x07E0) >> 5; - $v_seconde = ($p_header['mtime'] & 0x001F) * 2; - - // ----- Extract date - $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980; - $v_month = ($p_header['mdate'] & 0x01E0) >> 5; - $v_day = $p_header['mdate'] & 0x001F; - - // ----- Get UNIX date format - $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year); - - } else { - $p_header['mtime'] = time(); - } - - // ----- Set the stored filename - $p_header['stored_filename'] = $p_header['filename']; - - // ----- Set default status to ok - $p_header['status'] = 'ok'; - - // ----- Look if it is a directory - if (substr($p_header['filename'], -1) == '/') { - //$p_header['external'] = 0x41FF0010; - $p_header['external'] = 0x00000010; - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privCheckFileHeaders() - // Description : - // Parameters : - // Return Values : - // 1 on success, - // 0 on error; - // -------------------------------------------------------------------------------- - public function privCheckFileHeaders(&$p_local_header, &$p_central_header) - { - $v_result = 1; - - // ----- Check the static values - // TBC - if ($p_local_header['filename'] != $p_central_header['filename']) { - } - if ($p_local_header['version_extracted'] != $p_central_header['version_extracted']) { - } - if ($p_local_header['flag'] != $p_central_header['flag']) { - } - if ($p_local_header['compression'] != $p_central_header['compression']) { - } - if ($p_local_header['mtime'] != $p_central_header['mtime']) { - } - if ($p_local_header['filename_len'] != $p_central_header['filename_len']) { - } - - // ----- Look for flag bit 3 - if (($p_local_header['flag'] & 8) == 8) { - $p_local_header['size'] = $p_central_header['size']; - $p_local_header['compressed_size'] = $p_central_header['compressed_size']; - $p_local_header['crc'] = $p_central_header['crc']; - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privReadEndCentralDir() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - public function privReadEndCentralDir(&$p_central_dir) - { - $v_result = 1; - - // ----- Go to the end of the zip file - $v_size = filesize($this->zipname); - @fseek($this->zip_fd, $v_size); - if (@ftell($this->zip_fd) != $v_size) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to go to the end of the archive \'' . $this->zipname . '\''); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- First try : look if this is an archive with no commentaries (most of the time) - // in this case the end of central dir is at 22 bytes of the file end - $v_found = 0; - if ($v_size > 26) { - @fseek($this->zip_fd, $v_size - 22); - if (($v_pos = @ftell($this->zip_fd)) != ($v_size - 22)) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \'' . $this->zipname . '\''); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Read for bytes - $v_binary_data = @fread($this->zip_fd, 4); - $v_data = @unpack('Vid', $v_binary_data); - - // ----- Check signature - if ($v_data['id'] == 0x06054b50) { - $v_found = 1; - } - - $v_pos = ftell($this->zip_fd); - } - - // ----- Go back to the maximum possible size of the Central Dir End Record - if (!$v_found) { - $v_maximum_size = 65557; // 0xFFFF + 22; - if ($v_maximum_size > $v_size) { - $v_maximum_size = $v_size; - } - @fseek($this->zip_fd, $v_size - $v_maximum_size); - if (@ftell($this->zip_fd) != ($v_size - $v_maximum_size)) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Unable to seek back to the middle of the archive \'' . $this->zipname . '\''); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Read byte per byte in order to find the signature - $v_pos = ftell($this->zip_fd); - $v_bytes = 0x00000000; - while ($v_pos < $v_size) { - // ----- Read a byte - $v_byte = @fread($this->zip_fd, 1); - - // ----- Add the byte - //$v_bytes = ($v_bytes << 8) | Ord($v_byte); - // Note we mask the old value down such that once shifted we can never end up with more than a 32bit number - // Otherwise on systems where we have 64bit integers the check below for the magic number will fail. - $v_bytes = (($v_bytes & 0xFFFFFF) << 8) | Ord($v_byte); - - // ----- Compare the bytes - if ($v_bytes == 0x504b0506) { - $v_pos++; - break; - } - - $v_pos++; - } - - // ----- Look if not found end of central dir - if ($v_pos == $v_size) { - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Unable to find End of Central Dir Record signature"); - - // ----- Return - return PclZip::errorCode(); - } - } - - // ----- Read the first 18 bytes of the header - $v_binary_data = fread($this->zip_fd, 18); - - // ----- Look for invalid block size - if (strlen($v_binary_data) != 18) { - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid End of Central Dir Record size : " . strlen($v_binary_data)); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Extract the values - $v_data = unpack('vdisk/vdisk_start/vdisk_entries/ventries/Vsize/Voffset/vcomment_size', $v_binary_data); - - // ----- Check the global size - if (($v_pos + $v_data['comment_size'] + 18) != $v_size) { - - // ----- Removed in release 2.2 see readme file - // The check of the file size is a little too strict. - // Some bugs where found when a zip is encrypted/decrypted with 'crypt'. - // While decrypted, zip has training 0 bytes - if (0) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'The central dir is not at the end of the archive.' . ' Some trailing bytes exists after the archive.'); - - // ----- Return - return PclZip::errorCode(); - } - } - - // ----- Get comment - if ($v_data['comment_size'] != 0) { - $p_central_dir['comment'] = fread($this->zip_fd, $v_data['comment_size']); - } else { - $p_central_dir['comment'] = ''; - } - - $p_central_dir['entries'] = $v_data['entries']; - $p_central_dir['disk_entries'] = $v_data['disk_entries']; - $p_central_dir['offset'] = $v_data['offset']; - $p_central_dir['size'] = $v_data['size']; - $p_central_dir['disk'] = $v_data['disk']; - $p_central_dir['disk_start'] = $v_data['disk_start']; - - // TBC - //for (reset($p_central_dir); $key = key($p_central_dir); next($p_central_dir)) { - //} - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privDeleteByRule() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - public function privDeleteByRule(&$p_result_list, &$p_options) - { - $v_result = 1; - $v_list_detail = array(); - - // ----- Open the zip file - if (($v_result = $this->privOpenFd('rb')) != 1) { - // ----- Return - return $v_result; - } - - // ----- Read the central directory informations - $v_central_dir = array(); - if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { - $this->privCloseFd(); - - return $v_result; - } - - // ----- Go to beginning of File - @rewind($this->zip_fd); - - // ----- Scan all the files - // ----- Start at beginning of Central Dir - $v_pos_entry = $v_central_dir['offset']; - @rewind($this->zip_fd); - if (@fseek($this->zip_fd, $v_pos_entry)) { - // ----- Close the zip file - $this->privCloseFd(); - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Read each entry - $v_header_list = array(); - $j_start = 0; - for ($i = 0, $v_nb_extracted = 0; $i < $v_central_dir['entries']; $i++) { - - // ----- Read the file header - $v_header_list[$v_nb_extracted] = array(); - if (($v_result = $this->privReadCentralFileHeader($v_header_list[$v_nb_extracted])) != 1) { - // ----- Close the zip file - $this->privCloseFd(); - - return $v_result; - } - - // ----- Store the index - $v_header_list[$v_nb_extracted]['index'] = $i; - - // ----- Look for the specific extract rules - $v_found = false; - - // ----- Look for extract by name rule - if ((isset($p_options[PCLZIP_OPT_BY_NAME])) && ($p_options[PCLZIP_OPT_BY_NAME] != 0)) { - - // ----- Look if the filename is in the list - for ($j = 0; ($j < sizeof($p_options[PCLZIP_OPT_BY_NAME])) && (!$v_found); $j++) { - - // ----- Look for a directory - if (substr($p_options[PCLZIP_OPT_BY_NAME][$j], -1) == "/") { - - // ----- Look if the directory is in the filename path - if ((strlen($v_header_list[$v_nb_extracted]['stored_filename']) > strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) && (substr($v_header_list[$v_nb_extracted]['stored_filename'], 0, strlen($p_options[PCLZIP_OPT_BY_NAME][$j])) == $p_options[PCLZIP_OPT_BY_NAME][$j])) { - $v_found = true; - } elseif ((($v_header_list[$v_nb_extracted]['external'] & 0x00000010) == 0x00000010) /* Indicates a folder */ && ($v_header_list[$v_nb_extracted]['stored_filename'] . '/' == $p_options[PCLZIP_OPT_BY_NAME][$j])) { - $v_found = true; - } - - // ----- Look for a filename - } elseif ($v_header_list[$v_nb_extracted]['stored_filename'] == $p_options[PCLZIP_OPT_BY_NAME][$j]) { - $v_found = true; - } - } - - // ----- Look for extract by ereg rule - // ereg() is deprecated with PHP 5.3 - /* - elseif ( (isset($p_options[PCLZIP_OPT_BY_EREG])) - && ($p_options[PCLZIP_OPT_BY_EREG] != "")) { - - if (ereg($p_options[PCLZIP_OPT_BY_EREG], $v_header_list[$v_nb_extracted]['stored_filename'])) { - $v_found = true; - } - } - */ - - // ----- Look for extract by preg rule - } elseif ((isset($p_options[PCLZIP_OPT_BY_PREG])) && ($p_options[PCLZIP_OPT_BY_PREG] != "")) { - - if (preg_match($p_options[PCLZIP_OPT_BY_PREG], $v_header_list[$v_nb_extracted]['stored_filename'])) { - $v_found = true; - } - - // ----- Look for extract by index rule - } elseif ((isset($p_options[PCLZIP_OPT_BY_INDEX])) && ($p_options[PCLZIP_OPT_BY_INDEX] != 0)) { - - // ----- Look if the index is in the list - for ($j = $j_start; ($j < sizeof($p_options[PCLZIP_OPT_BY_INDEX])) && (!$v_found); $j++) { - - if (($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['start']) && ($i <= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end'])) { - $v_found = true; - } - if ($i >= $p_options[PCLZIP_OPT_BY_INDEX][$j]['end']) { - $j_start = $j + 1; - } - - if ($p_options[PCLZIP_OPT_BY_INDEX][$j]['start'] > $i) { - break; - } - } - } else { - $v_found = true; - } - - // ----- Look for deletion - if ($v_found) { - unset($v_header_list[$v_nb_extracted]); - } else { - $v_nb_extracted++; - } - } - - // ----- Look if something need to be deleted - if ($v_nb_extracted > 0) { - - // ----- Creates a temporay file - $v_zip_temp_name = PCLZIP_TEMPORARY_DIR . uniqid('pclzip-') . '.tmp'; - - // ----- Creates a temporary zip archive - $v_temp_zip = new PclZip($v_zip_temp_name); - - // ----- Open the temporary zip file in write mode - if (($v_result = $v_temp_zip->privOpenFd('wb')) != 1) { - $this->privCloseFd(); - - // ----- Return - return $v_result; - } - - // ----- Look which file need to be kept - for ($i = 0; $i < sizeof($v_header_list); $i++) { - - // ----- Calculate the position of the header - @rewind($this->zip_fd); - if (@fseek($this->zip_fd, $v_header_list[$i]['offset'])) { - // ----- Close the zip file - $this->privCloseFd(); - $v_temp_zip->privCloseFd(); - @unlink($v_zip_temp_name); - - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_INVALID_ARCHIVE_ZIP, 'Invalid archive size'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Read the file header - $v_local_header = array(); - if (($v_result = $this->privReadFileHeader($v_local_header)) != 1) { - // ----- Close the zip file - $this->privCloseFd(); - $v_temp_zip->privCloseFd(); - @unlink($v_zip_temp_name); - - // ----- Return - return $v_result; - } - - // ----- Check that local file header is same as central file header - if ($this->privCheckFileHeaders($v_local_header, $v_header_list[$i]) != 1) { - // TBC - } - unset($v_local_header); - - // ----- Write the file header - if (($v_result = $v_temp_zip->privWriteFileHeader($v_header_list[$i])) != 1) { - // ----- Close the zip file - $this->privCloseFd(); - $v_temp_zip->privCloseFd(); - @unlink($v_zip_temp_name); - - // ----- Return - return $v_result; - } - - // ----- Read/write the data block - if (($v_result = PclZipUtilCopyBlock($this->zip_fd, $v_temp_zip->zip_fd, $v_header_list[$i]['compressed_size'])) != 1) { - // ----- Close the zip file - $this->privCloseFd(); - $v_temp_zip->privCloseFd(); - @unlink($v_zip_temp_name); - - // ----- Return - return $v_result; - } - } - - // ----- Store the offset of the central dir - $v_offset = @ftell($v_temp_zip->zip_fd); - - // ----- Re-Create the Central Dir files header - for ($i = 0; $i < sizeof($v_header_list); $i++) { - // ----- Create the file header - if (($v_result = $v_temp_zip->privWriteCentralFileHeader($v_header_list[$i])) != 1) { - $v_temp_zip->privCloseFd(); - $this->privCloseFd(); - @unlink($v_zip_temp_name); - - // ----- Return - return $v_result; - } - - // ----- Transform the header to a 'usable' info - $v_temp_zip->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]); - } - - // ----- Zip file comment - $v_comment = ''; - if (isset($p_options[PCLZIP_OPT_COMMENT])) { - $v_comment = $p_options[PCLZIP_OPT_COMMENT]; - } - - // ----- Calculate the size of the central header - $v_size = @ftell($v_temp_zip->zip_fd) - $v_offset; - - // ----- Create the central dir footer - if (($v_result = $v_temp_zip->privWriteCentralHeader(sizeof($v_header_list), $v_size, $v_offset, $v_comment)) != 1) { - // ----- Reset the file list - unset($v_header_list); - $v_temp_zip->privCloseFd(); - $this->privCloseFd(); - @unlink($v_zip_temp_name); - - // ----- Return - return $v_result; - } - - // ----- Close - $v_temp_zip->privCloseFd(); - $this->privCloseFd(); - - // ----- Delete the zip file - // TBC : I should test the result ... - @unlink($this->zipname); - - // ----- Rename the temporary file - // TBC : I should test the result ... - //@rename($v_zip_temp_name, $this->zipname); - PclZipUtilRename($v_zip_temp_name, $this->zipname); - - // ----- Destroy the temporary archive - unset($v_temp_zip); - - // ----- Remove every files : reset the file - } elseif ($v_central_dir['entries'] != 0) { - $this->privCloseFd(); - - if (($v_result = $this->privOpenFd('wb')) != 1) { - return $v_result; - } - - if (($v_result = $this->privWriteCentralHeader(0, 0, 0, '')) != 1) { - return $v_result; - } - - $this->privCloseFd(); - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privDirCheck() - // Description : - // Check if a directory exists, if not it creates it and all the parents directory - // which may be useful. - // Parameters : - // $p_dir : Directory path to check. - // Return Values : - // 1 : OK - // -1 : Unable to create directory - // -------------------------------------------------------------------------------- - public function privDirCheck($p_dir, $p_is_dir = false) - { - $v_result = 1; - - // ----- Remove the final '/' - if (($p_is_dir) && (substr($p_dir, -1) == '/')) { - $p_dir = substr($p_dir, 0, strlen($p_dir) - 1); - } - - // ----- Check the directory availability - if ((is_dir($p_dir)) || ($p_dir == "")) { - return 1; - } - - // ----- Extract parent directory - $p_parent_dir = dirname($p_dir); - - // ----- Just a check - if ($p_parent_dir != $p_dir) { - // ----- Look for parent directory - if ($p_parent_dir != "") { - if (($v_result = $this->privDirCheck($p_parent_dir)) != 1) { - return $v_result; - } - } - } - - // ----- Create the directory - if (!@mkdir($p_dir, 0777)) { - // ----- Error log - PclZip::privErrorLog(PCLZIP_ERR_DIR_CREATE_FAIL, "Unable to create directory '$p_dir'"); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privMerge() - // Description : - // If $p_archive_to_add does not exist, the function exit with a success result. - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - public function privMerge(&$p_archive_to_add) - { - $v_result = 1; - - // ----- Look if the archive_to_add exists - if (!is_file($p_archive_to_add->zipname)) { - - // ----- Nothing to merge, so merge is a success - $v_result = 1; - - // ----- Return - return $v_result; - } - - // ----- Look if the archive exists - if (!is_file($this->zipname)) { - - // ----- Do a duplicate - $v_result = $this->privDuplicate($p_archive_to_add->zipname); - - // ----- Return - return $v_result; - } - - // ----- Open the zip file - if (($v_result = $this->privOpenFd('rb')) != 1) { - // ----- Return - return $v_result; - } - - // ----- Read the central directory informations - $v_central_dir = array(); - if (($v_result = $this->privReadEndCentralDir($v_central_dir)) != 1) { - $this->privCloseFd(); - - return $v_result; - } - - // ----- Go to beginning of File - @rewind($this->zip_fd); - - // ----- Open the archive_to_add file - if (($v_result = $p_archive_to_add->privOpenFd('rb')) != 1) { - $this->privCloseFd(); - - // ----- Return - return $v_result; - } - - // ----- Read the central directory informations - $v_central_dir_to_add = array(); - if (($v_result = $p_archive_to_add->privReadEndCentralDir($v_central_dir_to_add)) != 1) { - $this->privCloseFd(); - $p_archive_to_add->privCloseFd(); - - return $v_result; - } - - // ----- Go to beginning of File - @rewind($p_archive_to_add->zip_fd); - - // ----- Creates a temporay file - $v_zip_temp_name = PCLZIP_TEMPORARY_DIR . uniqid('pclzip-') . '.tmp'; - - // ----- Open the temporary file in write mode - if (($v_zip_temp_fd = @fopen($v_zip_temp_name, 'wb')) == 0) { - $this->privCloseFd(); - $p_archive_to_add->privCloseFd(); - - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open temporary file \'' . $v_zip_temp_name . '\' in binary write mode'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Copy the files from the archive to the temporary file - // TBC : Here I should better append the file and go back to erase the central dir - $v_size = $v_central_dir['offset']; - while ($v_size != 0) { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = fread($this->zip_fd, $v_read_size); - @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Copy the files from the archive_to_add into the temporary file - $v_size = $v_central_dir_to_add['offset']; - while ($v_size != 0) { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = fread($p_archive_to_add->zip_fd, $v_read_size); - @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Store the offset of the central dir - $v_offset = @ftell($v_zip_temp_fd); - - // ----- Copy the block of file headers from the old archive - $v_size = $v_central_dir['size']; - while ($v_size != 0) { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @fread($this->zip_fd, $v_read_size); - @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Copy the block of file headers from the archive_to_add - $v_size = $v_central_dir_to_add['size']; - while ($v_size != 0) { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @fread($p_archive_to_add->zip_fd, $v_read_size); - @fwrite($v_zip_temp_fd, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Merge the file comments - $v_comment = $v_central_dir['comment'] . ' ' . $v_central_dir_to_add['comment']; - - // ----- Calculate the size of the (new) central header - $v_size = @ftell($v_zip_temp_fd) - $v_offset; - - // ----- Swap the file descriptor - // Here is a trick : I swap the temporary fd with the zip fd, in order to use - // the following methods on the temporary fil and not the real archive fd - $v_swap = $this->zip_fd; - $this->zip_fd = $v_zip_temp_fd; - $v_zip_temp_fd = $v_swap; - - // ----- Create the central dir footer - if (($v_result = $this->privWriteCentralHeader($v_central_dir['entries'] + $v_central_dir_to_add['entries'], $v_size, $v_offset, $v_comment)) != 1) { - $this->privCloseFd(); - $p_archive_to_add->privCloseFd(); - @fclose($v_zip_temp_fd); - $this->zip_fd = null; - - // ----- Reset the file list - unset($v_header_list); - - // ----- Return - return $v_result; - } - - // ----- Swap back the file descriptor - $v_swap = $this->zip_fd; - $this->zip_fd = $v_zip_temp_fd; - $v_zip_temp_fd = $v_swap; - - // ----- Close - $this->privCloseFd(); - $p_archive_to_add->privCloseFd(); - - // ----- Close the temporary file - @fclose($v_zip_temp_fd); - - // ----- Delete the zip file - // TBC : I should test the result ... - @unlink($this->zipname); - - // ----- Rename the temporary file - // TBC : I should test the result ... - //@rename($v_zip_temp_name, $this->zipname); - PclZipUtilRename($v_zip_temp_name, $this->zipname); - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privDuplicate() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - public function privDuplicate($p_archive_filename) - { - $v_result = 1; - - // ----- Look if the $p_archive_filename exists - if (!is_file($p_archive_filename)) { - - // ----- Nothing to duplicate, so duplicate is a success. - $v_result = 1; - - // ----- Return - return $v_result; - } - - // ----- Open the zip file - if (($v_result = $this->privOpenFd('wb')) != 1) { - // ----- Return - return $v_result; - } - - // ----- Open the temporary file in write mode - if (($v_zip_temp_fd = @fopen($p_archive_filename, 'rb')) == 0) { - $this->privCloseFd(); - - PclZip::privErrorLog(PCLZIP_ERR_READ_OPEN_FAIL, 'Unable to open archive file \'' . $p_archive_filename . '\' in binary write mode'); - - // ----- Return - return PclZip::errorCode(); - } - - // ----- Copy the files from the archive to the temporary file - // TBC : Here I should better append the file and go back to erase the central dir - $v_size = filesize($p_archive_filename); - while ($v_size != 0) { - $v_read_size = ($v_size < PCLZIP_READ_BLOCK_SIZE ? $v_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = fread($v_zip_temp_fd, $v_read_size); - @fwrite($this->zip_fd, $v_buffer, $v_read_size); - $v_size -= $v_read_size; - } - - // ----- Close - $this->privCloseFd(); - - // ----- Close the temporary file - @fclose($v_zip_temp_fd); - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privErrorLog() - // Description : - // Parameters : - // -------------------------------------------------------------------------------- - public function privErrorLog($p_error_code = 0, $p_error_string = '') - { - if (PCLZIP_ERROR_EXTERNAL == 1) { - PclError($p_error_code, $p_error_string); - } else { - $this->error_code = $p_error_code; - $this->error_string = $p_error_string; - } - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privErrorReset() - // Description : - // Parameters : - // -------------------------------------------------------------------------------- - public function privErrorReset() - { - if (PCLZIP_ERROR_EXTERNAL == 1) { - PclErrorReset(); - } else { - $this->error_code = 0; - $this->error_string = ''; - } - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privDisableMagicQuotes() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - public function privDisableMagicQuotes() - { - $v_result = 1; - - // ----- Look if function exists - if ((!function_exists("get_magic_quotes_runtime")) || (!function_exists("set_magic_quotes_runtime"))) { - return $v_result; - } - - // ----- Look if already done - if ($this->magic_quotes_status != -1) { - return $v_result; - } - - // ----- Get and memorize the magic_quote value - $this->magic_quotes_status = @get_magic_quotes_runtime(); - - // ----- Disable magic_quotes - if ($this->magic_quotes_status == 1) { - @set_magic_quotes_runtime(0); - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- - - // -------------------------------------------------------------------------------- - // Function : privSwapBackMagicQuotes() - // Description : - // Parameters : - // Return Values : - // -------------------------------------------------------------------------------- - public function privSwapBackMagicQuotes() - { - $v_result = 1; - - // ----- Look if function exists - if ((!function_exists("get_magic_quotes_runtime")) || (!function_exists("set_magic_quotes_runtime"))) { - return $v_result; - } - - // ----- Look if something to do - if ($this->magic_quotes_status != -1) { - return $v_result; - } - - // ----- Swap back magic_quotes - if ($this->magic_quotes_status == 1) { - @set_magic_quotes_runtime($this->magic_quotes_status); - } - - // ----- Return - return $v_result; - } - // -------------------------------------------------------------------------------- -} - -// End of class -// -------------------------------------------------------------------------------- - -// -------------------------------------------------------------------------------- -// Function : PclZipUtilPathReduction() -// Description : -// Parameters : -// Return Values : -// -------------------------------------------------------------------------------- -function PclZipUtilPathReduction($p_dir) -{ - $v_result = ""; - - // ----- Look for not empty path - if ($p_dir != "") { - // ----- Explode path by directory names - $v_list = explode("/", $p_dir); - - // ----- Study directories from last to first - $v_skip = 0; - for ($i = sizeof($v_list) - 1; $i >= 0; $i--) { - // ----- Look for current path - if ($v_list[$i] == ".") { - // ----- Ignore this directory - // Should be the first $i=0, but no check is done - } elseif ($v_list[$i] == "..") { - $v_skip++; - } elseif ($v_list[$i] == "") { - // ----- First '/' i.e. root slash - if ($i == 0) { - $v_result = "/" . $v_result; - if ($v_skip > 0) { - // ----- It is an invalid path, so the path is not modified - // TBC - $v_result = $p_dir; - $v_skip = 0; - } - - // ----- Last '/' i.e. indicates a directory - } elseif ($i == (sizeof($v_list) - 1)) { - $v_result = $v_list[$i]; - - // ----- Double '/' inside the path - } else { - // ----- Ignore only the double '//' in path, - // but not the first and last '/' - } - } else { - // ----- Look for item to skip - if ($v_skip > 0) { - $v_skip--; - } else { - $v_result = $v_list[$i] . ($i != (sizeof($v_list) - 1) ? "/" . $v_result : ""); - } - } - } - - // ----- Look for skip - if ($v_skip > 0) { - while ($v_skip > 0) { - $v_result = '../' . $v_result; - $v_skip--; - } - } - } - - // ----- Return - return $v_result; -} -// -------------------------------------------------------------------------------- - -// -------------------------------------------------------------------------------- -// Function : PclZipUtilPathInclusion() -// Description : -// This function indicates if the path $p_path is under the $p_dir tree. Or, -// said in an other way, if the file or sub-dir $p_path is inside the dir -// $p_dir. -// The function indicates also if the path is exactly the same as the dir. -// This function supports path with duplicated '/' like '//', but does not -// support '.' or '..' statements. -// Parameters : -// Return Values : -// 0 if $p_path is not inside directory $p_dir -// 1 if $p_path is inside directory $p_dir -// 2 if $p_path is exactly the same as $p_dir -// -------------------------------------------------------------------------------- -function PclZipUtilPathInclusion($p_dir, $p_path) -{ - $v_result = 1; - - // ----- Look for path beginning by ./ - if (($p_dir == '.') || ((strlen($p_dir) >= 2) && (substr($p_dir, 0, 2) == './'))) { - $p_dir = PclZipUtilTranslateWinPath(getcwd(), false) . '/' . substr($p_dir, 1); - } - if (($p_path == '.') || ((strlen($p_path) >= 2) && (substr($p_path, 0, 2) == './'))) { - $p_path = PclZipUtilTranslateWinPath(getcwd(), false) . '/' . substr($p_path, 1); - } - - // ----- Explode dir and path by directory separator - $v_list_dir = explode("/", $p_dir); - $v_list_dir_size = sizeof($v_list_dir); - $v_list_path = explode("/", $p_path); - $v_list_path_size = sizeof($v_list_path); - - // ----- Study directories paths - $i = 0; - $j = 0; - while (($i < $v_list_dir_size) && ($j < $v_list_path_size) && ($v_result)) { - - // ----- Look for empty dir (path reduction) - if ($v_list_dir[$i] == '') { - $i++; - continue; - } - if ($v_list_path[$j] == '') { - $j++; - continue; - } - - // ----- Compare the items - if (($v_list_dir[$i] != $v_list_path[$j]) && ($v_list_dir[$i] != '') && ($v_list_path[$j] != '')) { - $v_result = 0; - } - - // ----- Next items - $i++; - $j++; - } - - // ----- Look if everything seems to be the same - if ($v_result) { - // ----- Skip all the empty items - while (($j < $v_list_path_size) && ($v_list_path[$j] == '')) { - $j++; - } - while (($i < $v_list_dir_size) && ($v_list_dir[$i] == '')) { - $i++; - } - - if (($i >= $v_list_dir_size) && ($j >= $v_list_path_size)) { - // ----- There are exactly the same - $v_result = 2; - } elseif ($i < $v_list_dir_size) { - // ----- The path is shorter than the dir - $v_result = 0; - } - } - - // ----- Return - return $v_result; -} -// -------------------------------------------------------------------------------- - -// -------------------------------------------------------------------------------- -// Function : PclZipUtilCopyBlock() -// Description : -// Parameters : -// $p_mode : read/write compression mode -// 0 : src & dest normal -// 1 : src gzip, dest normal -// 2 : src normal, dest gzip -// 3 : src & dest gzip -// Return Values : -// -------------------------------------------------------------------------------- -function PclZipUtilCopyBlock($p_src, $p_dest, $p_size, $p_mode = 0) -{ - $v_result = 1; - - if ($p_mode == 0) { - while ($p_size != 0) { - $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @fread($p_src, $v_read_size); - @fwrite($p_dest, $v_buffer, $v_read_size); - $p_size -= $v_read_size; - } - } elseif ($p_mode == 1) { - while ($p_size != 0) { - $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @gzread($p_src, $v_read_size); - @fwrite($p_dest, $v_buffer, $v_read_size); - $p_size -= $v_read_size; - } - } elseif ($p_mode == 2) { - while ($p_size != 0) { - $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @fread($p_src, $v_read_size); - @gzwrite($p_dest, $v_buffer, $v_read_size); - $p_size -= $v_read_size; - } - } elseif ($p_mode == 3) { - while ($p_size != 0) { - $v_read_size = ($p_size < PCLZIP_READ_BLOCK_SIZE ? $p_size : PCLZIP_READ_BLOCK_SIZE); - $v_buffer = @gzread($p_src, $v_read_size); - @gzwrite($p_dest, $v_buffer, $v_read_size); - $p_size -= $v_read_size; - } - } - - // ----- Return - return $v_result; -} -// -------------------------------------------------------------------------------- - -// -------------------------------------------------------------------------------- -// Function : PclZipUtilRename() -// Description : -// This function tries to do a simple rename() function. If it fails, it -// tries to copy the $p_src file in a new $p_dest file and then unlink the -// first one. -// Parameters : -// $p_src : Old filename -// $p_dest : New filename -// Return Values : -// 1 on success, 0 on failure. -// -------------------------------------------------------------------------------- -function PclZipUtilRename($p_src, $p_dest) -{ - $v_result = 1; - - // ----- Try to rename the files - if (!@rename($p_src, $p_dest)) { - - // ----- Try to copy & unlink the src - if (!@copy($p_src, $p_dest)) { - $v_result = 0; - } elseif (!@unlink($p_src)) { - $v_result = 0; - } - } - - // ----- Return - return $v_result; -} -// -------------------------------------------------------------------------------- - -// -------------------------------------------------------------------------------- -// Function : PclZipUtilOptionText() -// Description : -// Translate option value in text. Mainly for debug purpose. -// Parameters : -// $p_option : the option value. -// Return Values : -// The option text value. -// -------------------------------------------------------------------------------- -function PclZipUtilOptionText($p_option) -{ - - $v_list = get_defined_constants(); - for (reset($v_list); $v_key = key($v_list); next($v_list)) { - $v_prefix = substr($v_key, 0, 10); - if ((($v_prefix == 'PCLZIP_OPT') || ($v_prefix == 'PCLZIP_CB_') || ($v_prefix == 'PCLZIP_ATT')) && ($v_list[$v_key] == $p_option)) { - return $v_key; - } - } - - $v_result = 'Unknown'; - - return $v_result; -} -// -------------------------------------------------------------------------------- - -// -------------------------------------------------------------------------------- -// Function : PclZipUtilTranslateWinPath() -// Description : -// Translate windows path by replacing '\' by '/' and optionally removing -// drive letter. -// Parameters : -// $p_path : path to translate. -// $p_remove_disk_letter : true | false -// Return Values : -// The path translated. -// -------------------------------------------------------------------------------- -function PclZipUtilTranslateWinPath($p_path, $p_remove_disk_letter = true) -{ - if (stristr(php_uname(), 'windows')) { - // ----- Look for potential disk letter - if (($p_remove_disk_letter) && (($v_position = strpos($p_path, ':')) != false)) { - $p_path = substr($p_path, $v_position + 1); - } - // ----- Change potential windows directory separator - if ((strpos($p_path, '\\') > 0) || (substr($p_path, 0, 1) == '\\')) { - $p_path = strtr($p_path, '\\', '/'); - } - } - - return $p_path; -} -// -------------------------------------------------------------------------------- diff --git a/vendor/pclzip/pclzip/readme.txt b/vendor/pclzip/pclzip/readme.txt deleted file mode 100644 index 115c22ed..00000000 --- a/vendor/pclzip/pclzip/readme.txt +++ /dev/null @@ -1,421 +0,0 @@ -// -------------------------------------------------------------------------------- -// PclZip 2.8.2 - readme.txt -// -------------------------------------------------------------------------------- -// License GNU/LGPL - August 2009 -// Vincent Blavet - vincent@phpconcept.net -// http://www.phpconcept.net -// -------------------------------------------------------------------------------- -// $Id: readme.txt,v 1.60 2009/09/30 20:35:21 vblavet Exp $ -// -------------------------------------------------------------------------------- - - - -0 - Sommaire -============ - 1 - Introduction - 2 - What's new - 3 - Corrected bugs - 4 - Known bugs or limitations - 5 - License - 6 - Warning - 7 - Documentation - 8 - Author - 9 - Contribute - -1 - Introduction -================ - - PclZip is a library that allow you to manage a Zip archive. - - Full documentation about PclZip can be found here : http://www.phpconcept.net/pclzip - -2 - What's new -============== - - Version 2.8.2 : - - PCLZIP_CB_PRE_EXTRACT and PCLZIP_CB_POST_EXTRACT are now supported with - extraction as a string (PCLZIP_OPT_EXTRACT_AS_STRING). The string - can also be modified in the post-extract call back. - **Bugs correction : - - PCLZIP_OPT_REMOVE_ALL_PATH was not working correctly - - Remove use of eval() and do direct call to callback functions - - Correct support of 64bits systems (Thanks to WordPress team) - - Version 2.8.1 : - - Move option PCLZIP_OPT_BY_EREG to PCLZIP_OPT_BY_PREG because ereg() is - deprecated in PHP 5.3. When using option PCLZIP_OPT_BY_EREG, PclZip will - automatically replace it by PCLZIP_OPT_BY_PREG. - - Version 2.8 : - - Improve extraction of zip archive for large files by using temporary files - This feature is working like the one defined in r2.7. - Options are renamed : PCLZIP_OPT_TEMP_FILE_ON, PCLZIP_OPT_TEMP_FILE_OFF, - PCLZIP_OPT_TEMP_FILE_THRESHOLD - - Add a ratio constant PCLZIP_TEMPORARY_FILE_RATIO to configure the auto - sense of temporary file use. - - Bug correction : Reduce filepath in returned file list to remove ennoying - './/' preambule in file path. - - Version 2.7 : - - Improve creation of zip archive for large files : - PclZip will now autosense the configured memory and use temporary files - when large file is suspected. - This feature can also ne triggered by manual options in create() and add() - methods. 'PCLZIP_OPT_ADD_TEMP_FILE_ON' force the use of temporary files, - 'PCLZIP_OPT_ADD_TEMP_FILE_OFF' disable the autosense technic, - 'PCLZIP_OPT_ADD_TEMP_FILE_THRESHOLD' allow for configuration of a size - threshold to use temporary files. - Using "temporary files" rather than "memory" might take more time, but - might give the ability to zip very large files : - Tested on my win laptop with a 88Mo file : - Zip "in-memory" : 18sec (max_execution_time=30, memory_limit=180Mo) - Zip "tmporary-files" : 23sec (max_execution_time=30, memory_limit=30Mo) - - Replace use of mktime() by time() to limit the E_STRICT error messages. - - Bug correction : When adding files with full windows path (drive letter) - PclZip is now working. Before, if the drive letter is not the default - path, PclZip was not able to add the file. - - Version 2.6 : - - Code optimisation - - New attributes PCLZIP_ATT_FILE_COMMENT gives the ability to - add a comment for a specific file. (Don't really know if this is usefull) - - New attribute PCLZIP_ATT_FILE_CONTENT gives the ability to add a string - as a file. - - New attribute PCLZIP_ATT_FILE_MTIME modify the timestamp associated with - a file. - - Correct a bug. Files archived with a timestamp with 0h0m0s were extracted - with current time - - Add CRC value in the informations returned back for each file after an - action. - - Add missing closedir() statement. - - When adding a folder, and removing the path of this folder, files were - incorrectly added with a '/' at the beginning. Which means files are - related to root in unix systems. Corrected. - - Add conditional if before constant definition. This will allow users - to redefine constants without changing the file, and then improve - upgrade of pclzip code for new versions. - - Version 2.5 : - - Introduce the ability to add file/folder with individual properties (file descriptor). - This gives for example the ability to change the filename of a zipped file. - . Able to add files individually - . Able to change full name - . Able to change short name - . Compatible with global options - - New attributes : PCLZIP_ATT_FILE_NAME, PCLZIP_ATT_FILE_NEW_SHORT_NAME, PCLZIP_ATT_FILE_NEW_FULL_NAME - - New error code : PCLZIP_ERR_INVALID_ATTRIBUTE_VALUE - - Add a security control feature. PclZip can extract any file in any folder - of a system. People may use this to upload a zip file and try to override - a system file. The PCLZIP_OPT_EXTRACT_DIR_RESTRICTION will give the - ability to forgive any directory transversal behavior. - - New PCLZIP_OPT_EXTRACT_DIR_RESTRICTION : check extraction path - - New error code : PCLZIP_ERR_DIRECTORY_RESTRICTION - - Modification in PclZipUtilPathInclusion() : dir and path beginning with ./ will be prepend - by current path (getcwd()) - - Version 2.4 : - - Code improvment : try to speed up the code by removing unusefull call to pack() - - Correct bug in delete() : delete() should be called with no argument. This was not - the case in 2.3. This is corrected in 2.4. - - Correct a bug in path_inclusion function. When the path has several '../../', the - result was bad. - - Add a check for magic_quotes_runtime configuration. If enabled, PclZip will - disable it while working and det it back to its original value. - This resolve a lots of bad formated archive errors. - - Bug correction : PclZip now correctly unzip file in some specific situation, - when compressed content has same size as uncompressed content. - - Bug correction : When selecting option 'PCLZIP_OPT_REMOVE_ALL_PATH', - directories are not any more created. - - Code improvment : correct unclosed opendir(), better handling of . and .. in - loops. - - - Version 2.3 : - - Correct a bug with PHP5 : affecting the value 0xFE49FFE0 to a variable does not - give the same result in PHP4 and PHP5 .... - - Version 2.2 : - - Try development of PCLZIP_OPT_CRYPT ..... - However this becomes to a stop. To crypt/decrypt I need to multiply 2 long integers, - the result (greater than a long) is not supported by PHP. Even the use of bcmath - functions does not help. I did not find yet a solution ...; - - Add missing '/' at end of directory entries - - Check is a file is encrypted or not. Returns status 'unsupported_encryption' and/or - error code PCLZIP_ERR_UNSUPPORTED_ENCRYPTION. - - Corrected : Bad "version need to extract" field in local file header - - Add private method privCheckFileHeaders() in order to check local and central - file headers. PclZip is now supporting purpose bit flag bit 3. Purpose bit flag bit 3 gives - the ability to have a local file header without size, compressed size and crc filled. - - Add a generic status 'error' for file status - - Add control of compression type. PclZip only support deflate compression method. - Before v2.2, PclZip does not check the compression method used in an archive while - extracting. With v2.2 PclZip returns a new error status for a file using an unsupported - compression method. New status is "unsupported_compression". New error code is - PCLZIP_ERR_UNSUPPORTED_COMPRESSION. - - Add optional attribute PCLZIP_OPT_STOP_ON_ERROR. This will stop the extract of files - when errors like 'a folder with same name exists' or 'a newer file exists' or - 'a write protected file' exists, rather than set a status for the concerning file - and resume the extract of the zip. - - Add optional attribute PCLZIP_OPT_REPLACE_NEWER. This will force, during an extract' the - replacement of the file, even if a newer version of the file exists. - Note that today if a file with the same name already exists but is older it will be - replaced by the extracted one. - - Improve PclZipUtilOption() - - Support of zip archive with trailing bytes. Before 2.2, PclZip checks that the central - directory structure is the last data in the archive. Crypt encryption/decryption of - zip archive put trailing 0 bytes after decryption. PclZip is now supporting this. - - Version 2.1 : - - Add the ability to abort the extraction by using a user callback function. - The user can now return the value '2' in its callback which indicates to stop the - extraction. For a pre call-back extract is stopped before the extration of the current - file. For a post call back, the extraction is stopped after. - - Add the ability to extract a file (or several files) directly in the standard output. - This is done by the new parameter PCLZIP_OPT_EXTRACT_IN_OUTPUT with method extract(). - - Add support for parameters PCLZIP_OPT_COMMENT, PCLZIP_OPT_ADD_COMMENT, - PCLZIP_OPT_PREPEND_COMMENT. This will create, replace, add, or prepend comments - in the zip archive. - - When merging two archives, the comments are not any more lost, but merged, with a - blank space separator. - - Corrected bug : Files are not deleted when all files are asked to be deleted. - - Corrected bug : Folders with name '0' made PclZip to abort the create or add feature. - - - Version 2.0 : - ***** Warning : Some new features may break the backward compatibility for your scripts. - Please carefully read the readme file. - - Add the ability to delete by Index, name and regular expression. This feature is - performed by the method delete(), which uses the optional parameters - PCLZIP_OPT_BY_INDEX, PCLZIP_OPT_BY_NAME, PCLZIP_OPT_BY_EREG or PCLZIP_OPT_BY_PREG. - - Add the ability to extract by regular expression. To extract by regexp you must use the method - extract(), with the option PCLZIP_OPT_BY_EREG or PCLZIP_OPT_BY_PREG - (depending if you want to use ereg() or preg_match() syntax) followed by the - regular expression pattern. - - Add the ability to extract by index, directly with the extract() method. This is a - code improvment of the extractByIndex() method. - - Add the ability to extract by name. To extract by name you must use the method - extract(), with the option PCLZIP_OPT_BY_NAME followed by the filename to - extract or an array of filenames to extract. To extract all a folder, use the folder - name rather than the filename with a '/' at the end. - - Add the ability to add files without compression. This is done with a new attribute - which is PCLZIP_OPT_NO_COMPRESSION. - - Add the attribute PCLZIP_OPT_EXTRACT_AS_STRING, which allow to extract a file directly - in a string without using any file (or temporary file). - - Add constant PCLZIP_SEPARATOR for static configuration of filename separators in a single string. - The default separator is now a comma (,) and not any more a blank space. - THIS BREAK THE BACKWARD COMPATIBILITY : Please check if this may have an impact with - your script. - - Improve algorythm performance by removing the use of temporary files when adding or - extracting files in an archive. - - Add (correct) detection of empty filename zipping. This can occurs when the removed - path is the same - as a zipped dir. The dir is not zipped (['status'] = filtered), only its content. - - Add better support for windows paths (thanks for help from manus@manusfreedom.com). - - Corrected bug : When the archive file already exists with size=0, the add() method - fails. Corrected in 2.0. - - Remove the use of OS_WINDOWS constant. Use php_uname() function rather. - - Control the order of index ranges in extract by index feature. - - Change the internal management of folders (better handling of internal flag). - - - Version 1.3 : - - Removing the double include check. This is now done by include_once() and require_once() - PHP directives. - - Changing the error handling mecanism : Remove the use of an external error library. - The former PclError...() functions are replaced by internal equivalent methods. - By changing the environment variable PCLZIP_ERROR_EXTERNAL you can still use the former library. - Introducing the use of constants for error codes rather than integer values. This will help - in futur improvment. - Introduction of error handling functions like errorCode(), errorName() and errorInfo(). - - Remove the deprecated use of calling function with arguments passed by reference. - - Add the calling of extract(), extractByIndex(), create() and add() functions - with variable options rather than fixed arguments. - - Add the ability to remove all the file path while extracting or adding, - without any need to specify the path to remove. - This is available for extract(), extractByIndex(), create() and add() functionS by using - the new variable options parameters : - - PCLZIP_OPT_REMOVE_ALL_PATH : by indicating this option while calling the fct. - - Ability to change the mode of a file after the extraction (chmod()). - This is available for extract() and extractByIndex() functionS by using - the new variable options parameters. - - PCLZIP_OPT_SET_CHMOD : by setting the value of this option. - - Ability to definition call-back options. These call-back will be called during the adding, - or the extracting of file (extract(), extractByIndex(), create() and add() functions) : - - PCLZIP_CB_PRE_EXTRACT : will be called before each extraction of a file. The user - can trigerred the change the filename of the extracted file. The user can triggered the - skip of the extraction. This is adding a 'skipped' status in the file list result value. - - PCLZIP_CB_POST_EXTRACT : will be called after each extraction of a file. - Nothing can be triggered from that point. - - PCLZIP_CB_PRE_ADD : will be called before each add of a file. The user - can trigerred the change the stored filename of the added file. The user can triggered the - skip of the add. This is adding a 'skipped' status in the file list result value. - - PCLZIP_CB_POST_ADD : will be called after each add of a file. - Nothing can be triggered from that point. - - Two status are added in the file list returned as function result : skipped & filename_too_long - 'skipped' is used when a call-back function ask for skipping the file. - 'filename_too_long' is used while adding a file with a too long filename to archive (the file is - not added) - - Adding the function PclZipUtilPathInclusion(), that check the inclusion of a path into - a directory. - - Add a check of the presence of the archive file before some actions (like list, ...) - - Add the initialisation of field "index" in header array. This means that by - default index will be -1 when not explicitly set by the methods. - - Version 1.2 : - - Adding a duplicate function. - - Adding a merge function. The merge function is a "quick merge" function, - it just append the content of an archive at the end of the first one. There - is no check for duplicate files or more recent files. - - Improve the search of the central directory end. - - Version 1.1.2 : - - - Changing the license of PclZip. PclZip is now released under the GNU / LGPL license - (see License section). - - Adding the optional support of a static temporary directory. You will need to configure - the constant PCLZIP_TEMPORARY_DIR if you want to use this feature. - - Improving the rename() function. In some cases rename() does not work (different - Filesystems), so it will be replaced by a copy() + unlink() functions. - - Version 1.1.1 : - - - Maintenance release, no new feature. - - Version 1.1 : - - - New method Add() : adding files in the archive - - New method ExtractByIndex() : partial extract of the archive, files are identified by - their index in the archive - - New method DeleteByIndex() : delete some files/folder entries from the archive, - files are identified by their index in the archive. - - Adding a test of the zlib extension presence. If not present abort the script. - - Version 1.0.1 : - - - No new feature - - -3 - Corrected bugs -================== - - Corrected in Version 2.0 : - - Corrected : During an extraction, if a call-back fucntion is used and try to skip - a file, all the extraction process is stopped. - - Corrected in Version 1.3 : - - Corrected : Support of static synopsis for method extract() is broken. - - Corrected : invalid size of archive content field (0xFF) should be (0xFFFF). - - Corrected : When an extract is done with a remove_path parameter, the entry for - the directory with exactly the same path is not skipped/filtered. - - Corrected : extractByIndex() and deleteByIndex() were not managing index in the - right way. For example indexes '1,3-5,11' will only extract files 1 and 11. This - is due to a sort of the index resulting table that puts 11 before 3-5 (sort on - string and not interger). The sort is temporarilly removed, this means that - you must provide a sorted list of index ranges. - - Corrected in Version 1.2 : - - - Nothing. - - Corrected in Version 1.1.2 : - - - Corrected : Winzip is unable to delete or add new files in a PclZip created archives. - - Corrected in Version 1.1.1 : - - - Corrected : When archived file is not compressed (0% compression), the - extract method fails. - - Corrected in Version 1.1 : - - - Corrected : Adding a complete tree of folder may result in a bad archive - creation. - - Corrected in Version 1.0.1 : - - - Corrected : Error while compressing files greater than PCLZIP_READ_BLOCK_SIZE (default=1024). - - -4 - Known bugs or limitations -============================= - - Please publish bugs reports in SourceForge : - http://sourceforge.net/tracker/?group_id=40254&atid=427564 - - In Version 2.x : - - PclZip does only support file uncompressed or compressed with deflate (compression method 8) - - PclZip does not support password protected zip archive - - Some concern were seen when changing mtime of a file while archiving. - Seems to be linked to Daylight Saving Time (PclTest_changing_mtime). - - In Version 1.2 : - - - merge() methods does not check for duplicate files or last date of modifications. - - In Version 1.1 : - - - Limitation : Using 'extract' fields in the file header in the zip archive is not supported. - - WinZip is unable to delete a single file in a PclZip created archive. It is also unable to - add a file in a PclZip created archive. (Corrected in v.1.2) - - In Version 1.0.1 : - - - Adding a complete tree of folder may result in a bad archive - creation. (Corrected in V.1.1). - - Path given to methods must be in the unix format (/) and not the Windows format (\). - Workaround : Use only / directory separators. - - PclZip is using temporary files that are sometime the name of the file with a .tmp or .gz - added suffix. Files with these names may already exist and may be overwritten. - Workaround : none. - - PclZip does not check if the zlib extension is present. If it is absent, the zip - file is not created and the lib abort without warning. - Workaround : enable the zlib extension on the php install - - In Version 1.0 : - - - Error while compressing files greater than PCLZIP_READ_BLOCK_SIZE (default=1024). - (Corrected in v.1.0.1) - - Limitation : Multi-disk zip archive are not supported. - - -5 - License -=========== - - Since version 1.1.2, PclZip Library is released under GNU/LGPL license. - This library is free, so you can use it at no cost. - - HOWEVER, if you release a script, an application, a library or any kind of - code using PclZip library (or a part of it), YOU MUST : - - Indicate in the documentation (or a readme file), that your work - uses PclZip Library, and make a reference to the author and the web site - http://www.phpconcept.net - - Gives the ability to the final user to update the PclZip libary. - - I will also appreciate that you send me a mail (vincent@phpconcept.net), just to - be aware that someone is using PclZip. - - For more information about GNU/LGPL license : http://www.gnu.org - -6 - Warning -================= - - This library and the associated files are non commercial, non professional work. - It should not have unexpected results. However if any damage is caused by this software - the author can not be responsible. - The use of this software is at the risk of the user. - -7 - Documentation -================= - PclZip User Manuel is available in English on PhpConcept : http://www.phpconcept.net/pclzip/man/en/index.php - A Russian translation was done by Feskov Kuzma : http://php.russofile.ru/ru/authors/unsort/zip/ - -8 - Author -========== - - This software was written by Vincent Blavet (vincent@phpconcept.net) on its leasure time. - -9 - Contribute -============== - If you want to contribute to the development of PclZip, please contact vincent@phpconcept.net. - If you can help in financing PhpConcept hosting service, please go to - http://www.phpconcept.net/soutien.php diff --git a/vendor/php4world/auth/.editorconfig b/vendor/php4world/auth/.editorconfig deleted file mode 100644 index e291365a..00000000 --- a/vendor/php4world/auth/.editorconfig +++ /dev/null @@ -1,9 +0,0 @@ -root = true - -[*] -charset = utf-8 -indent_style = space -indent_size = 4 -end_of_line = lf -insert_final_newline = true -trim_trailing_whitespace = true diff --git a/vendor/php4world/auth/.gitignore b/vendor/php4world/auth/.gitignore deleted file mode 100644 index 0ec455a1..00000000 --- a/vendor/php4world/auth/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.DS_Store -vendor/ -tests/ -composer.lock diff --git a/vendor/php4world/auth/README.md b/vendor/php4world/auth/README.md deleted file mode 100644 index b9b009f0..00000000 --- a/vendor/php4world/auth/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# auth -ThinkPHP5.1 Auth Class. diff --git a/vendor/php4world/auth/composer.json b/vendor/php4world/auth/composer.json deleted file mode 100644 index 74b15a67..00000000 --- a/vendor/php4world/auth/composer.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "php4world/auth", - "description": "ThinkPHP5.1 Auth Class.", - "license": "Apache-2.0", - "authors": [ - { - "name": "php4world", - "email": "76422937@qq.com" - } - ], - "minimum-stability": "dev", - "require": { - "topthink/framework": "5.1.*" - }, - "autoload": { - "psr-4": { - "php4world\\": "src/" - } - } -} diff --git a/vendor/php4world/auth/src/Auth.php b/vendor/php4world/auth/src/Auth.php deleted file mode 100644 index 844389fb..00000000 --- a/vendor/php4world/auth/src/Auth.php +++ /dev/null @@ -1,226 +0,0 @@ -check('规则名称', '用户ID'); - * - * 2、同时对多条规则进行认证,可以设置多条规则的关系[or|and] - * $auth = new \php4world\Auth(); - * $auth->check('规则1,规则2,...', '用户ID', 'and'); - * -> and表示用户需要同时具有规则列表权限。 - * -> or 表示用户只需要具有任一规则权限。 - * - * 3、规则表达式用法 - * 在[auth_rule]表中[condition]字段,如果定义了表达式,则同时进行表达式验证。 - * 比如 {score}>5 and {score}<100 表示用户分数在5~100之间时才会通过认证。 - * [score]为用户表字段,表达式字段用{}包裹。 - * - * 配置说明: - * 1、正式开发需要在应用配置目录添加根为auth的配置项,参考下面$_config属性 - * 2、配置参数表明根据自己的表名修改 - */ - -class Auth -{ - // 默认配置 - protected $_config = [ - 'auth_on' => true, // 认证开关 - 'auth_type' => 1, // 认证方式,1为实时认证;2为登录认证。 - 'auth_group' => 'auth_group', // 用户组数据表名 - 'auth_group_access' => 'auth_group_access', // 用户-用户组关系表 - 'auth_rule' => 'auth_rule', // 权限规则表 - 'auth_user' => 'user', // 用户信息表 - 'auth_user_id_field'=> 'id', // 用户表ID字段名 - 'administrator' => [1], // 超级管理员列表 - ]; - - public function __construct() - { - $auth = Config::get('app.auth'); - if (!empty($auth)) { - $this->_config = array_merge($this->_config, $auth); - } - } - - /** - * 验证权限 - * @param mixed $name 规则验证列表支持逗号分隔或者数组 - * @param integer $uid 用户ID - * @param string $relation 关系类型 or | and - * @param string $mode 执行模式 url - * @return boolean 验证结果 - */ - public function check($name, $uid, $relation = 'or', $mode = 'url') - { - // 没有开启认证,直接通过 - if (!$this->_config['auth_on']) { - return true; - } - - // 超级管理员,直接通过 - if (!empty($this->_config['administrator']) && in_array($uid, $this->_config['administrator'])) { - return true; - } - - $authlist = $this->getAuthList($uid); - if (is_string($name)) { - $name = strtolower($name); - if (strpos($name, ',') === false) { - $name = [$name]; - } else { - $name = explode(',', $name); - } - } - - $list = []; - if ($mode === 'url') { - $REQUEST = unserialize(strtolower(serialize(Request::param()))); - } - - foreach ($authlist as $auth) { - $query = preg_replace('/^.+\?/U', '', $auth); - - if ($mode === 'url' && $query !== $auth) { - parse_str($query, $param); - $intersect = array_intersect_assoc($REQUEST, $param); - $auth = preg_replace('/\?.*$/U', '', $auth); - if (in_array($auth, $name) && $intersect == $param) { - $list[] = $auth; - } - } elseif (in_array($auth, $name)) { - $list[] = $auth; - } - } - - if ($relation === 'or' && !empty($list)) { - return true; - } - - $diff = array_diff($name, $list); - if ($relation === 'and' && empty($diff)) { - return true; - } - - return false; - } - - /** - * 根据用户ID获取用户组,返回值为数组 - * @param integer $uid 用户ID - * @return array 用户所属用户组 ['uid'=>'用户ID', 'group_id'=>'用户组ID', 'title'=>'用户组名', 'rules'=>'用户组拥有的规则ID,多个用英文,隔开'] - */ - public function getGroups($uid) - { - static $groups = []; - - if (isset($groups[$uid])) { - return $groups[$uid]; - } - - $user_groups = Db::table($this->_config['auth_group_access']) - ->alias('a') - ->join($this->_config['auth_group'].' g', "a.group_id = g.id") - ->field('uid,group_id,title,rules') - ->where('a.uid', $uid) - ->where('g.status', 1) - ->select(); - $groups[$uid] = $user_groups ?: []; - return $groups[$uid]; - } - - /** - * 获得权限列表 - * @param integer $uid 用户ID - * @param integer $type 规则类型 - * @return array 权限列表 - */ - protected function getAuthList($uid) - { - static $_authlist = []; - - if (isset($_authlist[$uid])) { - return $_authlist[$uid]; - } - - if ($this->_config['auth_type'] === 2 && Session::has('_auth_list_'.$uid)) { - return Session::get('_auth_list_'.$uid); - } - - // 读取用户所属用户组 - $groups = $this->getGroups($uid); - $ids = []; // 保存用户所属用户组设置的所有权限规则ID - foreach ($groups as $g) { - $ids = array_merge($ids, explode(',', trim($g['rules'], ','))); - } - - $ids = array_unique($ids); - if (empty($ids)) { - $_authlist[$uid] = []; - return []; - } - - $map = [ - ['id', 'in', $ids], - ['status', '=', 1] // 只查正常状态的数据 - ]; - - // 读取用户组所有权限规则 - $rules = Db::table($this->_config['auth_rule'])->where($map)->field('condition,name')->select(); - - // 循环规则,判断结果。 - $authlist = []; - - foreach ($rules as $rule) { - if (!empty($rule['condition'])) { // 根据condition进行验证 - $user = $this->getUserInfo($uid); // 获取用户信息,一维数组 - - $command = preg_replace('/\{(\w*?)\}/', '$user[\'\\1\']', $rule['condition']); - // dump($command); // debug - @(eval('$condition=('.$command.');')); - if ($condition) { - $authlist[] = strtolower($rule['name']); - } - } else { - // 只要存在就记录 - $authlist[] = strtolower($rule['name']); - } - } - - $_authlist[$uid] = $authlist; - - if ($this->_config['auth_type'] == 2) { - Session::set('_auth_list_'.$uid, $authlist); - } - return array_unique($authlist); - } - - /** - * 获得用户资料,根据自己的情况读取数据库 - */ - protected function getUserInfo($uid) { - static $userinfo = []; - - if (!isset($userinfo[$uid])) { - $userinfo[$uid] = Db::table($this->_config['auth_user'])->where((string)$this->_config['auth_user_id_field'], $uid)->find(); - } - - return $userinfo[$uid]; - } -} diff --git a/vendor/php4world/auth/src/tables.sql b/vendor/php4world/auth/src/tables.sql deleted file mode 100644 index b023cf87..00000000 --- a/vendor/php4world/auth/src/tables.sql +++ /dev/null @@ -1,30 +0,0 @@ -DROP TABLE IF EXISTS `php4world_auth_group`; -CREATE TABLE `php4world_auth_group` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `title` varchar(50) NOT NULL DEFAULT '' COMMENT '用户组中文名称', - `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态:1正常,0禁用', - `rules` varchar(500) NOT NULL DEFAULT '' COMMENT '用户组拥有的规则ID', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户组表'; - - -DROP TABLE IF EXISTS `php4world_auth_group_access`; -CREATE TABLE `php4world_auth_group_access` ( - `uid` int(10) unsigned NOT NULL COMMENT '用户ID', - `group_id` int(10) unsigned NOT NULL COMMENT '用户组ID', - UNIQUE KEY `uid_group_id` (`uid`,`group_id`), - KEY `uid` (`uid`), - KEY `group_id` (`group_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户组关系表'; - - -DROP TABLE IF EXISTS `php4world_auth_rule`; -CREATE TABLE `php4world_auth_rule` ( - `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `title` varchar(50) NOT NULL DEFAULT '' COMMENT '规则中文名称', - `name` varchar(100) NOT NULL DEFAULT '' COMMENT '规则唯一标识', - `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '状态:1正常,0禁用', - `condition` varchar(200) NOT NULL DEFAULT '' COMMENT '规则表达式,为空表示存在就验证,不为空表示按照条件验证', - PRIMARY KEY (`id`), - UNIQUE KEY `name` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='规则表'; diff --git a/vendor/phpoffice/common/.gitignore b/vendor/phpoffice/common/.gitignore deleted file mode 100644 index 605fc80c..00000000 --- a/vendor/phpoffice/common/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -.DS_Store -._* -.Spotlight-V100 -.Trashes -Thumbs.db -Desktop.ini -.idea -build/ -phpunit.xml -composer.phar -vendor -*.settings -*.project -*.buildpath - -/samples/results -/phpunit.bat -/todo.txt -/samples/Sample_00_Test.php -/samples/#47 -/samples/#70 -/samples/#71 -/samples/Github_*.* -/samples/#83/*.lnk -/composer.lock diff --git a/vendor/phpoffice/common/.scrutinizer.yml b/vendor/phpoffice/common/.scrutinizer.yml deleted file mode 100644 index 6d188bee..00000000 --- a/vendor/phpoffice/common/.scrutinizer.yml +++ /dev/null @@ -1,24 +0,0 @@ -filter: - excluded_paths: [ 'vendor/*', 'tests/*', 'samples/*' ] - -before_commands: - - "composer install --prefer-source --dev" - -tools: - php_code_sniffer: - enabled: true - config: - standard: PSR2 - php_mess_detector: - enabled: true - config: - ruleset: phpmd.xml.dist - external_code_coverage: - enabled: true - timeout: 900 - php_cpd: true - # php_sim: # Temporarily disabled to allow focus on things other than duplicates - # min_mass: 40 - php_pdepend: true - php_analyzer: true - sensiolabs_security_checker: true \ No newline at end of file diff --git a/vendor/phpoffice/common/.travis.yml b/vendor/phpoffice/common/.travis.yml deleted file mode 100644 index e5f01f1a..00000000 --- a/vendor/phpoffice/common/.travis.yml +++ /dev/null @@ -1,60 +0,0 @@ -language: php - -php: - - 5.4 - - 5.5 - - 5.6 - - 7.0 - - 7.1 - - 7.2 - - hhvm - -matrix: - allow_failures: - - php: 7.1 - - php: 7.2 - - php: hhvm - -env: - global: - ## - secure: "LtlUOzC8FtqgbqUTmU7EU281NSCb58UFdvnz8lelNIDltBdP4eayN/TsgNIePB4jXg2d2R56ZA6j/grhE/md6jdUkulV355H3GrH/hIZmmQ+F9+87agnwLzb9+MJbqXoiE7VvjY3zGIO09G897SUfsfu6JWEcscYFlsH6KcXM6M=" - -before_script: - ## Packages - - sudo apt-get -qq update > /dev/null - - sudo apt-get -qq install graphviz > /dev/null - ## Composer - - composer self-update - - composer install --prefer-source --dev - ## PHPDocumentor - - mkdir -p build/docs - - mkdir -p build/coverage - -script: - ## PHP_CodeSniffer - - ./vendor/bin/phpcs src/ tests/ --standard=PSR2 -n - ## PHP Copy/Paste Detector - # - ./vendor/bin/phpcpd src/ - ## PHP Mess Detector - - ./vendor/bin/phpmd src/,tests/ text ./phpmd.xml.dist - ## PHPUnit - - ./vendor/bin/phpunit -c ./ --coverage-text --coverage-html ./build/coverage - ## PHPLOC - - ./vendor/bin/phploc src/ - ## PHPDocumentor - - ./vendor/bin/phpdoc -q -d ./src -t ./build/docs --template="responsive-twig" - -after_script: - ## PHPDocumentor - ## - bash .travis_shell_after_success.sh - ## Scrutinizer - - wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml - -notifications: - webhooks: - urls: - - https://webhooks.gitter.im/e/e019b92a7793d27e080c - on_success: change # options: [always|never|change] default: always - on_failure: always # options: [always|never|change] default: always - on_start: false # default: false \ No newline at end of file diff --git a/vendor/phpoffice/common/.travis_shell_after_success.sh b/vendor/phpoffice/common/.travis_shell_after_success.sh deleted file mode 100644 index bbfb7cb8..00000000 --- a/vendor/phpoffice/common/.travis_shell_after_success.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -echo "--DEBUG--" -echo "TRAVIS_REPO_SLUG: $TRAVIS_REPO_SLUG" -echo "TRAVIS_PHP_VERSION: $TRAVIS_PHP_VERSION" -echo "TRAVIS_PULL_REQUEST: $TRAVIS_PULL_REQUEST" - -if [ "$TRAVIS_REPO_SLUG" == "PHPOffice/Common" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_PHP_VERSION" == "5.5" ]; then - - echo -e "Publishing PHPDoc...\n" - - cp -R build/docs $HOME/docs-latest - cp -R build/coverage $HOME/coverage-latest - - cd $HOME - git config --global user.email "travis@travis-ci.org" - git config --global user.name "travis-ci" - git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/PHPOffice/Common gh-pages > /dev/null - - cd gh-pages - echo "--DEBUG : Suppression" - git rm -rf ./docs/$TRAVIS_BRANCH - - echo "--DEBUG : Dossier" - mkdir -p docs/$TRAVIS_BRANCH - mkdir -p coverage/$TRAVIS_BRANCH - - echo "--DEBUG : Copie" - cp -Rf $HOME/docs-latest/* ./docs/$TRAVIS_BRANCH/ - cp -Rf $HOME/coverage-latest/* ./coverage/$TRAVIS_BRANCH/ - - echo "--DEBUG : Git" - git add -f . - git commit -m "PHPDocumentor (Travis Build: $TRAVIS_BUILD_NUMBER - Branch: $TRAVIS_BRANCH)" - git push -fq origin gh-pages > /dev/null - - echo -e "Published PHPDoc to gh-pages.\n" - -fi diff --git a/vendor/phpoffice/common/CHANGELOG.md b/vendor/phpoffice/common/CHANGELOG.md deleted file mode 100644 index 9ab6d688..00000000 --- a/vendor/phpoffice/common/CHANGELOG.md +++ /dev/null @@ -1,61 +0,0 @@ -# Changelog -## 0.1.0 - -### Features -- Initial Release - -## 0.1.1 - -### Features -- Added String::chr for suppporting Unicode Characters - -## 0.2.0 - -### Changes -- Renamed String class in Text class for supporting PHP7 - -## 0.2.1 - -### Features -- Added XMLReader from PHPWord - -## 0.2.2 - -### BugFix -- Fixed "Class 'PhpOffice\Common\ZipArchive' not found in /src/Common/XMLReader.php on line 54" - -## 0.2.3 - -### Features -- Added missing features for supporting PHPWord - -## 0.2.4 - -### Changes -- XMLWriter : Refactoring for improving performances - -## 0.2.5 - -### Features -- Added Zip Adapters (PclZip & ZipArchive) - -## 0.2.6 - -### Changes -- `\PhpOffice\Common\Text::utf8ToUnicode()` became `public`. - -## 0.2.7 - -### Features -- Added `\PhpOffice\Common\File::fileGetContents()` (with support of zip://) -- Added Support for PHP 7.1 - -## 0.2.8 - -### Features -- Added possibility to register namespaces to DOMXpath -- Added Utility to get an Office compatible hash of a password -- Write attribute's value of type float independently of locale - -## 0.2.9 -- Fix XML Entity injection vulnerability \ No newline at end of file diff --git a/vendor/phpoffice/common/COPYING b/vendor/phpoffice/common/COPYING deleted file mode 100644 index 94a9ed02..00000000 --- a/vendor/phpoffice/common/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/vendor/phpoffice/common/COPYING.LESSER b/vendor/phpoffice/common/COPYING.LESSER deleted file mode 100644 index 65c5ca88..00000000 --- a/vendor/phpoffice/common/COPYING.LESSER +++ /dev/null @@ -1,165 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/vendor/phpoffice/common/LICENSE b/vendor/phpoffice/common/LICENSE deleted file mode 100644 index dba7f0ee..00000000 --- a/vendor/phpoffice/common/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -PHPOffice Common, a shared PHP library for PHPOffice Libraries - -Copyright (c) 2015-2015 PHPOffice. - -PHPOffice Common is free software: you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License version 3 as published by -the Free Software Foundation. - -PHPOffice Common is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Lesser General Public License version 3 for more details. - -You should have received a copy of the GNU Lesser General Public License version 3 -along with PHPOffice Common. If not, see . diff --git a/vendor/phpoffice/common/README.md b/vendor/phpoffice/common/README.md deleted file mode 100644 index a55ff1d5..00000000 --- a/vendor/phpoffice/common/README.md +++ /dev/null @@ -1,33 +0,0 @@ -[![Latest Stable Version](https://poser.pugx.org/phpoffice/common/v/stable.png)](https://packagist.org/packages/phpoffice/common) -[![Build Status](https://travis-ci.org/PHPOffice/Common.svg?branch=master)](https://travis-ci.org/PHPOffice/Common) -[![Code Quality](https://scrutinizer-ci.com/g/PHPOffice/Common/badges/quality-score.png?s=b5997ce59ac2816b4514f3a38de9900f6d492c1d)](https://scrutinizer-ci.com/g/PHPOffice/Common/) -[![Code Coverage](https://scrutinizer-ci.com/g/PHPOffice/Common/badges/coverage.png?s=742a98745725c562955440edc8d2c39d7ff5ae25)](https://scrutinizer-ci.com/g/PHPOffice/Common/) -[![Total Downloads](https://poser.pugx.org/phpoffice/common/downloads.png)](https://packagist.org/packages/phpoffice/common) -[![License](https://poser.pugx.org/phpoffice/common/license.png)](https://packagist.org/packages/phpoffice/common) -[![Join the chat at https://gitter.im/PHPOffice/Common](https://img.shields.io/badge/GITTER-join%20chat-green.svg)](https://gitter.im/PHPOffice/Common) - - -PHPOffice Common is a library written in pure PHP that provides a set of components for PHPOffice librairies. - -PHPOffice Common is an open source project licensed under the terms of [LGPL version 3](https://github.com/PHPOffice/Common/blob/develop/COPYING.LESSER). PHPOffice Common is aimed to be a high quality software product by incorporating [continuous integration](https://travis-ci.org/PHPOffice/Common) and [unit testing](http://phpoffice.github.io/Common/coverage/develop/). You can learn more about PHPPowerPoint by reading the [API Documentation](http://phpoffice.github.io/Common/docs/develop/). - -Read more about PHPPowerPoint: - -- [Requirements](#requirements) -- [Contributing](#contributing) -- [API Documentation](http://phpoffice.github.io/Common/docs/master/) - -### Requirements - -PHPOffice Common requires the following: - -- PHP 5.3+ - -## Contributing - -We welcome everyone to contribute to PHPOffice Common. Below are some of the things that you can do to contribute: - -- Read [our contributing guide](https://github.com/PHPOffice/Common/blob/master/CONTRIBUTING.md) -- [Fork us](https://github.com/PHPOffice/Common/fork) and [request a pull](https://github.com/PHPOffice/Common/pulls) to the [develop](https://github.com/PHPOffice/Common/tree/develop) branch -- Submit [bug reports or feature requests](https://github.com/PHPOffice/Common/issues) to GitHub -- Follow [@PHPOffice](https://twitter.com/PHPOffice) on Twitter diff --git a/vendor/phpoffice/common/VERSION b/vendor/phpoffice/common/VERSION deleted file mode 100644 index d81f1c3f..00000000 --- a/vendor/phpoffice/common/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.2.9 \ No newline at end of file diff --git a/vendor/phpoffice/common/composer.json b/vendor/phpoffice/common/composer.json deleted file mode 100644 index 2a75a30c..00000000 --- a/vendor/phpoffice/common/composer.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "phpoffice/common", - "description": "PHPOffice Common", - "keywords": ["PHP","Office","Common","component"], - "homepage": "http://phpoffice.github.io", - "type": "library", - "license": "LGPL", - "authors": [ - { - "name": "Mark Baker" - }, - { - "name": "Franck Lefevre", - "homepage": "http://rootslabs.net" - } - ], - "require": { - "php": ">=5.3.0", - "pclzip/pclzip": "^2.8" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.36 || ^7.0", - "phpdocumentor/phpdocumentor":"2.*", - "phpmd/phpmd": "2.*", - "sebastian/phpcpd": "2.*", - "phploc/phploc": "2.*", - "squizlabs/php_codesniffer": "2.*" - }, - "autoload": { - "psr-4": { - "PhpOffice\\Common\\": "src/Common/" - } - } -} diff --git a/vendor/phpoffice/common/phpmd.xml.dist b/vendor/phpoffice/common/phpmd.xml.dist deleted file mode 100644 index bae0df3b..00000000 --- a/vendor/phpoffice/common/phpmd.xml.dist +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/vendor/phpoffice/common/phpunit.xml.dist b/vendor/phpoffice/common/phpunit.xml.dist deleted file mode 100644 index 7b09d348..00000000 --- a/vendor/phpoffice/common/phpunit.xml.dist +++ /dev/null @@ -1,24 +0,0 @@ - - - - ./tests/Common - - - - - ./src - - - - - - - \ No newline at end of file diff --git a/vendor/phpoffice/common/src/Common/Adapter/Zip/PclZipAdapter.php b/vendor/phpoffice/common/src/Common/Adapter/Zip/PclZipAdapter.php deleted file mode 100644 index 053531f1..00000000 --- a/vendor/phpoffice/common/src/Common/Adapter/Zip/PclZipAdapter.php +++ /dev/null @@ -1,45 +0,0 @@ -oPclZip = new PclZip($filename); - $this->tmpDir = sys_get_temp_dir(); - return $this; - } - - public function close() - { - return $this; - } - - public function addFromString($localname, $contents) - { - $pathData = pathinfo($localname); - - $hFile = fopen($this->tmpDir.'/'.$pathData['basename'], "wb"); - fwrite($hFile, $contents); - fclose($hFile); - - $res = $this->oPclZip->add($this->tmpDir.'/'.$pathData['basename'], PCLZIP_OPT_REMOVE_PATH, $this->tmpDir, PCLZIP_OPT_ADD_PATH, $pathData['dirname']); - if ($res == 0) { - throw new \Exception("Error zipping files : " . $this->oPclZip->errorInfo(true)); - } - unlink($this->tmpDir.'/'.$pathData['basename']); - return $this; - } -} diff --git a/vendor/phpoffice/common/src/Common/Adapter/Zip/ZipArchiveAdapter.php b/vendor/phpoffice/common/src/Common/Adapter/Zip/ZipArchiveAdapter.php deleted file mode 100644 index da2c3462..00000000 --- a/vendor/phpoffice/common/src/Common/Adapter/Zip/ZipArchiveAdapter.php +++ /dev/null @@ -1,49 +0,0 @@ -filename = $filename; - $this->oZipArchive = new ZipArchive(); - - if ($this->oZipArchive->open($this->filename, ZipArchive::OVERWRITE) === true) { - return $this; - } - if ($this->oZipArchive->open($this->filename, ZipArchive::CREATE) === true) { - return $this; - } - throw new \Exception("Could not open $this->filename for writing."); - } - - public function close() - { - if ($this->oZipArchive->close() === false) { - throw new \Exception("Could not close zip file $this->filename."); - } - return $this; - } - - public function addFromString($localname, $contents) - { - if ($this->oZipArchive->addFromString($localname, $contents) === false) { - throw new \Exception("Error zipping files : " . $localname); - } - - return $this; - } -} diff --git a/vendor/phpoffice/common/src/Common/Adapter/Zip/ZipInterface.php b/vendor/phpoffice/common/src/Common/Adapter/Zip/ZipInterface.php deleted file mode 100644 index e8dbc8c2..00000000 --- a/vendor/phpoffice/common/src/Common/Adapter/Zip/ZipInterface.php +++ /dev/null @@ -1,30 +0,0 @@ -open($zipFile) === true) { - $returnValue = ($zip->getFromName($archiveFile) !== false); - $zip->close(); - - return $returnValue; - } - - return false; - } - - // Regular file_exists - return file_exists($pFilename); - } - /** - * Returns the content of a file - * - * @param string $pFilename Filename - * @return string - */ - public static function fileGetContents($pFilename) - { - if (!self::fileExists($pFilename)) { - return false; - } - if (strtolower(substr($pFilename, 0, 3)) == 'zip') { - // Open ZIP file and verify if the file exists - $zipFile = substr($pFilename, 6, strpos($pFilename, '#') - 6); - $archiveFile = substr($pFilename, strpos($pFilename, '#') + 1); - - $zip = new \ZipArchive(); - if ($zip->open($zipFile) === true) { - $returnValue = $zip->getFromName($archiveFile); - $zip->close(); - return $returnValue; - } - return false; - } - // Regular file contents - return file_get_contents($pFilename); - } - - /** - * Returns canonicalized absolute pathname, also for ZIP archives - * - * @param string $pFilename - * @return string - */ - public static function realpath($pFilename) - { - // Try using realpath() - $returnValue = realpath($pFilename); - - // Found something? - if ($returnValue == '' || is_null($returnValue)) { - $pathArray = explode('/', $pFilename); - while (in_array('..', $pathArray) && $pathArray[0] != '..') { - $numPathArray = count($pathArray); - for ($i = 0; $i < $numPathArray; ++$i) { - if ($pathArray[$i] == '..' && $i > 0) { - unset($pathArray[$i]); - unset($pathArray[$i - 1]); - break; - } - } - } - $returnValue = implode('/', $pathArray); - } - - // Return - return $returnValue; - } -} diff --git a/vendor/phpoffice/common/src/Common/Font.php b/vendor/phpoffice/common/src/Common/Font.php deleted file mode 100644 index 03a8e738..00000000 --- a/vendor/phpoffice/common/src/Common/Font.php +++ /dev/null @@ -1,100 +0,0 @@ -data = file_get_contents($sFileName, false, null, 0, 8); - - // Check OLE identifier - if ($this->data != self::IDENTIFIER_OLE) { - throw new \Exception('The filename ' . $sFileName . ' is not recognised as an OLE file'); - } - - // Get the file data - $this->data = file_get_contents($sFileName); - - // Total number of sectors used for the SAT - $numBigBlkDepotBlks = self::getInt4d($this->data, self::NUM_BIG_BLOCK_DEPOT_BLOCKS_POS); - - // SecID of the first sector of the directory stream - $rootStartBlock = self::getInt4d($this->data, self::ROOT_START_BLOCK_POS); - - // SecID of the first sector of the SSAT (or -2 if not extant) - $sbdStartBlock = self::getInt4d($this->data, self::SMALL_BLOCK_DEPOT_BLOCK_POS); - - // SecID of the first sector of the MSAT (or -2 if no additional sectors are used) - $extensionBlock = self::getInt4d($this->data, self::EXTENSION_BLOCK_POS); - - // Total number of sectors used by MSAT - $numExtensionBlocks = self::getInt4d($this->data, self::NUM_EXTENSION_BLOCK_POS); - - $bigBlockDepotBlocks = array(); - $pos = self::BIG_BLOCK_DEPOT_BLOCKS_POS; - - $bbdBlocks = $numBigBlkDepotBlks; - - if ($numExtensionBlocks != 0) { - $bbdBlocks = (self::BIG_BLOCK_SIZE - self::BIG_BLOCK_DEPOT_BLOCKS_POS)/4; - } - - for ($i = 0; $i < $bbdBlocks; ++$i) { - $bigBlockDepotBlocks[$i] = self::getInt4d($this->data, $pos); - $pos += 4; - } - - for ($j = 0; $j < $numExtensionBlocks; ++$j) { - $pos = ($extensionBlock + 1) * self::BIG_BLOCK_SIZE; - $blocksToRead = min($numBigBlkDepotBlks - $bbdBlocks, self::BIG_BLOCK_SIZE / 4 - 1); - - for ($i = $bbdBlocks; $i < $bbdBlocks + $blocksToRead; ++$i) { - $bigBlockDepotBlocks[$i] = self::getInt4d($this->data, $pos); - $pos += 4; - } - - $bbdBlocks += $blocksToRead; - if ($bbdBlocks < $numBigBlkDepotBlks) { - $extensionBlock = self::getInt4d($this->data, $pos); - } - } - - $this->bigBlockChain = ''; - $bbs = self::BIG_BLOCK_SIZE / 4; - for ($i = 0; $i < $numBigBlkDepotBlks; ++$i) { - $pos = ($bigBlockDepotBlocks[$i] + 1) * self::BIG_BLOCK_SIZE; - - $this->bigBlockChain .= substr($this->data, $pos, 4*$bbs); - $pos += 4*$bbs; - } - - $sbdBlock = $sbdStartBlock; - $this->smallBlockChain = ''; - while ($sbdBlock != -2) { - $pos = ($sbdBlock + 1) * self::BIG_BLOCK_SIZE; - - $this->smallBlockChain .= substr($this->data, $pos, 4*$bbs); - $pos += 4*$bbs; - - $sbdBlock = self::getInt4d($this->bigBlockChain, $sbdBlock*4); - } - - // read the directory stream - $block = $rootStartBlock; - $this->entry = $this->readData($block); - - $this->readPropertySets(); - } - - /** - * Extract binary stream data - * - * @return string - */ - public function getStream($stream) - { - if ($stream === null) { - return null; - } - - $streamData = ''; - - if ($this->props[$stream]['size'] < self::SMALL_BLOCK_THRESHOLD) { - $rootdata = $this->readData($this->props[$this->rootEntry]['startBlock']); - - $block = $this->props[$stream]['startBlock']; - - while ($block != -2) { - $pos = $block * self::SMALL_BLOCK_SIZE; - $streamData .= substr($rootdata, $pos, self::SMALL_BLOCK_SIZE); - - $block = self::getInt4d($this->smallBlockChain, $block*4); - } - - return $streamData; - } - - $numBlocks = $this->props[$stream]['size'] / self::BIG_BLOCK_SIZE; - if ($this->props[$stream]['size'] % self::BIG_BLOCK_SIZE != 0) { - ++$numBlocks; - } - - if ($numBlocks == 0) { - return ''; - } - - $block = $this->props[$stream]['startBlock']; - - while ($block != -2) { - $pos = ($block + 1) * self::BIG_BLOCK_SIZE; - $streamData .= substr($this->data, $pos, self::BIG_BLOCK_SIZE); - $block = self::getInt4d($this->bigBlockChain, $block*4); - } - - return $streamData; - } - - /** - * Read a standard stream (by joining sectors using information from SAT) - * - * @param int $blID Sector ID where the stream starts - * @return string Data for standard stream - */ - private function readData($blID) - { - $block = $blID; - $data = ''; - - while ($block != -2) { - $pos = ($block + 1) * self::BIG_BLOCK_SIZE; - $data .= substr($this->data, $pos, self::BIG_BLOCK_SIZE); - $block = self::getInt4d($this->bigBlockChain, $block*4); - } - return $data; - } - - /** - * Read entries in the directory stream. - */ - private function readPropertySets() - { - $offset = 0; - - // loop through entires, each entry is 128 bytes - $entryLen = strlen($this->entry); - while ($offset < $entryLen) { - // entry data (128 bytes) - $data = substr($this->entry, $offset, self::PROPERTY_STORAGE_BLOCK_SIZE); - - // size in bytes of name - $nameSize = ord($data[self::SIZE_OF_NAME_POS]) | (ord($data[self::SIZE_OF_NAME_POS+1]) << 8); - - // type of entry - $type = ord($data[self::TYPE_POS]); - - // sectorID of first sector or short sector, if this entry refers to a stream (the case with workbook) - // sectorID of first sector of the short-stream container stream, if this entry is root entry - $startBlock = self::getInt4d($data, self::START_BLOCK_POS); - - $size = self::getInt4d($data, self::SIZE_POS); - - $name = str_replace("\x00", "", substr($data, 0, $nameSize)); - if ($size > 0) { - $this->props[] = array ( - 'name' => $name, - 'type' => $type, - 'startBlock' => $startBlock, - 'size' => $size); - - // tmp helper to simplify checks - $upName = strtoupper($name); - - switch ($upName) { - case 'ROOT ENTRY': - case 'R': - $this->rootEntry = count($this->props) - 1; - break; - case chr(1).'COMPOBJ': - break; - case chr(1).'OLE': - break; - case chr(5).'SUMMARYINFORMATION': - $this->summaryInformation = count($this->props) - 1; - break; - case chr(5).'DOCUMENTSUMMARYINFORMATION': - $this->docSummaryInfos = count($this->props) - 1; - break; - case 'CURRENT USER': - $this->currentUser = count($this->props) - 1; - break; - case 'PICTURES': - $this->pictures = count($this->props) - 1; - break; - case 'POWERPOINT DOCUMENT': - $this->powerpointDocument = count($this->props) - 1; - break; - default: - throw new \Exception('OLE Block Not defined: $upName : '.$upName. ' - $name : "'.$name.'"'); - } - } - - $offset += self::PROPERTY_STORAGE_BLOCK_SIZE; - } - } - - /** - * Read 4 bytes of data at specified position - * - * @param string $data - * @param int $pos - * @return int - */ - private static function getInt4d($data, $pos) - { - // FIX: represent numbers correctly on 64-bit system - // http://sourceforge.net/tracker/index.php?func=detail&aid=1487372&group_id=99160&atid=623334 - // Hacked by Andreas Rehm 2006 to ensure correct result of the <<24 block on 32 and 64bit systems - $or24 = ord($data[$pos + 3]); - if ($or24 >= 128) { - // negative number - $ord24 = -abs((256 - $or24) << 24); - } else { - $ord24 = ($or24 & 127) << 24; - } - return ord($data[$pos]) | (ord($data[$pos + 1]) << 8) | (ord($data[$pos + 2]) << 16) | $ord24; - } -} diff --git a/vendor/phpoffice/common/src/Common/Microsoft/PasswordEncoder.php b/vendor/phpoffice/common/src/Common/Microsoft/PasswordEncoder.php deleted file mode 100644 index f620f4c7..00000000 --- a/vendor/phpoffice/common/src/Common/Microsoft/PasswordEncoder.php +++ /dev/null @@ -1,234 +0,0 @@ - array(1, 'md2'), - self::ALGORITHM_MD4 => array(2, 'md4'), - self::ALGORITHM_MD5 => array(3, 'md5'), - self::ALGORITHM_SHA_1 => array(4, 'sha1'), - self::ALGORITHM_MAC => array(5, ''), // 'mac' -> not possible with hash() - self::ALGORITHM_RIPEMD => array(6, 'ripemd'), - self::ALGORITHM_RIPEMD_160 => array(7, 'ripemd160'), - self::ALGORITHM_HMAC => array(9, ''), //'hmac' -> not possible with hash() - self::ALGORITHM_SHA_256 => array(12, 'sha256'), - self::ALGORITHM_SHA_384 => array(13, 'sha384'), - self::ALGORITHM_SHA_512 => array(14, 'sha512'), - ); - - private static $initialCodeArray = array( - 0xE1F0, - 0x1D0F, - 0xCC9C, - 0x84C0, - 0x110C, - 0x0E10, - 0xF1CE, - 0x313E, - 0x1872, - 0xE139, - 0xD40F, - 0x84F9, - 0x280C, - 0xA96A, - 0x4EC3, - ); - - private static $encryptionMatrix = array( - array(0xAEFC, 0x4DD9, 0x9BB2, 0x2745, 0x4E8A, 0x9D14, 0x2A09), - array(0x7B61, 0xF6C2, 0xFDA5, 0xEB6B, 0xC6F7, 0x9DCF, 0x2BBF), - array(0x4563, 0x8AC6, 0x05AD, 0x0B5A, 0x16B4, 0x2D68, 0x5AD0), - array(0x0375, 0x06EA, 0x0DD4, 0x1BA8, 0x3750, 0x6EA0, 0xDD40), - array(0xD849, 0xA0B3, 0x5147, 0xA28E, 0x553D, 0xAA7A, 0x44D5), - array(0x6F45, 0xDE8A, 0xAD35, 0x4A4B, 0x9496, 0x390D, 0x721A), - array(0xEB23, 0xC667, 0x9CEF, 0x29FF, 0x53FE, 0xA7FC, 0x5FD9), - array(0x47D3, 0x8FA6, 0x0F6D, 0x1EDA, 0x3DB4, 0x7B68, 0xF6D0), - array(0xB861, 0x60E3, 0xC1C6, 0x93AD, 0x377B, 0x6EF6, 0xDDEC), - array(0x45A0, 0x8B40, 0x06A1, 0x0D42, 0x1A84, 0x3508, 0x6A10), - array(0xAA51, 0x4483, 0x8906, 0x022D, 0x045A, 0x08B4, 0x1168), - array(0x76B4, 0xED68, 0xCAF1, 0x85C3, 0x1BA7, 0x374E, 0x6E9C), - array(0x3730, 0x6E60, 0xDCC0, 0xA9A1, 0x4363, 0x86C6, 0x1DAD), - array(0x3331, 0x6662, 0xCCC4, 0x89A9, 0x0373, 0x06E6, 0x0DCC), - array(0x1021, 0x2042, 0x4084, 0x8108, 0x1231, 0x2462, 0x48C4), - ); - - private static $passwordMaxLength = 15; - - /** - * Create a hashed password that MS Word will be able to work with - * @see https://blogs.msdn.microsoft.com/vsod/2010/04/05/how-to-set-the-editing-restrictions-in-word-using-open-xml-sdk-2-0/ - * - * @param string $password - * @param string $algorithmName - * @param string $salt - * @param int $spinCount - * @return string - */ - public static function hashPassword($password, $algorithmName = self::ALGORITHM_SHA_1, $salt = null, $spinCount = 10000) - { - $origEncoding = mb_internal_encoding(); - mb_internal_encoding('UTF-8'); - - $password = mb_substr($password, 0, min(self::$passwordMaxLength, mb_strlen($password))); - - // Get the single-byte values by iterating through the Unicode characters of the truncated password. - // For each character, if the low byte is not equal to 0, take it. Otherwise, take the high byte. - $passUtf8 = mb_convert_encoding($password, 'UCS-2LE', 'UTF-8'); - $byteChars = array(); - - for ($i = 0; $i < mb_strlen($password); $i++) { - $byteChars[$i] = ord(substr($passUtf8, $i * 2, 1)); - - if ($byteChars[$i] == 0) { - $byteChars[$i] = ord(substr($passUtf8, $i * 2 + 1, 1)); - } - } - - // build low-order word and hig-order word and combine them - $combinedKey = self::buildCombinedKey($byteChars); - // build reversed hexadecimal string - $hex = str_pad(strtoupper(dechex($combinedKey & 0xFFFFFFFF)), 8, '0', \STR_PAD_LEFT); - $reversedHex = $hex[6] . $hex[7] . $hex[4] . $hex[5] . $hex[2] . $hex[3] . $hex[0] . $hex[1]; - - $generatedKey = mb_convert_encoding($reversedHex, 'UCS-2LE', 'UTF-8'); - - // Implementation Notes List: - // Word requires that the initial hash of the password with the salt not be considered in the count. - // The initial hash of salt + key is not included in the iteration count. - $algorithm = self::getAlgorithm($algorithmName); - $generatedKey = hash($algorithm, $salt . $generatedKey, true); - - for ($i = 0; $i < $spinCount; $i++) { - $generatedKey = hash($algorithm, $generatedKey . pack('CCCC', $i, $i >> 8, $i >> 16, $i >> 24), true); - } - $generatedKey = base64_encode($generatedKey); - - mb_internal_encoding($origEncoding); - - return $generatedKey; - } - - /** - * Get algorithm from self::$algorithmMapping - * - * @param string $algorithmName - * @return string - */ - private static function getAlgorithm($algorithmName) - { - $algorithm = self::$algorithmMapping[$algorithmName][1]; - if ($algorithm == '') { - $algorithm = 'sha1'; - } - - return $algorithm; - } - - /** - * Returns the algorithm ID - * - * @param string $algorithmName - * @return int - */ - public static function getAlgorithmId($algorithmName) - { - return self::$algorithmMapping[$algorithmName][0]; - } - - /** - * Build combined key from low-order word and high-order word - * - * @param array $byteChars byte array representation of password - * @return int - */ - private static function buildCombinedKey($byteChars) - { - $byteCharsLength = count($byteChars); - // Compute the high-order word - // Initialize from the initial code array (see above), depending on the passwords length. - $highOrderWord = self::$initialCodeArray[$byteCharsLength - 1]; - - // For each character in the password: - // For every bit in the character, starting with the least significant and progressing to (but excluding) - // the most significant, if the bit is set, XOR the key’s high-order word with the corresponding word from - // the Encryption Matrix - for ($i = 0; $i < $byteCharsLength; $i++) { - $tmp = self::$passwordMaxLength - $byteCharsLength + $i; - $matrixRow = self::$encryptionMatrix[$tmp]; - for ($intBit = 0; $intBit < 7; $intBit++) { - if (($byteChars[$i] & (0x0001 << $intBit)) != 0) { - $highOrderWord = ($highOrderWord ^ $matrixRow[$intBit]); - } - } - } - - // Compute low-order word - // Initialize with 0 - $lowOrderWord = 0; - // For each character in the password, going backwards - for ($i = $byteCharsLength - 1; $i >= 0; $i--) { - // low-order word = (((low-order word SHR 14) AND 0x0001) OR (low-order word SHL 1) AND 0x7FFF)) XOR character - $lowOrderWord = (((($lowOrderWord >> 14) & 0x0001) | (($lowOrderWord << 1) & 0x7FFF)) ^ $byteChars[$i]); - } - // Lastly, low-order word = (((low-order word SHR 14) AND 0x0001) OR (low-order word SHL 1) AND 0x7FFF)) XOR strPassword length XOR 0xCE4B. - $lowOrderWord = (((($lowOrderWord >> 14) & 0x0001) | (($lowOrderWord << 1) & 0x7FFF)) ^ $byteCharsLength ^ 0xCE4B); - - // Combine the Low and High Order Word - return self::int32(($highOrderWord << 16) + $lowOrderWord); - } - - /** - * Simulate behaviour of (signed) int32 - * - * @codeCoverageIgnore - * @param int $value - * @return int - */ - private static function int32($value) - { - $value = ($value & 0xFFFFFFFF); - - if ($value & 0x80000000) { - $value = -((~$value & 0xFFFFFFFF) + 1); - } - - return $value; - } -} diff --git a/vendor/phpoffice/common/src/Common/Text.php b/vendor/phpoffice/common/src/Common/Text.php deleted file mode 100644 index 91c790ae..00000000 --- a/vendor/phpoffice/common/src/Common/Text.php +++ /dev/null @@ -1,232 +0,0 @@ -) - * element or in the shared string element. - * - * @param string $value Value to escape - * @return string - */ - public static function controlCharacterPHP2OOXML($value = '') - { - if (empty(self::$controlCharacters)) { - self::buildControlCharacters(); - } - - return str_replace(array_values(self::$controlCharacters), array_keys(self::$controlCharacters), $value); - } - - /** - * Return a number formatted for being integrated in xml files - * @param float $number - * @param integer $decimals - */ - public static function numberFormat($number, $decimals) - { - return number_format($number, $decimals, '.', ''); - } - - /** - * @param int $dec - * @link http://stackoverflow.com/a/7153133/2235790 - * @author velcrow - */ - public static function chr($dec) - { - if ($dec<=0x7F) { - return chr($dec); - } - if ($dec<=0x7FF) { - return chr(($dec>>6)+192).chr(($dec&63)+128); - } - if ($dec<=0xFFFF) { - return chr(($dec>>12)+224).chr((($dec>>6)&63)+128).chr(($dec&63)+128); - } - if ($dec<=0x1FFFFF) { - return chr(($dec>>18)+240).chr((($dec>>12)&63)+128).chr((($dec>>6)&63)+128).chr(($dec&63)+128); - } - return ''; - } - - /** - * Convert from OpenXML escaped control character to PHP control character - * - * @param string $value Value to unescape - * @return string - */ - public static function controlCharacterOOXML2PHP($value = '') - { - if (empty(self::$controlCharacters)) { - self::buildControlCharacters(); - } - - return str_replace(array_keys(self::$controlCharacters), array_values(self::$controlCharacters), $value); - } - - /** - * Check if a string contains UTF-8 data - * - * @param string $value - * @return boolean - */ - public static function isUTF8($value = '') - { - return is_string($value) && ($value === '' || preg_match('/^./su', $value) == 1); - } - - /** - * Return UTF8 encoded value - * - * @param string $value - * @return string - */ - public static function toUTF8($value = '') - { - if (!is_null($value) && !self::isUTF8($value)) { - $value = utf8_encode($value); - } - - return $value; - } - - /** - * Returns unicode from UTF8 text - * - * The function is splitted to reduce cyclomatic complexity - * - * @param string $text UTF8 text - * @return string Unicode text - * @since 0.11.0 - */ - public static function toUnicode($text) - { - return self::unicodeToEntities(self::utf8ToUnicode($text)); - } - - /** - * Returns unicode array from UTF8 text - * - * @param string $text UTF8 text - * @return array - * @since 0.11.0 - * @link http://www.randomchaos.com/documents/?source=php_and_unicode - */ - public static function utf8ToUnicode($text) - { - $unicode = array(); - $values = array(); - $lookingFor = 1; - - // Gets unicode for each character - for ($i = 0; $i < strlen($text); $i++) { - $thisValue = ord($text[$i]); - if ($thisValue < 128) { - $unicode[] = $thisValue; - } else { - if (count($values) == 0) { - $lookingFor = $thisValue < 224 ? 2 : 3; - } - $values[] = $thisValue; - if (count($values) == $lookingFor) { - if ($lookingFor == 3) { - $number = (($values[0] % 16) * 4096) + (($values[1] % 64) * 64) + ($values[2] % 64); - } else { - $number = (($values[0] % 32) * 64) + ($values[1] % 64); - } - $unicode[] = $number; - $values = array(); - $lookingFor = 1; - } - } - } - - return $unicode; - } - - /** - * Returns entites from unicode array - * - * @param array $unicode - * @return string - * @since 0.11.0 - * @link http://www.randomchaos.com/documents/?source=php_and_unicode - */ - private static function unicodeToEntities($unicode) - { - $entities = ''; - - foreach ($unicode as $value) { - if ($value != 65279) { - $entities .= $value > 127 ? '\uc0{\u' . $value . '}' : chr($value); - } - } - - return $entities; - } - - /** - * Return name without underscore for < 0.10.0 variable name compatibility - * - * @param string $value - * @return string - */ - public static function removeUnderscorePrefix($value) - { - if (!is_null($value)) { - if (substr($value, 0, 1) == '_') { - $value = substr($value, 1); - } - } - - return $value; - } -} diff --git a/vendor/phpoffice/common/src/Common/XMLReader.php b/vendor/phpoffice/common/src/Common/XMLReader.php deleted file mode 100644 index f804fb8a..00000000 --- a/vendor/phpoffice/common/src/Common/XMLReader.php +++ /dev/null @@ -1,209 +0,0 @@ -open($zipFile); - $content = $zip->getFromName($xmlFile); - $zip->close(); - - if ($content === false) { - return false; - } - - return $this->getDomFromString($content); - } - - /** - * Get DOMDocument from content string - * - * @param string $content - * @return \DOMDocument - */ - public function getDomFromString($content) - { - libxml_disable_entity_loader(true); - $this->dom = new \DOMDocument(); - $this->dom->loadXML($content); - - return $this->dom; - } - - /** - * Get elements - * - * @param string $path - * @param \DOMElement $contextNode - * @return \DOMNodeList - */ - public function getElements($path, \DOMElement $contextNode = null) - { - if ($this->dom === null) { - return array(); - } - if ($this->xpath === null) { - $this->xpath = new \DOMXpath($this->dom); - } - - if (is_null($contextNode)) { - return $this->xpath->query($path); - } - - return $this->xpath->query($path, $contextNode); - } - - /** - * Registers the namespace with the DOMXPath object - * - * @param string $prefix The prefix - * @param string $namespaceURI The URI of the namespace - * @return bool true on success or false on failure - * @throws \InvalidArgumentException If called before having loaded the DOM document - */ - public function registerNamespace($prefix, $namespaceURI) - { - if ($this->dom === null) { - throw new \InvalidArgumentException('Dom needs to be loaded before registering a namespace'); - } - if ($this->xpath === null) { - $this->xpath = new \DOMXpath($this->dom); - } - return $this->xpath->registerNamespace($prefix, $namespaceURI); - } - - /** - * Get element - * - * @param string $path - * @param \DOMElement $contextNode - * @return \DOMElement|null - */ - public function getElement($path, \DOMElement $contextNode = null) - { - $elements = $this->getElements($path, $contextNode); - if ($elements->length > 0) { - return $elements->item(0); - } - - return null; - } - - /** - * Get element attribute - * - * @param string $attribute - * @param \DOMElement $contextNode - * @param string $path - * @return string|null - */ - public function getAttribute($attribute, \DOMElement $contextNode = null, $path = null) - { - $return = null; - if ($path !== null) { - $elements = $this->getElements($path, $contextNode); - if ($elements->length > 0) { - /** @var \DOMElement $node Type hint */ - $node = $elements->item(0); - $return = $node->getAttribute($attribute); - } - } else { - if ($contextNode !== null) { - $return = $contextNode->getAttribute($attribute); - } - } - - return ($return == '') ? null : $return; - } - - /** - * Get element value - * - * @param string $path - * @param \DOMElement $contextNode - * @return string|null - */ - public function getValue($path, \DOMElement $contextNode = null) - { - $elements = $this->getElements($path, $contextNode); - if ($elements->length > 0) { - return $elements->item(0)->nodeValue; - } - - return null; - } - - /** - * Count elements - * - * @param string $path - * @param \DOMElement $contextNode - * @return integer - */ - public function countElements($path, \DOMElement $contextNode = null) - { - $elements = $this->getElements($path, $contextNode); - - return $elements->length; - } - - /** - * Element exists - * - * @param string $path - * @param \DOMElement $contextNode - * @return boolean - */ - public function elementExists($path, \DOMElement $contextNode = null) - { - return $this->getElements($path, $contextNode)->length > 0; - } -} diff --git a/vendor/phpoffice/common/src/Common/XMLWriter.php b/vendor/phpoffice/common/src/Common/XMLWriter.php deleted file mode 100644 index 43e5b665..00000000 --- a/vendor/phpoffice/common/src/Common/XMLWriter.php +++ /dev/null @@ -1,182 +0,0 @@ -openMemory(); - } else { - if (!is_dir($pTemporaryStorageDir)) { - $pTemporaryStorageDir = sys_get_temp_dir(); - } - // Create temporary filename - $this->tempFileName = @tempnam($pTemporaryStorageDir, 'xml'); - - // Open storage - $this->openUri($this->tempFileName); - } - - if ($compatibility) { - $this->setIndent(false); - $this->setIndentString(''); - } else { - $this->setIndent(true); - $this->setIndentString(' '); - } - } - - /** - * Destructor - */ - public function __destruct() - { - // Unlink temporary files - if (empty($this->tempFileName)) { - return; - } - if (PHP_OS != 'WINNT' && @unlink($this->tempFileName) === false) { - throw new \Exception('The file '.$this->tempFileName.' could not be deleted.'); - } - } - - /** - * Get written data - * - * @return string - */ - public function getData() - { - if ($this->tempFileName == '') { - return $this->outputMemory(true); - } - - $this->flush(); - return file_get_contents($this->tempFileName); - } - - - /** - * Write simple element and attribute(s) block - * - * There are two options: - * 1. If the `$attributes` is an array, then it's an associative array of attributes - * 2. If not, then it's a simple attribute-value pair - * - * @param string $element - * @param string|array $attributes - * @param string $value - * @return void - */ - public function writeElementBlock($element, $attributes, $value = null) - { - $this->startElement($element); - if (!is_array($attributes)) { - $attributes = array($attributes => $value); - } - foreach ($attributes as $attribute => $value) { - $this->writeAttribute($attribute, $value); - } - $this->endElement(); - } - - /** - * Write element if ... - * - * @param bool $condition - * @param string $element - * @param string $attribute - * @param mixed $value - * @return void - */ - public function writeElementIf($condition, $element, $attribute = null, $value = null) - { - if ($condition == true) { - if (is_null($attribute)) { - $this->writeElement($element, $value); - } else { - $this->startElement($element); - $this->writeAttribute($attribute, $value); - $this->endElement(); - } - } - } - - /** - * Write attribute if ... - * - * @param bool $condition - * @param string $attribute - * @param mixed $value - * @return void - */ - public function writeAttributeIf($condition, $attribute, $value) - { - if ($condition == true) { - $this->writeAttribute($attribute, $value); - } - } - - /** - * @param string $name - * @param mixed $value - * @return bool - */ - public function writeAttribute($name, $value) - { - if (is_float($value)) { - $value = json_encode($value); - } - return parent::writeAttribute($name, $value); - } -} diff --git a/vendor/phpoffice/common/tests/Common/Tests/Adapter/Zip/AbstractZipAdapterTest.php b/vendor/phpoffice/common/tests/Common/Tests/Adapter/Zip/AbstractZipAdapterTest.php deleted file mode 100644 index c95eae77..00000000 --- a/vendor/phpoffice/common/tests/Common/Tests/Adapter/Zip/AbstractZipAdapterTest.php +++ /dev/null @@ -1,61 +0,0 @@ -zipTest = tempnam(sys_get_temp_dir(), 'PhpOfficeCommon'); - copy($pathResources.'Sample_01_Simple.pptx', $this->zipTest); - } - - public function tearDown() - { - parent::tearDown(); - - if (is_file($this->zipTest)) { - unlink($this->zipTest); - } - } - - public function testOpen() - { - $adapter = $this->createAdapter(); - $this->assertSame($adapter, $adapter->open($this->zipTest)); - } - - public function testClose() - { - $adapter = $this->createAdapter(); - $adapter->open($this->zipTest); - $this->assertSame($adapter, $adapter->close()); - } - - public function testAddFromString() - { - $expectedPath = 'file.test'; - $expectedContent = 'Content'; - - $adapter = $this->createAdapter(); - $adapter->open($this->zipTest); - $this->assertSame($adapter, $adapter->addFromString($expectedPath, $expectedContent)); - $adapter->close(); - - $this->assertTrue(TestHelperZip::assertFileExists($this->zipTest, $expectedPath)); - $this->assertTrue(TestHelperZip::assertFileContent($this->zipTest, $expectedPath, $expectedContent)); - } -} diff --git a/vendor/phpoffice/common/tests/Common/Tests/Adapter/Zip/PclZipAdapterTest.php b/vendor/phpoffice/common/tests/Common/Tests/Adapter/Zip/PclZipAdapterTest.php deleted file mode 100644 index c7535bce..00000000 --- a/vendor/phpoffice/common/tests/Common/Tests/Adapter/Zip/PclZipAdapterTest.php +++ /dev/null @@ -1,14 +0,0 @@ -assertContains( - array('PhpOffice\\Common\\Autoloader', 'autoload'), - spl_autoload_functions() - ); - } - - /** - * Autoload - */ - public function testAutoload() - { - $declared = get_declared_classes(); - $declaredCount = count($declared); - Autoloader::autoload('Foo'); - $this->assertEquals( - $declaredCount, - count(get_declared_classes()), - 'PhpOffice\\Common\\Autoloader::autoload() is trying to load ' . - 'classes outside of the PhpOffice\\Common namespace' - ); - } -} diff --git a/vendor/phpoffice/common/tests/Common/Tests/DrawingTest.php b/vendor/phpoffice/common/tests/Common/Tests/DrawingTest.php deleted file mode 100644 index bbcf4e3a..00000000 --- a/vendor/phpoffice/common/tests/Common/Tests/DrawingTest.php +++ /dev/null @@ -1,125 +0,0 @@ -assertEquals(0, Drawing::degreesToAngle()); - $this->assertEquals((int) round($value * 60000), Drawing::degreesToAngle($value)); - $this->assertEquals(0, Drawing::angleToDegrees()); - $this->assertEquals(round($value / 60000), Drawing::angleToDegrees($value)); - } - - /** - */ - public function testPixelsCentimeters() - { - $value = rand(1, 100); - - $this->assertEquals(0, Drawing::pixelsToCentimeters()); - $this->assertEquals($value / Drawing::DPI_96 * 2.54, Drawing::pixelsToCentimeters($value)); - $this->assertEquals(0, Drawing::centimetersToPixels()); - $this->assertEquals($value / 2.54 * Drawing::DPI_96, Drawing::centimetersToPixels($value)); - } - - /** - */ - public function testPixelsEMU() - { - $value = rand(1, 100); - - $this->assertEquals(0, Drawing::pixelsToEmu()); - $this->assertEquals(round($value*9525), Drawing::pixelsToEmu($value)); - $this->assertEquals(0, Drawing::emuToPixels()); - $this->assertEquals(round($value/9525), Drawing::emuToPixels($value)); - } - - /** - */ - public function testPixelsPoints() - { - $value = rand(1, 100); - - $this->assertEquals(0, Drawing::pixelsToPoints()); - $this->assertEquals($value*0.67777777, Drawing::pixelsToPoints($value)); - $this->assertEquals(0, Drawing::pointsToPixels()); - $this->assertEquals($value* 1.333333333, Drawing::pointsToPixels($value)); - } - - /** - */ - public function testPointsCentimeters() - { - $value = rand(1, 100); - - $this->assertEquals(0, Drawing::pointsToCentimeters()); - $this->assertEquals($value * 1.333333333 / Drawing::DPI_96 * 2.54, Drawing::pointsToCentimeters($value)); - } - - /** - */ - public function testTwips() - { - $value = rand(1, 100); - - // Centimeters - $this->assertEquals(0, Drawing::centimetersToTwips()); - $this->assertEquals($value * 566.928, Drawing::centimetersToTwips($value)); - - $this->assertEquals(0, Drawing::twipsToCentimeters()); - $this->assertEquals($value / 566.928, Drawing::twipsToCentimeters($value)); - - // Inches - $this->assertEquals(0, Drawing::inchesToTwips()); - $this->assertEquals($value * 1440, Drawing::inchesToTwips($value)); - - $this->assertEquals(0, Drawing::twipsToInches()); - $this->assertEquals($value / 1440, Drawing::twipsToInches($value)); - - // Pixels - $this->assertEquals(0, Drawing::twipsToPixels()); - $this->assertEquals(round($value / 15.873984), Drawing::twipsToPixels($value)); - } - - public function testHTML() - { - $this->assertFalse(Drawing::htmlToRGB('0')); - $this->assertFalse(Drawing::htmlToRGB('00')); - $this->assertFalse(Drawing::htmlToRGB('0000')); - $this->assertFalse(Drawing::htmlToRGB('00000')); - - $this->assertInternalType('array', Drawing::htmlToRGB('ABCDEF')); - $this->assertCount(3, Drawing::htmlToRGB('ABCDEF')); - $this->assertEquals(array(0xAB, 0xCD, 0xEF), Drawing::htmlToRGB('ABCDEF')); - $this->assertEquals(array(0xAB, 0xCD, 0xEF), Drawing::htmlToRGB('#ABCDEF')); - $this->assertEquals(array(0xAA, 0xBB, 0xCC), Drawing::htmlToRGB('ABC')); - $this->assertEquals(array(0xAA, 0xBB, 0xCC), Drawing::htmlToRGB('#ABC')); - } -} diff --git a/vendor/phpoffice/common/tests/Common/Tests/FileTest.php b/vendor/phpoffice/common/tests/Common/Tests/FileTest.php deleted file mode 100644 index 439cc7bf..00000000 --- a/vendor/phpoffice/common/tests/Common/Tests/FileTest.php +++ /dev/null @@ -1,62 +0,0 @@ -assertTrue(File::fileExists($pathResources.'images'.DIRECTORY_SEPARATOR.'PHPPowerPointLogo.png')); - $this->assertFalse(File::fileExists($pathResources.'images'.DIRECTORY_SEPARATOR.'PHPPowerPointLogo_404.png')); - $this->assertTrue(File::fileExists('zip://'.$pathResources.'files'.DIRECTORY_SEPARATOR.'Sample_01_Simple.pptx#[Content_Types].xml')); - $this->assertFalse(File::fileExists('zip://'.$pathResources.'files'.DIRECTORY_SEPARATOR.'Sample_01_Simple.pptx#404.xml')); - $this->assertFalse(File::fileExists('zip://'.$pathResources.'files'.DIRECTORY_SEPARATOR.'404.pptx#404.xml')); - } - - /** - */ - public function testGetFileContents() - { - $pathResources = PHPOFFICE_COMMON_TESTS_BASE_DIR.DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR; - $this->assertInternalType('string', File::fileGetContents($pathResources.'images'.DIRECTORY_SEPARATOR.'PHPPowerPointLogo.png')); - $this->assertFalse(File::fileGetContents($pathResources.'images'.DIRECTORY_SEPARATOR.'PHPPowerPointLogo_404.png')); - $this->assertInternalType('string', File::fileGetContents('zip://'.$pathResources.'files'.DIRECTORY_SEPARATOR.'Sample_01_Simple.pptx#[Content_Types].xml')); - $this->assertFalse(File::fileGetContents('zip://'.$pathResources.'files'.DIRECTORY_SEPARATOR.'Sample_01_Simple.pptx#404.xml')); - $this->assertFalse(File::fileGetContents('zip://'.$pathResources.'files'.DIRECTORY_SEPARATOR.'404.pptx#404.xml')); - } - - /** - */ - public function testRealPath() - { - $pathFiles = PHPOFFICE_COMMON_TESTS_BASE_DIR.DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'files'.DIRECTORY_SEPARATOR; - - $this->assertEquals($pathFiles.'Sample_01_Simple.pptx', File::realpath($pathFiles.'Sample_01_Simple.pptx')); - $this->assertEquals('zip://'.$pathFiles.'Sample_01_Simple.pptx#[Content_Types].xml', File::realpath('zip://'.$pathFiles.'Sample_01_Simple.pptx#[Content_Types].xml')); - $this->assertEquals('zip://'.$pathFiles.'Sample_01_Simple.pptx#/[Content_Types].xml', File::realpath('zip://'.$pathFiles.'Sample_01_Simple.pptx#/rels/../[Content_Types].xml')); - } -} diff --git a/vendor/phpoffice/common/tests/Common/Tests/FontTest.php b/vendor/phpoffice/common/tests/Common/Tests/FontTest.php deleted file mode 100644 index c6615021..00000000 --- a/vendor/phpoffice/common/tests/Common/Tests/FontTest.php +++ /dev/null @@ -1,44 +0,0 @@ -assertEquals(16, Font::fontSizeToPixels()); - $this->assertEquals((16 / 12) * $value, Font::fontSizeToPixels($value)); - $this->assertEquals(96, Font::inchSizeToPixels()); - $this->assertEquals(96 * $value, Font::inchSizeToPixels($value)); - $this->assertEquals(37.795275591, Font::centimeterSizeToPixels()); - $this->assertEquals(37.795275591 * $value, Font::centimeterSizeToPixels($value)); - $this->assertEquals($value / 2.54 * 1440, Font::centimeterSizeToTwips($value)); - $this->assertEquals($value * 1440, Font::inchSizeToTwips($value)); - $this->assertEquals($value / 96 * 1440, Font::pixelSizeToTwips($value)); - $this->assertEquals($value / 72 * 1440, Font::pointSizeToTwips($value)); - } -} diff --git a/vendor/phpoffice/common/tests/Common/Tests/Microsoft/PasswordEncoderTest.php b/vendor/phpoffice/common/tests/Common/Tests/Microsoft/PasswordEncoderTest.php deleted file mode 100644 index b796575f..00000000 --- a/vendor/phpoffice/common/tests/Common/Tests/Microsoft/PasswordEncoderTest.php +++ /dev/null @@ -1,89 +0,0 @@ -assertEquals('M795/MAlmGU8RIsY9Q9uDLHC7bk=', $hashPassword); - } - - /** - * Test that a password can be hashed with a custom salt - */ - public function testEncodePasswordWithSalt() - { - //given - $password = 'test'; - $salt = base64_decode('uq81pJRRGFIY5U+E9gt8tA=='); - - //when - $hashPassword = PasswordEncoder::hashPassword($password, PasswordEncoder::ALGORITHM_SHA_1, $salt); - - //then - $this->assertEquals('QiDOcpia1YzSVJPiKPwWebl9p/0=', $hashPassword); - } - - /** - * Test that the encoder falls back on SHA-1 if a non supported algorithm is given - */ - public function testDefaultsToSha1IfUnsupportedAlgorithm() - { - //given - $password = 'test'; - $salt = base64_decode('uq81pJRRGFIY5U+E9gt8tA=='); - - //when - $hashPassword = PasswordEncoder::hashPassword($password, PasswordEncoder::ALGORITHM_MAC, $salt); - - //then - $this->assertEquals('QiDOcpia1YzSVJPiKPwWebl9p/0=', $hashPassword); - } - - /** - * Test that the encoder falls back on SHA-1 if a non supported algorithm is given - */ - public function testEncodePasswordWithNullAsciiCodeInPassword() - { - //given - $password = 'test' . chr(0); - $salt = base64_decode('uq81pJRRGFIY5U+E9gt8tA=='); - - //when - $hashPassword = PasswordEncoder::hashPassword($password, PasswordEncoder::ALGORITHM_MAC, $salt, 1); - - //then - $this->assertEquals('rDV9sgdDsztoCQlvRCb1lF2wxNg=', $hashPassword); - } -} diff --git a/vendor/phpoffice/common/tests/Common/Tests/TextTest.php b/vendor/phpoffice/common/tests/Common/Tests/TextTest.php deleted file mode 100644 index edd65e21..00000000 --- a/vendor/phpoffice/common/tests/Common/Tests/TextTest.php +++ /dev/null @@ -1,89 +0,0 @@ -assertEquals('', Text::controlCharacterPHP2OOXML()); - $this->assertEquals('aeiou', Text::controlCharacterPHP2OOXML('aeiou')); - $this->assertEquals('àéîöù', Text::controlCharacterPHP2OOXML('àéîöù')); - - $value = rand(0, 8); - $this->assertEquals('_x'.sprintf('%04s', strtoupper(dechex($value))).'_', Text::controlCharacterPHP2OOXML(chr($value))); - - $this->assertEquals('', Text::controlCharacterOOXML2PHP('')); - $this->assertEquals(chr(0x08), Text::controlCharacterOOXML2PHP('_x0008_')); - } - - public function testNumberFormat() - { - $this->assertEquals('2.1', Text::numberFormat('2.06', 1)); - $this->assertEquals('2.1', Text::numberFormat('2.12', 1)); - $this->assertEquals('1234.0', Text::numberFormat(1234, 1)); - } - - public function testChr() - { - $this->assertEquals('A', Text::chr(65)); - $this->assertEquals('A', Text::chr(0x41)); - $this->assertEquals('é', Text::chr(233)); - $this->assertEquals('é', Text::chr(0xE9)); - $this->assertEquals('⼳', Text::chr(12083)); - $this->assertEquals('⼳', Text::chr(0x2F33)); - $this->assertEquals('🌃', Text::chr(127747)); - $this->assertEquals('🌃', Text::chr(0x1F303)); - $this->assertEquals('', Text::chr(2097152)); - } - /** - * Is UTF8 - */ - public function testIsUTF8() - { - $this->assertTrue(Text::isUTF8('')); - $this->assertTrue(Text::isUTF8('éééé')); - $this->assertFalse(Text::isUTF8(utf8_decode('éééé'))); - } - - /** - * Test unicode conversion - */ - public function testToUnicode() - { - $this->assertEquals('a', Text::toUnicode('a')); - $this->assertEquals('\uc0{\u8364}', Text::toUnicode('€')); - $this->assertEquals('\uc0{\u233}', Text::toUnicode('é')); - } - - /** - * Test remove underscore prefix - */ - public function testRemoveUnderscorePrefix() - { - $this->assertEquals('item', Text::removeUnderscorePrefix('_item')); - } -} diff --git a/vendor/phpoffice/common/tests/Common/Tests/XMLReaderTest.php b/vendor/phpoffice/common/tests/Common/Tests/XMLReaderTest.php deleted file mode 100644 index b0acde76..00000000 --- a/vendor/phpoffice/common/tests/Common/Tests/XMLReaderTest.php +++ /dev/null @@ -1,135 +0,0 @@ -getDomFromString('AAA'); - - $this->assertTrue($reader->elementExists('/element/child')); - $this->assertEquals('AAA', $reader->getElement('/element/child')->textContent); - $this->assertEquals('AAA', $reader->getValue('/element/child')); - $this->assertEquals('test', $reader->getAttribute('attr', $reader->getElement('/element'))); - $this->assertEquals('subtest', $reader->getAttribute('attr', $reader->getElement('/element'), 'child')); - } - - /** - * Test reading XML from zip - */ - public function testDomFromZip() - { - $pathResources = PHPOFFICE_COMMON_TESTS_BASE_DIR.DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'files'.DIRECTORY_SEPARATOR; - - $reader = new XMLReader(); - $reader->getDomFromZip($pathResources. 'reader.zip', 'test.xml'); - - $this->assertTrue($reader->elementExists('/element/child')); - - $this->assertFalse($reader->getDomFromZip($pathResources. 'reader.zip', 'non_existing_xml_file.xml')); - } - - /** - * Test that read from non existing archive throws exception - * - * @expectedException Exception - */ - public function testThrowsExceptionOnNonExistingArchive() - { - $pathResources = PHPOFFICE_COMMON_TESTS_BASE_DIR.DIRECTORY_SEPARATOR.'resources'.DIRECTORY_SEPARATOR.'files'.DIRECTORY_SEPARATOR; - - $reader = new XMLReader(); - $reader->getDomFromZip($pathResources. 'readers.zip', 'test.xml'); - } - - /** - * Test elements count - */ - public function testCountElements() - { - $reader = new XMLReader(); - $reader->getDomFromString('AAABBB'); - - $this->assertEquals(2, $reader->countElements('/element/child')); - } - - /** - * Test read non existing elements - */ - public function testReturnNullOnNonExistingNode() - { - $reader = new XMLReader(); - $this->assertEmpty($reader->getElements('/element/children')); - $reader->getDomFromString('AAA'); - - $this->assertNull($reader->getElement('/element/children')); - $this->assertNull($reader->getValue('/element/children')); - } - - /** - * Test that xpath fails if custom namespace is not registered - */ - public function testShouldThrowExceptionIfNamespaceIsNotKnown() - { - try { - $reader = new XMLReader(); - $reader->getDomFromString('AAA'); - - $this->assertTrue($reader->elementExists('/element/test:child')); - $this->assertEquals('AAA', $reader->getElement('/element/test:child')->textContent); - $this->fail(); - } catch (\Exception $e) { - $this->assertTrue(true); - } - } - - /** - * Test reading XML with manually registered namespace - */ - public function testShouldParseXmlWithCustomNamespace() - { - $reader = new XMLReader(); - $reader->getDomFromString('AAA'); - $reader->registerNamespace('test', 'http://phpword.com/my/custom/namespace'); - - $this->assertTrue($reader->elementExists('/element/test:child')); - $this->assertEquals('AAA', $reader->getElement('/element/test:child')->textContent); - } - - /** - * Test that xpath fails if custom namespace is not registered - * - * @expectedException InvalidArgumentException - */ - public function testShouldThowExceptionIfTryingToRegisterNamespaceBeforeReadingDoc() - { - $reader = new XMLReader(); - $reader->registerNamespace('test', 'http://phpword.com/my/custom/namespace'); - } -} diff --git a/vendor/phpoffice/common/tests/Common/Tests/XMLWriterTest.php b/vendor/phpoffice/common/tests/Common/Tests/XMLWriterTest.php deleted file mode 100644 index 2ff2d2c0..00000000 --- a/vendor/phpoffice/common/tests/Common/Tests/XMLWriterTest.php +++ /dev/null @@ -1,71 +0,0 @@ -startElement('element'); - $object->text('AAA'); - $object->endElement(); - $this->assertEquals('AAA'.chr(10), $object->getData()); - - // Disk - $object = new XMLWriter(XMLWriter::STORAGE_DISK); - $object->startElement('element'); - $object->text('BBB'); - $object->endElement(); - $this->assertEquals('BBB'.chr(10), $object->getData()); - } - - public function testWriteAttribute() - { - $xmlWriter = new XMLWriter(); - $xmlWriter->startElement('element'); - $xmlWriter->writeAttribute('name', 'value'); - $xmlWriter->endElement(); - - $this->assertSame('' . chr(10), $xmlWriter->getData()); - } - - public function testWriteAttributeShouldWriteFloatValueLocaleIndependent() - { - $value = 1.2; - - $xmlWriter = new XMLWriter(); - $xmlWriter->startElement('element'); - $xmlWriter->writeAttribute('name', $value); - $xmlWriter->endElement(); - - setlocale(LC_NUMERIC, 'de_DE.UTF-8', 'de'); - - $this->assertSame('1,2', (string)$value); - $this->assertSame('' . chr(10), $xmlWriter->getData()); - } -} diff --git a/vendor/phpoffice/common/tests/Common/Tests/_includes/TestHelperZip.php b/vendor/phpoffice/common/tests/Common/Tests/_includes/TestHelperZip.php deleted file mode 100644 index 6f7c54d8..00000000 --- a/vendor/phpoffice/common/tests/Common/Tests/_includes/TestHelperZip.php +++ /dev/null @@ -1,33 +0,0 @@ -open($fileZip) !== true) { - return false; - } - if ($oZip->statName($path) === false) { - return false; - } - return true; - } - - public static function assertFileContent($fileZip, $path, $content) - { - $oZip = new \ZipArchive; - if ($oZip->open($fileZip) !== true) { - return false; - } - $zipFileContent = $oZip->getFromName($path); - if ($zipFileContent === false) { - return false; - } - if ($zipFileContent != $content) { - return false; - } - return true; - } -} diff --git a/vendor/phpoffice/common/tests/Common/Tests/_includes/XmlDocument.php b/vendor/phpoffice/common/tests/Common/Tests/_includes/XmlDocument.php deleted file mode 100644 index 29e9d6a6..00000000 --- a/vendor/phpoffice/common/tests/Common/Tests/_includes/XmlDocument.php +++ /dev/null @@ -1,175 +0,0 @@ -path = realpath($path); - } - - /** - * Get DOM from file - * - * @param string $file - * @return \DOMDocument - */ - public function getFileDom($file = 'word/document.xml') - { - if (null !== $this->dom && $file === $this->file) { - return $this->dom; - } - - $this->xpath = null; - $this->file = $file; - - $file = $this->path . '/' . $file; - $this->dom = new \DOMDocument(); - $this->dom->load($file); - return $this->dom; - } - - /** - * Get node list - * - * @param string $path - * @param string $file - * @return \DOMNodeList - */ - public function getNodeList($path, $file = 'word/document.xml') - { - if ($this->dom === null || $file !== $this->file) { - $this->getFileDom($file); - } - - if (null === $this->xpath) { - $this->xpath = new \DOMXpath($this->dom); - } - - return $this->xpath->query($path); - } - - /** - * Get element - * - * @param string $path - * @param string $file - * @return \DOMElement - */ - public function getElement($path, $file = 'word/document.xml') - { - $elements = $this->getNodeList($path, $file); - return $elements->item(0); - } - - /** - * Get file name - * - * @return string - */ - public function getFile() - { - return $this->file; - } - - /** - * Get path - * - * @return string - */ - public function getPath() - { - return $this->path; - } - - /** - * Get element attribute - * - * @param string $path - * @param string $attribute - * @param string $file - * @return string - */ - public function getElementAttribute($path, $attribute, $file = 'word/document.xml') - { - return $this->getElement($path, $file)->getAttribute($attribute); - } - - /** - * Get element attribute - * - * @param string $path - * @param string $attribute - * @param string $file - * @return string - */ - public function attributeElementExists($path, $attribute, $file = 'word/document.xml') - { - return $this->getElement($path, $file)->hasAttribute($attribute); - } - - /** - * Check if element exists - * - * @param string $path - * @param string $file - * @return string - */ - public function elementExists($path, $file = 'word/document.xml') - { - $nodeList = $this->getNodeList($path, $file); - return !($nodeList->length == 0); - } -} diff --git a/vendor/phpoffice/common/tests/bootstrap.php b/vendor/phpoffice/common/tests/bootstrap.php deleted file mode 100644 index 35fd6f19..00000000 --- a/vendor/phpoffice/common/tests/bootstrap.php +++ /dev/null @@ -1,52 +0,0 @@ - - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. - - If this is still an issue for you, please try to help by debugging it - further and sharing your results. - - Thank you for your contributions. - -# Comment to post when closing a stale issue. Set to `false` to disable -closeComment: false diff --git a/vendor/phpoffice/phpspreadsheet/.github/support.yml b/vendor/phpoffice/phpspreadsheet/.github/support.yml deleted file mode 100644 index e66573e9..00000000 --- a/vendor/phpoffice/phpspreadsheet/.github/support.yml +++ /dev/null @@ -1,15 +0,0 @@ -# Label used to mark issues as support requests -supportLabel: question -# Comment to post on issues marked as support requests. Add a link -# to a support page, or set to `false` to disable -supportComment: > - This looks like a support question. Please ask your support questions on - [StackOverflow](http://stackoverflow.com/questions/tagged/phpspreadsheet), - or [Gitter](https://gitter.im/PHPOffice/PhpSpreadsheet). - - Thank you for your contributions. - -# Whether to close issues marked as support requests -close: true -# Whether to lock issues marked as support requests -lock: false diff --git a/vendor/phpoffice/phpspreadsheet/.gitignore b/vendor/phpoffice/phpspreadsheet/.gitignore deleted file mode 100644 index 0723541d..00000000 --- a/vendor/phpoffice/phpspreadsheet/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -/tests/codeCoverage -/analysis -/vendor/ -/phpunit.xml - -## IDE support -*.buildpath -*.project -/.settings -/.idea diff --git a/vendor/phpoffice/phpspreadsheet/.php_cs.dist b/vendor/phpoffice/phpspreadsheet/.php_cs.dist deleted file mode 100644 index 29b85d77..00000000 --- a/vendor/phpoffice/phpspreadsheet/.php_cs.dist +++ /dev/null @@ -1,182 +0,0 @@ -exclude('vendor') - ->in('samples') - ->in('src') - ->in('tests'); - -return PhpCsFixer\Config::create() - ->setRiskyAllowed(true) - ->setFinder($finder) - ->setCacheFile(sys_get_temp_dir() . '/php-cs-fixer' . preg_replace('~\W~', '-', __DIR__)) - ->setRules([ - 'align_multiline_comment' => true, - 'array_syntax' => ['syntax' => 'short'], - 'backtick_to_shell_exec' => true, - 'binary_operator_spaces' => true, - 'blank_line_after_namespace' => true, - 'blank_line_after_opening_tag' => true, - 'blank_line_before_statement' => true, - 'braces' => true, - 'cast_spaces' => true, - 'class_attributes_separation' => ['elements' => ['method', 'property']], // const are often grouped with other related const - 'class_definition' => true, - 'class_keyword_remove' => false, // ::class keyword gives us beter support in IDE - 'combine_consecutive_issets' => true, - 'combine_consecutive_unsets' => true, - 'compact_nullable_typehint' => true, - 'concat_space' => ['spacing' => 'one'], - 'declare_equal_normalize' => true, - 'declare_strict_types' => false, // Too early to adopt strict types - 'dir_constant' => true, - 'doctrine_annotation_array_assignment' => true, - 'doctrine_annotation_braces' => true, - 'doctrine_annotation_indentation' => true, - 'doctrine_annotation_spaces' => true, - 'elseif' => true, - 'encoding' => true, - 'ereg_to_preg' => true, - 'escape_implicit_backslashes' => true, - 'explicit_indirect_variable' => false, // I feel it makes the code actually harder to read - 'explicit_string_variable' => false, // I feel it makes the code actually harder to read - 'final_internal_class' => true, - 'full_opening_tag' => true, - 'function_declaration' => true, - 'function_to_constant' => true, - 'function_typehint_space' => true, - 'general_phpdoc_annotation_remove' => false, // No use for that - 'hash_to_slash_comment' => true, - 'header_comment' => false, // We don't use common header in all our files - 'heredoc_to_nowdoc' => false, // Not sure about this one - 'include' => true, - 'increment_style' => true, - 'indentation_type' => true, - 'is_null' => ['use_yoda_style' => false], - 'linebreak_after_opening_tag' => true, - 'line_ending' => true, - 'list_syntax' => ['syntax' => 'long'], // Stay compatiblew with PHP 5.6 - 'lowercase_cast' => true, - 'lowercase_constants' => true, - 'lowercase_keywords' => true, - 'magic_constant_casing' => true, - 'mb_str_functions' => false, // No, too dangerous to change that - 'method_argument_space' => true, - 'method_chaining_indentation' => true, - 'method_separation' => true, - 'modernize_types_casting' => true, - 'multiline_comment_opening_closing' => true, - 'native_function_casing' => true, - 'native_function_invocation' => false, // This is risky and seems to be micro-optimization that make code uglier so not worth it, at least for now - 'new_with_braces' => true, - 'no_alias_functions' => true, - 'no_blank_lines_after_class_opening' => true, - 'no_blank_lines_after_phpdoc' => true, - 'no_blank_lines_before_namespace' => false, // we want 1 blank line before namespace - 'no_break_comment' => true, - 'no_closing_tag' => true, - 'no_empty_comment' => true, - 'no_empty_phpdoc' => true, - 'no_empty_statement' => true, - 'no_extra_blank_lines' => true, - 'no_homoglyph_names' => true, - 'no_leading_import_slash' => true, - 'no_leading_namespace_whitespace' => true, - 'no_mixed_echo_print' => true, - 'no_multiline_whitespace_around_double_arrow' => true, - 'no_multiline_whitespace_before_semicolons' => true, - 'non_printable_character' => true, - 'no_null_property_initialization' => true, - 'no_php4_constructor' => true, - 'normalize_index_brace' => true, - 'no_short_bool_cast' => true, - 'no_short_echo_tag' => true, - 'no_singleline_whitespace_before_semicolons' => true, - 'no_spaces_after_function_name' => true, - 'no_spaces_around_offset' => true, - 'no_spaces_inside_parenthesis' => true, - 'no_superfluous_elseif' => false, // Might be risky on a huge code base - 'not_operator_with_space' => false, // No we prefer to keep '!' without spaces - 'not_operator_with_successor_space' => false, // idem - 'no_trailing_comma_in_list_call' => true, - 'no_trailing_comma_in_singleline_array' => true, - 'no_trailing_whitespace_in_comment' => true, - 'no_trailing_whitespace' => true, - 'no_unneeded_control_parentheses' => true, - 'no_unneeded_curly_braces' => true, - 'no_unneeded_final_method' => true, - 'no_unreachable_default_argument_value' => true, - 'no_unused_imports' => true, - 'no_useless_else' => true, - 'no_useless_return' => true, - 'no_whitespace_before_comma_in_array' => true, - 'no_whitespace_in_blank_line' => true, - 'object_operator_without_whitespace' => true, - 'ordered_class_elements' => false, // We prefer to keep some freedom - 'ordered_imports' => true, - 'phpdoc_add_missing_param_annotation' => true, - 'phpdoc_align' => false, // Waste of time - 'phpdoc_annotation_without_dot' => true, - 'phpdoc_indent' => true, - 'phpdoc_inline_tag' => true, - 'phpdoc_no_access' => true, - 'phpdoc_no_alias_tag' => true, - 'phpdoc_no_empty_return' => true, - 'phpdoc_no_package' => true, - 'phpdoc_no_useless_inheritdoc' => true, - 'phpdoc_order' => true, - 'phpdoc_return_self_reference' => true, - 'phpdoc_scalar' => true, - 'phpdoc_separation' => true, - 'phpdoc_single_line_var_spacing' => true, - 'phpdoc_summary' => true, - 'phpdoc_to_comment' => true, - 'phpdoc_trim' => true, - 'phpdoc_types_order' => true, - 'phpdoc_types' => true, - 'phpdoc_var_without_name' => true, - 'php_unit_construct' => true, - 'php_unit_dedicate_assert' => true, - 'php_unit_expectation' => true, - 'php_unit_fqcn_annotation' => true, - 'php_unit_mock' => true, - 'php_unit_namespaced' => true, - 'php_unit_no_expectation_annotation' => true, - 'php_unit_strict' => false, // We sometime actually need assertEquals - 'php_unit_test_annotation' => true, - 'php_unit_test_class_requires_covers' => false, // We don't care as much as we should about coverage - 'pow_to_exponentiation' => false, - 'protected_to_private' => true, - 'psr0' => true, - 'psr4' => true, - 'random_api_migration' => false, // This breaks our unit tests - 'return_type_declaration' => true, - 'self_accessor' => true, - 'semicolon_after_instruction' => false, // Buggy in `samples/index.php` - 'short_scalar_cast' => true, - 'silenced_deprecation_error' => true, - 'simplified_null_return' => false, // While technically correct we prefer to be explicit when returning null - 'single_blank_line_at_eof' => true, - 'single_blank_line_before_namespace' => true, - 'single_class_element_per_statement' => true, - 'single_import_per_statement' => true, - 'single_line_after_imports' => true, - 'single_line_comment_style' => true, - 'single_quote' => true, - 'space_after_semicolon' => true, - 'standardize_not_equals' => true, - 'static_lambda' => false, // Risky if we can't guarantee nobody use `bindTo()` - 'strict_comparison' => false, // No, too dangerous to change that - 'strict_param' => false, // No, too dangerous to change that - 'switch_case_semicolon_to_colon' => true, - 'switch_case_space' => true, - 'ternary_operator_spaces' => true, - 'ternary_to_null_coalescing' => false, // Cannot use that with PHP 5.6 - 'trailing_comma_in_multiline_array' => true, - 'trim_array_spaces' => true, - 'unary_operator_spaces' => true, - 'visibility_required' => true, - 'void_return' => false, // Cannot use that with PHP 5.6 - 'whitespace_after_comma_in_array' => true, - 'yoda_style' => false, - ]); diff --git a/vendor/phpoffice/phpspreadsheet/.sami.php b/vendor/phpoffice/phpspreadsheet/.sami.php deleted file mode 100644 index 9a2fca35..00000000 --- a/vendor/phpoffice/phpspreadsheet/.sami.php +++ /dev/null @@ -1,24 +0,0 @@ -files() - ->name('*.php') - ->in($dir = __DIR__ . '/src'); -$versions = GitVersionCollection::create($dir) - ->addFromTags(function ($version) { - return preg_match('~^\d+\.\d+\.\d+$~', $version); - }) - ->add('master'); - -return new Sami($iterator, [ - 'title' => 'PhpSpreadsheet', - 'versions' => $versions, - 'build_dir' => __DIR__ . '/build/%version%', - 'cache_dir' => __DIR__ . '/cache/%version%', - 'remote_repository' => new GitHubRemoteRepository('PHPOffice/PhpSpreadsheet', dirname($dir)), -]); diff --git a/vendor/phpoffice/phpspreadsheet/.scrutinizer.yml b/vendor/phpoffice/phpspreadsheet/.scrutinizer.yml deleted file mode 100644 index 748f3ac3..00000000 --- a/vendor/phpoffice/phpspreadsheet/.scrutinizer.yml +++ /dev/null @@ -1,27 +0,0 @@ -checks: - php: true - -coding_style: - php: - spaces: - before_parentheses: - closure_definition: true - around_operators: - concatenation: true - -build: - nodes: - analysis: - tests: - override: - - php-scrutinizer-run - -tools: - external_code_coverage: - timeout: 3600 - -build_failure_conditions: - - 'elements.rating(<= C).new.exists' # No new classes/methods with a rating of C or worse allowed - - 'issues.severity(>= MAJOR).new.exists' # New issues of major or higher severity - - 'project.metric_change("scrutinizer.test_coverage", < 0)' # Code Coverage decreased from previous inspection - - 'patches.label("Unused Use Statements").new.exists' # No new unused imports patches allowed diff --git a/vendor/phpoffice/phpspreadsheet/.travis.yml b/vendor/phpoffice/phpspreadsheet/.travis.yml deleted file mode 100644 index fd86412a..00000000 --- a/vendor/phpoffice/phpspreadsheet/.travis.yml +++ /dev/null @@ -1,60 +0,0 @@ -language: php -dist: trusty -sudo: false - -php: - - 5.6 - - 7.0 - - 7.1 - - 7.2 - - 7.3 - -cache: - directories: - - cache - - vendor - - $HOME/.composer/cache - -before_script: - # Deactivate xdebug - - if [ -z "$KEEP_XDEBUG" ]; then rm -rfv /home/travis/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ; fi - - composer install --ignore-platform-reqs - -script: - - ./vendor/bin/phpunit - -jobs: - include: - - - stage: Code style - php: 7.2 - script: - - ./vendor/bin/php-cs-fixer fix --diff --verbose --dry-run - - ./vendor/bin/phpcs --report-width=200 samples/ src/ tests/ --ignore=samples/Header.php --standard=PSR2 -n - - - stage: Coverage - php: 7.2 - env: KEEP_XDEBUG=1 - script: - - travis_wait 40 ./vendor/bin/phpunit --debug --coverage-clover coverage-clover.xml - after_script: - - wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover tests/coverage-clover.xml - - - stage: API documentation - php: 7.2 - before_script: - - curl -O http://get.sensiolabs.org/sami.phar - script: - - git fetch origin master:master - - git fetch origin --tags - - php sami.phar update .sami.php - - echo '

    If you are not automatically redirected, please go to the latest stable API documentation.

    ' > build/index.html - deploy: - provider: pages - skip-cleanup: true - local-dir: build - github-token: $GITHUB_TOKEN - on: - all_branches: true - condition: $TRAVIS_BRANCH =~ ^master|develop$ diff --git a/vendor/phpoffice/phpspreadsheet/CHANGELOG.PHPExcel.md b/vendor/phpoffice/phpspreadsheet/CHANGELOG.PHPExcel.md deleted file mode 100644 index a32f78b5..00000000 --- a/vendor/phpoffice/phpspreadsheet/CHANGELOG.PHPExcel.md +++ /dev/null @@ -1,1593 +0,0 @@ -# Changelog for PHPExcel - -This is the historic changelog of the project when it was still called PHPExcel. -It exists only for historical purposes and versions mentioned here should not be -confused with PhpSpreadsheet versions. - -## [1.8.1] - 2015-04-30 - -### Bugfixes - -- Fix for Writing an Open Document cell with non-numeric formula - @goncons [#397](https://github.com/PHPOffice/PHPExcel/issues/397) -- Avoid potential divide by zero in basedrawing - @sarciszewski [#329](https://github.com/PHPOffice/PHPExcel/issues/329) -- XML External Entity (XXE) Processing, different behaviour between simplexml_load_string() and simplexml_load_file(). - @ymaerschalck [#405](https://github.com/PHPOffice/PHPExcel/issues/405) -- Fix to ensure that current cell is maintained when executing formula calculations - @MarkBaker -- Keep/set the value on Reader _loadSheetsOnly as NULL, courtesy of Restless-ET - @MarkBaker [#350](https://github.com/PHPOffice/PHPExcel/issues/350) -- Loading an Excel 2007 spreadsheet throws an "Autofilter must be set on a range of cells" exception - @MarkBaker [CodePlex #18105](https://phpexcel.codeplex.com/workitem/18105) -- Fix to autoloader registration for backward compatibility with PHP 5.2.0 not accepting the prepend flag - @MarkBaker [#388](https://github.com/PHPOffice/PHPExcel/issues/388) -- DOM loadHTMLFile() failing with options flags when using PHP < 5.4.0 - @MarkBaker [#384](https://github.com/PHPOffice/PHPExcel/issues/384) -- Fix for percentage operator in formulae for BIFF Writer - @MarkBaker -- Fix to getStyle() call for cell object - @MarkBaker -- Discard Autofilters in Excel2007 Reader when filter range isn't a valid range - @MarkBaker -- Fix invalid NA return in VLOOKUP - @frozenstupidity [#423](https://github.com/PHPOffice/PHPExcel/issues/423) -- "No Impact" conditional formatting fix for NumberFormat - @wiseloren [CodePlex #21454](https://phpexcel.codeplex.com/workitem/21454) -- Bug in Excel2003XML reader, parsing merged cells - @bobwitlox [#467](https://github.com/PHPOffice/PHPExcel/issues/467) -- Fix for CEIL() and FLOOR() when number argument is zero - @MarkBaker [#302](https://github.com/PHPOffice/PHPExcel/issues/302) - -### General - -- Remove cells cleanly when calling RemoveRow() or RemoveColumn() - @MarkBaker -- Small performance improvement for autosize columns - @MarkBaker -- Change the getter/setter for zeroHeight to camel case - @frost-nzcr4 [#379](https://github.com/PHPOffice/PHPExcel/issues/379) -- DefaultValueBinder is too much aggressive when converting string to numeric - @MarkBaker [#394](https://github.com/PHPOffice/PHPExcel/issues/394) -- Default precalculate formulas to false for writers - @MarkBaker -- Set default Cyclic Reference behaviour to 1 to eliminate exception when using a single cyclic iteration in formulae - @MarkBaker - -### Features - -- Some Excel writer libraries erroneously use Codepage 21010 for UTF-16LE - @MarkBaker [#396](https://github.com/PHPOffice/PHPExcel/issues/396) -- Methods to manage most of the existing options for Chart Axis, Major Grid-lines and Minor Grid-lines - @WiktrzGE [#404](https://github.com/PHPOffice/PHPExcel/issues/404) -- ODS read/write comments in the cell - @frost-nzcr4 [#403](https://github.com/PHPOffice/PHPExcel/issues/403) -- Additional Mac CJK codepage definitions - @CQD [#389](https://github.com/PHPOffice/PHPExcel/issues/389) -- Update Worksheet.php getStyleByColumnAndRow() to allow a range of cells rather than just a single cell - @bolovincev [#269](https://github.com/PHPOffice/PHPExcel/issues/269) -- New methods added for testing cell status within merge groups - @MarkBaker -- Handling merge cells in HTML Reader - @cifren/MBaker [#205](https://github.com/PHPOffice/PHPExcel/issues/205) -- Helper to convert basic HTML markup to a Rich Text object - @MarkBaker -- Improved Iterators - @MarkBaker - - New Column Iterator - - Support for row and column ranges - - Improved handling for next/prev - -### Security - -- XML filescan in XML-based Readers to prevent XML Entity Expansion (XEE) - @MarkBaker - - (see http://projects.webappsec.org/w/page/13247002/XML%20Entity%20Expansion for an explanation of XEE injection) attacks - - Reference CVE-2015-3542 - Identification of problem courtesy of Dawid Golunski (Pentest Ltd.) - -## [1.8.0] - 2014-03-02 - -### Bugfixes - -- Undefined variable: fileHandle in CSV Reader - @MarkBaker [CodePlex #19830](https://phpexcel.codeplex.com/workitem/19830) -- Out of memory in style/supervisor.php - @MarkBaker [CodePlex #19968](https://phpexcel.codeplex.com/workitem/19968) -- Style error with merged cells in PDF Writer - @MarkBaker -- Problem with cloning worksheets - @MarkBaker -- Bug fix reading Open Office files - @tavoarcila [#259](https://github.com/PHPOffice/PHPExcel/issues/259) -- Serious bug in absolute cell reference used in shared formula - @MarkBaker [CodePlex #20397](https://phpexcel.codeplex.com/workitem/20397) - - Would also have affected insert/delete column/row- CHOOSE() returns "#VALUE!" if the 1st entry is chosen - @RomanSyroeshko [#267](https://github.com/PHPOffice/PHPExcel/issues/267) -- When duplicating styles, styles shifted by one column to the right - @Gemorroj [#268](https://github.com/PHPOffice/PHPExcel/issues/268) - - Fix also applied to duplicating conditional styles- Fix for formulae that reference a sheet whose name begins with a digit: - @IndrekHaav [#212](https://github.com/PHPOffice/PHPExcel/issues/212) - - these were erroneously identified as numeric values, causing the parser to throw an undefined variable error.- Fixed undefined variable error due to $styleArray being used before it's initialised - @IndrekHaav [CodePlex #16208](https://phpexcel.codeplex.com/workitem/16208) -- ISTEXT() return wrong result if referencing an empty but formatted cell - @PowerKiKi [#273](https://github.com/PHPOffice/PHPExcel/issues/273) -- Binary comparison of strings are case insensitive - @PowerKiKi [#270](https://github.com/PHPOffice/PHPExcel/issues/270), [#31](https://github.com/PHPOffice/PHPExcel/issues/31) -- Insert New Row/Column Before is not correctly updating formula references - @MarkBaker [#275](https://github.com/PHPOffice/PHPExcel/issues/275) -- Passing an array of cells to _generateRow() in the HTML/PDF Writer causes caching problems with last cell in the range - @MarkBaker [#257](https://github.com/PHPOffice/PHPExcel/issues/257) -- Fix to empty worksheet garbage collection when using cell caching - @MarkBaker [#193](https://github.com/PHPOffice/PHPExcel/issues/193) -- Excel2007 does not correctly mark rows as hidden - @Jazzo [#248](https://github.com/PHPOffice/PHPExcel/issues/248) -- Fixed typo in Chart/Layout set/getYMode() - @Roy Shahbazian [#299](https://github.com/PHPOffice/PHPExcel/issues/299) -- Fatal error: Call to a member function cellExists() line: 3327 in calculation.php if referenced worksheet doesn't exist - @EliuFlorez [#279](https://github.com/PHPOffice/PHPExcel/issues/279) -- AdvancedValueBinder "Division by zero"-error - @MarkBaker [#290](https://github.com/PHPOffice/PHPExcel/issues/290) -- Adding Sheet to Workbook Bug - @MarkBaker [CodePlex #20604](https://phpexcel.codeplex.com/workitem/20604) -- Calculation engine incorrectly evaluates empty cells as #VALUE - @MarkBaker [CodePlex #20703](https://phpexcel.codeplex.com/workitem/20703) -- Formula references to cell on another sheet in ODS files - @MarkBaker [CodePlex #20760](https://phpexcel.codeplex.com/workitem/20760) - -### Features - -- LibreOffice created XLSX files results in an empty file. - @MarkBaker [#321](https://github.com/PHPOffice/PHPExcel/issues/321), [#158](https://github.com/PHPOffice/PHPExcel/issues/158), [CodePlex #17824](https://phpexcel.codeplex.com/workitem/17824) -- Implementation of the Excel HLOOKUP() function - @amerov -- Added "Quote Prefix" to style settings (Excel2007 Reader and Writer only) - @MarkBaker -- Added Horizontal FILL alignment for Excel5 and Excel2007 Readers/Writers, and Horizontal DISTRIBUTED alignment for Excel2007 Reader/Writer - @MarkBaker -- Add support for reading protected (RC4 encrypted) .xls files - @trvrnrth [#261](https://github.com/PHPOffice/PHPExcel/issues/261) - -### General - -- Adding support for macros, Ribbon in Excel 2007 - @LWol [#252](https://github.com/PHPOffice/PHPExcel/issues/252) -- Remove array_shift in ReferenceHelper::insertNewBefore improves column or row delete speed - @cdhutch [CodePlex #20055](https://phpexcel.codeplex.com/workitem/20055) -- Improve stock chart handling and rendering, with help from Swashata Ghosh - @MarkBaker -- Fix to calculation properties for Excel2007 so that the opening application will only recalculate on load if it's actually required - @MarkBaker -- Modified Excel2007 Writer to default preCalculateFormulas to false - @MarkBaker - - Note that autosize columns will still recalculate affected formulae internally- Functionality to getHighestRow() for a specified column, and getHighestColumn() for a specified row - @dresenhista [#242](https://github.com/PHPOffice/PHPExcel/issues/242) -- Modify PHPExcel_Reader_Excel2007 to use zipClass from PHPExcel_Settings::getZipClass() - @adamriyadi [#247](https://github.com/PHPOffice/PHPExcel/issues/247) - - This allows the use of PCLZip when reading for people that don't have access to ZipArchive -### Security - -- Convert properties to string in OOCalc reader - @infojunkie [#276](https://github.com/PHPOffice/PHPExcel/issues/276) -- Disable libxml external entity loading by default. - @maartenba [#322](https://github.com/PHPOffice/PHPExcel/issues/322) - - This is to prevent XML External Entity Processing (XXE) injection attacks (see http://websec.io/2012/08/27/Preventing-XEE-in-PHP.html for an explanation of XXE injection). - - Reference CVE-2014-2054 - -## [1.7.9] - 2013-06-02 - -### Features - -- Include charts option for HTML Writer - @MarkBaker -- Added composer file - @MarkBaker -- cache_in_memory_gzip "eats" last worksheet line, cache_in_memory doesn't - @MarkBaker [CodePlex #18844](https://phpexcel.codeplex.com/workitem/18844) -- echo statements in HTML.php - @MarkBaker [#104](https://github.com/PHPOffice/PHPExcel/issues/104) - -### Bugfixes - -- Added getStyle() method to Cell object - @MarkBaker -- Error in PHPEXCEL/Calculation.php script on line 2976 (stack pop check) - @Asker [CodePlex #18777](https://phpexcel.codeplex.com/workitem/18777) -- CSV files without a file extension being identified as HTML - @MarkBaker [CodePlex #18794](https://phpexcel.codeplex.com/workitem/18794) -- Wrong check for maximum number of rows in Excel5 Writer - @AndreKR [#66](https://github.com/PHPOffice/PHPExcel/issues/66) -- Cache directory for DiscISAM cache storage cannot be set - @MarkBaker [#67](https://github.com/PHPOffice/PHPExcel/issues/67) -- Fix to Excel2007 Reader for hyperlinks with an anchor fragment (following a #), otherwise they were treated as sheet references - @MarkBaker [CodePlex #17976](https://phpexcel.codeplex.com/workitem/17976) -- getSheetNames() fails on numeric (floating point style) names with trailing zeroes - @MarkBaker [CodePlex #18963](https://phpexcel.codeplex.com/workitem/18963) -- Modify cell's getCalculatedValue() method to return the content of RichText objects rather than the RichText object itself - @MarkBaker -- Fixed formula/formatting bug when removing rows - @techhead [#70](https://github.com/PHPOffice/PHPExcel/issues/70) -- Fix to cellExists for non-existent namedRanges - @alexgann [#63](https://github.com/PHPOffice/PHPExcel/issues/63) -- Sheet View in Excel5 Writer - @Progi1984 [#22](https://github.com/PHPOffice/PHPExcel/issues/22) -- PHPExcel_Worksheet::getCellCollection() may not return last cached cell - @amironov [#82](https://github.com/PHPOffice/PHPExcel/issues/82) -- Rich Text containing UTF-8 characters creating unreadable content with Excel5 Writer - @teso [CodePlex #18551](https://phpexcel.codeplex.com/workitem/18551) -- Work item GH-8/CP11704 : Conditional formatting in Excel 5 Writer - @Progi1984 -- canRead() Error for GoogleDocs ODS files: in ODS files from Google Docs there is no mimetype file - @MarkBaker [#113](https://github.com/PHPOffice/PHPExcel/issues/113) -- "Sheet index is out of bounds." Exception - @MarkBaker [#80](https://github.com/PHPOffice/PHPExcel/issues/80) -- Fixed number format fatal error - @ccorliss [#105](https://github.com/PHPOffice/PHPExcel/issues/105) -- Add DROP TABLE in destructor for SQLite and SQLite3 cache controllers - @MarkBaker -- Fix merged-cell borders on HTML/PDF output - @alexgann [#154](https://github.com/PHPOffice/PHPExcel/issues/154) -- Fix: Hyperlinks break when removing rows - @Shanto [#161](https://github.com/PHPOffice/PHPExcel/issues/161) -- Fix Extra Table Row From Images and Charts - @neclimdul [#166](https://github.com/PHPOffice/PHPExcel/issues/166) - -### General - -- Single cell print area - @MarkBaker [#130](https://github.com/PHPOffice/PHPExcel/issues/130) -- Improved AdvancedValueBinder for currency - @kea [#69](https://github.com/PHPOffice/PHPExcel/issues/69) -- Fix for environments where there is no access to /tmp but to upload_tmp_dir - @MarkBaker - - Provided an option to set the sys_get_temp_dir() call to use the upload_tmp_dir; though by default the standard temp directory will still be used- Search style by identity in PHPExcel_Worksheet::duplicateStyle() - @amironov [#84](https://github.com/PHPOffice/PHPExcel/issues/84) -- Fill SheetView IO in Excel5 - @karak [#85](https://github.com/PHPOffice/PHPExcel/issues/85) -- Memory and Speed improvements in PHPExcel_Reader_Excel5 - @cfhay [CodePlex #18958](https://phpexcel.codeplex.com/workitem/18958) -- Modify listWorksheetNames() and listWorksheetInfo to use XMLReader with streamed XML rather than SimpleXML - @MarkBaker [#78](https://github.com/PHPOffice/PHPExcel/issues/78) -- Restructuring of PHPExcel Exceptions - @dbonsch -- Refactor Calculation Engine from singleton to a Multiton - @MarkBaker - - Ensures that calculation cache is maintained independently for different workbooks - -## [1.7.8] - 2012-10-12 - -### Features - -- Phar builder script to add phar file as a distribution option - @kkamkou -- Refactor PDF Writer to allow use with a choice of PDF Rendering library - @MarkBaker - - rather than restricting to tcPDF - - Current options are tcPDF, mPDF, DomPDF - - tcPDF Library has now been removed from the deployment bundle- Initial version of HTML Reader - @MarkBaker -- Implement support for AutoFilter in PHPExcel_Writer_Excel5 - @Progi1984 -- Modified ERF and ERFC Engineering functions to accept Excel 2010's modified acceptance of negative arguments - @MarkBaker -- Support SheetView `view` attribute (Excel2007) - @k1LoW -- Excel compatibility option added for writing CSV files - @MarkBaker - - While Excel 2010 can read CSV files with a simple UTF-8 BOM, Excel2007 and earlier require UTF-16LE encoded tab-separated files. - - The new setExcelCompatibility(TRUE) option for the CSV Writer will generate files with this formatting for easy import into Excel2007 and below.- Language implementations for Turkish (tr) - @MarkBaker -- Added fraction tests to advanced value binder - @MarkBaker - -### General - -- Allow call to font setUnderline() for underline format to specify a simple boolean for UNDERLINE_NONE or UNDERLINE_SINGLE - @MarkBaker -- Add Currency detection to the Advanced Value Binder - @alexgann -- setCellValueExplicitByColumnAndRow() do not return PHPExcel_Worksheet - @MarkBaker [CodePlex #18404](https://phpexcel.codeplex.com/workitem/18404) -- Reader factory doesn't read anymore XLTX and XLT files - @MarkBaker [CodePlex #18324](https://phpexcel.codeplex.com/workitem/18324) -- Magic __toString() method added to Cell object to return raw data value as a string - @MarkBaker -- Add cell indent to html rendering - @alexgann - -### Bugfixes - -- ZeroHeight for rows in sheet format - @Raghav1981 -- OOCalc cells containing inside the tag - @cyberconte -- Fix to listWorksheetInfo() method for OOCalc Reader - @schir1964 -- Support for "e" (epoch) date format mask - @MarkBaker - - Rendered as a 4-digit CE year in non-Excel outputs- Background color cell is always black when editing cell - @MarkBaker -- Allow "no impact" to formats on Conditional Formatting - @MarkBaker -- OOCalc Reader fix for NULL cells - @wackonline -- Fix to excel2007 Chart Writer when a $plotSeriesValues is empty - @seltzlab -- Various fixes to Chart handling - @MarkBaker -- Error loading xlsx file with column breaks - @MarkBaker [CodePlex #18370](https://phpexcel.codeplex.com/workitem/18370) -- OOCalc Reader now handles percentage and currency data types - @MarkBaker -- mb_stripos empty delimiter - @MarkBaker -- getNestingLevel() Error on Excel5 Read - @takaakik -- Fix to Excel5 Reader when cell annotations are defined before their referenced text objects - @MarkBaker -- OOCalc Reader modified to process number-rows-repeated - @MarkBaker -- Chart Title compatibility on Excel 2007 - @MarkBaker [CodePlex #18377](https://phpexcel.codeplex.com/workitem/18377) -- Chart Refresh returning cell reference rather than values - @MarkBaker [CodePlex #18146](https://phpexcel.codeplex.com/workitem/18146) -- Autoshape being identified in twoCellAnchor when includeCharts is TRUE triggering load error - @MarkBaker [CodePlex #18145](https://phpexcel.codeplex.com/workitem/18145) -- v-type texts for series labels now recognised and parsed correctly - @MarkBaker [CodePlex #18325](https://phpexcel.codeplex.com/workitem/18325) -- load file failed if the file has no extensionType - @wolf5x [CodePlex #18492](https://phpexcel.codeplex.com/workitem/18492) -- Pattern fill colours in Excel2007 Style Writer - @dverspui -- Excel2007 Writer order of font style elements to conform with Excel2003 using compatibility pack - @MarkBaker -- Problems with $_activeSheetIndex when decreased below 0. - @MarkBaker [CodePlex #18425](https://phpexcel.codeplex.com/workitem/18425) -- PHPExcel_CachedObjectStorage_SQLite3::cacheMethodIsAvailable() uses class_exists - autoloader throws error - @MarkBaker [CodePlex #18597](https://phpexcel.codeplex.com/workitem/18597) -- Cannot access private property PHPExcel_CachedObjectStorageFactory::$_cacheStorageMethod - @MarkBaker [CodePlex #18598](https://phpexcel.codeplex.com/workitem/18598) -- Data titles for charts - @MarkBaker [CodePlex #18397](https://phpexcel.codeplex.com/workitem/18397) - - PHPExcel_Chart_Layout now has methods for getting/setting switches for displaying/hiding chart data labels- Discard single cell merge ranges when reading (stupid that Excel allows them in the first place) - @MarkBaker -- Discard hidden autoFilter named ranges - @MarkBaker - -## [1.7.7] - 2012-05-19 - -### Bugfixes - -- Support for Rich-Text in PHPExcel_Writer_Excel5 - @Progi1984 [CodePlex #8916](https://phpexcel.codeplex.com/workitem/8916) -- Change iterators to implement Iterator rather than extend CachingIterator, as a fix for PHP 5.4. changes in SPL - @MarkBaker -- Invalid cell coordinate in Autofilter for Excel2007 Writer - @MarkBaker [CodePlex #15459](https://phpexcel.codeplex.com/workitem/15459) -- PCLZip library issue - @MarkBaker [CodePlex #15518](https://phpexcel.codeplex.com/workitem/15518) -- Excel2007 Reader canRead function bug - @MarkBaker [CodePlex #15537](https://phpexcel.codeplex.com/workitem/15537) -- Support for Excel functions whose return can be used as either a value or as a cell reference depending on its context within a formula - @MarkBaker -- ini_set() call in Calculation class destructor - @gilles06 [CodePlex #15707](https://phpexcel.codeplex.com/workitem/15707) -- RangeToArray strange array keys - @MarkBaker [CodePlex #15786](https://phpexcel.codeplex.com/workitem/15786) -- INDIRECT() function doesn't work with named ranges - @MarkBaker [CodePlex #15762](https://phpexcel.codeplex.com/workitem/15762) -- Locale-specific fix to text functions when passing a boolean argument instead of a string - @MarkBaker -- reader/CSV fails on this file - @MarkBaker [CodePlex #16246](https://phpexcel.codeplex.com/workitem/16246) - - auto_detect_line_endings now set in CSV reader- $arguments improperly used in CachedObjectStorage/PHPTemp.php - @MarkBaker [CodePlex #16212](https://phpexcel.codeplex.com/workitem/16212) -- Bug In Cache System (cell reference when throwing caching errors) - @MarkBaker [CodePlex #16643](https://phpexcel.codeplex.com/workitem/16643) -- PHP Invalid index notice on writing excel file when active sheet has been deleted - @MarkBaker [CodePlex #16895](https://phpexcel.codeplex.com/workitem/16895) -- External links in Excel2010 files cause Fatal error - @MarkBaker [CodePlex #16956](https://phpexcel.codeplex.com/workitem/16956) -- Previous calculation engine error conditions trigger cyclic reference errors - @MarkBaker [CodePlex #16960](https://phpexcel.codeplex.com/workitem/16960) -- PHPExcel_Style::applyFromArray() returns null rather than style object in advanced mode - @mkopinsky [CodePlex #16266](https://phpexcel.codeplex.com/workitem/16266) -- Cell::getFormattedValue returns RichText object instead of string - @fauvel [CodePlex #16958](https://phpexcel.codeplex.com/workitem/16958) -- Indexed colors do not refer to Excel's indexed colors? - @MarkBaker [CodePlex #17166](https://phpexcel.codeplex.com/workitem/17166) -- Indexed colors should be consistent with Excel and start from 1 (current index starts at 0) - @MarkBaker [CodePlex #17199](https://phpexcel.codeplex.com/workitem/17199) -- Named Range definition in .xls when sheet reeference is quote wrapped - @MarkBaker [CodePlex #17262](https://phpexcel.codeplex.com/workitem/17262) -- duplicateStyle() method doesn't duplicate conditional formats - @MarkBaker [CodePlex #17403](https://phpexcel.codeplex.com/workitem/17403) - - Added an equivalent duplicateConditionalStyle() method for duplicating conditional styles- =sumproduct(A,B) <> =sumproduct(B,A) in xlsx - @bnr [CodePlex #17501](https://phpexcel.codeplex.com/workitem/17501) - -### Features - -- OOCalc cells contain same data bug? - @cyberconte [CodePlex #17471](https://phpexcel.codeplex.com/workitem/17471) -- listWorksheetInfo() method added to Readers... courtesy of Christopher Mullins - @schir1964 -- Options for cell caching using Igbinary and SQLite/SQlite3. - @MarkBaker -- Additional row iterator options: allow a start row to be defined in the constructor; seek(), and prev() methods added. - @MarkBaker -- Implement document properties in Excel5 writer - @Progi1984 [CodePlex #9759](https://phpexcel.codeplex.com/workitem/9759) - -### General - -- Implement chart functionality (EXPERIMENTAL) - @MarkBaker [CodePlex #16](https://phpexcel.codeplex.com/workitem/16) - - Initial definition of chart objects. - - Reading Chart definitions through the Excel2007 Reader - - Facility to render charts to images using the 3rd-party jpgraph library - - Writing Charts using the Excel2007 Writer- Fix to build to ensure that Examples are included with the documentation - @MarkBaker -- Reduce cell caching overhead using dirty flag to ensure that cells are only rewritten to the cache if they have actually been changed - @MarkBaker -- Improved memory usage in CSV Writer - @MarkBaker -- Improved speed and memory usage in Excel5 Writer - @MarkBaker -- Experimental - @MarkBaker - - Added getHighestDataColumn(), getHighestDataRow(), getHighestRowAndColumn() and calculateWorksheetDataDimension() methods for the worksheet that return the highest row and column that have cell records- Support for Rich-Text in PHPExcel_Writer_Excel5 - @Progi1984 [CodePlex #8916](https://phpexcel.codeplex.com/workitem/8916) -- Two easy to fix Issues concerning PHPExcel_Token_Stack (l10n/UC) - @MarkBaker [CodePlex #15405](https://phpexcel.codeplex.com/workitem/15405) -- Locale file paths not fit for windows - @MarkBaker [CodePlex #15461](https://phpexcel.codeplex.com/workitem/15461) -- Add file directory as a cache option for cache_to_discISAM - @MarkBaker [CodePlex #16643](https://phpexcel.codeplex.com/workitem/16643) -- Datatype.php & constant TYPE_NULL - @MarkBaker [CodePlex #16923](https://phpexcel.codeplex.com/workitem/16923) -- Ensure use of system temp directory for all temporary work files, unless explicitly specified - @MarkBaker -- [Patch] faster stringFromColumnIndex() - @char101 [CodePlex #16359](https://phpexcel.codeplex.com/workitem/16359) -- Fix for projects that still use old autoloaders - @whit1206 [CodePlex #16028](https://phpexcel.codeplex.com/workitem/16028) -- Unknown codepage: 10007 - @atz [CodePlex #17024](https://phpexcel.codeplex.com/workitem/17024) - - Additional Mac codepages - -## [1.7.6] - 2011-02-27 - -### Features - -- Provide option to use PCLZip as an alternative to ZipArchive. - @MarkBaker - - This allows the writing of Excel2007 files, even without ZipArchive enabled (it does require zlib), or when php_zip is one of the buggy PHP 5.2.6 or 5.2.8 versions - - It can be enabled using PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP); - - Note that it is not yet implemented as an alternative to ZipArchive for those Readers that are extracting from zips- Added listWorksheetNames() method to Readers that support multiple worksheets in a workbook, allowing a user to extract a list of all the worksheet names from a file without parsing/loading the whole file. - @MarkBaker [CodePlex #14979](https://phpexcel.codeplex.com/workitem/14979) -- Speed boost and memory reduction in the Worksheet toArray() method. - @MarkBaker -- Added new rangeToArray() and namedRangeToArray() methods to the PHPExcel_Worksheet object. - @MarkBaker - - Functionally, these are identical to the toArray() method, except that they take an additional first parameter of a Range (e.g. 'B2:C3') or a Named Range name. - - Modified the toArray() method so that it actually uses rangeToArray().- Added support for cell comments in the OOCalc, Gnumeric and Excel2003XML Readers, and in the Excel5 Reader - @MarkBaker -- Improved toFormattedString() handling for Currency and Accounting formats to render currency symbols - @MarkBaker - -### Bugfixes - -- Implement more Excel calculation functions - @MarkBaker - - Implemented the DAVERAGE(), DCOUNT(), DCOUNTA(), DGET(), DMAX(), DMIN(), DPRODUCT(), DSTDEV(), DSTDEVP(), DSUM(), DVAR() and DVARP() Database functions- Simple =IF() formula disappears - @MarkBaker [CodePlex #14888](https://phpexcel.codeplex.com/workitem/14888) -- PHP Warning: preg_match(): Compilation failed: PCRE does not support \\L, \\l, \\N, \\P, \\p, \\U, \\u, or \\X - @MarkBaker [CodePlex #14898](https://phpexcel.codeplex.com/workitem/14898) -- VLOOKUP choking on parameters in PHPExcel.1.7.5/PHPExcel_Writer_Excel2007 - @MarkBaker [CodePlex #14901](https://phpexcel.codeplex.com/workitem/14901) -- PHPExcel_Cell::isInRange() incorrect results - offset by one column - @MarkBaker [CodePlex #14973](https://phpexcel.codeplex.com/workitem/14973) -- Treat CodePage of 0 as CP1251 (for .xls files written by applications that don't set the CodePage correctly, such as Apple Numbers) - @MarkBaker -- Need method for removing autoFilter - @MarkBaker [CodePlex #11583](https://phpexcel.codeplex.com/workitem/11583) -- coordinateFromString throws exception for rows greater than 99,999 - @MarkBaker [CodePlex #15029](https://phpexcel.codeplex.com/workitem/15029) -- PHPExcel Excel2007 Reader colour problems with solidfill - @MarkBaker [CodePlex #14999](https://phpexcel.codeplex.com/workitem/14999) -- Formatting get lost and edit a template XLSX file - @MarkBaker [CodePlex #13215](https://phpexcel.codeplex.com/workitem/13215) -- Excel 2007 Reader /writer lost fontcolor - @MarkBaker [CodePlex #14029](https://phpexcel.codeplex.com/workitem/14029) -- file that makes cells go black - @MarkBaker [CodePlex #13374](https://phpexcel.codeplex.com/workitem/13374) -- Minor patchfix for Excel2003XML Reader when XML is defined with a charset attribute - @MarkBaker -- PHPExcel_Worksheet->toArray() index problem - @MarkBaker [CodePlex #15089](https://phpexcel.codeplex.com/workitem/15089) -- Merge cells 'un-merge' when using an existing spreadsheet - @MarkBaker [CodePlex #15094](https://phpexcel.codeplex.com/workitem/15094) -- Worksheet fromArray() only working with 2-D arrays - @MarkBaker [CodePlex #15129](https://phpexcel.codeplex.com/workitem/15129) -- rangeToarray function modified for non-existent cells - @xkeshav [CodePlex #15172](https://phpexcel.codeplex.com/workitem/15172) -- Images not getting copyied with the ->clone function - @MarkBaker [CodePlex #14980](https://phpexcel.codeplex.com/workitem/14980) -- AdvancedValueBinder.php: String sometimes becomes a date when it shouldn't - @MarkBaker [CodePlex #11576](https://phpexcel.codeplex.com/workitem/11576) -- Fix Excel5 Writer so that it only writes column dimensions for columns that are actually used rather than the full range (A to IV) - @MarkBaker -- FreezePane causing damaged or modified error - @MarkBaker [CodePlex #15198](https://phpexcel.codeplex.com/workitem/15198) - - The freezePaneByColumnAndRow() method row argument should default to 1 rather than 0. - - Default row argument for all __ByColumnAndRow() methods should be 1- Column reference rather than cell reference in Print Area definition - @MarkBaker [CodePlex #15121](https://phpexcel.codeplex.com/workitem/15121) - - Fix Excel2007 Writer to handle print areas that are defined as row or column ranges rather than just as cell ranges- Reduced false positives from isDateTimeFormatCode() method by suppressing testing within quoted strings - @MarkBaker -- Caching and tmp partition exhaustion - @MarkBaker [CodePlex #15312](https://phpexcel.codeplex.com/workitem/15312) -- Writing to Variable No Longer Works. $_tmp_dir Missing in PHPExcel\PHPExcel\Shared\OLE\PPS\Root.php - @MarkBaker [CodePlex #15308](https://phpexcel.codeplex.com/workitem/15308) -- Named ranges with dot don't get parsed properly - @MarkBaker [CodePlex #15379](https://phpexcel.codeplex.com/workitem/15379) -- insertNewRowBefore fails to consistently update references - @MarkBaker [CodePlex #15096](https://phpexcel.codeplex.com/workitem/15096) -- "i" is not a valid character for Excel date format masks (in isDateTimeFormatCode() method) - @MarkBaker -- PHPExcel_ReferenceHelper::insertNewBefore() is missing an 'Update worksheet: comments' section - @MKunert [CodePlex #15421](https://phpexcel.codeplex.com/workitem/15421) - -### General - -- Full column/row references in named ranges not supported by updateCellReference() - @MarkBaker [CodePlex #15409](https://phpexcel.codeplex.com/workitem/15409) -- Improved performance (speed), for building the Shared Strings table in the Excel2007 Writer. - @MarkBaker -- Improved performance (speed), for PHP to Excel date conversions - @MarkBaker -- Enhanced SheetViews element structures in the Excel2007 Writer for frozen panes. - @MarkBaker -- Removed Serialized Reader/Writer as these no longer work. - @MarkBaker - -## [1.7.5] - 2010-12-10 - -### Features - -- Implement Gnumeric File Format - @MarkBaker [CodePlex #8769](https://phpexcel.codeplex.com/workitem/8769) - - Initial work on Gnumeric Reader (Worksheet Data, Document Properties and basic Formatting)- Support for Extended Workbook Properties in Excel2007, Excel5 and OOCalc Readers; support for User-defined Workbook Properties in Excel2007 and OOCalc Readers - @MarkBaker -- Support for Extended and User-defined Workbook Properties in Excel2007 Writer - @MarkBaker -- Provided a setGenerateSheetNavigationBlock(false); option to suppress generation of the sheet navigation block when writing multiple worksheets to HTML - @MarkBaker -- Advanced Value Binder now recognises TRUE/FALSE strings (locale-specific) and converts to boolean - @MarkBaker -- PHPExcel_Worksheet->toArray() is returning truncated values - @MarkBaker [CodePlex #14301](https://phpexcel.codeplex.com/workitem/14301) -- Configure PDF Writer margins based on Excel Worksheet Margin Settings value - @MarkBaker -- Added Contiguous flag for the CSV Reader, when working with Read Filters - @MarkBaker -- Added getFormattedValue() method for cell object - @MarkBaker -- Added strictNullComparison argument to the worksheet fromArray() method - @MarkBaker - -### Bugfixes - -- Fix to toFormattedString() method in PHPExcel_Style_NumberFormat to handle fractions with a # code for the integer part - @MarkBaker -- NA() doesn't propagate in matrix calc - quick fix in JAMA/Matrix.php - @MarkBaker [CodePlex #14143](https://phpexcel.codeplex.com/workitem/14143) -- Excel5 : Formula : String constant containing double quotation mark - @Progi1984 [CodePlex #7895](https://phpexcel.codeplex.com/workitem/7895) -- Excel5 : Formula : Percent - @Progi1984 [CodePlex #7895](https://phpexcel.codeplex.com/workitem/7895) -- Excel5 : Formula : Error constant - @Progi1984 [CodePlex #7895](https://phpexcel.codeplex.com/workitem/7895) -- Excel5 : Formula : Concatenation operator - @Progi1984 [CodePlex #7895](https://phpexcel.codeplex.com/workitem/7895) -- Worksheet clone broken for CachedObjectStorage_Memory - @MarkBaker [CodePlex #14146](https://phpexcel.codeplex.com/workitem/14146) -- PHPExcel_Reader_Excel2007 fails when gradient fill without type is present in a file - @MarkBaker [CodePlex #12998](https://phpexcel.codeplex.com/workitem/12998) -- @ format for numeric strings in XLSX to CSV conversion - @MarkBaker [CodePlex #14176](https://phpexcel.codeplex.com/workitem/14176) -- Advanced Value Binder Not Working? - @MarkBaker [CodePlex #14223](https://phpexcel.codeplex.com/workitem/14223) -- unassigned object variable in PHPExcel->removeCellXfByIndex - @MarkBaker [CodePlex #14226](https://phpexcel.codeplex.com/workitem/14226) -- problem with getting cell values from another worksheet... (if cell doesn't exist) - @MarkBaker [CodePlex #14236](https://phpexcel.codeplex.com/workitem/14236) -- Setting cell values to one char strings & Trouble reading one character string (thanks gorfou) - @MarkBaker -- Worksheet title exception when duplicate worksheet is being renamed but exceeds the 31 character limit - @MarkBaker [CodePlex #14256](https://phpexcel.codeplex.com/workitem/14256) -- Named range with sheet name that contains the $ throws exception when getting the cell - @MarkBaker [CodePlex #14086](https://phpexcel.codeplex.com/workitem/14086) -- Added autoloader to DefaultValueBinder and AdvancedValueBinder - @MarkBaker -- Modified PHPExcel_Shared_Date::isDateTimeFormatCode() to return false if format code begins with "_" or with "0 " to prevent false positives - @MarkBaker - - These leading characters are most commonly associated with number, currency or accounting (or occasionally fraction) formats- BUG : Excel5 and setReadFilter ? - @MarkBaker [CodePlex #14374](https://phpexcel.codeplex.com/workitem/14374) -- Wrong exception message while deleting column - @MarkBaker [CodePlex #14425](https://phpexcel.codeplex.com/workitem/14425) -- Formula evaluation fails with Japanese sheet refs - @MarkBaker [CodePlex #14679](https://phpexcel.codeplex.com/workitem/14679) -- PHPExcel_Writer_PDF does not handle cell borders correctly - @MarkBaker [CodePlex #13559](https://phpexcel.codeplex.com/workitem/13559) -- Style : applyFromArray() for 'allborders' not working - @MarkBaker [CodePlex #14831](https://phpexcel.codeplex.com/workitem/14831) - -### General - -- Using $this when not in object context in Excel5 Reader - @MarkBaker [CodePlex #14837](https://phpexcel.codeplex.com/workitem/14837) -- Removes a unnecessary loop through each cell when applying conditional formatting to a range. - @MarkBaker -- Removed spurious PHP end tags (?>) - @MarkBaker -- Improved performance (speed) and reduced memory overheads, particularly for the Writers, but across the whole library. - @MarkBaker - -## [1.7.4] - 2010-08-26 - -### Bugfixes - -- Excel5 : Formula : Power - @Progi1984 [CodePlex #7895](https://phpexcel.codeplex.com/workitem/7895) -- Excel5 : Formula : Unary plus - @Progi1984 [CodePlex #7895](https://phpexcel.codeplex.com/workitem/7895) -- Excel5 : Just write the Escher stream if necessary in Worksheet - @Progi1984 -- Syntax errors in memcache.php 1.7.3c - @MarkBaker [CodePlex #13433](https://phpexcel.codeplex.com/workitem/13433) -- Support for row or column ranges in the calculation engine, e.g. =SUM(C:C) or =SUM(1:2) - @MarkBaker - - Also support in the calculation engine for absolute row or column ranges e.g. =SUM($C:$E) or =SUM($3:5)- Picture problem with Excel 2003 - @Erik Tilt [CodePlex #13455](https://phpexcel.codeplex.com/workitem/13455) -- Wrong variable used in addExternalSheet in PHPExcel.php - @MarkBaker [CodePlex #13484](https://phpexcel.codeplex.com/workitem/13484) -- "Invalid cell coordinate" error when formula access data from an other sheet - @MarkBaker [CodePlex #13515](https://phpexcel.codeplex.com/workitem/13515) -- (related to Work item 13515) Calculation engine confusing cell range worksheet when referencing cells in a different worksheet to the formula - @MarkBaker -- Wrong var naming in Worksheet->garbageCollect() - @MarkBaker [CodePlex #13752](https://phpexcel.codeplex.com/workitem/13752) -- PHPExcel_Style_*::__clone() methods cause cloning loops? - @MarkBaker [CodePlex #13764](https://phpexcel.codeplex.com/workitem/13764) -- Recent builds causing problems loading xlsx files? (ZipArchive issue?) - @MarkBaker [CodePlex #11488](https://phpexcel.codeplex.com/workitem/11488) -- cache_to_apc causes fatal error when processing large data sets - @MarkBaker [CodePlex #13856](https://phpexcel.codeplex.com/workitem/13856) -- OOCalc reader misses first line if it's a 'table-header-row' - @MarkBaker [CodePlex #13880](https://phpexcel.codeplex.com/workitem/13880) -- using cache with copy or clone bug? - @MarkBaker [CodePlex #14011](https://phpexcel.codeplex.com/workitem/14011) - - Fixed $worksheet->copy() or clone $worksheet when using cache_in_memory, cache_in_memory_gzip, cache_in_memory_serialized, cache_to_discISAM, cache_to_phpTemp, cache_to_apc and cache_to_memcache; - - Fixed but untested when using cache_to_wincache. -### Features - -- Standard Deviation functions returning DIV/0 Error when Standard Deviation is zero - @MarkBaker [CodePlex #13450](https://phpexcel.codeplex.com/workitem/13450) -- Support for print area with several ranges in the Excel2007 reader, and improved features for editing print area with several ranges - @MarkBaker -- Improved Cell Exception Reporting - @MarkBaker [CodePlex #13769](https://phpexcel.codeplex.com/workitem/13769) - -### General - -- Fixed problems with reading Excel2007 Properties - @MarkBaker -- PHP Strict Standards: Non-static method PHPExcel_Shared_String::utf16_decode() should not be called statically - @MarkBaker -- Array functions were ignored when loading an existing file containing them, and as a result, they would lose their 'cse' status. - @MarkBaker -- Minor memory tweaks to Excel2007 Writer - @MarkBaker -- Modified ReferenceHelper updateFormulaReferences() method to handle updates to row and column cell ranges (including absolute references e.g. =SUM(A:$E) or =SUM($5:5), and range/cell references that reference a worksheet by name), and to provide both performance and memory improvements. - @MarkBaker -- Modified Excel2007 Reader so that ReferenceHelper class is instantiated only once rather than for every shared formula in a workbook. - @MarkBaker -- Correct handling for additional (synonym) formula tokens in Excel5 Reader - @MarkBaker -- Additional reading of some Excel2007 Extended Properties (Company, Manager) - @MarkBaker - -## [1.7.3c] - 2010-06-01 - -### Bugfixes - -- Fatal error: Class 'ZipArchive' not found... ...Reader/Excel2007.php on line 217 - @MarkBaker [CodePlex #13012](https://phpexcel.codeplex.com/workitem/13012) -- PHPExcel_Writer_Excel2007 error after 1.7.3b - @MarkBaker [CodePlex #13398](https://phpexcel.codeplex.com/workitem/13398) - -## [1.7.3b] - 2010-05-31 - -### Bugfixes - -- Infinite loop when reading - @MarkBaker [CodePlex #12903](https://phpexcel.codeplex.com/workitem/12903) -- Wrong method chaining on PHPExcel_Worksheet class - @MarkBaker [CodePlex #13381](https://phpexcel.codeplex.com/workitem/13381) - -## [1.7.3] - 2010-05-17 - -### General - -- Applied patch 4990 (modified) - @Erik Tilt -- Applied patch 5568 (modified) - @MarkBaker -- Applied patch 5943 - @MarkBaker -- Upgrade build script to use Phing - @MarkBaker [CodePlex #13042](https://phpexcel.codeplex.com/workitem/13042) -- Replacing var with public/private - @Erik Tilt [CodePlex #11586](https://phpexcel.codeplex.com/workitem/11586) -- Applied Anthony's Sterling's Class Autoloader to reduce memory overhead by "Lazy Loading" of classes - @MarkBaker -- Modification to functions that accept a date parameter to support string values containing ordinals as per Excel (English language only) - @MarkBaker -- Modify PHPExcel_Style_NumberFormat::toFormattedString() to handle dates that fall outside of PHP's 32-bit date range - @MarkBaker -- Applied patch 5207 - @MarkBaker - -### Features - -- PHPExcel developer documentation: Set page margins - @Erik Tilt [CodePlex #11970](https://phpexcel.codeplex.com/workitem/11970) -- Special characters and accents in SYLK reader - @Erik Tilt [CodePlex #11038](https://phpexcel.codeplex.com/workitem/11038) -- Implement more Excel calculation functions - @MarkBaker - - Implemented the COUPDAYS(), COUPDAYBS(), COUPDAYSNC(), COUPNCD(), COUPPCD() and PRICE() Financial functions - - Implemented the N() and TYPE() Information functions - - Implemented the HYPERLINK() Lookup and Reference function- Horizontal page break support in PHPExcel_Writer_PDF - @Erik Tilt [CodePlex #11526](https://phpexcel.codeplex.com/workitem/11526) -- Introduce method setActiveSheetIndexByName() - @Erik Tilt [CodePlex #11529](https://phpexcel.codeplex.com/workitem/11529) -- AdvancedValueBinder.php: Automatically wrap text when there is new line in string (ALT+"Enter") - @Erik Tilt [CodePlex #11550](https://phpexcel.codeplex.com/workitem/11550) -- Data validation support in PHPExcel_Reader_Excel5 and PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #10300](https://phpexcel.codeplex.com/workitem/10300) -- Improve autosize calculation - @MarkBaker [CodePlex #11616](https://phpexcel.codeplex.com/workitem/11616) -- Methods to translate locale-specific function names in formulae - @MarkBaker - - Language implementations for Czech (cs), Danish (da), German (de), English (uk), Spanish (es), Finnish (fi), French (fr), Hungarian (hu), Italian (it), Dutch (nl), Norwegian (no), Polish (pl), Portuguese (pt), Brazilian Portuguese (pt_br), Russian (ru) and Swedish (sv)- Implement document properties in Excel5 reader/writer - @Erik Tilt [CodePlex #9759](https://phpexcel.codeplex.com/workitem/9759) - - Fixed so far for PHPExcel_Reader_Excel5- Show/hide row and column headers in worksheet - @Erik Tilt [CodePlex #11849](https://phpexcel.codeplex.com/workitem/11849) -- Can't set font on writing PDF (by key) - @Erik Tilt [CodePlex #11919](https://phpexcel.codeplex.com/workitem/11919) -- Thousands scale (1000^n) support in PHPExcel_Style_NumberFormat::toFormattedString - @Erik Tilt [CodePlex #12096](https://phpexcel.codeplex.com/workitem/12096) -- Implement repeating rows in PDF and HTML writer - @Erik Tilt -- Sheet tabs in PHPExcel_Writer_HTML - @Erik Tilt [CodePlex #12289](https://phpexcel.codeplex.com/workitem/12289) -- Add Wincache CachedObjectProvider - @MarkBaker [CodePlex #13041](https://phpexcel.codeplex.com/workitem/13041) -- Configure PDF Writer paper size based on Excel Page Settings value, and provided methods to override paper size and page orientation with the writer - @MarkBaker - - Note PHPExcel defaults to Letter size, while the previous PDF writer enforced A4 size, so PDF writer will now default to Letter- Initial implementation of cell caching: allowing larger workbooks to be managed, but at a cost in speed - @MarkBaker - -### Bugfixes - -- Added an identify() method to the IO Factory that identifies the reader which will be used to load a particular file without actually loading it. - @MarkBaker -- Warning messages with INDEX function having 2 arguments - @MarkBaker [CodePlex #10979](https://phpexcel.codeplex.com/workitem/10979) -- setValue('=') should result in string instead of formula - @Erik Tilt [CodePlex #11473](https://phpexcel.codeplex.com/workitem/11473) -- method _raiseFormulaError should no be private - @MarkBaker [CodePlex #11471](https://phpexcel.codeplex.com/workitem/11471) -- Fatal error: Call to undefined function mb_substr() in ...Classes\PHPExcel\Reader\Excel5.php on line 2903 - @Erik Tilt [CodePlex #11485](https://phpexcel.codeplex.com/workitem/11485) -- getBold(), getItallic(), getStrikeThrough() not always working with PHPExcel_Reader_Excel2007 - @Erik Tilt [CodePlex #11487](https://phpexcel.codeplex.com/workitem/11487) -- AdvancedValueBinder.php not working correctly for $cell->setValue('hh:mm:ss') - @Erik Tilt [CodePlex #11492](https://phpexcel.codeplex.com/workitem/11492) -- Fixed leap year handling for the YEARFRAC() Date/Time function when basis ia 1 (Actual/actual) - @MarkBaker -- Warning messages - @MarkBaker [CodePlex #11490](https://phpexcel.codeplex.com/workitem/11490) - - Calculation Engine code modified to enforce strict standards for pass by reference- PHPExcel_Cell_AdvancedValueBinder doesnt work for dates in far future - @Erik Tilt [CodePlex #11483](https://phpexcel.codeplex.com/workitem/11483) -- MSODRAWING bug with long CONTINUE record in PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #11528](https://phpexcel.codeplex.com/workitem/11528) -- PHPExcel_Reader_Excel2007 reads print titles as named range when there is more than one sheet - @Erik Tilt [CodePlex #11571](https://phpexcel.codeplex.com/workitem/11571) -- missing @return in phpdocblock in reader classes - @Erik Tilt [CodePlex #11561](https://phpexcel.codeplex.com/workitem/11561) -- AdvancedValueBinder.php: String sometimes becomes a date when it shouldn't - @Erik Tilt [CodePlex #11576](https://phpexcel.codeplex.com/workitem/11576) -- Small numbers escape treatment in PHPExcel_Style_NumberFormat::toFormattedString() - @Erik Tilt [CodePlex #11588](https://phpexcel.codeplex.com/workitem/11588) -- Blank styled cells are not blank in output by HTML writer due to   - @Erik Tilt [CodePlex #11590](https://phpexcel.codeplex.com/workitem/11590) -- Calculation engine bug: Existing, blank cell + number gives #NUM - @MarkBaker [CodePlex #11587](https://phpexcel.codeplex.com/workitem/11587) -- AutoSize only measures length of first line in cell with multiple lines (ALT+Enter) - @Erik Tilt [CodePlex #11608](https://phpexcel.codeplex.com/workitem/11608) -- Fatal error running Tests/12serializedfileformat.php (PHPExcel 1.7.2) - @Erik Tilt [CodePlex #11608](https://phpexcel.codeplex.com/workitem/11608) -- Fixed various errors in the WORKDAY() and NETWORKDAYS() Date/Time functions (particularly related to holidays) - @MarkBaker -- Uncaught exception 'Exception' with message 'Valid scale is between 10 and 400.' in Classes/PHPExcel/Worksheet/SheetView.php:115 - @Erik Tilt [CodePlex #11660](https://phpexcel.codeplex.com/workitem/11660) -- "Unrecognized token 39 in formula" with PHPExcel_Reader_Excel5 (occuring with add-in functions) - @Erik Tilt [CodePlex #11551](https://phpexcel.codeplex.com/workitem/11551) -- Excel2007 reader not reading PHPExcel_Style_Conditional::CONDITION_EXPRESSION - @Erik Tilt [CodePlex #11668](https://phpexcel.codeplex.com/workitem/11668) -- Fix to the BESSELI(), BESSELJ(), BESSELK(), BESSELY() and COMPLEX() Engineering functions to use correct default values for parameters - @MarkBaker -- DATEVALUE function not working for pure time values + allow DATEVALUE() function to handle partial dates (e.g. "1-Jun" or "12/2010") - @MarkBaker [CodePlex #11525](https://phpexcel.codeplex.com/workitem/11525) -- Fix for empty quoted strings in formulae - @MarkBaker -- Trap for division by zero in Bessel functions - @MarkBaker -- Fix to OOCalc Reader to convert semi-colon (;) argument separator in formulae to a comma (,) - @MarkBaker -- PHPExcel_Writer_Excel5_Parser cannot parse formula like =SUM(C$5:C5) - @Erik Tilt [CodePlex #11693](https://phpexcel.codeplex.com/workitem/11693) -- Fix to OOCalc Reader to handle dates that fall outside 32-bit PHP's date range - @MarkBaker -- File->sys_get_temp_dir() can fail in safe mode - @Erik Tilt [CodePlex #11692](https://phpexcel.codeplex.com/workitem/11692) -- Sheet references in Excel5 writer do not work when referenced sheet title contains non-Latin symbols - @Erik Tilt [CodePlex #11727](https://phpexcel.codeplex.com/workitem/11727) -- Bug in HTML writer can result in missing rows in output - @Erik Tilt [CodePlex #11743](https://phpexcel.codeplex.com/workitem/11743) -- setShowGridLines(true) not working with PHPExcel_Writer_PDF - @Erik Tilt [CodePlex #11674](https://phpexcel.codeplex.com/workitem/11674) -- PHPExcel_Worksheet_RowIterator initial position incorrect - @Erik Tilt [CodePlex #11836](https://phpexcel.codeplex.com/workitem/11836) -- PHPExcel_Worksheet_HeaderFooterDrawing Strict Exception thrown (by jshaw86) - @Erik Tilt [CodePlex #11835](https://phpexcel.codeplex.com/workitem/11835) -- Parts of worksheet lost when there are embedded charts (Excel5 reader) - @Erik Tilt [CodePlex #11850](https://phpexcel.codeplex.com/workitem/11850) -- VLOOKUP() function error when lookup value is passed as a cell reference rather than an absolute value - @MarkBaker -- First segment of Rich-Text not read correctly by PHPExcel_Reader_Excel2007 - @Erik Tilt [CodePlex #12041](https://phpexcel.codeplex.com/workitem/12041) -- Fatal Error with getCell('name') when name matches the pattern for a cell reference - @MarkBaker [CodePlex #12048](https://phpexcel.codeplex.com/workitem/12048) -- excel5 writer appears to be swapping image locations - @Erik Tilt [CodePlex #12039](https://phpexcel.codeplex.com/workitem/12039) -- Undefined index: host in ZipStreamWrapper.php, line 94 and line 101 - @Erik Tilt [CodePlex #11954](https://phpexcel.codeplex.com/workitem/11954) -- BIFF8 File Format problem (too short COLINFO record) - @Erik Tilt [CodePlex #11672](https://phpexcel.codeplex.com/workitem/11672) -- Column width sometimes changed after read/write with Excel2007 reader/writer - @Erik Tilt [CodePlex #12121](https://phpexcel.codeplex.com/workitem/12121) -- Worksheet.php throws a fatal error when styling is turned off via setReadDataOnly on the reader - @Erik Tilt [CodePlex #11964](https://phpexcel.codeplex.com/workitem/11964) -- Checking for Circular References in Formulae - @MarkBaker [CodePlex #11851](https://phpexcel.codeplex.com/workitem/11851) - - Calculation Engine code now traps for cyclic references, raising an error or throwing an exception, or allows 1 or more iterations through cyclic references, based on a configuration setting- PNG transparency using Excel2007 writer - @Erik Tilt [CodePlex #12244](https://phpexcel.codeplex.com/workitem/12244) -- Custom readfilter error when cell formulas reference excluded cells (Excel5 reader) - @Erik Tilt [CodePlex #12221](https://phpexcel.codeplex.com/workitem/12221) -- Protection problem in XLS - @Erik Tilt [CodePlex #12288](https://phpexcel.codeplex.com/workitem/12288) -- getColumnDimension()->setAutoSize() incorrect on cells with Number Formatting - @Erik Tilt [CodePlex #12300](https://phpexcel.codeplex.com/workitem/12300) -- Notices reading Excel file with Add-in funcitons (PHPExcel_Reader_Excel5) - @Erik Tilt [CodePlex #12378](https://phpexcel.codeplex.com/workitem/12378) -- Excel5 reader not reading formulas with deleted sheet references - @Erik Tilt [CodePlex #12380](https://phpexcel.codeplex.com/workitem/12380) -- Named range (defined name) scope problems for in PHPExcel - @Erik Tilt [CodePlex #12404](https://phpexcel.codeplex.com/workitem/12404) -- PHP Parse error: syntax error, unexpected T_PUBLIC in PHPExcel/Calculation.php on line 3482 - @Erik Tilt [CodePlex #12423](https://phpexcel.codeplex.com/workitem/12423) -- Named ranges don't appear in name box using Excel5 writer - @Erik Tilt [CodePlex #12505](https://phpexcel.codeplex.com/workitem/12505) -- Many merged cells + autoSize column -> slows down the writer - @Erik Tilt [CodePlex #12509](https://phpexcel.codeplex.com/workitem/12509) -- Incorrect fallback order comment in Shared/Strings.php ConvertEncoding() - @Erik Tilt [CodePlex #12539](https://phpexcel.codeplex.com/workitem/12539) -- IBM AIX iconv() will not work, should revert to mbstring etc. instead - @Erik Tilt [CodePlex #12538](https://phpexcel.codeplex.com/workitem/12538) -- Excel5 writer and mbstring functions overload - @Erik Tilt [CodePlex #12568](https://phpexcel.codeplex.com/workitem/12568) -- OFFSET needs to flattenSingleValue the $rows and $columns args - @MarkBaker [CodePlex #12672](https://phpexcel.codeplex.com/workitem/12672) -- Formula with DMAX(): Notice: Undefined offset: 2 in ...\PHPExcel\Calculation.php on line 2365 - @MarkBaker [CodePlex #12546](https://phpexcel.codeplex.com/workitem/12546) - - Note that the Database functions have not yet been implemented- Call to a member function getParent() on a non-object in Classes\\PHPExcel\\Calculation.php Title is required - @MarkBaker [CodePlex #12839](https://phpexcel.codeplex.com/workitem/12839) -- Cyclic Reference in Formula - @MarkBaker [CodePlex #12935](https://phpexcel.codeplex.com/workitem/12935) -- Memory error...data validation? - @MarkBaker [CodePlex #13025](https://phpexcel.codeplex.com/workitem/13025) - -## [1.7.2] - 2010-01-11 - -### General - -- Applied patch 4362 - @Erik Tilt -- Applied patch 4363 (modified) - @Erik Tilt -- 1.7.1 Extremely Slow - Refactored PHPExcel_Calculation_Functions::flattenArray() method and set calculation cache timer default to 2.5 seconds - @MarkBaker [CodePlex #10874](https://phpexcel.codeplex.com/workitem/10874) -- Allow formulae to contain line breaks - @MarkBaker -- split() function deprecated in PHP 5.3.0 - @Erik Tilt [CodePlex #10910](https://phpexcel.codeplex.com/workitem/10910) -- sys_get_temp_dir() requires PHP 5.2.1, not PHP 5.2 [provide fallback function for PHP 5.2.0] - @Erik Tilt -- Implementation of the ISPMT() Financial function by Matt Groves - @MarkBaker -- Put the example of formula with more arguments in documentation - @MarkBaker [CodePlex #11052](https://phpexcel.codeplex.com/workitem/11052) - -### Features - -- Improved accuracy for the GAMMAINV() Statistical Function - @MarkBaker -- XFEXT record support to fix colors change from Excel5 reader, and copy/paste color change with Excel5 writer - @Erik Tilt [CodePlex #10409](https://phpexcel.codeplex.com/workitem/10409) - - Excel5 reader reads RGB color information in XFEXT records for borders, font color and fill color- Implement more Excel calculation functions - @MarkBaker - - Implemented the FVSCHEDULE(), XNPV(), IRR(), MIRR(), XIRR() and RATE() Financial functions - - Implemented the SUMPRODUCT() Mathematical function - - Implemented the ZTEST() Statistical Function- Multiple print areas in one sheet - @Erik Tilt [CodePlex #10919](https://phpexcel.codeplex.com/workitem/10919) -- Store calculated values in output by PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #10930](https://phpexcel.codeplex.com/workitem/10930) -- Sheet protection options in Excel5 reader/writer - @Erik Tilt [CodePlex #10939](https://phpexcel.codeplex.com/workitem/10939) -- Modification of the COUNT(), AVERAGE(), AVERAGEA(), DEVSQ, AVEDEV(), STDEV(), STDEVA(), STDEVP(), STDEVPA(), VARA() and VARPA() SKEW() and KURT() functions to correctly handle boolean values depending on whether they're passed in as values, values within a matrix or values within a range of cells. - @MarkBaker -- Cell range selection - @Erik Tilt -- Root-relative path handling - @MarkBaker [CodePlex #10266](https://phpexcel.codeplex.com/workitem/10266) - -### Bugfixes - -- Named Ranges not working with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #11315](https://phpexcel.codeplex.com/workitem/11315) -- Excel2007 Reader fails to load Apache POI generated Excel - @MarkBaker [CodePlex #11206](https://phpexcel.codeplex.com/workitem/11206) -- Number format is broken when system's thousands separator is empty - @MarkBaker [CodePlex #11154](https://phpexcel.codeplex.com/workitem/11154) -- ReferenceHelper::updateNamedFormulas throws errors if oldName is empty - @MarkBaker [CodePlex #11401](https://phpexcel.codeplex.com/workitem/11401) -- parse_url() fails to parse path to an image in xlsx - @MarkBaker [CodePlex #11296](https://phpexcel.codeplex.com/workitem/11296) -- Workaround for iconv_substr() bug in PHP 5.2.0 - @Erik Tilt [CodePlex #10876](https://phpexcel.codeplex.com/workitem/10876) -- 1 pixel error for image width and height with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #10877](https://phpexcel.codeplex.com/workitem/10877) -- Fix to GEOMEAN() Statistical function - @MarkBaker -- setValue('-') and setValue('.') sets numeric 0 instead of 1-character string - @Erik Tilt [CodePlex #10884](https://phpexcel.codeplex.com/workitem/10884) -- Row height sometimes much too low after read with PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #10885](https://phpexcel.codeplex.com/workitem/10885) -- Diagonal border. Miscellaneous missing support. - @Erik Tilt [CodePlex #10888](https://phpexcel.codeplex.com/workitem/10888) - - Constant PHPExcel_Style_Borders::DIAGONAL_BOTH added to support double-diagonal (cross) - - PHPExcel_Reader_Excel2007 not always reading diagonal borders (only recognizes 'true' and not '1') - - PHPExcel_Reader_Excel5 support for diagonal borders - - PHPExcel_Writer_Excel5 support for diagonal borders- Session bug: Fatal error: Call to a member function bindValue() on a non-object in ...\Classes\PHPExcel\Cell.php on line 217 - @Erik Tilt [CodePlex #10894](https://phpexcel.codeplex.com/workitem/10894) -- Colors messed up saving twice with same instance of PHPExcel_Writer_Excel5 (regression since 1.7.0) - @Erik Tilt [CodePlex #10896](https://phpexcel.codeplex.com/workitem/10896) -- Method PHPExcel_Worksheet::setDefaultStyle is not working - @Erik Tilt [CodePlex #10917](https://phpexcel.codeplex.com/workitem/10917) -- PHPExcel_Reader_CSV::canRead() sometimes says false when it shouldn't - @Erik Tilt [CodePlex #10897](https://phpexcel.codeplex.com/workitem/10897) -- Changes in workbook not picked up between two saves with PHPExcel_Writer_Excel2007 - @Erik Tilt [CodePlex #10922](https://phpexcel.codeplex.com/workitem/10922) -- Decimal and thousands separators missing in HTML and PDF output - @Erik Tilt [CodePlex #10913](https://phpexcel.codeplex.com/workitem/10913) -- Notices with PHPExcel_Reader_Excel5 and named array constants - @Erik Tilt [CodePlex #10936](https://phpexcel.codeplex.com/workitem/10936) -- Calculation engine limitation on 32-bit platform with integers > 2147483647 - @MarkBaker [CodePlex #10938](https://phpexcel.codeplex.com/workitem/10938) -- Shared(?) formulae containing absolute cell references not read correctly using Excel5 Reader - @Erik Tilt [CodePlex #10959](https://phpexcel.codeplex.com/workitem/10959) -- Warning messages with intersection operator involving single cell - @MarkBaker [CodePlex #10962](https://phpexcel.codeplex.com/workitem/10962) -- Infinite loop in Excel5 reader caused by zero-length string in SST - @Erik Tilt [CodePlex #10980](https://phpexcel.codeplex.com/workitem/10980) -- Remove unnecessary cell sorting to improve speed by approx. 18% in HTML and PDF writers - @Erik Tilt [CodePlex #10983](https://phpexcel.codeplex.com/workitem/10983) -- Cannot read A1 cell content - OO_Reader - @MarkBaker [CodePlex #10977](https://phpexcel.codeplex.com/workitem/10977) -- Transliteration failed, invalid encoding - @Erik Tilt [CodePlex #11000](https://phpexcel.codeplex.com/workitem/11000) - -## [1.7.1] - 2009-11-02 - -### General - -- ereg() function deprecated in PHP 5.3.0 - @Erik Tilt [CodePlex #10687](https://phpexcel.codeplex.com/workitem/10687) -- Writer Interface Inconsequence - setTempDir and setUseDiskCaching - @MarkBaker [CodePlex #10739](https://phpexcel.codeplex.com/workitem/10739) - -### Features - -- Upgrade to TCPDF 4.8.009 - @Erik Tilt -- Support for row and column styles (feature request) - @Erik Tilt - - Basic implementation for Excel2007/Excel5 reader/writer- Hyperlink to local file in Excel5 reader/writer - @Erik Tilt [CodePlex #10459](https://phpexcel.codeplex.com/workitem/10459) -- Color Tab (Color Sheet's name) - @MarkBaker [CodePlex #10472](https://phpexcel.codeplex.com/workitem/10472) -- Border style "double" support in PHPExcel_Writer_HTML - @Erik Tilt [CodePlex #10488](https://phpexcel.codeplex.com/workitem/10488) -- Multi-section number format support in HTML/PDF/CSV writers - @Erik Tilt [CodePlex #10492](https://phpexcel.codeplex.com/workitem/10492) -- Some additional performance tweaks in the calculation engine - @MarkBaker -- Fix result of DB() and DDB() Financial functions to 2dp when in Gnumeric Compatibility mode - @MarkBaker -- Added AMORDEGRC(), AMORLINC() and COUPNUM() Financial function (no validation of parameters yet) - @MarkBaker -- Improved accuracy of TBILLEQ(), TBILLPRICE() and TBILLYIELD() Financial functions when in Excel or Gnumeric mode - @MarkBaker -- Added INDIRECT() Lookup/Reference function (only supports full addresses at the moment) - @MarkBaker -- PHPExcel_Reader_CSV::canRead() improvements - @MarkBaker [CodePlex #10498](https://phpexcel.codeplex.com/workitem/10498) -- Input encoding option for PHPExcel_Reader_CSV - @Erik Tilt [CodePlex #10500](https://phpexcel.codeplex.com/workitem/10500) -- Colored number format support, e.g. [Red], in HTML/PDF output - @Erik Tilt [CodePlex #10493](https://phpexcel.codeplex.com/workitem/10493) -- Color Tab (Color Sheet's name) [Excel5 reader/writer support] - @Erik Tilt [CodePlex #10559](https://phpexcel.codeplex.com/workitem/10559) -- Initial version of SYLK (slk) and Excel 2003 XML Readers (Cell data and basic cell formatting) - @MarkBaker -- Initial version of Open Office Calc (ods) Reader (Cell data only) - @MarkBaker -- Initial use of "pass by reference" in the calculation engine for ROW() and COLUMN() Lookup/Reference functions - @MarkBaker -- COLUMNS() and ROWS() Lookup/Reference functions, and SUBSTITUTE() Text function - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- AdvancedValueBinder(): Re-enable zero-padded string-to-number conversion, e.g '0004' -> 4 - @Erik Tilt [CodePlex #10502](https://phpexcel.codeplex.com/workitem/10502) -- Make PHP type match Excel datatype - @Erik Tilt [CodePlex #10600](https://phpexcel.codeplex.com/workitem/10600) -- Change first page number on header - @MarkBaker [CodePlex #10630](https://phpexcel.codeplex.com/workitem/10630) -- Applied patch 3941 - @MarkBaker -- Hidden sheets - @MB,ET [CodePlex #10745](https://phpexcel.codeplex.com/workitem/10745) -- mbstring fallback when iconv is broken - @Erik Tilt [CodePlex #10761](https://phpexcel.codeplex.com/workitem/10761) -- Note, can't yet handle comparison of two matrices - @MarkBaker -- Improved handling for validation and error trapping in a number of functions - @MarkBaker -- Improved support for fraction number formatting - @MarkBaker -- Support Reading CSV with Byte Order Mark (BOM) - @Erik Tilt [CodePlex #10455](https://phpexcel.codeplex.com/workitem/10455) - -### Bugfixes - -- addExternalSheet() at specified index - @Erik Tilt [CodePlex #10860](https://phpexcel.codeplex.com/workitem/10860) -- Named range can no longer be passed to worksheet->getCell() - @MarkBaker [CodePlex #10684](https://phpexcel.codeplex.com/workitem/10684) -- RichText HTML entities no longer working in PHPExcel 1.7.0 - @Erik Tilt [CodePlex #10455](https://phpexcel.codeplex.com/workitem/10455) -- Fit-to-width value of 1 is lost after read/write of Excel2007 spreadsheet [+ support for simultaneous scale/fitToPage] - @Erik Tilt -- Performance issue identified by profiling - @MarkBaker [CodePlex #10469](https://phpexcel.codeplex.com/workitem/10469) -- setSelectedCell is wrong - @Erik Tilt [CodePlex #10473](https://phpexcel.codeplex.com/workitem/10473) -- Images get squeezed/stretched with (Mac) Verdana 10 Excel files using Excel5 reader/writer - @Erik Tilt [CodePlex #10481](https://phpexcel.codeplex.com/workitem/10481) -- Error in argument count for DATEDIF() function - @MarkBaker [CodePlex #10482](https://phpexcel.codeplex.com/workitem/10482) -- updateFormulaReferences is buggy - @MarkBaker [CodePlex #10452](https://phpexcel.codeplex.com/workitem/10452) -- CellIterator returns null Cell if onlyExistingCells is set and key() is in use - @MarkBaker [CodePlex #10485](https://phpexcel.codeplex.com/workitem/10485) -- Wrong RegEx for parsing cell references in formulas - @MarkBaker [CodePlex #10453](https://phpexcel.codeplex.com/workitem/10453) -- Optimisation subverted to devastating effect if IterateOnlyExistingCells is clear - @MarkBaker [CodePlex #10486](https://phpexcel.codeplex.com/workitem/10486) -- Fatal error: Uncaught exception 'Exception' with message 'Unrecognized token 6C in formula'... with PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #10494](https://phpexcel.codeplex.com/workitem/10494) -- Fractions stored as text are not treated as numbers by PHPExcel's calculation engine - @MarkBaker [CodePlex #10490](https://phpexcel.codeplex.com/workitem/10490) -- AutoFit (autosize) row height not working in PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #10503](https://phpexcel.codeplex.com/workitem/10503) -- Fixed problem with null values breaking the calculation stack - @MarkBaker -- Date number formats sometimes fail with PHPExcel_Style_NumberFormat::toFormattedString, e.g. [$-40047]mmmm d yyyy - @Erik Tilt [CodePlex #10524](https://phpexcel.codeplex.com/workitem/10524) -- Fixed minor problem with DATEDIFF YM calculation - @MarkBaker -- Applied patch 3695 - @MarkBaker -- setAutosize() and Date cells not working properly - @Erik Tilt [CodePlex #10536](https://phpexcel.codeplex.com/workitem/10536) -- Time value hour offset in output by HTML/PDF/CSV writers (system timezone problem) - @Erik Tilt [CodePlex #10556](https://phpexcel.codeplex.com/workitem/10556) -- Control characters 0x14-0x1F are not treated by PHPExcel - @Erik Tilt [CodePlex #10558](https://phpexcel.codeplex.com/workitem/10558) -- PHPExcel_Writer_Excel5 not working when open_basedir restriction is in effect - @Erik Tilt [CodePlex #10560](https://phpexcel.codeplex.com/workitem/10560) -- IF formula calculation problem in PHPExcel 1.7.0 (string comparisons) - @MarkBaker [CodePlex #10563](https://phpexcel.codeplex.com/workitem/10563) -- Improved CODE() Text function result for UTF-8 characters - @MarkBaker -- Empty rows are collapsed with HTML/PDF writer - @Erik Tilt [CodePlex #10568](https://phpexcel.codeplex.com/workitem/10568) -- Gaps between rows in output by PHPExcel_Writer_PDF (Upgrading to TCPDF 4.7.003) - @Erik Tilt [CodePlex #10569](https://phpexcel.codeplex.com/workitem/10569) -- Problem reading formulas (Excel5 reader problem with "fake" shared formulas) - @Erik Tilt [CodePlex #10575](https://phpexcel.codeplex.com/workitem/10575) -- Error type in formula: "_raiseFormulaError message is Formula Error: An unexpected error occured" - @MarkBaker [CodePlex #10588](https://phpexcel.codeplex.com/workitem/10588) -- Miscellaneous column width problems in Excel5/Excel2007 writer - @Erik Tilt [CodePlex #10599](https://phpexcel.codeplex.com/workitem/10599) -- Reader/Excel5 'Unrecognized token 2D in formula' in latest version - @Erik Tilt [CodePlex #10615](https://phpexcel.codeplex.com/workitem/10615) -- on php 5.3 PHPExcel 1.7 Excel 5 reader fails in _getNextToken, token = 2C, throws exception - @Erik Tilt [CodePlex #10623](https://phpexcel.codeplex.com/workitem/10623) -- Fatal error when altering styles after workbook has been saved - @Erik Tilt [CodePlex #10617](https://phpexcel.codeplex.com/workitem/10617) -- Images vertically stretched or squeezed when default font size is changed (PHPExcel_Writer_Excel5) - @Erik Tilt [CodePlex #10661](https://phpexcel.codeplex.com/workitem/10661) -- Styles not read in "manipulated" Excel2007 workbook - @Erik Tilt [CodePlex #10676](https://phpexcel.codeplex.com/workitem/10676) -- Windows 7 says corrupt file by PHPExcel_Writer_Excel5 when opening in Excel - @Erik Tilt [CodePlex #10059](https://phpexcel.codeplex.com/workitem/10059) -- Calculations sometimes not working with cell references to other sheets - @MarkBaker [CodePlex #10708](https://phpexcel.codeplex.com/workitem/10708) -- Problem with merged cells after insertNewRowBefore() - @Erik Tilt [CodePlex #10706](https://phpexcel.codeplex.com/workitem/10706) -- Applied patch 4023 - @MarkBaker -- Fix to SUMIF() and COUNTIF() Statistical functions for when condition is a match against a string value - @MarkBaker -- PHPExcel_Cell::coordinateFromString should throw exception for bad string parameter - @Erik Tilt [CodePlex #10721](https://phpexcel.codeplex.com/workitem/10721) -- EucrosiaUPC (Thai font) not working with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #10723](https://phpexcel.codeplex.com/workitem/10723) -- Improved the return of calculated results when the result value is an array - @MarkBaker -- Allow calculation engine to support Functions prefixed with @ within formulae - @MarkBaker -- Intersection operator (space operator) fatal error with calculation engine - @MarkBaker [CodePlex #10632](https://phpexcel.codeplex.com/workitem/10632) -- Chinese, Japanese, Korean characters show as squares in PDF - @Erik Tilt [CodePlex #10742](https://phpexcel.codeplex.com/workitem/10742) -- sheet title allows invalid characters - @Erik Tilt [CodePlex #10756](https://phpexcel.codeplex.com/workitem/10756) -- Sheet!$A$1 as function argument in formula causes infinite loop in Excel5 writer - @Erik Tilt [CodePlex #10757](https://phpexcel.codeplex.com/workitem/10757) -- Cell range involving name not working with calculation engine - Modified calculation parser to handle range operator (:), but doesn't currently handle worksheet references with spaces or other non-alphameric characters, or trap erroneous references - @MarkBaker [CodePlex #10740](https://phpexcel.codeplex.com/workitem/10740) -- DATE function problem with calculation engine (says too few arguments given) - @MarkBaker [CodePlex #10798](https://phpexcel.codeplex.com/workitem/10798) -- Blank cell can cause wrong calculated value - @MarkBaker [CodePlex #10799](https://phpexcel.codeplex.com/workitem/10799) -- Modified ROW() and COLUMN() Lookup/Reference Functions to return an array when passed a cell range, plus some additional work on INDEX() - @MarkBaker -- Images not showing in Excel 97 using PHPExcel_Writer_Excel5 (patch by Jordi Gutiérrez Hermoso) - @Erik Tilt [CodePlex #10817](https://phpexcel.codeplex.com/workitem/10817) -- When figures are contained in the excel sheet, Reader was stopped - @Erik Tilt [CodePlex #10785](https://phpexcel.codeplex.com/workitem/10785) -- Formulas changed after insertNewRowBefore() - @MarkBaker [CodePlex #10818](https://phpexcel.codeplex.com/workitem/10818) -- Cell range row offset problem with shared formulas using PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #10825](https://phpexcel.codeplex.com/workitem/10825) -- Warning: Call-time pass-by-reference has been deprecated - @MarkBaker [CodePlex #10832](https://phpexcel.codeplex.com/workitem/10832) -- Image should "Move but don't size with cells" instead of "Move and size with cells" with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #10849](https://phpexcel.codeplex.com/workitem/10849) -- Opening a Excel5 generated XLS in Excel 2007 results in header/footer entry not showing on input - @Erik Tilt [CodePlex #10856](https://phpexcel.codeplex.com/workitem/10856) -- addExternalSheet() not returning worksheet - @Erik Tilt [CodePlex #10859](https://phpexcel.codeplex.com/workitem/10859) -- Invalid results in formulas with named ranges - @MarkBaker [CodePlex #10629](https://phpexcel.codeplex.com/workitem/10629) - -## [1.7.0] - 2009-08-10 - -### General - -- Expand documentation: Number formats - @Erik Tilt -- Class 'PHPExcel_Cell_AdvancedValueBinder' not found - @Erik Tilt - -### Features - -- Change return type of date functions to PHPExcel_Calculation_Functions::RETURNDATE_EXCEL - @MarkBaker -- New RPN and stack-based calculation engine for improved performance of formula calculation - @MarkBaker - - Faster (anything between 2 and 12 times faster than the old parser, depending on the complexity and nature of the formula) - - Significantly more memory efficient when formulae reference cells across worksheets - - Correct behaviour when referencing Named Ranges that exist on several worksheets - - Support for Excel ^ (Exponential) and % (Percentage) operators - - Support for matrices within basic arithmetic formulae (e.g. ={1,2,3;4,5,6;7,8,9}/2) - - Better trapping/handling of NaN and infinity results (return #NUM! error) - - Improved handling of empty parameters for Excel functions - - Optional logging of calculation steps- New calculation engine can be accessed independently of workbooks (for use as a standalone calculator) - @MarkBaker -- Implement more Excel calculation functions - @MarkBaker - - Initial implementation of the COUNTIF() and SUMIF() Statistical functions - - Added ACCRINT() Financial function- Modifications to number format handling for dddd and ddd masks in dates, use of thousand separators even when locale only implements it for money, and basic fraction masks (0 ?/? and ?/?) - @MarkBaker -- Support arbitrary fixed number of decimals in PHPExcel_Style_NumberFormat::toFormattedString() - @Erik Tilt -- Improving performance and memory on data dumps - @Erik Tilt - - Various style optimizations (merging from branch wi6857-memory) - - Moving hyperlink and dataValidation properties from cell to worksheet for lower PHP memory usage- Provide fluent interfaces where possible - @MarkBaker -- Make easy way to apply a border to a rectangular selection - @Erik Tilt -- Support for system window colors in PHPExcel_Reader_Excel5 - @Erik Tilt -- Horizontal center across selection - @Erik Tilt -- Merged cells record, write to full record size in PHPExcel_Writer_Excel5 - @Erik Tilt -- Add page break between sheets in exported PDF - @MarkBaker -- Sanitization of UTF-8 input for cell values - @Erik Tilt -- Read cached calculated value with PHPExcel_Reader_Excel5 - @Erik Tilt -- Miscellaneous CSS improvements for PHPExcel_Writer_HTML - @Erik Tilt -- getProperties: setCompany feature request - @Erik Tilt -- Insert worksheet at a specified index - @MarkBaker -- Change worksheet index - @MarkBaker -- Readfilter for CSV reader - @MarkBaker -- Check value of mbstring.func_overload when saving with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #10172](https://phpexcel.codeplex.com/workitem/10172) -- Eliminate dependency of an include path pointing to class directory - @Erik Tilt [CodePlex #10251](https://phpexcel.codeplex.com/workitem/10251) -- Method for getting the correct reader for a certain file (contribution) - @Erik Tilt [CodePlex #10292](https://phpexcel.codeplex.com/workitem/10292) -- Choosing specific row in fromArray method - @Erik Tilt [CodePlex #10287](https://phpexcel.codeplex.com/workitem/10287) -- Shared formula support in PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #10319](https://phpexcel.codeplex.com/workitem/10319) - -### Bugfixes - -- Right-to-left column direction in worksheet - @MB,ET [CodePlex #10345](https://phpexcel.codeplex.com/workitem/10345) -- PHPExcel_Reader_Excel5 not reading PHPExcel_Style_NumberFormat::FORMAT_NUMBER ('0') - @Erik Tilt -- Fractional row height in locale other than English results in corrupt output using PHPExcel_Writer_Excel2007 - @Erik Tilt -- Fractional (decimal) numbers not inserted correctly when locale is other than English - @Erik Tilt -- Fractional calculated value in locale other than English results in corrupt output using PHPExcel_Writer_Excel2007 - @Erik Tilt -- Locale aware decimal and thousands separator in exported formats HTML, CSV, PDF - @Erik Tilt -- Cannot Add Image with Space on its Name - @MarkBaker -- Black line at top of every page in output by PHPExcel_Writer_PDF - @Erik Tilt -- Border styles and border colors not showing in HTML output (regression since 1.6.4) - @Erik Tilt -- Hidden screen gridlines setting in worksheet not read by PHPExcel_Reader_Excel2007 - @Erik Tilt -- Some valid sheet names causes corrupt output using PHPExcel_Writer_Excel2007 - @MarkBaker -- More than 32,767 characters in a cell gives corrupt Excel file - @Erik Tilt -- Images not getting copyied with the ->copy() function - @Erik Tilt -- Bad calculation of column width setAutoSize(true) function - @Erik Tilt -- Dates are sometimes offset by 1 day in output by HTML and PDF writers depending on system timezone setting - @Erik Tilt -- Wingdings symbol fonts not working with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #10003](https://phpexcel.codeplex.com/workitem/10003) -- White space string prefix stripped by PHPExcel_Writer_Excel2007 - @MarkBaker [CodePlex #10010](https://phpexcel.codeplex.com/workitem/10010) -- The name of the Workbook stream MUST be "Workbook", not "Book" - @Erik Tilt [CodePlex #10023](https://phpexcel.codeplex.com/workitem/10023) -- Avoid message "Microsoft Excel recalculates formulas..." when closing xls file from Excel - @Erik Tilt [CodePlex #10030](https://phpexcel.codeplex.com/workitem/10030) -- Non-unique newline representation causes problems with LEN formula - @Erik Tilt [CodePlex #10031](https://phpexcel.codeplex.com/workitem/10031) -- Newline in cell not showing with PHPExcel_Writer_HTML and PHPExcel_Writer_PDF - @Erik Tilt [CodePlex #10033](https://phpexcel.codeplex.com/workitem/10033) -- Rich-Text strings get prefixed by   when output by HTML writer - @Erik Tilt [CodePlex #10046](https://phpexcel.codeplex.com/workitem/10046) -- Leading spaces do not appear in output by HTML/PDF writers - @Erik Tilt [CodePlex #10052](https://phpexcel.codeplex.com/workitem/10052) -- Empty Apache POI-generated file can not be read - @MarkBaker [CodePlex #10061](https://phpexcel.codeplex.com/workitem/10061) -- Column width not scaling correctly with font size in HTML and PDF writers - @Erik Tilt [CodePlex #10068](https://phpexcel.codeplex.com/workitem/10068) -- Inaccurate row heights with HTML writer - @Erik Tilt [CodePlex #10069](https://phpexcel.codeplex.com/workitem/10069) -- Reference helper - @MarkBaker -- Excel 5 Named ranges should not be local to the worksheet, but accessible from all worksheets - @MarkBaker -- Row heights are ignored by PHPExcel_Writer_PDF - @Erik Tilt [CodePlex #10088](https://phpexcel.codeplex.com/workitem/10088) -- Write raw XML - @MarkBaker -- removeRow(), removeColumn() not always clearing cell values - @Erik Tilt [CodePlex #10098](https://phpexcel.codeplex.com/workitem/10098) -- Problem reading certain hyperlink records with PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #10142](https://phpexcel.codeplex.com/workitem/10142) -- Hyperlink cell range read failure with PHPExcel_Reader_Excel2007 - @Erik Tilt [CodePlex #10143](https://phpexcel.codeplex.com/workitem/10143) -- 'Column string index can not be empty.' - @MarkBaker [CodePlex #10149](https://phpexcel.codeplex.com/workitem/10149) -- getHighestColumn() sometimes says there are 256 columns with PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #10204](https://phpexcel.codeplex.com/workitem/10204) -- extractSheetTitle fails when sheet title contains exclamation mark (!) - @Erik Tilt [CodePlex #10220](https://phpexcel.codeplex.com/workitem/10220) -- setTitle() sometimes erroneously appends integer to sheet name - @Erik Tilt [CodePlex #10221](https://phpexcel.codeplex.com/workitem/10221) -- Mac BIFF5 Excel file read failure (missing support for Mac OS Roman character set) - @Erik Tilt [CodePlex #10229](https://phpexcel.codeplex.com/workitem/10229) -- BIFF5 header and footer incorrectly read by PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #10230](https://phpexcel.codeplex.com/workitem/10230) -- iconv notices when reading hyperlinks with PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #10259](https://phpexcel.codeplex.com/workitem/10259) -- Excel5 reader OLE read failure with small Mac BIFF5 Excel files - @Erik Tilt [CodePlex #10252](https://phpexcel.codeplex.com/workitem/10252) -- Problem in reading formula : IF( IF ) with PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #10272](https://phpexcel.codeplex.com/workitem/10272) -- Error reading formulas referencing external sheets with PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #10274](https://phpexcel.codeplex.com/workitem/10274) -- Image horizontally stretched when default font size is increased (PHPExcel_Writer_Excel5) - @Erik Tilt [CodePlex #10291](https://phpexcel.codeplex.com/workitem/10291) -- Undefined offset in Reader\Excel5.php on line 3572 - @Erik Tilt [CodePlex #10333](https://phpexcel.codeplex.com/workitem/10333) -- PDF output different then XLS (copied data) - @MarkBaker [CodePlex #10340](https://phpexcel.codeplex.com/workitem/10340) -- Internal hyperlinks with UTF-8 sheet names not working in PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #10352](https://phpexcel.codeplex.com/workitem/10352) -- String shared formula result read error with PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #10361](https://phpexcel.codeplex.com/workitem/10361) -- Uncaught exception 'Exception' with message 'Valid scale is between 10 and 400.' in Classes/PHPExcel/Worksheet/PageSetup.php:338 - @Erik Tilt [CodePlex #10363](https://phpexcel.codeplex.com/workitem/10363) -- Using setLoadSheetsOnly fails if you do not use setReadDataOnly(true) and sheet is not the first sheet - @Erik Tilt [CodePlex #10355](https://phpexcel.codeplex.com/workitem/10355) -- getCalculatedValue() sometimes incorrect with IF formula and 0-values - @MarkBaker [CodePlex #10362](https://phpexcel.codeplex.com/workitem/10362) -- Excel Reader 2007 problem with "shared" formulae when "master" is an error - @MarkBaker -- Named Range Bug, using the same range name on different worksheets - @MarkBaker -- Java code in JAMA classes - @MarkBaker -- getCalculatedValue() not working with some formulas involving error types - @MarkBaker -- evaluation of both return values in an IF() statement returning an error if either result was an error, irrespective of the IF evaluation - @MarkBaker -- Power in formulas: new calculation engine no longer treats ^ as a bitwise XOR operator - @MarkBaker -- Bugfixes and improvements to many of the Excel functions in PHPExcel - @MarkBaker - - Added optional "places" parameter in the BIN2HEX(), BIN2OCT, DEC2BIN(), DEC2OCT(), DEC2HEX(), HEX2BIN(), HEX2OCT(), OCT2BIN() and OCT2HEX() Engineering Functions - - Trap for unbalanced matrix sizes in MDETERM() and MINVERSE() Mathematic and Trigonometric functions - - Fix for default characters parameter value for LEFT() and RIGHT() Text functions - - Fix for GCD() and LCB() Mathematical functions when the parameters include a zero (0) value - - Fix for BIN2OCT() Engineering Function for 2s complement values (which were returning hex values) - - Fix for BESSELK() and BESSELY() Engineering functions - - Fix for IMDIV() Engineering Function when result imaginary component is positive (wasn't setting the sign) - - Fix for ERF() Engineering Function when called with an upper limit value for the integration - - Fix to DATE() Date/Time Function for year value of 0 - - Set ISPMT() function as category FINANCIAL - - Fix for DOLLARDE() and DOLLARFR() Financial functions - - Fix to EFFECT() Financial function (treating $nominal_rate value as a variable name rather than a value) - - Fix to CRITBINOM() Statistical function (CurrentValue and EssentiallyZero treated as constants rather than variables) - - Note that an Error in the function logic can still lead to a permanent loop - - Fix to MOD() Mathematical function to work with floating point results - - Fix for QUOTIENT() Mathematical function - - Fix to HOUR(), MINUTE() and SECOND() Date/Time functions to return an error when passing in a floating point value of 1.0 or greater, or less than 0 - - LOG() Function now correctly returns base-10 log when called with only one parameter, rather than the natural log as the default base - - Modified text functions to handle multibyte character set (UTF-8). - -## [1.6.7] - 2009-04-22 - -### BREAKING CHANGE - -In previous versions of PHPExcel up to and including 1.6.6, -when a cell had a date-like number format code, it was possible to enter a date -directly using an integer PHP-time without converting to Excel date format. -Starting with PHPExcel 1.6.7 this is no longer supported. Refer to the developer -documentation for more information on entering dates into a cell. - -### General - -- Deprecate misspelled setStriketrough() and getStriketrough() methods - @MarkBaker [CodePlex #9416](https://phpexcel.codeplex.com/workitem/9416) - -### Features - -- Performance improvement when saving file - @MarkBaker [CodePlex #9526](https://phpexcel.codeplex.com/workitem/9526) -- Check that sheet title has maximum 31 characters - @MarkBaker [CodePlex #9598](https://phpexcel.codeplex.com/workitem/9598) -- True support for Excel built-in number format codes - @MB, ET [CodePlex #9631](https://phpexcel.codeplex.com/workitem/9631) -- Ability to read defect BIFF5 Excel file without CODEPAGE record - @Erik Tilt [CodePlex #9683](https://phpexcel.codeplex.com/workitem/9683) -- Auto-detect which reader to invoke - @MarkBaker [CodePlex #9701](https://phpexcel.codeplex.com/workitem/9701) -- Deprecate insertion of dates using PHP-time (Unix time) [request for removal of feature] - @Erik Tilt [CodePlex #9214](https://phpexcel.codeplex.com/workitem/9214) -- Support for entering time values like '9:45', '09:45' using AdvancedValueBinder - @Erik Tilt [CodePlex #9747](https://phpexcel.codeplex.com/workitem/9747) - -### Bugfixes - -- DataType dependent horizontal alignment in HTML and PDF writer - @Erik Tilt [CodePlex #9797](https://phpexcel.codeplex.com/workitem/9797) -- Cloning data validation object causes script to stop - @MarkBaker [CodePlex #9375](https://phpexcel.codeplex.com/workitem/9375) -- Simultaneous repeating rows and repeating columns not working with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #9400](https://phpexcel.codeplex.com/workitem/9400) -- Simultaneous repeating rows and repeating columns not working with PHPExcel_Writer_Excel2007 - @MarkBaker [CodePlex #9399](https://phpexcel.codeplex.com/workitem/9399) -- Row outline level not working with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #9437](https://phpexcel.codeplex.com/workitem/9437) -- Occasional notices with PHPExcel_Reader_Excel5 when Excel file contains drawing elements - @Erik Tilt [CodePlex #9452](https://phpexcel.codeplex.com/workitem/9452) -- PHPExcel_Reader_Excel5 fails as a whole when workbook contains images other than JPEG/PNG - @Erik Tilt [CodePlex #9453](https://phpexcel.codeplex.com/workitem/9453) -- Excel5 writer checks for iconv but does not necessarily use it - @Erik Tilt [CodePlex #9444](https://phpexcel.codeplex.com/workitem/9444) -- Altering a style on copied worksheet alters also the original - @Erik Tilt [CodePlex #9463](https://phpexcel.codeplex.com/workitem/9463) -- Formulas are incorrectly updated when a sheet is renamed - @MarkBaker [CodePlex #9480](https://phpexcel.codeplex.com/workitem/9480) -- PHPExcel_Worksheet::extractSheetTitle not treating single quotes correctly - @MarkBaker [CodePlex #9513](https://phpexcel.codeplex.com/workitem/9513) -- PHP Warning raised in function array_key_exists - @MarkBaker [CodePlex #9477](https://phpexcel.codeplex.com/workitem/9477) -- getAlignWithMargins() gives wrong value when using PHPExcel_Reader_Excel2007 - @MarkBaker [CodePlex #9599](https://phpexcel.codeplex.com/workitem/9599) -- getScaleWithDocument() gives wrong value when using PHPExcel_Reader_Excel2007 - @MarkBaker [CodePlex #9600](https://phpexcel.codeplex.com/workitem/9600) -- PHPExcel_Reader_Excel2007 not reading the first user-defined number format - @MarkBaker [CodePlex #9630](https://phpexcel.codeplex.com/workitem/9630) -- Print area converted to uppercase after read with PHPExcel_Reader_Excel2007 - @MarkBaker [CodePlex #9647](https://phpexcel.codeplex.com/workitem/9647) -- Incorrect reading of scope for named range using PHPExcel_Reader_Excel2007 - @MarkBaker [CodePlex #9661](https://phpexcel.codeplex.com/workitem/9661) -- Error with pattern (getFillType) and rbg (getRGB) - @MarkBaker [CodePlex #9690](https://phpexcel.codeplex.com/workitem/9690) -- AdvancedValueBinder affected by system timezone setting when inserting date values - @Erik Tilt [CodePlex #9712](https://phpexcel.codeplex.com/workitem/9712) -- PHPExcel_Reader_Excel2007 not reading value of active sheet index - @Erik Tilt [CodePlex #9743](https://phpexcel.codeplex.com/workitem/9743) -- getARGB() sometimes returns SimpleXMLElement object instead of string with PHPExcel_Reader_Excel2007 - @Erik Tilt [CodePlex #9742](https://phpexcel.codeplex.com/workitem/9742) -- Negative image offset causes defects in 14excel5.xls and 20readexcel5.xlsx - @Erik Tilt [CodePlex #9731](https://phpexcel.codeplex.com/workitem/9731) -- HTML & PDF Writer not working with mergeCells (regression since 1.6.5) - @Erik Tilt [CodePlex #9758](https://phpexcel.codeplex.com/workitem/9758) -- Too wide columns with HTML and PDF writer - @Erik Tilt [CodePlex #9774](https://phpexcel.codeplex.com/workitem/9774) -- PDF and cyrillic fonts - @MarkBaker [CodePlex #9775](https://phpexcel.codeplex.com/workitem/9775) -- Percentages not working correctly with HTML and PDF writers (shows 0.25% instead of 25%) - @Erik Tilt [CodePlex #9793](https://phpexcel.codeplex.com/workitem/9793) -- PHPExcel_Writer_HTML creates extra borders around cell contents using setUseInlineCss(true) - @Erik Tilt [CodePlex #9791](https://phpexcel.codeplex.com/workitem/9791) -- Problem with text wrap + merged cells in HTML and PDF writer - @Erik Tilt [CodePlex #9784](https://phpexcel.codeplex.com/workitem/9784) -- Adjacent path separators in include_path causing IOFactory to violate open_basedir restriction - @Erik Tilt [CodePlex #9814](https://phpexcel.codeplex.com/workitem/9814) - -## [1.6.6] - 2009-03-02 - -### General - -- Improve support for built-in number formats in PHPExcel_Reader_Excel2007 - @MarkBaker [CodePlex #9102](https://phpexcel.codeplex.com/workitem/9102) -- Source files are in both UNIX and DOS formats - changed to UNIX - @Erik Tilt [CodePlex #9281](https://phpexcel.codeplex.com/workitem/9281) - -### Features - -- Update documentation: Which language to write formulas in? - @MarkBaker [CodePlex #9338](https://phpexcel.codeplex.com/workitem/9338) -- Ignore DEFCOLWIDTH records with value 8 in PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #8817](https://phpexcel.codeplex.com/workitem/8817) -- Support for width, height, offsetX, offsetY for images in PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #8847](https://phpexcel.codeplex.com/workitem/8847) -- Disk Caching in specific folder - @MarkBaker [CodePlex #8870](https://phpexcel.codeplex.com/workitem/8870) -- Added SUMX2MY2, SUMX2PY2, SUMXMY2, MDETERM and MINVERSE Mathematical and Trigonometric Functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Added CONVERT Engineering Function - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Added DB, DDB, DISC, DOLLARDE, DOLLARFR, INTRATE, IPMT, PPMT, PRICEDISC, PRICEMAT and RECEIVED Financial Functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Added ACCRINTM, CUMIPMT, CUMPRINC, TBILLEQ, TBILLPRICE, TBILLYIELD, YIELDDISC and YIELDMAT Financial Functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Added DOLLAR Text Function - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Added CORREL, COVAR, FORECAST, INTERCEPT, RSQ, SLOPE and STEYX Statistical Functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Added PEARSON Statistical Functions as a synonym for CORREL - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Added LINEST, LOGEST (currently only valid for stats = false), TREND and GROWTH Statistical Functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Added RANK and PERCENTRANK Statistical Functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Added ROMAN Mathematical Function (Classic form only) - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Update documentation to show example of getCellByColumnAndRow($col, $row) - @MarkBaker [CodePlex #8931](https://phpexcel.codeplex.com/workitem/8931) -- Implement worksheet, row and cell iterators - @MarkBaker [CodePlex #8770](https://phpexcel.codeplex.com/workitem/8770) -- Support for arbitrary defined names (named range) - @MarkBaker [CodePlex #9001](https://phpexcel.codeplex.com/workitem/9001) -- Update formulas when sheet title / named range title changes - @MB, ET [CodePlex #9016](https://phpexcel.codeplex.com/workitem/9016) -- Ability to read cached calculated value - @MarkBaker [CodePlex #9103](https://phpexcel.codeplex.com/workitem/9103) -- Support for Excel 1904 calendar date mode (Mac) - @MBaker, ET [CodePlex #8483](https://phpexcel.codeplex.com/workitem/8483) -- PHPExcel_Writer_Excel5 improvements writing shared strings table - @Erik Tilt [CodePlex #9194](https://phpexcel.codeplex.com/workitem/9194) -- PHPExcel_Writer_Excel5 iconv fallback when mbstring extension is not enabled - @Erik Tilt [CodePlex #9248](https://phpexcel.codeplex.com/workitem/9248) -- UTF-8 support in font names in PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #9253](https://phpexcel.codeplex.com/workitem/9253) -- Implement value binding architecture - @MarkBaker [CodePlex #9215](https://phpexcel.codeplex.com/workitem/9215) -- PDF writer not working with UTF-8 - @MarkBaker [CodePlex #6742](https://phpexcel.codeplex.com/workitem/6742) - -### Bugfixes - -- Eliminate duplicate style entries in multisheet workbook written by PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #9355](https://phpexcel.codeplex.com/workitem/9355) -- Redirect to client browser fails due to trailing white space in class definitions - @Erik Tilt [CodePlex #8810](https://phpexcel.codeplex.com/workitem/8810) -- Spurious column dimension element introduced in blank worksheet after using PHPExcel_Writer_Excel2007 - @MarkBaker [CodePlex #8816](https://phpexcel.codeplex.com/workitem/8816) -- Image gets slightly narrower than expected when using PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #8830](https://phpexcel.codeplex.com/workitem/8830) -- Image laid over non-visible row gets squeezed in height when using PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #8831](https://phpexcel.codeplex.com/workitem/8831) -- PHPExcel_Reader_Excel5 fails when there are 10 or more images in the workbook - @Erik Tilt [CodePlex #8860](https://phpexcel.codeplex.com/workitem/8860) -- Different header/footer images in different sheets not working with PHPExcel_Writer_Excel2007 - @MarkBaker [CodePlex #8909](https://phpexcel.codeplex.com/workitem/8909) -- Fractional seconds disappear when using PHPExcel_Reader_Excel2007 and PHPExcel_Reader_Excel5 - @MB, ET [CodePlex #8924](https://phpexcel.codeplex.com/workitem/8924) -- Images not showing in OpenOffice when using PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7994](https://phpexcel.codeplex.com/workitem/7994) -- Images not showing on print using PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #9047](https://phpexcel.codeplex.com/workitem/9047) -- PHPExcel_Writer_Excel5 maximum allowed record size 4 bytes too short - @Erik Tilt [CodePlex #9085](https://phpexcel.codeplex.com/workitem/9085) -- Not numeric strings are formatted as dates and numbers using worksheet's toArray method - @MarkBaker [CodePlex #9119](https://phpexcel.codeplex.com/workitem/9119) -- Excel5 simple formula parsing error - @Erik Tilt [CodePlex #9132](https://phpexcel.codeplex.com/workitem/9132) -- Problems writing dates with CSV - @Erik Tilt [CodePlex #9206](https://phpexcel.codeplex.com/workitem/9206) -- PHPExcel_Reader_Excel5 reader fails with fatal error when reading group shapes - @Erik Tilt [CodePlex #9203](https://phpexcel.codeplex.com/workitem/9203) -- PHPExcel_Writer_Excel5 fails completely when workbook contains more than 57 colors - @Erik Tilt [CodePlex #9231](https://phpexcel.codeplex.com/workitem/9231) -- PHPExcel_Writer_PDF not compatible with autoload - @Erik Tilt [CodePlex #9244](https://phpexcel.codeplex.com/workitem/9244) -- Fatal error: Call to a member function getNestingLevel() on a non-object in PHPExcel/Reader/Excel5.php on line 690 - @Erik Tilt [CodePlex #9250](https://phpexcel.codeplex.com/workitem/9250) -- Notices when running test 04printing.php on PHP 5.2.8 - @MarkBaker [CodePlex #9246](https://phpexcel.codeplex.com/workitem/9246) -- insertColumn() spawns creation of spurious RowDimension - @MarkBaker [CodePlex #9294](https://phpexcel.codeplex.com/workitem/9294) -- Fix declarations for methods in extended Trend classes - @MarkBaker [CodePlex #9296](https://phpexcel.codeplex.com/workitem/9296) -- Fix to parameters for the FORECAST Statistical Function - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- PDF writer problems with cell height and text wrapping - @MarkBaker [CodePlex #7083](https://phpexcel.codeplex.com/workitem/7083) -- Fix test for calculated value in case the returned result is an array - @MarkBaker -- Column greater than 256 results in corrupt Excel file using PHPExcel_Writer_Excel5 - @Erik Tilt -- Excel Numberformat 0.00 results in non internal decimal places values in toArray() Method - @MarkBaker [CodePlex #9351](https://phpexcel.codeplex.com/workitem/9351) -- setAutoSize not taking into account text rotation - @MB,ET [CodePlex #9356](https://phpexcel.codeplex.com/workitem/9356) -- Call to undefined method PHPExcel_Worksheet_MemoryDrawing::getPath() in PHPExcel/Writer/HTML.php - @Erik Tilt [CodePlex #9372](https://phpexcel.codeplex.com/workitem/9372) - -## [1.6.5] - 2009-01-05 - -### General - -- Applied patch 2063 - @MarkBaker -- Optimise Shared Strings - @MarkBaker -- Optimise Cell Sorting - @MarkBaker -- Optimise Style Hashing - @MarkBaker -- UTF-8 enhancements - @Erik Tilt -- PHPExcel_Writer_HTML validation errors against strict HTML 4.01 / CSS 2.1 - @Erik Tilt -- Documented work items 6203 and 8110 in manual - @MarkBaker -- Restructure package hierachy so classes can be found more easily in auto-generated API (from work item 8468) - @Erik Tilt - -### Features - -- Redirect output to a client's browser: Update recommendation in documentation - @MarkBaker [CodePlex #8806](https://phpexcel.codeplex.com/workitem/8806) -- PHPExcel_Reader_Excel5 support for print gridlines - @Erik Tilt [CodePlex #7897](https://phpexcel.codeplex.com/workitem/7897) -- Screen gridlines support in Excel5 reader/writer - @Erik Tilt [CodePlex #7899](https://phpexcel.codeplex.com/workitem/7899) -- Option for adding image to spreadsheet from image resource in memory - @MB, ET [CodePlex #7552](https://phpexcel.codeplex.com/workitem/7552) -- PHPExcel_Reader_Excel5 style support for BIFF5 files (Excel 5.0 - Excel 95) - @Erik Tilt [CodePlex #7862](https://phpexcel.codeplex.com/workitem/7862) -- PHPExcel_Reader_Excel5 support for user-defined colors and special built-in colors - @Erik Tilt [CodePlex #7918](https://phpexcel.codeplex.com/workitem/7918) -- Support for freeze panes in PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #7992](https://phpexcel.codeplex.com/workitem/7992) -- Support for header and footer margins in PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #7996](https://phpexcel.codeplex.com/workitem/7996) -- Support for active sheet index in Excel5 reader/writer - @Erik Tilt [CodePlex #7997](https://phpexcel.codeplex.com/workitem/7997) -- Freeze panes not read by PHPExcel_Reader_Excel2007 - @MarkBaker [CodePlex #7991](https://phpexcel.codeplex.com/workitem/7991) -- Support for screen zoom level (feature request) - @MB, ET [CodePlex #7993](https://phpexcel.codeplex.com/workitem/7993) -- Support for default style in PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #8012](https://phpexcel.codeplex.com/workitem/8012) -- Apple iWork / Numbers.app incompatibility - @MarkBaker [CodePlex #8094](https://phpexcel.codeplex.com/workitem/8094) -- Support "between rule" in conditional formatting - @MarkBaker [CodePlex #7931](https://phpexcel.codeplex.com/workitem/7931) -- Comment size, width and height control (feature request) - @MarkBaker [CodePlex #8308](https://phpexcel.codeplex.com/workitem/8308) -- Improve method for storing MERGEDCELLS records in PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #8418](https://phpexcel.codeplex.com/workitem/8418) -- Support for protectCells() in Excel5 reader/writer - @Erik Tilt [CodePlex #8435](https://phpexcel.codeplex.com/workitem/8435) -- Support for fitToWidth and fitToHeight pagesetup properties in PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #8472](https://phpexcel.codeplex.com/workitem/8472) -- Support for setShowSummaryBelow() and setShowSummaryRight() in PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #8489](https://phpexcel.codeplex.com/workitem/8489) -- Support for Excel 1904 calendar date mode (Mac) - @MarkBaker [CodePlex #8483](https://phpexcel.codeplex.com/workitem/8483) -- Excel5 reader: Support for reading images (bitmaps) - @Erik Tilt [CodePlex #7538](https://phpexcel.codeplex.com/workitem/7538) -- Support for default style in PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #8787](https://phpexcel.codeplex.com/workitem/8787) -- Modified calculate() method to return either an array or the first value from the array for those functions that return arrays rather than single values (e.g the MMULT and TRANSPOSE function). This performance can be modified based on the $returnArrayAsType which can be set/retrieved by calling the setArrayReturnType() and getArrayReturnType() methods of the PHPExcel_Calculation class. - @MarkBaker - -### Bugfixes - -- Added ERROR.TYPE Information Function, MMULT Mathematical and Trigonometry Function, and TRANSPOSE Lookup and Reference Function - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- setPrintGridlines(true) not working with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7896](https://phpexcel.codeplex.com/workitem/7896) -- Incorrect mapping of fill patterns in PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7907](https://phpexcel.codeplex.com/workitem/7907) -- setShowGridlines(false) not working with PHPExcel_Writer_Excel2007 - @MarkBaker [CodePlex #7898](https://phpexcel.codeplex.com/workitem/7898) -- getShowGridlines() gives inverted value when reading sheet with PHPExcel_Reader_Excel2007 - @MarkBaker [CodePlex #7905](https://phpexcel.codeplex.com/workitem/7905) -- User-defined column width becomes slightly larger after read/write with Excel5 - @Erik Tilt [CodePlex #7944](https://phpexcel.codeplex.com/workitem/7944) -- Incomplete border style support in PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7949](https://phpexcel.codeplex.com/workitem/7949) -- Conditional formatting "containsText" read/write results in MS Office Excel 2007 crash - @MarkBaker [CodePlex #7928](https://phpexcel.codeplex.com/workitem/7928) -- All sheets are always selected in output when using PHPExcel_Writer_Excel2007 - @MarkBaker [CodePlex #7995](https://phpexcel.codeplex.com/workitem/7995) -- COLUMN function warning message during plain read/write - @MarkBaker [CodePlex #8013](https://phpexcel.codeplex.com/workitem/8013) -- setValue(0) results in string data type '0' - @MarkBaker [CodePlex #8155](https://phpexcel.codeplex.com/workitem/8155) -- Styles not removed when removing rows from sheet - @MarkBaker [CodePlex #8226](https://phpexcel.codeplex.com/workitem/8226) -- =IF formula causes fatal error during $objWriter->save() in Excel2007 format - @MarkBaker [CodePlex #8301](https://phpexcel.codeplex.com/workitem/8301) -- Exception thrown reading valid xls file: "Excel file is corrupt. Didn't find CONTINUE record while reading shared strings" - @Erik Tilt [CodePlex #8333](https://phpexcel.codeplex.com/workitem/8333) -- MS Outlook corrupts files generated by PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #8320](https://phpexcel.codeplex.com/workitem/8320) -- Undefined method PHPExcel_Worksheet::setFreezePane() in ReferenceHelper.php on line 271 - @MarkBaker [CodePlex #8351](https://phpexcel.codeplex.com/workitem/8351) -- Ampersands (&), left and right angles (<, >) in Rich-Text strings leads to corrupt output using PHPExcel_Writer_Excel2007 - @MarkBaker [CodePlex #8401](https://phpexcel.codeplex.com/workitem/8401) -- Print header and footer not supporting UTF-8 in PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #8408](https://phpexcel.codeplex.com/workitem/8408) -- Vertical page breaks not working with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #8463](https://phpexcel.codeplex.com/workitem/8463) -- Missing support for accounting underline types in PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #8476](https://phpexcel.codeplex.com/workitem/8476) -- Infinite loops when reading corrupt xls file using PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #8482](https://phpexcel.codeplex.com/workitem/8482) -- Sheet protection password not working with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #8566](https://phpexcel.codeplex.com/workitem/8566) -- PHPExcel_Style_NumberFormat::FORMAT_NUMBER ignored by PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #8596](https://phpexcel.codeplex.com/workitem/8596) -- PHPExcel_Reader_Excel5 fails a whole when workbook contains a chart - @Erik Tilt [CodePlex #8781](https://phpexcel.codeplex.com/workitem/8781) -- Occasional loss of column widths using PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #8788](https://phpexcel.codeplex.com/workitem/8788) -- Notices while reading formulas with deleted sheet references using PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #8795](https://phpexcel.codeplex.com/workitem/8795) -- Default style not read by PHPExcel_Reader_Excel2007 - @MarkBaker [CodePlex #8807](https://phpexcel.codeplex.com/workitem/8807) -- Blank rows occupy too much space in file generated by PHPExcel_Writer_Excel2007 - @MarkBaker [CodePlex #9341](https://phpexcel.codeplex.com/workitem/9341) - -## [1.6.4] - 2008-10-27 - -### Features - -- RK record number error in MS developer documentation: 0x007E should be 0x027E - @Erik Tilt [CodePlex #7882](https://phpexcel.codeplex.com/workitem/7882) -- getHighestColumn() returning "@" for blank worksheet causes corrupt output - @MarkBaker [CodePlex #7878](https://phpexcel.codeplex.com/workitem/7878) -- Implement ROW and COLUMN Lookup/Reference Functions (when specified with a parameter) - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Implement initial work on OFFSET Lookup/Reference Function (returning address rather than value at address) - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Excel5 reader: Page margins - @Erik Tilt [CodePlex #7416](https://phpexcel.codeplex.com/workitem/7416) -- Excel5 reader: Header & Footer - @Erik Tilt [CodePlex #7417](https://phpexcel.codeplex.com/workitem/7417) -- Excel5 reader support for page setup (paper size etc.) - @Erik Tilt [CodePlex #7449](https://phpexcel.codeplex.com/workitem/7449) -- Improve speed and memory consumption of PHPExcel_Writer_CSV - @MarkBaker [CodePlex #7445](https://phpexcel.codeplex.com/workitem/7445) -- Better recognition of number format in HTML, CSV, and PDF writer - @MarkBaker [CodePlex #7432](https://phpexcel.codeplex.com/workitem/7432) -- Font support: Superscript and Subscript - @MarkBaker [CodePlex #7485](https://phpexcel.codeplex.com/workitem/7485) -- Excel5 reader font support: Super- and subscript - @Erik Tilt [CodePlex #7509](https://phpexcel.codeplex.com/workitem/7509) -- Excel5 reader style support: Text rotation and stacked text - @Erik Tilt [CodePlex #7521](https://phpexcel.codeplex.com/workitem/7521) -- Excel5 reader: Support for hyperlinks - @Erik Tilt [CodePlex #7530](https://phpexcel.codeplex.com/workitem/7530) -- Import sheet by request - @MB, ET [CodePlex #7557](https://phpexcel.codeplex.com/workitem/7557) -- PHPExcel_Reader_Excel5 support for page breaks - @Erik Tilt [CodePlex #7607](https://phpexcel.codeplex.com/workitem/7607) -- PHPExcel_Reader_Excel5 support for shrink-to-fit - @Erik Tilt [CodePlex #7622](https://phpexcel.codeplex.com/workitem/7622) -- Support for error types - @MB, ET [CodePlex #7675](https://phpexcel.codeplex.com/workitem/7675) -- Excel5 reader true formula support - @Erik Tilt [CodePlex #7388](https://phpexcel.codeplex.com/workitem/7388) -- Support for named ranges (defined names) in PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #7701](https://phpexcel.codeplex.com/workitem/7701) -- Support for repeating rows and repeating columns (print titles) in PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #7781](https://phpexcel.codeplex.com/workitem/7781) -- Support for print area in PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #7783](https://phpexcel.codeplex.com/workitem/7783) -- Excel5 reader and writer support for horizontal and vertical centering of page - @Erik Tilt [CodePlex #7795](https://phpexcel.codeplex.com/workitem/7795) -- Applied patch 1962 - @MarkBaker -- Excel5 reader and writer support for hidden cells (formulas) - @Erik Tilt [CodePlex #7866](https://phpexcel.codeplex.com/workitem/7866) -- Support for indentation in cells (feature request) - @MB, ET [CodePlex #7612](https://phpexcel.codeplex.com/workitem/7612) - -### Bugfixes - -- Option for reading only specified interval of rows in a sheet - @MB, ET [CodePlex #7828](https://phpexcel.codeplex.com/workitem/7828) -- PHPExcel_Calculation_Functions::DATETIMENOW() and PHPExcel_Calculation_Functions::DATENOW() to force UTC - @MarkBaker [CodePlex #7367](https://phpexcel.codeplex.com/workitem/7367) -- Modified PHPExcel_Shared_Date::FormattedPHPToExcel() and PHPExcel_Shared_Date::ExcelToPHP to force datatype for return values - @MarkBaker [CodePlex #7395](https://phpexcel.codeplex.com/workitem/7395) -- Excel5 reader not producing UTF-8 strings with BIFF5 files - @Erik Tilt [CodePlex #7450](https://phpexcel.codeplex.com/workitem/7450) -- Array constant in formula gives run-time notice with Excel2007 writer - @MarkBaker [CodePlex #7470](https://phpexcel.codeplex.com/workitem/7470) -- PHPExcel_Reader_Excel2007 setReadDataOnly(true) returns Rich-Text - @MarkBaker [CodePlex #7494](https://phpexcel.codeplex.com/workitem/7494) -- PHPExcel_Reader_Excel5 setReadDataOnly(true) returns Rich-Text - @Erik Tilt [CodePlex #7496](https://phpexcel.codeplex.com/workitem/7496) -- Characters before superscript or subscript losing style - @MarkBaker [CodePlex #7497](https://phpexcel.codeplex.com/workitem/7497) -- Subscript not working with HTML writer - @MarkBaker [CodePlex #7507](https://phpexcel.codeplex.com/workitem/7507) -- DefaultColumnDimension not working on first column (A) - @MarkBaker [CodePlex #7508](https://phpexcel.codeplex.com/workitem/7508) -- Negative numbers are stored as text in PHPExcel_Writer_2007 - @MarkBaker [CodePlex #7527](https://phpexcel.codeplex.com/workitem/7527) -- Text rotation and stacked text not working with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7531](https://phpexcel.codeplex.com/workitem/7531) -- PHPExcel_Shared_Date::isDateTimeFormatCode erroneously says true - @MarkBaker [CodePlex #7536](https://phpexcel.codeplex.com/workitem/7536) -- Different images with same filename in separate directories become duplicates - @MarkBaker [CodePlex #7559](https://phpexcel.codeplex.com/workitem/7559) -- PHPExcel_Reader_Excel5 not returning sheet names as UTF-8 using for Excel 95 files - @Erik Tilt [CodePlex #7568](https://phpexcel.codeplex.com/workitem/7568) -- setAutoSize(true) on empty column gives column width of 10 using PHPExcel_Writer_Excel2007 - @MarkBaker [CodePlex #7575](https://phpexcel.codeplex.com/workitem/7575) -- setAutoSize(true) on empty column gives column width of 255 using PHPExcel_Writer_Excel5 - @MB, ET [CodePlex #7573](https://phpexcel.codeplex.com/workitem/7573) -- Worksheet_Drawing bug - @MarkBaker [CodePlex #7514](https://phpexcel.codeplex.com/workitem/7514) -- getCalculatedValue() with REPT function causes script to stop - @MarkBaker [CodePlex #7593](https://phpexcel.codeplex.com/workitem/7593) -- getCalculatedValue() with LEN function causes script to stop - @MarkBaker [CodePlex #7594](https://phpexcel.codeplex.com/workitem/7594) -- Explicit fit-to-width (page setup) results in fit-to-height becoming 1 - @MarkBaker [CodePlex #7600](https://phpexcel.codeplex.com/workitem/7600) -- Fit-to-width value of 1 is lost after read/write of Excel2007 spreadsheet - @MarkBaker [CodePlex #7610](https://phpexcel.codeplex.com/workitem/7610) -- Conditional styles not read properly using PHPExcel_Reader_Excel2007 - @MarkBaker [CodePlex #7516](https://phpexcel.codeplex.com/workitem/7516) -- PHPExcel_Writer_2007: Default worksheet style works only for first sheet - @MarkBaker [CodePlex #7611](https://phpexcel.codeplex.com/workitem/7611) -- Cannot Lock Cells using PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #6940](https://phpexcel.codeplex.com/workitem/6940) -- Incorrect cell protection values found when using Excel5 reader - @Erik Tilt [CodePlex #7621](https://phpexcel.codeplex.com/workitem/7621) -- Default row height not working above highest row using PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7623](https://phpexcel.codeplex.com/workitem/7623) -- Default column width does not get applied when using PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7637](https://phpexcel.codeplex.com/workitem/7637) -- Broken support for UTF-8 string formula results in PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #7642](https://phpexcel.codeplex.com/workitem/7642) -- UTF-8 sheet names not working with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7643](https://phpexcel.codeplex.com/workitem/7643) -- getCalculatedValue() with ISNONTEXT function causes script to stop - @MarkBaker [CodePlex #7631](https://phpexcel.codeplex.com/workitem/7631) -- Missing BIFF3 functions in PHPExcel_Writer_Excel5: USDOLLAR (YEN), FINDB, SEARCHB, REPLACEB, LEFTB, RIGHTB, MIDB, LENB, ASC, DBCS (JIS) - @Erik Tilt [CodePlex #7652](https://phpexcel.codeplex.com/workitem/7652) -- Excel5 reader doesn't read numbers correctly in 64-bit systems - @Erik Tilt [CodePlex #7663](https://phpexcel.codeplex.com/workitem/7663) -- Missing BIFF5 functions in PHPExcel_Writer_Excel5: ISPMT, DATEDIF, DATESTRING, NUMBERSTRING - @Erik Tilt [CodePlex #7667](https://phpexcel.codeplex.com/workitem/7667) -- Missing BIFF8 functions in PHPExcel_Writer_Excel5: GETPIVOTDATA, HYPERLINK, PHONETIC, AVERAGEA, MAXA, MINA, STDEVPA, VARPA, STDEVA, VARA - @Erik Tilt [CodePlex #7668](https://phpexcel.codeplex.com/workitem/7668) -- Wrong host value in PHPExcel_Shared_ZipStreamWrapper::stream_open() - @MarkBaker [CodePlex #7657](https://phpexcel.codeplex.com/workitem/7657) -- PHPExcel_Reader_Excel5 not reading explicitly entered error types in cells - @Erik Tilt [CodePlex #7676](https://phpexcel.codeplex.com/workitem/7676) -- Boolean and error data types not preserved for formula results in PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #7678](https://phpexcel.codeplex.com/workitem/7678) -- PHPExcel_Reader_Excel2007 ignores cell data type - @MarkBaker [CodePlex #7695](https://phpexcel.codeplex.com/workitem/7695) -- PHPExcel_Reader_Excel5 ignores cell data type - @Erik Tilt [CodePlex #7712](https://phpexcel.codeplex.com/workitem/7712) -- PHPExcel_Writer_Excel5 not aware of data type - @Erik Tilt [CodePlex #7587](https://phpexcel.codeplex.com/workitem/7587) -- Long strings sometimes truncated when using PHPExcel_Reader_Excel5 - @Erik Tilt [CodePlex #7713](https://phpexcel.codeplex.com/workitem/7713) -- Direct entry of boolean or error type in cell not supported by PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7727](https://phpexcel.codeplex.com/workitem/7727) -- PHPExcel_Reader_Excel2007: Error reading cell with data type string, date number format, and numeric-like cell value - @MarkBaker [CodePlex #7714](https://phpexcel.codeplex.com/workitem/7714) -- Row and column outlines (group indent level) not showing after using PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7735](https://phpexcel.codeplex.com/workitem/7735) -- Missing UTF-8 support in number format codes for PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7737](https://phpexcel.codeplex.com/workitem/7737) -- Missing UTF-8 support with PHPExcel_Writer_Excel5 for explicit string in formula - @Erik Tilt [CodePlex #7750](https://phpexcel.codeplex.com/workitem/7750) -- Problem with class constants in PHPExcel_Style_NumberFormat - @MarkBaker [CodePlex #7726](https://phpexcel.codeplex.com/workitem/7726) -- Sometimes errors with PHPExcel_Reader_Excel5 reading hyperlinks - @Erik Tilt [CodePlex #7758](https://phpexcel.codeplex.com/workitem/7758) -- Hyperlink in cell always results in string data type when using PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7759](https://phpexcel.codeplex.com/workitem/7759) -- Excel file with blank sheet seen as broken in MS Office Excel 2007 when created by PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7771](https://phpexcel.codeplex.com/workitem/7771) -- PHPExcel_Reader_Excel5: Incorrect reading of formula with explicit string containing (escaped) double-quote - @Erik Tilt [CodePlex #7785](https://phpexcel.codeplex.com/workitem/7785) -- getCalculatedValue() fails on formula with sheet name containing (escaped) single-quote - @MarkBaker [CodePlex #7787](https://phpexcel.codeplex.com/workitem/7787) -- getCalculatedValue() fails on formula with explicit string containing (escaped) double-quote - @MarkBaker [CodePlex #7786](https://phpexcel.codeplex.com/workitem/7786) -- Problems with simultaneous repeatRowsAtTop and repeatColumnsAtLeft using Excel2007 reader and writer - @MarkBaker [CodePlex #7780](https://phpexcel.codeplex.com/workitem/7780) -- PHPExcel_Reader_Excel5: Error reading formulas with sheet reference containing special characters - @Erik Tilt [CodePlex #7802](https://phpexcel.codeplex.com/workitem/7802) -- Off-sheet references sheet!A1 not working with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7831](https://phpexcel.codeplex.com/workitem/7831) -- Repeating rows/columns (print titles), print area not working with PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7834](https://phpexcel.codeplex.com/workitem/7834) -- Formula having datetime number format shows as text when using PHPExcel_Writer_Excel5 - @Erik Tilt [CodePlex #7849](https://phpexcel.codeplex.com/workitem/7849) -- Cannot set formula to hidden using applyFromArray() - @MarkBaker [CodePlex #7863](https://phpexcel.codeplex.com/workitem/7863) -- HTML/PDF Writers limited to 26 columns by calculateWorksheetDimension (erroneous comparison in getHighestColumn() method) - @MarkBaker [CodePlex #7805](https://phpexcel.codeplex.com/workitem/7805) -- Formula returning error type is lost when read by PHPExcel_Reader_Excel2007 - @MarkBaker [CodePlex #7873](https://phpexcel.codeplex.com/workitem/7873) -- PHPExcel_Reader_Excel5: Cell style lost for last column in group of blank cells - @Erik Tilt [CodePlex #7883](https://phpexcel.codeplex.com/workitem/7883) -- Column width sometimes collapses to auto size using Excel2007 reader/writer - @MarkBaker [CodePlex #7886](https://phpexcel.codeplex.com/workitem/7886) -- Data Validation Formula = 0 crashes Excel - @MarkBaker [CodePlex #9343](https://phpexcel.codeplex.com/workitem/9343) - -## [1.6.3] - 2008-08-25 - -### General - -- Modified PHPExcel_Shared_Date::PHPToExcel() to force UTC - @MarkBaker [CodePlex #7367](https://phpexcel.codeplex.com/workitem/7367) -- Applied patch 1629 - @MarkBaker -- Applied patch 1644 - @MarkBaker -- Implement repeatRow and repeatColumn in Excel5 writer - @MarkBaker [CodePlex #6485](https://phpexcel.codeplex.com/workitem/6485) - -### Features - -- Remove scene3d filter in Excel2007 drawing - @MarkBaker [CodePlex #6838](https://phpexcel.codeplex.com/workitem/6838) -- Implement CHOOSE and INDEX Lookup/Reference Functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Implement CLEAN Text Functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Implement YEARFRAC Date/Time Functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Implement 2 options for print/show gridlines - @MarkBaker [CodePlex #6508](https://phpexcel.codeplex.com/workitem/6508) -- Add VLOOKUP function (contribution) - @MarkBaker [CodePlex #7270](https://phpexcel.codeplex.com/workitem/7270) -- Implemented: ShrinkToFit - @MarkBaker [CodePlex #7182](https://phpexcel.codeplex.com/workitem/7182) -- Row heights not updated correctly when inserting new rows - @MarkBaker [CodePlex #7218](https://phpexcel.codeplex.com/workitem/7218) -- Copy worksheets within the same workbook - @MarkBaker [CodePlex #7157](https://phpexcel.codeplex.com/workitem/7157) -- Excel5 reader style support: horizontal and vertical alignment plus text wrap - @Erik Tilt [CodePlex #7290](https://phpexcel.codeplex.com/workitem/7290) -- Excel5 reader support for merged cells - @Erik Tilt [CodePlex #7294](https://phpexcel.codeplex.com/workitem/7294) -- Excel5 reader: Sheet Protection - @Erik Tilt [CodePlex #7296](https://phpexcel.codeplex.com/workitem/7296) -- Excel5 reader: Password for sheet protection - @Erik Tilt [CodePlex #7297](https://phpexcel.codeplex.com/workitem/7297) -- Excel5 reader: Column width - @Erik Tilt [CodePlex #7299](https://phpexcel.codeplex.com/workitem/7299) -- Excel5 reader: Row height - @Erik Tilt [CodePlex #7301](https://phpexcel.codeplex.com/workitem/7301) -- Excel5 reader: Font support - @Erik Tilt [CodePlex #7304](https://phpexcel.codeplex.com/workitem/7304) -- Excel5 reader: support for locked cells - @Erik Tilt [CodePlex #7324](https://phpexcel.codeplex.com/workitem/7324) -- Excel5 reader style support: Fill (background colors and patterns) - @Erik Tilt [CodePlex #7330](https://phpexcel.codeplex.com/workitem/7330) -- Excel5 reader style support: Borders (style and color) - @Erik Tilt [CodePlex #7332](https://phpexcel.codeplex.com/workitem/7332) -- Excel5 reader: Rich-Text support - @Erik Tilt [CodePlex #7346](https://phpexcel.codeplex.com/workitem/7346) -- Read Excel built-in number formats with Excel 2007 reader - @MarkBaker [CodePlex #7313](https://phpexcel.codeplex.com/workitem/7313) -- Excel5 reader: Number format support - @Erik Tilt [CodePlex #7317](https://phpexcel.codeplex.com/workitem/7317) -- Creating a copy of PHPExcel object - @MarkBaker [CodePlex #7362](https://phpexcel.codeplex.com/workitem/7362) -- Excel5 reader: support for row / column outline (group) - @Erik Tilt [CodePlex #7373](https://phpexcel.codeplex.com/workitem/7373) -- Implement default row/column sizes - @MarkBaker [CodePlex #7380](https://phpexcel.codeplex.com/workitem/7380) -- Writer HTML - option to return styles and table separately - @MarkBaker [CodePlex #7364](https://phpexcel.codeplex.com/workitem/7364) - -### Bugfixes - -- Excel5 reader: Support for remaining built-in number formats - @Erik Tilt [CodePlex #7393](https://phpexcel.codeplex.com/workitem/7393) -- Fixed rounding in HOUR MINUTE and SECOND Time functions, and improved performance for these - @MarkBaker -- Fix to TRIM function - @MarkBaker -- Fixed range validation in TIME Functions.php - @MarkBaker -- EDATE and EOMONTH functions now return date values based on the returnDateType flag - @MarkBaker -- Write date values that are the result of a calculation function correctly as Excel serialized dates rather than PHP serialized date values - @MarkBaker -- Excel2007 reader not always reading boolean correctly - @MarkBaker [CodePlex #6690](https://phpexcel.codeplex.com/workitem/6690) -- Columns above IZ - @MarkBaker [CodePlex #6275](https://phpexcel.codeplex.com/workitem/6275) -- Other locale than English causes Excel2007 writer to produce broken xlsx - @MarkBaker [CodePlex #6853](https://phpexcel.codeplex.com/workitem/6853) -- Typo: Number_fromat in NumberFormat.php - @MarkBaker [CodePlex #7061](https://phpexcel.codeplex.com/workitem/7061) -- Bug in Worksheet_BaseDrawing setWidth() - @MarkBaker [CodePlex #6865](https://phpexcel.codeplex.com/workitem/6865) -- PDF writer collapses column width for merged cells - @MarkBaker [CodePlex #6891](https://phpexcel.codeplex.com/workitem/6891) -- Issues with drawings filenames - @MarkBaker [CodePlex #6867](https://phpexcel.codeplex.com/workitem/6867) -- fromArray() local variable isn't defined - @MarkBaker [CodePlex #7073](https://phpexcel.codeplex.com/workitem/7073) -- PHPExcel_Writer_Excel5->setTempDir() not passed to all classes involved in writing to a file - @MarkBaker [CodePlex #7276](https://phpexcel.codeplex.com/workitem/7276) -- Excel5 reader not handling UTF-8 properly - @MarkBaker [CodePlex #7277](https://phpexcel.codeplex.com/workitem/7277) -- If you write a 0 value in cell, cell shows as empty - @MarkBaker [CodePlex #7327](https://phpexcel.codeplex.com/workitem/7327) -- Excel2007 writer: Row height ignored for empty rows - @MarkBaker [CodePlex #7302](https://phpexcel.codeplex.com/workitem/7302) -- Excel2007 (comments related error) - @MarkBaker [CodePlex #7281](https://phpexcel.codeplex.com/workitem/7281) -- Column width in other locale - @MarkBaker [CodePlex #7345](https://phpexcel.codeplex.com/workitem/7345) -- Excel2007 reader not reading underlined Rich-Text - @MarkBaker [CodePlex #7347](https://phpexcel.codeplex.com/workitem/7347) -- Excel5 reader converting booleans to strings - @Erik Tilt [CodePlex #7357](https://phpexcel.codeplex.com/workitem/7357) -- Recursive Object Memory Leak - @MarkBaker [CodePlex #7365](https://phpexcel.codeplex.com/workitem/7365) -- Excel2007 writer ignoring row dimensions without cells - @MarkBaker [CodePlex #7372](https://phpexcel.codeplex.com/workitem/7372) -- Excel5 reader is converting formatted numbers / dates to strings - @Erik Tilt [CodePlex #7382](https://phpexcel.codeplex.com/workitem/7382) - -## [1.6.2] - 2008-06-23 - -### General - -- Document style array values - @MarkBaker [CodePlex #6088](https://phpexcel.codeplex.com/workitem/6088) -- Applied patch 1195 - @MarkBaker -- Redirecting output to a client’s web browser - http headers - @MarkBaker [CodePlex #6178](https://phpexcel.codeplex.com/workitem/6178) -- Improve worksheet garbage collection - @MarkBaker [CodePlex #6187](https://phpexcel.codeplex.com/workitem/6187) -- Functions that return date values can now be configured to return as Excel serialized date/time, PHP serialized date/time, or a PHP date/time object. - @MarkBaker -- Functions that explicitly accept dates as parameters now permit values as Excel serialized date/time, PHP serialized date/time, a valid date string, or a PHP date/time object. - @MarkBaker -- Implement ACOSH, ASINH and ATANH functions for those operating platforms/PHP versions that don't include these functions - @MarkBaker -- Implement ATAN2 logic reversing the arguments as per Excel - @MarkBaker -- Additional validation of parameters for COMBIN - @MarkBaker - -### Features - -- Fixed validation for CEILING and FLOOR when the value and significance parameters have different signs; and allowed default value of 1 or -1 for significance when in GNUMERIC compatibility mode - @MarkBaker -- Implement ADDRESS, ISLOGICAL, ISTEXT and ISNONTEXT functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Implement COMPLEX, IMAGINARY, IMREAL, IMARGUMENT, IMCONJUGATE, IMABS, IMSUB, IMDIV, IMSUM, IMPRODUCT, IMSQRT, IMEXP, IMLN, IMLOG10, IMLOG2, IMPOWER IMCOS and IMSIN Engineering functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Implement NETWORKDAYS and WORKDAY Date/Time functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) -- Make cell column AAA available - @MarkBaker [CodePlex #6100](https://phpexcel.codeplex.com/workitem/6100) -- Mark particular cell as selected when opening Excel - @MarkBaker [CodePlex #6095](https://phpexcel.codeplex.com/workitem/6095) -- Multiple sheets in PDF and HTML - @MarkBaker [CodePlex #6120](https://phpexcel.codeplex.com/workitem/6120) -- Implement PHPExcel_ReaderFactory and PHPExcel_WriterFactory - @MarkBaker [CodePlex #6227](https://phpexcel.codeplex.com/workitem/6227) -- Set image root of PHPExcel_Writer_HTML - @MarkBaker [CodePlex #6249](https://phpexcel.codeplex.com/workitem/6249) -- Enable/disable calculation cache - @MarkBaker [CodePlex #6264](https://phpexcel.codeplex.com/workitem/6264) -- PDF writer and multi-line text - @MarkBaker [CodePlex #6259](https://phpexcel.codeplex.com/workitem/6259) -- Feature request - setCacheExpirationTime() - @MarkBaker [CodePlex #6350](https://phpexcel.codeplex.com/workitem/6350) -- Implement late-binding mechanisms to reduce memory footprint - @JB [CodePlex #6370](https://phpexcel.codeplex.com/workitem/6370) -- Implement shared styles - @JB [CodePlex #6430](https://phpexcel.codeplex.com/workitem/6430) -- Copy sheet from external Workbook to active Workbook - @MarkBaker [CodePlex #6391](https://phpexcel.codeplex.com/workitem/6391) - -### Bugfixes - -- Functions in Conditional Formatting - @MarkBaker [CodePlex #6428](https://phpexcel.codeplex.com/workitem/6428) -- Default Style in Excel5 - @MarkBaker [CodePlex #6096](https://phpexcel.codeplex.com/workitem/6096) -- Numbers starting with '+' cause Excel 2007 errors - @MarkBaker [CodePlex #6150](https://phpexcel.codeplex.com/workitem/6150) -- ExcelWriter5 is not PHP5 compatible, using it with E_STRICT results in a bunch of errors (applied patches) - @MarkBaker [CodePlex #6092](https://phpexcel.codeplex.com/workitem/6092) -- Error Reader Excel2007 line 653 foreach ($relsDrawing->Relationship as $ele) - @MarkBaker [CodePlex #6179](https://phpexcel.codeplex.com/workitem/6179) -- Worksheet toArray() screws up DATE - @MarkBaker [CodePlex #6229](https://phpexcel.codeplex.com/workitem/6229) -- References to a Richtext cell in a formula - @MarkBaker [CodePlex #6253](https://phpexcel.codeplex.com/workitem/6253) -- insertNewColumnBefore Bug - @MarkBaker [CodePlex #6285](https://phpexcel.codeplex.com/workitem/6285) -- Error reading Excel2007 file with shapes - @MarkBaker [CodePlex #6319](https://phpexcel.codeplex.com/workitem/6319) -- Determine whether date values need conversion from PHP dates to Excel dates before writing to file, based on the data type (float or integer) - @MarkBaker [CodePlex #6302](https://phpexcel.codeplex.com/workitem/6302) -- Fixes to DATE function when it is given negative input parameters - @MarkBaker -- PHPExcel handles empty cells other than Excel - @MarkBaker [CodePlex #6347](https://phpexcel.codeplex.com/workitem/6347) -- PHPExcel handles 0 and "" as being the same - @MarkBaker [CodePlex #6348](https://phpexcel.codeplex.com/workitem/6348) -- Problem Using Excel2007 Reader for Spreadsheets containing images - @MarkBaker [CodePlex #6357](https://phpexcel.codeplex.com/workitem/6357) -- ShowGridLines ignored when reading/writing Excel 2007 - @MarkBaker [CodePlex #6359](https://phpexcel.codeplex.com/workitem/6359) -- Bug With Word Wrap in Excel 2007 Reader - @MarkBaker [CodePlex #6426](https://phpexcel.codeplex.com/workitem/6426) - -## [1.6.1] - 2008-04-28 - -### General - -- Fix documentation printing - @MarkBaker [CodePlex #5532](https://phpexcel.codeplex.com/workitem/5532) -- Memory usage improvements - @MarkBaker [CodePlex #5586](https://phpexcel.codeplex.com/workitem/5586) -- Applied patch 990 - @MarkBaker - -### Features - -- Applied patch 991 - @MarkBaker -- Implement PHPExcel_Reader_Excel5 - @BM [CodePlex #2841](https://phpexcel.codeplex.com/workitem/2841) -- Implement "toArray" and "fromArray" method - @MarkBaker [CodePlex #5564](https://phpexcel.codeplex.com/workitem/5564) -- Read shared formula - @MarkBaker [CodePlex #5665](https://phpexcel.codeplex.com/workitem/5665) -- Read image twoCellAnchor - @MarkBaker [CodePlex #5681](https://phpexcel.codeplex.com/workitem/5681) -- &G Image as bg for headerfooter - @MarkBaker [CodePlex #4446](https://phpexcel.codeplex.com/workitem/4446) -- Implement page layout functionality for Excel5 format - @MarkBaker [CodePlex #5834](https://phpexcel.codeplex.com/workitem/5834) - -### Bugfixes - -- Feature request: PHPExcel_Writer_PDF - @MarkBaker [CodePlex #6039](https://phpexcel.codeplex.com/workitem/6039) -- DefinedNames null check - @MarkBaker [CodePlex #5517](https://phpexcel.codeplex.com/workitem/5517) -- Hyperlinks should not always have trailing slash - @MarkBaker [CodePlex #5463](https://phpexcel.codeplex.com/workitem/5463) -- Saving Error - Uncaught exception (#REF! named range) - @MarkBaker [CodePlex #5592](https://phpexcel.codeplex.com/workitem/5592) -- Error when creating Zip file on Linux System (Not Windows) - @MarkBaker [CodePlex #5634](https://phpexcel.codeplex.com/workitem/5634) -- Time incorrecly formated - @MarkBaker [CodePlex #5876](https://phpexcel.codeplex.com/workitem/5876) -- Conditional formatting - second rule not applied - @MarkBaker [CodePlex #5914](https://phpexcel.codeplex.com/workitem/5914) -- PHPExcel_Reader_Excel2007 cannot load PHPExcel_Shared_File - @MarkBaker [CodePlex #5978](https://phpexcel.codeplex.com/workitem/5978) -- Output redirection to web browser - @MarkBaker [CodePlex #6020](https://phpexcel.codeplex.com/workitem/6020) - -## [1.6.0] - 2008-02-14 - -### Features - -- Use PHPExcel datatypes in formula calculation - @MarkBaker [CodePlex #3156](https://phpexcel.codeplex.com/workitem/3156) -- Center on page when printing - @MarkBaker [CodePlex #5019](https://phpexcel.codeplex.com/workitem/5019) -- Hyperlink to other spreadsheet - @MarkBaker [CodePlex #5099](https://phpexcel.codeplex.com/workitem/5099) -- Set the print area of a worksheet - @MarkBaker [CodePlex #5104](https://phpexcel.codeplex.com/workitem/5104) -- Read "definedNames" property of worksheet - @MarkBaker [CodePlex #5118](https://phpexcel.codeplex.com/workitem/5118) -- Set default style for all cells - @MarkBaker [CodePlex #5338](https://phpexcel.codeplex.com/workitem/5338) -- Named Ranges - @MarkBaker [CodePlex #4216](https://phpexcel.codeplex.com/workitem/4216) - -### Bugfixes - -- Implement worksheet references (Sheet1!A1) - @MarkBaker [CodePlex #5398](https://phpexcel.codeplex.com/workitem/5398) -- Redirect output to a client's web browser - @MarkBaker [CodePlex #4967](https://phpexcel.codeplex.com/workitem/4967) -- "File Error: data may have been lost." seen in Excel 2007 and Excel 2003 SP3 when opening XLS file - @MarkBaker [CodePlex #5008](https://phpexcel.codeplex.com/workitem/5008) -- Bug in style's getHashCode() - @MarkBaker [CodePlex #5165](https://phpexcel.codeplex.com/workitem/5165) -- PHPExcel_Reader not correctly reading numeric values - @MarkBaker [CodePlex #5165](https://phpexcel.codeplex.com/workitem/5165) -- Text rotation is read incorrectly - @MarkBaker [CodePlex #5324](https://phpexcel.codeplex.com/workitem/5324) -- Enclosure " and data " result a bad data : \" instead of "" - @MarkBaker [CodePlex #5326](https://phpexcel.codeplex.com/workitem/5326) -- Formula parser - IF statement returning array instead of scalar - @MarkBaker [CodePlex #5332](https://phpexcel.codeplex.com/workitem/5332) -- setFitToWidth(nbpage) & setFitToWidth(nbpage) work partially - @MarkBaker [CodePlex #5351](https://phpexcel.codeplex.com/workitem/5351) -- Worksheet::setTitle() causes unwanted renaming - @MarkBaker [CodePlex #5361](https://phpexcel.codeplex.com/workitem/5361) -- Hyperlinks not working. Results in broken xlsx file. - @MarkBaker [CodePlex #5407](https://phpexcel.codeplex.com/workitem/5407) - -## [1.5.5] - 2007-12-24 - -### General - -- Grouping Rows - @MarkBaker [CodePlex #4135](https://phpexcel.codeplex.com/workitem/4135) - -### Features - -- Semi-nightly builds - @MarkBaker [CodePlex #4427](https://phpexcel.codeplex.com/workitem/4427) -- Implement "date" datatype - @MarkBaker [CodePlex #3155](https://phpexcel.codeplex.com/workitem/3155) -- Date format not honored in CSV writer - @MarkBaker [CodePlex #4150](https://phpexcel.codeplex.com/workitem/4150) -- RichText and sharedStrings - @MarkBaker [CodePlex #4199](https://phpexcel.codeplex.com/workitem/4199) -- Implement more Excel calculation functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) - - Addition of DATE, DATEDIF, DATEVALUE, DAY, DAYS360- Implement more Excel calculation functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) - - Addition of AVEDEV, HARMEAN and GEOMEAN - - Addition of the BINOMDIST (Non-cumulative only), COUNTBLANK, EXPONDIST, FISHER, FISHERINV, NORMDIST, NORMSDIST, PERMUT, POISSON (Non-cumulative only) and STANDARDIZE Statistical Functions - - Addition of the CEILING, COMBIN, EVEN, FACT, FACTDOUBLE, FLOOR, MULTINOMIAL, ODD, ROUNDDOWN, ROUNDUP, SIGN, SQRTPI and SUMSQ Mathematical Functions - - Addition of the NORMINV, NORMSINV, CONFIDENCE and SKEW Statistical Functions - - Addition of the CRITBINOM, HYPGEOMDIST, KURT, LOGINV, LOGNORMDIST, NEGBINOMDIST and WEIBULL Statistical Functions - - Addition of the LARGE, PERCENTILE, QUARTILE, SMALL and TRIMMEAN Statistical Functions - - Addition of the BIN2HEX, BIN2OCT, DELTA, ERF, ERFC, GESTEP, HEX2BIN, HEX2DEC, HEX2OCT, OCT2BIN and OCT2HEX Engineering Functions - - Addition of the CHIDIST, GAMMADIST and GAMMALN Statistical Functions - - Addition of the GCD, LCM, MROUND and SUBTOTAL Mathematical Functions - - Addition of the LOWER, PROPER and UPPER Text Functions - - Addition of the BETADIST and BETAINV Statistical Functions - - Addition of the CHIINV and GAMMAINV Statistical Functions - - Addition of the SERIESSUM Mathematical Function - - Addition of the CHAR, CODE, FIND, LEN, REPT, SEARCH, T, TRIM Text Functions - - Addition of the FALSE and TRUE Boolean Functions - - Addition of the TDIST and TINV Statistical Functions - - Addition of the EDATE, EOMONTH, YEAR, MONTH, TIME, TIMEVALUE, HOUR, MINUTE, SECOND, WEEKDAY, WEEKNUM, NOW, TODAY and Date/Time Function - - Addition of the BESSELI, BESSELJ, BESSELK and BESSELY Engineering Functions - - Addition of the SLN and SYD Financial Functions - - reworked MODE calculation to handle floating point numbers - - Improved error trapping for invalid input values - - Fix to SMALL, LARGE, PERCENTILE and TRIMMEAN to eliminate non-numeric values - - Added CDF to BINOMDIST and POISSON - - Fix to a potential endless loop in CRITBINOM, together with other bugfixes to the algorithm - - Fix to SQRTPI so that it will work with a real value parameter rather than just integers - - Trap for passing negative values to FACT - - Improved accuracy of the NORMDIST cumulative function, and of the ERF and ERFC functions - - Replicated Excel data-type and error handling for BIN, DEC, OCT and HEX conversion functions - - Replicated Excel data-type and error handling for AND and OR Boolean functions - - Bugfix to MROUND - - Rework of the DATE, DATEVALUE, DAY, DAYS360 and DATEDIF date/Time functions to use Excel dates rather than straight PHP dates - - Rework of the AND, OR Boolean functions to ignore string values - - Rework of the BIN2DEC, BIN2HEX, BIN2OCT, DEC2BIN, DEC2HEX, DEC2OCT Engineering functions to handle two's complement - - Excel, Gnumeric and OpenOffice Calc compatibility flag for functions - - Note, not all functions have yet been written to work with the Gnumeric and OpenOffice Calc compatibility flags - - 1900 or 1904 Calendar flag for date functions - - Reworked ExcelToPHP date method to handle the Excel 1900 leap year - - Note that this will not correctly return values prior to 13-Dec-1901 20:45:52 as this is the minimum value that PHP date serial values can handle. If you need to work with dates prior to this, then an ExcelToPHPObject method has been added which will work correctly with values between Excel's 1900 calendar base date of 1-Jan-1900, and 13-Dec-1901 - - Addition of ExcelToPHPObject date method to return a PHP DateTime object from an Excel date serial value - - PHPToExcel method modified to accept either PHP date serial numbers or PHP DateTime objects - - Addition of FormattedPHPToExcel which will accept a date and time broken to into year, month, day, hour, minute, second and return an Excel date serial value- Control characters in Excel 2007 - @MarkBaker [CodePlex #4485](https://phpexcel.codeplex.com/workitem/4485) -- BaseDrawing::setWidthAndHeight method request - @MarkBaker [CodePlex #4796](https://phpexcel.codeplex.com/workitem/4796) -- Page Setup -> Print Titles -> Sheet -> 'Rows to repeat at top' - @MarkBaker [CodePlex #4798](https://phpexcel.codeplex.com/workitem/4798) - -### Bugfixes - -- Comment functionality - @MarkBaker [CodePlex #4433](https://phpexcel.codeplex.com/workitem/4433) -- Undefined variable in PHPExcel_Writer_Serialized - @MarkBaker [CodePlex #4124](https://phpexcel.codeplex.com/workitem/4124) -- Notice: Object of class PHPExcel_RichText could not be converted to int - @MarkBaker [CodePlex #4125](https://phpexcel.codeplex.com/workitem/4125) -- Excel5Writer: utf8 string not converted to utf16 - @MarkBaker [CodePlex #4126](https://phpexcel.codeplex.com/workitem/4126) -- PHPExcel_RichText and autosize - @MarkBaker [CodePlex #4180](https://phpexcel.codeplex.com/workitem/4180) -- Excel5Writer produces broken xls files after change mentioned in work item 4126 - @MarkBaker [CodePlex #4574](https://phpexcel.codeplex.com/workitem/4574) -- Small bug in PHPExcel_Reader_Excel2007 function _readStyle - @MarkBaker [CodePlex #4797](https://phpexcel.codeplex.com/workitem/4797) - -## [1.5.0] - 2007-10-23 - -### Features - -- Refactor PHPExcel Drawing - @MarkBaker [CodePlex #3265](https://phpexcel.codeplex.com/workitem/3265) -- Update Shared/OLE.php to latest version from PEAR - @CS [CodePlex #3079](https://phpexcel.codeplex.com/workitem/3079) -- Excel2007 vs Excel2003 compatibility pack - @MarkBaker [CodePlex #3217](https://phpexcel.codeplex.com/workitem/3217) -- Cell protection (lock/unlock) - @MarkBaker [CodePlex #3234](https://phpexcel.codeplex.com/workitem/3234) -- Create clickable links (hyperlinks) - @MarkBaker [CodePlex #3543](https://phpexcel.codeplex.com/workitem/3543) -- Additional page setup parameters - @MarkBaker [CodePlex #3241](https://phpexcel.codeplex.com/workitem/3241) -- Make temporary file path configurable (Excel5) - @MarkBaker [CodePlex #3300](https://phpexcel.codeplex.com/workitem/3300) -- Small addition to applyFromArray for font - @MarkBaker [CodePlex #3306](https://phpexcel.codeplex.com/workitem/3306) - -### Bugfixes - -- Better feedback when save of file is not possible - @MarkBaker [CodePlex #3373](https://phpexcel.codeplex.com/workitem/3373) -- Text Rotation - @MarkBaker [CodePlex #3181](https://phpexcel.codeplex.com/workitem/3181) -- Small bug in Page Orientation - @MarkBaker [CodePlex #3237](https://phpexcel.codeplex.com/workitem/3237) -- insertNewColumnBeforeByColumn undefined - @MarkBaker [CodePlex #3812](https://phpexcel.codeplex.com/workitem/3812) -- Sheet references not working in formula (Excel5 Writer) - @MarkBaker [CodePlex #3893](https://phpexcel.codeplex.com/workitem/3893) - -## [1.4.5] - 2007-08-23 - -### General - -- Class file endings - @MarkBaker [CodePlex #3003](https://phpexcel.codeplex.com/workitem/3003) -- Different calculation engine improvements - @MarkBaker [CodePlex #3081](https://phpexcel.codeplex.com/workitem/3081) -- Different improvements in PHPExcel_Reader_Excel2007 - @MarkBaker [CodePlex #3082](https://phpexcel.codeplex.com/workitem/3082) - -### Features - -- Set XML indentation in PHPExcel_Writer_Excel2007 - @MarkBaker [CodePlex #3146](https://phpexcel.codeplex.com/workitem/3146) -- Optionally store temporary Excel2007 writer data in file instead of memory - @MarkBaker [CodePlex #3159](https://phpexcel.codeplex.com/workitem/3159) -- Implement show/hide gridlines - @MarkBaker [CodePlex #3063](https://phpexcel.codeplex.com/workitem/3063) -- Implement option to read only data - @MarkBaker [CodePlex #3064](https://phpexcel.codeplex.com/workitem/3064) -- Optionally disable formula precalculation - @MarkBaker [CodePlex #3080](https://phpexcel.codeplex.com/workitem/3080) -- Explicitly set cell datatype - @MarkBaker [CodePlex #3154](https://phpexcel.codeplex.com/workitem/3154) - -### Bugfixes - -- Implement more Excel calculation functions - @MarkBaker [CodePlex #2346](https://phpexcel.codeplex.com/workitem/2346) - - Addition of MINA, MAXA, COUNTA, AVERAGEA, MEDIAN, MODE, DEVSQ, STDEV, STDEVA, STDEVP, STDEVPA, VAR, VARA, VARP and VARPA Excel Functions - - Fix to SUM, PRODUCT, QUOTIENT, MIN, MAX, COUNT and AVERAGE functions when cell contains a numeric value in a string datatype, bringing it in line with MS Excel behaviour- File_exists on ZIP fails on some installations - @MarkBaker [CodePlex #2881](https://phpexcel.codeplex.com/workitem/2881) -- Argument in textRotation should be -90..90 - @MarkBaker [CodePlex #2879](https://phpexcel.codeplex.com/workitem/2879) -- Excel2007 reader/writer not implementing OpenXML/SpreadsheetML styles 100% correct - @MarkBaker [CodePlex #2883](https://phpexcel.codeplex.com/workitem/2883) -- Active sheet index not read/saved - @MarkBaker [CodePlex #2513](https://phpexcel.codeplex.com/workitem/2513) -- Print and print preview of generated XLSX causes Excel2007 to crash - @MarkBaker [CodePlex #2935](https://phpexcel.codeplex.com/workitem/2935) -- Error in Calculations - COUNT() function - @MarkBaker [CodePlex #2952](https://phpexcel.codeplex.com/workitem/2952) -- HTML and CSV writer not writing last row - @MarkBaker [CodePlex #3002](https://phpexcel.codeplex.com/workitem/3002) -- Memory leak in Excel5 writer - @MarkBaker [CodePlex #3017](https://phpexcel.codeplex.com/workitem/3017) -- Printing (PHPExcel_Writer_Excel5) - @MarkBaker [CodePlex #3044](https://phpexcel.codeplex.com/workitem/3044) -- Problems reading zip:// - @MarkBaker [CodePlex #3046](https://phpexcel.codeplex.com/workitem/3046) -- Error reading conditional formatting - @MarkBaker [CodePlex #3047](https://phpexcel.codeplex.com/workitem/3047) -- Bug in Excel5 writer (storePanes) - @MarkBaker [CodePlex #3067](https://phpexcel.codeplex.com/workitem/3067) -- Memory leak in PHPExcel_Style_Color - @MarkBaker [CodePlex #3077](https://phpexcel.codeplex.com/workitem/3077) - -## [1.4.0] - 2007-07-23 - -### General - -- Coding convention / code cleanup - @MarkBaker [CodePlex #2687](https://phpexcel.codeplex.com/workitem/2687) -- Use set_include_path in tests - @MarkBaker [CodePlex #2717](https://phpexcel.codeplex.com/workitem/2717) - -### Features - -- Move PHPExcel_Writer_Excel5 OLE to PHPExcel_Shared_OLE - @MarkBaker [CodePlex #2812](https://phpexcel.codeplex.com/workitem/2812) -- Hide/Unhide Column or Row - @MarkBaker [CodePlex #2679](https://phpexcel.codeplex.com/workitem/2679) -- Implement multi-cell styling - @MarkBaker [CodePlex #2271](https://phpexcel.codeplex.com/workitem/2271) -- Implement CSV file format (reader/writer) - @MarkBaker [CodePlex #2720](https://phpexcel.codeplex.com/workitem/2720) - -### Bugfixes - -- Implement HTML file format - @MarkBaker [CodePlex #2845](https://phpexcel.codeplex.com/workitem/2845) -- Active sheet index not read/saved - @MarkBaker [CodePlex #2513](https://phpexcel.codeplex.com/workitem/2513) -- Freeze Panes with PHPExcel_Writer_Excel5 - @MarkBaker [CodePlex #2678](https://phpexcel.codeplex.com/workitem/2678) -- OLE.php - @MarkBaker [CodePlex #2680](https://phpexcel.codeplex.com/workitem/2680) -- Copy and pasting multiple drop-down list cells breaks reader - @MarkBaker [CodePlex #2736](https://phpexcel.codeplex.com/workitem/2736) -- Function setAutoFilterByColumnAndRow takes wrong arguments - @MarkBaker [CodePlex #2775](https://phpexcel.codeplex.com/workitem/2775) -- Simplexml_load_file fails on ZipArchive - @MarkBaker [CodePlex #2858](https://phpexcel.codeplex.com/workitem/2858) - -## [1.3.5] - 2007-06-27 - -### Features - -- Documentation - @MarkBaker [CodePlex #15](https://phpexcel.codeplex.com/workitem/15) -- PHPExcel_Writer_Excel5 - @JV -- PHPExcel_Reader_Excel2007: Image shadows - @JV -- Data validation - @MarkBaker [CodePlex #2385](https://phpexcel.codeplex.com/workitem/2385) - -### Bugfixes - -- Implement richtext strings - @MarkBaker -- Empty relations when adding image to any sheet but the first one - @MarkBaker [CodePlex #2443](https://phpexcel.codeplex.com/workitem/2443) -- Excel2007 crashes on print preview - @MarkBaker [CodePlex #2536](https://phpexcel.codeplex.com/workitem/2536) - -## [1.3.0] - 2007-06-05 - -### General - -- Create PEAR package - @MarkBaker [CodePlex #1942](https://phpexcel.codeplex.com/workitem/1942) - -### Features - -- Replace *->duplicate() by __clone() - @MarkBaker [CodePlex #2331](https://phpexcel.codeplex.com/workitem/2331) -- PHPExcel_Reader_Excel2007: Column auto-size, Protection, Merged cells, Wrap text, Page breaks, Auto filter, Images - @JV -- Implement "freezing" panes - @MarkBaker [CodePlex #245](https://phpexcel.codeplex.com/workitem/245) -- Cell addressing alternative - @MarkBaker [CodePlex #2273](https://phpexcel.codeplex.com/workitem/2273) -- Implement cell word-wrap attribute - @MarkBaker [CodePlex #2270](https://phpexcel.codeplex.com/workitem/2270) -- Auto-size column - @MarkBaker [CodePlex #2282](https://phpexcel.codeplex.com/workitem/2282) -- Implement formula calculation - @MarkBaker [CodePlex #241](https://phpexcel.codeplex.com/workitem/241) - -### Bugfixes - -- Insert/remove row/column - @MarkBaker [CodePlex #2375](https://phpexcel.codeplex.com/workitem/2375) -- PHPExcel_Worksheet::getCell() should not accept absolute coordinates - @MarkBaker [CodePlex #1931](https://phpexcel.codeplex.com/workitem/1931) -- Cell reference without row number - @MarkBaker [CodePlex #2272](https://phpexcel.codeplex.com/workitem/2272) -- Styles with same coordinate but different worksheet - @MarkBaker [CodePlex #2276](https://phpexcel.codeplex.com/workitem/2276) -- PHPExcel_Worksheet->getCellCollection() usort error - @MarkBaker [CodePlex #2290](https://phpexcel.codeplex.com/workitem/2290) -- Bug in PHPExcel_Cell::stringFromColumnIndex - @SS [CodePlex #2353](https://phpexcel.codeplex.com/workitem/2353) -- Reader: numFmts can be missing, use cellStyleXfs instead of cellXfs in styles - @JV [CodePlex #2353](https://phpexcel.codeplex.com/workitem/2353) - -## [1.2.0] - 2007-04-26 - -### General - -- Stringtable attribute "count" not necessary, provides wrong info to Excel sometimes... - @MarkBaker -- Updated tests to address more document properties - @MarkBaker -- Some refactoring in PHPExcel_Writer_Excel2007_Workbook - @MarkBaker -- New package: PHPExcel_Shared - @MarkBaker -- Password hashing algorithm implemented in PHPExcel_Shared_PasswordHasher - @MarkBaker -- Moved pixel conversion functions to PHPExcel_Shared_Drawing - @MarkBaker -- Switch over to LGPL license - @MarkBaker [CodePlex #244](https://phpexcel.codeplex.com/workitem/244) - -### Features - -- Include PHPExcel version in file headers - @MarkBaker [CodePlex #5](https://phpexcel.codeplex.com/workitem/5) -- Autofilter - @MarkBaker [CodePlex #6](https://phpexcel.codeplex.com/workitem/6) -- Extra document property: keywords - @MarkBaker [CodePlex #7](https://phpexcel.codeplex.com/workitem/7) -- Extra document property: category - @MarkBaker [CodePlex #8](https://phpexcel.codeplex.com/workitem/8) -- Document security - @MarkBaker [CodePlex #9](https://phpexcel.codeplex.com/workitem/9) -- PHPExcel_Writer_Serialized and PHPExcel_Reader_Serialized - @MarkBaker [CodePlex #10](https://phpexcel.codeplex.com/workitem/10) -- Alternative syntax: Addressing a cell - @MarkBaker [CodePlex #11](https://phpexcel.codeplex.com/workitem/11) -- Merge cells - @MarkBaker [CodePlex #12](https://phpexcel.codeplex.com/workitem/12) - -### Bugfixes - -- Protect ranges of cells with a password - @MarkBaker [CodePlex #13](https://phpexcel.codeplex.com/workitem/13) -- (style/fill/patternFill/fgColor or bgColor can be empty) - @JV [CodePlex #14](https://phpexcel.codeplex.com/workitem/14) - -## [1.1.1] - 2007-03-26 - -### General - -- Syntax error in "Classes/PHPExcel/Writer/Excel2007.php" on line 243 - @MarkBaker [CodePlex #1250](https://phpexcel.codeplex.com/workitem/1250) -- Reader should check if file exists and throws an exception when it doesn't - @MarkBaker [CodePlex #1282](https://phpexcel.codeplex.com/workitem/1282) - -## [1.1.0] - 2007-03-22 - -### Bugfixes - -- Style information lost after passing trough Excel2007_Reader - @MarkBaker [CodePlex #836](https://phpexcel.codeplex.com/workitem/836) - -### General - -- Number of columns > AZ fails fixed in PHPExcel_Cell::columnIndexFromString - @MarkBaker [CodePlex #913](https://phpexcel.codeplex.com/workitem/913) - -### Features - -- Added a brief file with installation instructions - @MarkBaker -- Page breaks (horizontal and vertical) - @MarkBaker -- Image shadows - @MarkBaker - -## [1.0.0] - 2007-02-22 - -### Bugfixes - -- PHPExcel->removeSheetByIndex now re-orders sheets after deletion, so no array indexes are lost - @JV -- PHPExcel_Writer_Excel2007_Worksheet::_writeCols() used direct assignment to $pSheet->getColumnDimension('A')->Width instead of $pSheet->getColumnDimension('A')->setWidth() - @JV -- DocumentProperties used $this->LastModifiedBy instead of $this->_lastModifiedBy. - @JV - -### General - -- Only first = should be removed when writing formula in PHPExcel_Writer_Excel2007_Worksheet. - @JV -- Consistency of method names to camelCase - @JV -- Updated tests to match consistency changes - @JV -- Detection of mime-types now with image_type_to_mime_type() - @JV -- Constants now hold string value used in Excel 2007 - @JV - -### Features - -- Fixed folder name case (WorkSheet -> Worksheet) - @MarkBaker -- PHPExcel classes (not the Writer classes) can be duplicated, using a duplicate() method. - @MarkBaker -- Cell styles can now be duplicated to a range of cells using PHPExcel_Worksheet->duplicateStyle() - @MarkBaker -- Conditional formatting - @MarkBaker -- Reader for Excel 2007 (not supporting full specification yet!) - @JV - -## [1.0.0 RC] - 2007-01-31 - -- Project name has been changed to PHPExcel -- Project homepage is now http://www.codeplex.com/PHPExcel -- Started versioning at number: PHPExcel 1.0.0 RC - -## 2007-01-22 - -- Fixed some performance issues on large-scale worksheets (mainly loops vs. indexed arrays) -- Performance on creating StringTable has been increased -- Performance on writing Excel2007 worksheet has been increased - -## 2007-01-18 - -- Images can now be rotated -- Fixed bug: When drawings have full path specified, no mime type can be deducted -- Fixed bug: Only one drawing can be added to a worksheet - -## 2007-01-12 - -- Refactoring of some classes to use ArrayObject instead of array() -- Cell style now has support for number format (i.e. #,##0) -- Implemented embedding images - -## 2007-01-02 - -- Cell style now has support for fills, including gradient fills -- Cell style now has support for fonts -- Cell style now has support for border colors -- Cell style now has support for font colors -- Cell style now has support for alignment - -## 2006-12-21 - -- Support for cell style borders -- Support for cell styles -- Refactoring of Excel2007 Writer into multiple classes in package SpreadSheet_Writer_Excel2007 -- Refactoring of all classes, changed public members to public properties using getter/setter -- Worksheet names are now unique. On duplicate worksheet names, a number is appended. -- Worksheet now has parent SpreadSheet object -- Worksheet now has support for page header and footer -- Worksheet now has support for page margins -- Worksheet now has support for page setup (only Paper size and Orientation) -- Worksheet properties now accessible by using getProperties() -- Worksheet now has support for row and column dimensions (height / width) -- Exceptions thrown have a more clear description - -## Initial version - -- Create a Spreadsheet object -- Add one or more Worksheet objects -- Add cells to Worksheet objects -- Export Spreadsheet object to Excel 2007 OpenXML format -- Each cell supports the following data formats: string, number, formula, boolean. diff --git a/vendor/phpoffice/phpspreadsheet/CHANGELOG.md b/vendor/phpoffice/phpspreadsheet/CHANGELOG.md deleted file mode 100644 index 1f8f49bd..00000000 --- a/vendor/phpoffice/phpspreadsheet/CHANGELOG.md +++ /dev/null @@ -1,261 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](http://keepachangelog.com/) -and this project adheres to [Semantic Versioning](http://semver.org/). - -## [1.5.0] - 2018-10-21 - -### Added - -- PHP 7.3 support -- Add the DAYS() function - [#594](https://github.com/PHPOffice/PhpSpreadsheet/pull/594) - -### Fixed - -- Sheet title can contain exclamation mark - [#325](https://github.com/PHPOffice/PhpSpreadsheet/issues/325) -- Xls file cause the exception during open by Xls reader - [#402](https://github.com/PHPOffice/PhpSpreadsheet/issues/402) -- Skip non numeric value in SUMIF - [#618](https://github.com/PHPOffice/PhpSpreadsheet/pull/618) -- OFFSET should allow omitted height and width - [#561](https://github.com/PHPOffice/PhpSpreadsheet/issues/561) -- Correctly determine delimiter when CSV contains line breaks inside enclosures - [#716](https://github.com/PHPOffice/PhpSpreadsheet/issues/716) - -## [1.4.1] - 2018-09-30 - -### Fixed - -- Remove locale from formatting string - [#644](https://github.com/PHPOffice/PhpSpreadsheet/pull/644) -- Allow iterators to go out of bounds with prev - [#587](https://github.com/PHPOffice/PhpSpreadsheet/issues/587) -- Fix warning when reading xlsx without styles - [#631](https://github.com/PHPOffice/PhpSpreadsheet/pull/631) -- Fix broken sample links on windows due to $baseDir having backslash - [#653](https://github.com/PHPOffice/PhpSpreadsheet/pull/653) - -## [1.4.0] - 2018-08-06 - -### Added - -- Add excel function EXACT(value1, value2) support - [#595](https://github.com/PHPOffice/PhpSpreadsheet/pull/595) -- Support workbook view attributes for Xlsx format - [#523](https://github.com/PHPOffice/PhpSpreadsheet/issues/523) -- Read and write hyperlink for drawing image - [#490](https://github.com/PHPOffice/PhpSpreadsheet/pull/490) -- Added calculation engine support for the new bitwise functions that were added in MS Excel 2013 - - BITAND() Returns a Bitwise 'And' of two numbers - - BITOR() Returns a Bitwise 'Or' of two number - - BITXOR() Returns a Bitwise 'Exclusive Or' of two numbers - - BITLSHIFT() Returns a number shifted left by a specified number of bits - - BITRSHIFT() Returns a number shifted right by a specified number of bits -- Added calculation engine support for other new functions that were added in MS Excel 2013 and MS Excel 2016 - - Text Functions - - CONCAT() Synonym for CONCATENATE() - - NUMBERVALUE() Converts text to a number, in a locale-independent way - - UNICHAR() Synonym for CHAR() in PHPSpreadsheet, which has always used UTF-8 internally - - UNIORD() Synonym for ORD() in PHPSpreadsheet, which has always used UTF-8 internally - - TEXTJOIN() Joins together two or more text strings, separated by a delimiter - - Logical Functions - - XOR() Returns a logical Exclusive Or of all arguments - - Date/Time Functions - - ISOWEEKNUM() Returns the ISO 8601 week number of the year for a given date - - Lookup and Reference Functions - - FORMULATEXT() Returns a formula as a string - - Financial Functions - - PDURATION() Calculates the number of periods required for an investment to reach a specified value - - RRI() Calculates the interest rate required for an investment to grow to a specified future value - - Engineering Functions - - ERF.PRECISE() Returns the error function integrated between 0 and a supplied limit - - ERFC.PRECISE() Synonym for ERFC - - Math and Trig Functions - - SEC() Returns the secant of an angle - - SECH() Returns the hyperbolic secant of an angle - - CSC() Returns the cosecant of an angle - - CSCH() Returns the hyperbolic cosecant of an angle - - COT() Returns the cotangent of an angle - - COTH() Returns the hyperbolic cotangent of an angle - - ACOT() Returns the cotangent of an angle - - ACOTH() Returns the hyperbolic cotangent of an angle -- Refactored Complex Engineering Functions to use external complex number library -- Added calculation engine support for the new complex number functions that were added in MS Excel 2013 - - IMCOSH() Returns the hyperbolic cosine of a complex number - - IMCOT() Returns the cotangent of a complex number - - IMCSC() Returns the cosecant of a complex number - - IMCSCH() Returns the hyperbolic cosecant of a complex number - - IMSEC() Returns the secant of a complex number - - IMSECH() Returns the hyperbolic secant of a complex number - - IMSINH() Returns the hyperbolic sine of a complex number - - IMTAN() Returns the tangent of a complex number - -### Fixed - -- Fix ISFORMULA() function to work with a cell reference to another worksheet -- Xlsx reader crashed when reading a file with workbook protection - [#553](https://github.com/PHPOffice/PhpSpreadsheet/pull/553) -- Cell formats with escaped spaces were causing incorrect date formatting - [#557](https://github.com/PHPOffice/PhpSpreadsheet/issues/557) -- Could not open CSV file containing HTML fragment - [#564](https://github.com/PHPOffice/PhpSpreadsheet/issues/564) -- Exclude the vendor folder in migration - [#481](https://github.com/PHPOffice/PhpSpreadsheet/issues/481) -- Chained operations on cell ranges involving borders operated on last cell only [#428](https://github.com/PHPOffice/PhpSpreadsheet/issues/428) -- Avoid memory exhaustion when cloning worksheet with a drawing [#437](https://github.com/PHPOffice/PhpSpreadsheet/issues/437) -- Migration tool keep variables containing $PHPExcel untouched [#598](https://github.com/PHPOffice/PhpSpreadsheet/issues/598) -- Rowspans/colspans were incorrect when adding worksheet using loadIntoExisting [#619](https://github.com/PHPOffice/PhpSpreadsheet/issues/619) - -## [1.3.1] - 2018-06-12 - -### Fixed - -- Ranges across Z and AA columns incorrectly threw an exception - [#545](https://github.com/PHPOffice/PhpSpreadsheet/issues/545) - -## [1.3.0] - 2018-06-10 - -### Added - -- Support to read Xlsm templates with form elements, macros, printer settings, protected elements and back compatibility drawing, and save result without losing important elements of document - [#435](https://github.com/PHPOffice/PhpSpreadsheet/issues/435) -- Expose sheet title maximum length as `Worksheet::SHEET_TITLE_MAXIMUM_LENGTH` - [#482](https://github.com/PHPOffice/PhpSpreadsheet/issues/482) -- Allow escape character to be set in CSV reader – [#492](https://github.com/PHPOffice/PhpSpreadsheet/issues/492) - -### Fixed - -- Subtotal 9 in a group that has other subtotals 9 exclude the totals of the other subtotals in the range - [#332](https://github.com/PHPOffice/PhpSpreadsheet/issues/332) -- `Helper\Html` support UTF-8 HTML input - [#444](https://github.com/PHPOffice/PhpSpreadsheet/issues/444) -- Xlsx loaded an extra empty comment for each real comment - [#375](https://github.com/PHPOffice/PhpSpreadsheet/issues/375) -- Xlsx reader do not read rows and columns filtered out in readFilter at all - [#370](https://github.com/PHPOffice/PhpSpreadsheet/issues/370) -- Make newer Excel versions properly recalculate formulas on document open - [#456](https://github.com/PHPOffice/PhpSpreadsheet/issues/456) -- `Coordinate::extractAllCellReferencesInRange()` throws an exception for an invalid range – [#519](https://github.com/PHPOffice/PhpSpreadsheet/issues/519) -- Fixed parsing of conditionals in COUNTIF functions - [#526](https://github.com/PHPOffice/PhpSpreadsheet/issues/526) -- Corruption errors for saved Xlsx docs with frozen panes - [#532](https://github.com/PHPOffice/PhpSpreadsheet/issues/532) - -## [1.2.1] - 2018-04-10 - -### Fixed - -- Plain text and richtext mixed in same cell can be read - [#442](https://github.com/PHPOffice/PhpSpreadsheet/issues/442) - -## [1.2.0] - 2018-03-04 - -### Added - -- HTML writer creates a generator meta tag - [#312](https://github.com/PHPOffice/PhpSpreadsheet/issues/312) -- Support invalid zoom value in XLSX format - [#350](https://github.com/PHPOffice/PhpSpreadsheet/pull/350) -- Support for `_xlfn.` prefixed functions and `ISFORMULA`, `MODE.SNGL`, `STDEV.S`, `STDEV.P` - [#390](https://github.com/PHPOffice/PhpSpreadsheet/pull/390) - -### Fixed - -- Avoid potentially unsupported PSR-16 cache keys - [#354](https://github.com/PHPOffice/PhpSpreadsheet/issues/354) -- Check for MIME type to know if CSV reader can read a file - [#167](https://github.com/PHPOffice/PhpSpreadsheet/issues/167) -- Use proper € symbol for currency format - [#379](https://github.com/PHPOffice/PhpSpreadsheet/pull/379) -- Read printing area correctly when skipping some sheets - [#371](https://github.com/PHPOffice/PhpSpreadsheet/issues/371) -- Avoid incorrectly overwriting calculated value type - [#394](https://github.com/PHPOffice/PhpSpreadsheet/issues/394) -- Select correct cell when calling freezePane - [#389](https://github.com/PHPOffice/PhpSpreadsheet/issues/389) -- `setStrikethrough()` did not set the font - [#403](https://github.com/PHPOffice/PhpSpreadsheet/issues/403) - -## [1.1.0] - 2018-01-28 - -### Added - -- Support for PHP 7.2 -- Support cell comments in HTML writer and reader - [#308](https://github.com/PHPOffice/PhpSpreadsheet/issues/308) -- Option to stop at a conditional styling, if it matches (only XLSX format) - [#292](https://github.com/PHPOffice/PhpSpreadsheet/pull/292) -- Support for line width for data series when rendering Xlsx - [#329](https://github.com/PHPOffice/PhpSpreadsheet/pull/329) - -### Fixed - -- Better auto-detection of CSV separators - [#305](https://github.com/PHPOffice/PhpSpreadsheet/issues/305) -- Support for shape style ending with `;` - [#304](https://github.com/PHPOffice/PhpSpreadsheet/issues/304) -- Freeze Panes takes wrong coordinates for XLSX - [#322](https://github.com/PHPOffice/PhpSpreadsheet/issues/322) -- `COLUMNS` and `ROWS` functions crashed in some cases - [#336](https://github.com/PHPOffice/PhpSpreadsheet/issues/336) -- Support XML file without styles - [#331](https://github.com/PHPOffice/PhpSpreadsheet/pull/331) -- Cell coordinates which are already a range cause an exception [#319](https://github.com/PHPOffice/PhpSpreadsheet/issues/319) - -## [1.0.0] - 2017-12-25 - -### Added - -- Support to write merged cells in ODS format - [#287](https://github.com/PHPOffice/PhpSpreadsheet/issues/287) -- Able to set the `topLeftCell` in freeze panes - [#261](https://github.com/PHPOffice/PhpSpreadsheet/pull/261) -- Support `DateTimeImmutable` as cell value -- Support migration of prefixed classes - -### Fixed - -- Can read very small HTML files - [#194](https://github.com/PHPOffice/PhpSpreadsheet/issues/194) -- Written DataValidation was corrupted - [#290](https://github.com/PHPOffice/PhpSpreadsheet/issues/290) -- Date format compatible with both LibreOffice and Excel - [#298](https://github.com/PHPOffice/PhpSpreadsheet/issues/298) - -### BREAKING CHANGE - -- Constant `TYPE_DOUGHTNUTCHART` is now `TYPE_DOUGHNUTCHART`. - -## [1.0.0-beta2] - 2017-11-26 - -### Added - -- Support for chart fill color - @CrazyBite [#158](https://github.com/PHPOffice/PhpSpreadsheet/pull/158) -- Support for read Hyperlink for xml - @GreatHumorist [#223](https://github.com/PHPOffice/PhpSpreadsheet/pull/223) -- Support for cell value validation according to data validation rules - @SailorMax [#257](https://github.com/PHPOffice/PhpSpreadsheet/pull/257) -- Support for custom implementation, or configuration, of PDF libraries - @SailorMax [#266](https://github.com/PHPOffice/PhpSpreadsheet/pull/266) - -### Changed - -- Merge data-validations to reduce written worksheet size - @billblume [#131](https://github.com/PHPOffice/PhpSpreadSheet/issues/131) -- Throws exception if a XML file is invalid - @GreatHumorist [#222](https://github.com/PHPOffice/PhpSpreadsheet/pull/222) -- Upgrade to mPDF 7.0+ - [#144](https://github.com/PHPOffice/PhpSpreadsheet/issues/144) - -### Fixed - -- Control characters in cell values are automatically escaped - [#212](https://github.com/PHPOffice/PhpSpreadsheet/issues/212) -- Prevent color changing when copy/pasting xls files written by PhpSpreadsheet to another file - @al-lala [#218](https://github.com/PHPOffice/PhpSpreadsheet/issues/218) -- Add cell reference automatic when there is no cell reference('r' attribute) in Xlsx file. - @GreatHumorist [#225](https://github.com/PHPOffice/PhpSpreadsheet/pull/225) Refer to [issue#201](https://github.com/PHPOffice/PhpSpreadsheet/issues/201) -- `Reader\Xlsx::getFromZipArchive()` function return false if the zip entry could not be located. - @anton-harvey [#268](https://github.com/PHPOffice/PhpSpreadsheet/pull/268) - -### BREAKING CHANGE - -- Extracted coordinate method to dedicate class [migration guide](./docs/topics/migration-from-PHPExcel.md). -- Column indexes are based on 1, see the [migration guide](./docs/topics/migration-from-PHPExcel.md). -- Standardization of array keys used for style, see the [migration guide](./docs/topics/migration-from-PHPExcel.md). -- Easier usage of PDF writers, and other custom readers and writers, see the [migration guide](./docs/topics/migration-from-PHPExcel.md). -- Easier usage of chart renderers, see the [migration guide](./docs/topics/migration-from-PHPExcel.md). -- Rename a few more classes to keep them in their related namespaces: - - `CalcEngine` => `Calculation\Engine` - - `PhpSpreadsheet\Calculation` => `PhpSpreadsheet\Calculation\Calculation` - - `PhpSpreadsheet\Cell` => `PhpSpreadsheet\Cell\Cell` - - `PhpSpreadsheet\Chart` => `PhpSpreadsheet\Chart\Chart` - - `PhpSpreadsheet\RichText` => `PhpSpreadsheet\RichText\RichText` - - `PhpSpreadsheet\Style` => `PhpSpreadsheet\Style\Style` - - `PhpSpreadsheet\Worksheet` => `PhpSpreadsheet\Worksheet\Worksheet` - -## [1.0.0-beta] - 2017-08-17 - -### Added - -- Initial implementation of SUMIFS() function -- Additional codepages -- MemoryDrawing not working in HTML writer [#808](https://github.com/PHPOffice/PHPExcel/issues/808) -- CSV Reader can auto-detect the separator used in file [#141](https://github.com/PHPOffice/PhpSpreadsheet/pull/141) -- HTML Reader supports some basic inline styles [#180](https://github.com/PHPOffice/PhpSpreadsheet/pull/180) - -### Changed - -- Start following [SemVer](http://semver.org) properly. - -### Fixed - -- Fix to getCell() method when cell reference includes a worksheet reference - @MarkBaker -- Ignore inlineStr type if formula element exists - @ncrypthic [#570](https://github.com/PHPOffice/PHPExcel/issues/570) -- Excel 2007 Reader freezes because of conditional formatting - @rentalhost [#575](https://github.com/PHPOffice/PHPExcel/issues/575) -- Readers will now parse files containing worksheet titles over 31 characters [#176](https://github.com/PHPOffice/PhpSpreadsheet/pull/176) - -### General - -- Whitespace after toRichTextObject() - @MarkBaker [#554](https://github.com/PHPOffice/PHPExcel/issues/554) -- Optimize vlookup() sort - @umpirsky [#548](https://github.com/PHPOffice/PHPExcel/issues/548) -- c:max and c:min elements shall NOT be inside c:orientation elements - @vitalyrepin [#869](https://github.com/PHPOffice/PHPExcel/pull/869) -- Implement actual timezone adjustment into PHPExcel_Shared_Date::PHPToExcel - @sim642 [#489](https://github.com/PHPOffice/PHPExcel/pull/489) - -### BREAKING CHANGE - -- Introduction of namespaces for all classes, eg: `PHPExcel_Calculation_Functions` becomes `PhpOffice\PhpSpreadsheet\Calculation\Functions` -- Some classes were renamed for clarity and/or consistency: - -For a comprehensive list of all class changes, and a semi-automated migration path, read the [migration guide](./docs/topics/migration-from-PHPExcel.md). - -- Dropped `PHPExcel_Calculation_Functions::VERSION()`. Composer or git should be used to know the version. -- Dropped `PHPExcel_Settings::setPdfRenderer()` and `PHPExcel_Settings::setPdfRenderer()`. Composer should be used to autoload PDF libs. -- Dropped support for HHVM - -## Previous versions of PHPExcel - -The changelog for the project when it was called PHPExcel is [still available](./CHANGELOG.PHPExcel.md). diff --git a/vendor/phpoffice/phpspreadsheet/CONTRIBUTING.md b/vendor/phpoffice/phpspreadsheet/CONTRIBUTING.md deleted file mode 100644 index 62f07721..00000000 --- a/vendor/phpoffice/phpspreadsheet/CONTRIBUTING.md +++ /dev/null @@ -1,11 +0,0 @@ -# Want to contribute? - -If you would like to contribute, here are some notes and guidelines: - - - All new development happens on feature/fix branches referenced with the GitHub issue number, and are then merged to the develop branch; so the develop branch is always the most up-to-date, working code - - The master branch only contains tagged releases - - If you are going to be submitting a pull request, please fork from develop, and submit your pull request back as a fix/feature branch referencing the GitHub issue number - - Code style might be automatically fixed by `composer fix` - - All code changes must be validated by `composer check` - - [Helpful article about forking](https://help.github.com/articles/fork-a-repo/ "Forking a GitHub repository") - - [Helpful article about pull requests](https://help.github.com/articles/using-pull-requests/ "Pull Requests") diff --git a/vendor/phpoffice/phpspreadsheet/LICENSE b/vendor/phpoffice/phpspreadsheet/LICENSE deleted file mode 100644 index c7338e3c..00000000 --- a/vendor/phpoffice/phpspreadsheet/LICENSE +++ /dev/null @@ -1,345 +0,0 @@ -GNU LESSER GENERAL PUBLIC LICENSE - - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - -NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - -END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/vendor/phpoffice/phpspreadsheet/bin/migrate-from-phpexcel b/vendor/phpoffice/phpspreadsheet/bin/migrate-from-phpexcel deleted file mode 100644 index 51c60d49..00000000 --- a/vendor/phpoffice/phpspreadsheet/bin/migrate-from-phpexcel +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env php -migrate(); diff --git a/vendor/phpoffice/phpspreadsheet/bin/pre-commit b/vendor/phpoffice/phpspreadsheet/bin/pre-commit deleted file mode 100644 index 8d93f8ab..00000000 --- a/vendor/phpoffice/phpspreadsheet/bin/pre-commit +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -pass=true - -files=$(git diff --cached --name-only --diff-filter=ACMR | grep -E '\.(php|phtml)$') -if [ "$files" != "" ]; then - - # Run php syntax check before commit - while read -r file; do - php -l "$file" - if [ $? -ne 0 ]; then - pass=false - fi - done <<< "$files" - - # Run php-cs-fixer validation before commit - echo "$files" | xargs ./vendor/bin/php-cs-fixer fix --diff --config .php_cs.dist - if [ $? -ne 0 ]; then - pass=false - fi - - # Automatically add files that may have been fixed by php-cs-fixer - echo "$files" | xargs git add -fi - -if $pass; then - exit 0 -else - echo "" - echo "PRE-COMMIT HOOK FAILED:" - echo "Code style validation failed. Please fix errors and try committing again." - exit 1 -fi diff --git a/vendor/phpoffice/phpspreadsheet/composer.json b/vendor/phpoffice/phpspreadsheet/composer.json deleted file mode 100644 index ce228ad6..00000000 --- a/vendor/phpoffice/phpspreadsheet/composer.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "name": "phpoffice/phpspreadsheet", - "description": "PHPSpreadsheet - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine", - "keywords": ["PHP", "OpenXML", "Excel", "xlsx", "xls", "ods", "gnumeric", "spreadsheet"], - "homepage": "https://github.com/PHPOffice/PhpSpreadsheet", - "type": "library", - "license": "LGPL-2.1-or-later", - "authors": [ - { - "name": "Maarten Balliauw", - "homepage": "http://blog.maartenballiauw.be" - }, - { - "name": "Mark Baker", - "homepage": "http://markbakeruk.net" - }, - { - "name": "Franck Lefevre", - "homepage": "http://rootslabs.net" - }, - { - "name": "Erik Tilt" - } - ], - "scripts": { - "check": [ - "php-cs-fixer fix --ansi --dry-run --diff", - "phpcs --report-width=200 samples/ src/ tests/ --ignore=samples/Header.php --standard=PSR2 -n", - "phpunit --color=always" - ], - "fix": [ - "php-cs-fixer fix --ansi" - ] - }, - "require": { - "php": "^5.6|^7.0", - "ext-ctype": "*", - "ext-dom": "*", - "ext-gd": "*", - "ext-iconv": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-SimpleXML": "*", - "ext-xml": "*", - "ext-xmlreader": "*", - "ext-xmlwriter": "*", - "ext-zip": "*", - "ext-zlib": "*", - "psr/simple-cache": "^1.0", - "markbaker/complex": "^1.4.1" - }, - "require-dev": { - "tecnickcom/tcpdf": "^6.2", - "phpunit/phpunit": "^5.7", - "dompdf/dompdf": "^0.8.0", - "mpdf/mpdf": "^7.0.0", - "jpgraph/jpgraph": "^4.0", - "friendsofphp/php-cs-fixer": "@stable", - "squizlabs/php_codesniffer": "^3.3" - }, - "suggest": { - "mpdf/mpdf": "Option for rendering PDF with PDF Writer", - "dompdf/dompdf": "Option for rendering PDF with PDF Writer", - "tecnickcom/tcpdf": "Option for rendering PDF with PDF Writer", - "jpgraph/jpgraph": "Option for rendering charts, or including charts with PDF or HTML Writers" - }, - "autoload": { - "psr-4": { - "PhpOffice\\PhpSpreadsheet\\": "src/PhpSpreadsheet" - } - }, - "autoload-dev": { - "psr-4": { - "PhpOffice\\PhpSpreadsheetTests\\": "tests/PhpSpreadsheetTests" - } - } -} diff --git a/vendor/phpoffice/phpspreadsheet/composer.lock b/vendor/phpoffice/phpspreadsheet/composer.lock deleted file mode 100644 index fe9fbc65..00000000 --- a/vendor/phpoffice/phpspreadsheet/composer.lock +++ /dev/null @@ -1,3171 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "66067b3ab7afd673a28cf0b31eb9ae20", - "packages": [ - { - "name": "markbaker/complex", - "version": "1.4.1", - "source": { - "type": "git", - "url": "https://github.com/MarkBaker/PHPComplex.git", - "reference": "615f5443473cf37729666e2354fd8dfa2cb48e91" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/MarkBaker/PHPComplex/zipball/615f5443473cf37729666e2354fd8dfa2cb48e91", - "reference": "615f5443473cf37729666e2354fd8dfa2cb48e91", - "shasum": "" - }, - "require": { - "php": "^5.6.0|^7.0.0" - }, - "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3", - "phpdocumentor/phpdocumentor": "2.*", - "phploc/phploc": "2.*", - "phpmd/phpmd": "2.*", - "phpunit/phpunit": "^4.8.35|^5.4.0", - "sebastian/phpcpd": "2.*", - "squizlabs/php_codesniffer": "^3.1.1", - "wimg/php-compatibility": "^8.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Complex\\": "classes/src/" - }, - "files": [ - "classes/src/functions/abs.php", - "classes/src/functions/acos.php", - "classes/src/functions/acosh.php", - "classes/src/functions/acot.php", - "classes/src/functions/acoth.php", - "classes/src/functions/acsc.php", - "classes/src/functions/acsch.php", - "classes/src/functions/argument.php", - "classes/src/functions/asec.php", - "classes/src/functions/asech.php", - "classes/src/functions/asin.php", - "classes/src/functions/asinh.php", - "classes/src/functions/atan.php", - "classes/src/functions/atanh.php", - "classes/src/functions/conjugate.php", - "classes/src/functions/cos.php", - "classes/src/functions/cosh.php", - "classes/src/functions/cot.php", - "classes/src/functions/coth.php", - "classes/src/functions/csc.php", - "classes/src/functions/csch.php", - "classes/src/functions/exp.php", - "classes/src/functions/inverse.php", - "classes/src/functions/ln.php", - "classes/src/functions/log2.php", - "classes/src/functions/log10.php", - "classes/src/functions/negative.php", - "classes/src/functions/pow.php", - "classes/src/functions/rho.php", - "classes/src/functions/sec.php", - "classes/src/functions/sech.php", - "classes/src/functions/sin.php", - "classes/src/functions/sinh.php", - "classes/src/functions/sqrt.php", - "classes/src/functions/tan.php", - "classes/src/functions/tanh.php", - "classes/src/functions/theta.php", - "classes/src/operations/add.php", - "classes/src/operations/subtract.php", - "classes/src/operations/multiply.php", - "classes/src/operations/divideby.php", - "classes/src/operations/divideinto.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mark Baker", - "email": "mark@lange.demon.co.uk" - } - ], - "description": "PHP Class for working with complex numbers", - "homepage": "https://github.com/MarkBaker/PHPComplex", - "keywords": [ - "complex", - "mathematics" - ], - "time": "2018-07-24T19:47:28+00:00" - }, - { - "name": "psr/simple-cache", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/simple-cache.git", - "reference": "753fa598e8f3b9966c886fe13f370baa45ef0e24" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/753fa598e8f3b9966c886fe13f370baa45ef0e24", - "reference": "753fa598e8f3b9966c886fe13f370baa45ef0e24", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\SimpleCache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interfaces for simple caching", - "keywords": [ - "cache", - "caching", - "psr", - "psr-16", - "simple-cache" - ], - "time": "2017-01-02T13:31:39+00:00" - } - ], - "packages-dev": [ - { - "name": "composer/semver", - "version": "1.4.2", - "source": { - "type": "git", - "url": "https://github.com/composer/semver.git", - "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/c7cb9a2095a074d131b65a8a0cd294479d785573", - "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.5 || ^5.0.5", - "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\Semver\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - }, - { - "name": "Rob Bast", - "email": "rob.bast@gmail.com", - "homepage": "http://robbast.nl" - } - ], - "description": "Semver library that offers utilities, version constraint parsing and validation.", - "keywords": [ - "semantic", - "semver", - "validation", - "versioning" - ], - "time": "2016-08-30T16:08:34+00:00" - }, - { - "name": "doctrine/annotations", - "version": "v1.6.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/annotations.git", - "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5", - "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5", - "shasum": "" - }, - "require": { - "doctrine/lexer": "1.*", - "php": "^7.1" - }, - "require-dev": { - "doctrine/cache": "1.*", - "phpunit/phpunit": "^6.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Docblock Annotations Parser", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "annotations", - "docblock", - "parser" - ], - "time": "2017-12-06T07:11:42+00:00" - }, - { - "name": "doctrine/instantiator", - "version": "1.0.5", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", - "shasum": "" - }, - "require": { - "php": ">=5.3,<8.0-DEV" - }, - "require-dev": { - "athletic/athletic": "~0.1.8", - "ext-pdo": "*", - "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2015-06-14T21:17:01+00:00" - }, - { - "name": "doctrine/lexer", - "version": "v1.0.1", - "source": { - "type": "git", - "url": "https://github.com/doctrine/lexer.git", - "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", - "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "Doctrine\\Common\\Lexer\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "lexer", - "parser" - ], - "time": "2014-09-09T13:34:57+00:00" - }, - { - "name": "dompdf/dompdf", - "version": "v0.8.0", - "source": { - "type": "git", - "url": "https://github.com/dompdf/dompdf.git", - "reference": "0f418c6b58fdeafc2a0e80eb1fa5e644e185089c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/dompdf/dompdf/zipball/0f418c6b58fdeafc2a0e80eb1fa5e644e185089c", - "reference": "0f418c6b58fdeafc2a0e80eb1fa5e644e185089c", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-gd": "*", - "ext-mbstring": "*", - "phenx/php-font-lib": "0.5.*", - "phenx/php-svg-lib": "0.2.*", - "php": ">=5.3.0" - }, - "require-dev": { - "phpunit/phpunit": "4.8.*", - "squizlabs/php_codesniffer": "2.*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-develop": "0.7-dev" - } - }, - "autoload": { - "psr-4": { - "Dompdf\\": "src/" - }, - "classmap": [ - "lib/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-2.1" - ], - "authors": [ - { - "name": "Fabien Ménager", - "email": "fabien.menager@gmail.com" - }, - { - "name": "Brian Sweeney", - "email": "eclecticgeek@gmail.com" - }, - { - "name": "Gabriel Bull", - "email": "me@gabrielbull.com" - } - ], - "description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter", - "homepage": "https://github.com/dompdf/dompdf", - "time": "2017-02-16T02:40:40+00:00" - }, - { - "name": "friendsofphp/php-cs-fixer", - "version": "v2.10.0", - "source": { - "type": "git", - "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "513a3765b56dd029175f9f32995566657ee89dda" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/513a3765b56dd029175f9f32995566657ee89dda", - "reference": "513a3765b56dd029175f9f32995566657ee89dda", - "shasum": "" - }, - "require": { - "composer/semver": "^1.4", - "doctrine/annotations": "^1.2", - "ext-json": "*", - "ext-tokenizer": "*", - "gecko-packages/gecko-php-unit": "^2.0 || ^3.0", - "php": "^5.6 || >=7.0 <7.3", - "php-cs-fixer/diff": "^1.2", - "symfony/console": "^3.2 || ^4.0", - "symfony/event-dispatcher": "^3.0 || ^4.0", - "symfony/filesystem": "^3.0 || ^4.0", - "symfony/finder": "^3.0 || ^4.0", - "symfony/options-resolver": "^3.0 || ^4.0", - "symfony/polyfill-php70": "^1.0", - "symfony/polyfill-php72": "^1.4", - "symfony/process": "^3.0 || ^4.0", - "symfony/stopwatch": "^3.0 || ^4.0" - }, - "conflict": { - "hhvm": "*" - }, - "require-dev": { - "johnkary/phpunit-speedtrap": "^1.1 || ^2.0@dev", - "justinrainbow/json-schema": "^5.0", - "keradus/cli-executor": "^1.0", - "mikey179/vfsstream": "^1.6", - "php-coveralls/php-coveralls": "^2.0", - "php-cs-fixer/accessible-object": "^1.0", - "phpunit/phpunit": "^5.7.23 || ^6.4.3", - "phpunitgoodpractices/traits": "^1.0", - "symfony/phpunit-bridge": "^3.2.2 || ^4.0" - }, - "suggest": { - "ext-mbstring": "For handling non-UTF8 characters in cache signature.", - "symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible." - }, - "bin": [ - "php-cs-fixer" - ], - "type": "application", - "extra": { - "branch-alias": { - "dev-master": "2.10-dev" - } - }, - "autoload": { - "psr-4": { - "PhpCsFixer\\": "src/" - }, - "classmap": [ - "tests/Test/AbstractFixerTestCase.php", - "tests/Test/AbstractIntegrationTestCase.php", - "tests/Test/Assert/AssertTokensTrait.php", - "tests/Test/IntegrationCase.php", - "tests/Test/IntegrationCaseFactory.php", - "tests/TestCase.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Dariusz Rumiński", - "email": "dariusz.ruminski@gmail.com" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "A tool to automatically fix PHP code style", - "time": "2018-01-10T17:16:15+00:00" - }, - { - "name": "gecko-packages/gecko-php-unit", - "version": "v3.0", - "source": { - "type": "git", - "url": "https://github.com/GeckoPackages/GeckoPHPUnit.git", - "reference": "6a866551dffc2154c1b091bae3a7877d39c25ca3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/GeckoPackages/GeckoPHPUnit/zipball/6a866551dffc2154c1b091bae3a7877d39c25ca3", - "reference": "6a866551dffc2154c1b091bae3a7877d39c25ca3", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "suggest": { - "ext-dom": "When testing with xml.", - "ext-libxml": "When testing with xml.", - "phpunit/phpunit": "This is an extension for it so make sure you have it some way." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "psr-4": { - "GeckoPackages\\PHPUnit\\": "src/PHPUnit" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Additional PHPUnit asserts and constraints.", - "homepage": "https://github.com/GeckoPackages", - "keywords": [ - "extension", - "filesystem", - "phpunit" - ], - "time": "2017-08-23T07:46:41+00:00" - }, - { - "name": "ircmaxell/password-compat", - "version": "v1.0.4", - "source": { - "type": "git", - "url": "https://github.com/ircmaxell/password_compat.git", - "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ircmaxell/password_compat/zipball/5c5cde8822a69545767f7c7f3058cb15ff84614c", - "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c", - "shasum": "" - }, - "require-dev": { - "phpunit/phpunit": "4.*" - }, - "type": "library", - "autoload": { - "files": [ - "lib/password.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Anthony Ferrara", - "email": "ircmaxell@php.net", - "homepage": "http://blog.ircmaxell.com" - } - ], - "description": "A compatibility library for the proposed simplified password hashing algorithm: https://wiki.php.net/rfc/password_hash", - "homepage": "https://github.com/ircmaxell/password_compat", - "keywords": [ - "hashing", - "password" - ], - "time": "2014-11-20T16:49:30+00:00" - }, - { - "name": "jpgraph/jpgraph", - "version": "4.0.2", - "source": { - "type": "git", - "url": "https://github.com/ztec/JpGraph.git", - "reference": "e82db7da6a546d3926c24c9a346226da7aa49094" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ztec/JpGraph/zipball/e82db7da6a546d3926c24c9a346226da7aa49094", - "reference": "e82db7da6a546d3926c24c9a346226da7aa49094", - "shasum": "" - }, - "type": "library", - "autoload": { - "classmap": [ - "lib/JpGraph.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "QPL 1.0" - ], - "authors": [ - { - "name": "JpGraph team" - } - ], - "description": "jpGraph, library to make graphs and charts", - "homepage": "http://jpgraph.net/", - "keywords": [ - "chart", - "data", - "graph", - "jpgraph", - "pie" - ], - "time": "2017-02-23T09:44:15+00:00" - }, - { - "name": "mpdf/mpdf", - "version": "v7.0.0", - "source": { - "type": "git", - "url": "https://github.com/mpdf/mpdf.git", - "reference": "375a79a575fde762a7c390766837e78e8dfe97bf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/mpdf/mpdf/zipball/375a79a575fde762a7c390766837e78e8dfe97bf", - "reference": "375a79a575fde762a7c390766837e78e8dfe97bf", - "shasum": "" - }, - "require": { - "ext-gd": "*", - "ext-mbstring": "*", - "paragonie/random_compat": "^2.0", - "php": "^5.6 || ~7.0.0 || ~7.1.0 || ~7.2.0", - "psr/log": "^1.0", - "setasign/fpdi": "1.6.*" - }, - "require-dev": { - "mockery/mockery": "^0.9.5", - "phpunit/phpunit": "^5.0", - "squizlabs/php_codesniffer": "^2.7.0", - "tracy/tracy": "^2.4" - }, - "suggest": { - "ext-bcmath": "Needed for generation of some types of barcodes", - "ext-xml": "Needed mainly for SVG manipulation", - "ext-zlib": "Needed for compression of embedded resources, such as fonts" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-development": "7.0-dev" - } - }, - "autoload": { - "psr-4": { - "Mpdf\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0" - ], - "authors": [ - { - "name": "Matěj Humpál", - "role": "Developer, maintainer" - }, - { - "name": "Ian Back", - "role": "Developer (retired)" - } - ], - "description": "A PHP class to generate PDF files from HTML with Unicode/UTF-8 and CJK support", - "homepage": "https://mpdf.github.io", - "keywords": [ - "pdf", - "php", - "utf-8" - ], - "time": "2017-10-19T16:38:45+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.6.0", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/5a5a9fc8025a08d8919be87d6884d5a92520cefe", - "reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "doctrine/collections": "1.*", - "phpunit/phpunit": "~4.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "homepage": "https://github.com/myclabs/DeepCopy", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "time": "2017-01-26T22:05:40+00:00" - }, - { - "name": "paragonie/random_compat", - "version": "v2.0.11", - "source": { - "type": "git", - "url": "https://github.com/paragonie/random_compat.git", - "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/5da4d3c796c275c55f057af5a643ae297d96b4d8", - "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8", - "shasum": "" - }, - "require": { - "php": ">=5.2.0" - }, - "require-dev": { - "phpunit/phpunit": "4.*|5.*" - }, - "suggest": { - "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." - }, - "type": "library", - "autoload": { - "files": [ - "lib/random.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com" - } - ], - "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", - "keywords": [ - "csprng", - "pseudorandom", - "random" - ], - "time": "2017-09-27T21:40:39+00:00" - }, - { - "name": "phenx/php-font-lib", - "version": "0.5", - "source": { - "type": "git", - "url": "https://github.com/PhenX/php-font-lib.git", - "reference": "19ad2bebc35be028fcc0221025fcbf3d436a3962" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PhenX/php-font-lib/zipball/19ad2bebc35be028fcc0221025fcbf3d436a3962", - "reference": "19ad2bebc35be028fcc0221025fcbf3d436a3962", - "shasum": "" - }, - "require-dev": { - "phpunit/phpunit": "^4.8" - }, - "type": "library", - "autoload": { - "psr-4": { - "FontLib\\": "src/FontLib" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-3.0" - ], - "authors": [ - { - "name": "Fabien Ménager", - "email": "fabien.menager@gmail.com" - } - ], - "description": "A library to read, parse, export and make subsets of different types of font files.", - "homepage": "https://github.com/PhenX/php-font-lib", - "time": "2017-02-11T10:58:43+00:00" - }, - { - "name": "phenx/php-svg-lib", - "version": "v0.2", - "source": { - "type": "git", - "url": "https://github.com/PhenX/php-svg-lib.git", - "reference": "de291bec8449b89acfe85691b5c71434797959dc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PhenX/php-svg-lib/zipball/de291bec8449b89acfe85691b5c71434797959dc", - "reference": "de291bec8449b89acfe85691b5c71434797959dc", - "shasum": "" - }, - "require": { - "sabberworm/php-css-parser": "6.0.*" - }, - "type": "library", - "autoload": { - "psr-0": { - "Svg\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-3.0" - ], - "authors": [ - { - "name": "Fabien Ménager", - "email": "fabien.menager@gmail.com" - } - ], - "description": "A library to read, parse and export to PDF SVG files.", - "homepage": "https://github.com/PhenX/php-svg-lib", - "time": "2016-12-13T20:25:45+00:00" - }, - { - "name": "php-cs-fixer/diff", - "version": "v1.2.0", - "source": { - "type": "git", - "url": "https://github.com/PHP-CS-Fixer/diff.git", - "reference": "f0ef6133d674137e902fdf8a6f2e8e97e14a087b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/f0ef6133d674137e902fdf8a6f2e8e97e14a087b", - "reference": "f0ef6133d674137e902fdf8a6f2e8e97e14a087b", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.4.3", - "symfony/process": "^3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "SpacePossum" - } - ], - "description": "sebastian/diff v2 backport support for PHP5.6", - "homepage": "https://github.com/PHP-CS-Fixer", - "keywords": [ - "diff" - ], - "time": "2017-10-19T09:58:18+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "1.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", - "shasum": "" - }, - "require": { - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "^4.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "time": "2015-12-27T11:43:31+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "3.1.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", - "shasum": "" - }, - "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.2.0", - "webmozart/assert": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^4.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2016-09-30T07:12:33+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "0.2.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", - "shasum": "" - }, - "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "time": "2016-11-25T06:54:22+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "v1.7.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "93d39f1f7f9326d746203c7c056f300f7f126073" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/93d39f1f7f9326d746203c7c056f300f7f126073", - "reference": "93d39f1f7f9326d746203c7c056f300f7f126073", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", - "sebastian/comparator": "^1.1|^2.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" - }, - "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8 || ^5.6.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6.x-dev" - } - }, - "autoload": { - "psr-0": { - "Prophecy\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2017-03-02T20:05:34+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "4.0.7", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "09e2277d14ea467e5a984010f501343ef29ffc69" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/09e2277d14ea467e5a984010f501343ef29ffc69", - "reference": "09e2277d14ea467e5a984010f501343ef29ffc69", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-xmlwriter": "*", - "php": "^5.6 || ^7.0", - "phpunit/php-file-iterator": "^1.3", - "phpunit/php-text-template": "^1.2", - "phpunit/php-token-stream": "^1.4.2 || ^2.0", - "sebastian/code-unit-reverse-lookup": "^1.0", - "sebastian/environment": "^1.3.2 || ^2.0", - "sebastian/version": "^1.0 || ^2.0" - }, - "require-dev": { - "ext-xdebug": "^2.1.4", - "phpunit/phpunit": "^5.7" - }, - "suggest": { - "ext-xdebug": "^2.5.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2017-03-01T09:12:17+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "1.4.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2016-10-03T07:40:28+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2015-06-21T13:50:34+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "1.0.9", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2017-02-26T11:10:40+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "1.4.11", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7", - "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2017-02-27T10:12:30+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "5.7.17", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "68752b665d3875f9a38a357e3ecb35c79f8673bf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/68752b665d3875f9a38a357e3ecb35c79f8673bf", - "reference": "68752b665d3875f9a38a357e3ecb35c79f8673bf", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "myclabs/deep-copy": "~1.3", - "php": "^5.6 || ^7.0", - "phpspec/prophecy": "^1.6.2", - "phpunit/php-code-coverage": "^4.0.4", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "^3.2", - "sebastian/comparator": "^1.2.4", - "sebastian/diff": "~1.2", - "sebastian/environment": "^1.3.4 || ^2.0", - "sebastian/exporter": "~2.0", - "sebastian/global-state": "^1.1", - "sebastian/object-enumerator": "~2.0", - "sebastian/resource-operations": "~1.0", - "sebastian/version": "~1.0.3|~2.0", - "symfony/yaml": "~2.1|~3.0" - }, - "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2" - }, - "require-dev": { - "ext-pdo": "*" - }, - "suggest": { - "ext-xdebug": "*", - "phpunit/php-invoker": "~1.1" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.7.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2017-03-19T16:52:12+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "3.4.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "3ab72b65b39b491e0c011e2e09bb2206c2aa8e24" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/3ab72b65b39b491e0c011e2e09bb2206c2aa8e24", - "reference": "3ab72b65b39b491e0c011e2e09bb2206c2aa8e24", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.6 || ^7.0", - "phpunit/php-text-template": "^1.2", - "sebastian/exporter": "^1.2 || ^2.0" - }, - "conflict": { - "phpunit/phpunit": "<5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.4" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2016-12-08T20:27:08+00:00" - }, - { - "name": "psr/log", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2016-10-10T12:19:37+00:00" - }, - { - "name": "sabberworm/php-css-parser", - "version": "6.0.1", - "source": { - "type": "git", - "url": "https://github.com/sabberworm/PHP-CSS-Parser.git", - "reference": "9ea4b00c569b19f731d0c2e0e802055877ff40c2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sabberworm/PHP-CSS-Parser/zipball/9ea4b00c569b19f731d0c2e0e802055877ff40c2", - "reference": "9ea4b00c569b19f731d0c2e0e802055877ff40c2", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "type": "library", - "autoload": { - "psr-0": { - "Sabberworm\\CSS": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Raphael Schweikert" - } - ], - "description": "Parser for CSS Files written in PHP", - "homepage": "http://www.sabberworm.com/blog/2010/6/10/php-css-parser", - "keywords": [ - "css", - "parser", - "stylesheet" - ], - "time": "2015-08-24T08:48:52+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" - }, - { - "name": "sebastian/comparator", - "version": "1.2.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2017-01-29T09:50:25+00:00" - }, - { - "name": "sebastian/diff", - "version": "1.4.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff" - ], - "time": "2015-12-08T07:14:41+00:00" - }, - { - "name": "sebastian/environment", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2016-11-26T07:53:53+00:00" - }, - { - "name": "sebastian/exporter", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~2.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2016-11-19T08:54:04+00:00" - }, - { - "name": "sebastian/global-state", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2015-10-12T03:26:01+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1311872ac850040a79c3c058bea3e22d0f09cbb7", - "reference": "1311872ac850040a79c3c058bea3e22d0f09cbb7", - "shasum": "" - }, - "require": { - "php": ">=5.6", - "sebastian/recursion-context": "~2.0" - }, - "require-dev": { - "phpunit/phpunit": "~5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-02-18T15:18:39+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-11-19T07:33:16+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "shasum": "" - }, - "require": { - "php": ">=5.6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28T20:34:47+00:00" - }, - { - "name": "sebastian/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" - }, - { - "name": "setasign/fpdi", - "version": "1.6.2", - "source": { - "type": "git", - "url": "https://github.com/Setasign/FPDI.git", - "reference": "a6ad58897a6d97cc2d2cd2adaeda343b25a368ea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Setasign/FPDI/zipball/a6ad58897a6d97cc2d2cd2adaeda343b25a368ea", - "reference": "a6ad58897a6d97cc2d2cd2adaeda343b25a368ea", - "shasum": "" - }, - "suggest": { - "setasign/fpdf": "FPDI will extend this class but as it is also possible to use \"tecnickcom/tcpdf\" as an alternative there's no fixed dependency configured.", - "setasign/fpdi-fpdf": "Use this package to automatically evaluate dependencies to FPDF.", - "setasign/fpdi-tcpdf": "Use this package to automatically evaluate dependencies to TCPDF." - }, - "type": "library", - "autoload": { - "classmap": [ - "filters/", - "fpdi.php", - "fpdf_tpl.php", - "fpdi_pdf_parser.php", - "pdf_context.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jan Slabon", - "email": "jan.slabon@setasign.com", - "homepage": "https://www.setasign.com" - } - ], - "description": "FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.", - "homepage": "https://www.setasign.com/fpdi", - "keywords": [ - "fpdf", - "fpdi", - "pdf" - ], - "time": "2017-05-11T14:25:49+00:00" - }, - { - "name": "squizlabs/php_codesniffer", - "version": "3.3.1", - "source": { - "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "628a481780561150481a9ec74709092b9759b3ec" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/628a481780561150481a9ec74709092b9759b3ec", - "reference": "628a481780561150481a9ec74709092b9759b3ec", - "shasum": "" - }, - "require": { - "ext-simplexml": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" - }, - "bin": [ - "bin/phpcs", - "bin/phpcbf" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Greg Sherwood", - "role": "lead" - } - ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "http://www.squizlabs.com/php-codesniffer", - "keywords": [ - "phpcs", - "standards" - ], - "time": "2018-07-26T23:47:18+00:00" - }, - { - "name": "symfony/console", - "version": "v4.0.3", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "fe0e69d7162cba0885791cf7eea5f0d7bc0f897e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/fe0e69d7162cba0885791cf7eea5f0d7bc0f897e", - "reference": "fe0e69d7162cba0885791cf7eea5f0d7bc0f897e", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/dependency-injection": "<3.4", - "symfony/process": "<3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "~3.4|~4.0", - "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.4|~4.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", - "time": "2018-01-03T07:38:00+00:00" - }, - { - "name": "symfony/event-dispatcher", - "version": "v4.0.3", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "74d33aac36208c4d6757807d9f598f0133a3a4eb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/74d33aac36208c4d6757807d9f598f0133a3a4eb", - "reference": "74d33aac36208c4d6757807d9f598f0133a3a4eb", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "conflict": { - "symfony/dependency-injection": "<3.4" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/expression-language": "~3.4|~4.0", - "symfony/stopwatch": "~3.4|~4.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony EventDispatcher Component", - "homepage": "https://symfony.com", - "time": "2018-01-03T07:38:00+00:00" - }, - { - "name": "symfony/filesystem", - "version": "v4.0.3", - "source": { - "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "760e47a4ee64b4c48f4b30017011e09d4c0f05ed" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/760e47a4ee64b4c48f4b30017011e09d4c0f05ed", - "reference": "760e47a4ee64b4c48f4b30017011e09d4c0f05ed", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Filesystem\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Filesystem Component", - "homepage": "https://symfony.com", - "time": "2018-01-03T07:38:00+00:00" - }, - { - "name": "symfony/finder", - "version": "v4.0.3", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "8b08180f2b7ccb41062366b9ad91fbc4f1af8601" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/8b08180f2b7ccb41062366b9ad91fbc4f1af8601", - "reference": "8b08180f2b7ccb41062366b9ad91fbc4f1af8601", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Finder Component", - "homepage": "https://symfony.com", - "time": "2018-01-03T07:38:00+00:00" - }, - { - "name": "symfony/options-resolver", - "version": "v4.0.3", - "source": { - "type": "git", - "url": "https://github.com/symfony/options-resolver.git", - "reference": "30d9240b30696a69e893534c9fc4a5c72ab6689b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/30d9240b30696a69e893534c9fc4a5c72ab6689b", - "reference": "30d9240b30696a69e893534c9fc4a5c72ab6689b", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\OptionsResolver\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony OptionsResolver Component", - "homepage": "https://symfony.com", - "keywords": [ - "config", - "configuration", - "options" - ], - "time": "2018-01-03T07:38:00+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.6.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", - "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2017-10-11T12:05:26+00:00" - }, - { - "name": "symfony/polyfill-php54", - "version": "v1.3.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php54.git", - "reference": "90e085822963fdcc9d1c5b73deb3d2e5783b16a0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/90e085822963fdcc9d1c5b73deb3d2e5783b16a0", - "reference": "90e085822963fdcc9d1c5b73deb3d2e5783b16a0", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php54\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 5.4+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2016-11-14T01:06:16+00:00" - }, - { - "name": "symfony/polyfill-php55", - "version": "v1.3.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php55.git", - "reference": "03e3f0350bca2220e3623a0e340eef194405fc67" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/03e3f0350bca2220e3623a0e340eef194405fc67", - "reference": "03e3f0350bca2220e3623a0e340eef194405fc67", - "shasum": "" - }, - "require": { - "ircmaxell/password-compat": "~1.0", - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php55\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2016-11-14T01:06:16+00:00" - }, - { - "name": "symfony/polyfill-php70", - "version": "v1.6.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff", - "reference": "0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff", - "shasum": "" - }, - "require": { - "paragonie/random_compat": "~1.0|~2.0", - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php70\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2017-10-11T12:05:26+00:00" - }, - { - "name": "symfony/polyfill-php72", - "version": "v1.6.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "6de4f4884b97abbbed9f0a84a95ff2ff77254254" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/6de4f4884b97abbbed9f0a84a95ff2ff77254254", - "reference": "6de4f4884b97abbbed9f0a84a95ff2ff77254254", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2017-10-11T12:05:26+00:00" - }, - { - "name": "symfony/polyfill-xml", - "version": "v1.3.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-xml.git", - "reference": "64b6a864f18ab4fddad49f5025f805f6781dfabd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-xml/zipball/64b6a864f18ab4fddad49f5025f805f6781dfabd", - "reference": "64b6a864f18ab4fddad49f5025f805f6781dfabd", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-xml": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Xml\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for xml's utf8_encode and utf8_decode functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2016-11-14T01:06:16+00:00" - }, - { - "name": "symfony/process", - "version": "v4.0.3", - "source": { - "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "2145b3e8137e463b1051b79440a59b38220944f0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/2145b3e8137e463b1051b79440a59b38220944f0", - "reference": "2145b3e8137e463b1051b79440a59b38220944f0", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Process Component", - "homepage": "https://symfony.com", - "time": "2018-01-03T07:38:00+00:00" - }, - { - "name": "symfony/stopwatch", - "version": "v4.0.3", - "source": { - "type": "git", - "url": "https://github.com/symfony/stopwatch.git", - "reference": "d52321f0e2b596bd03b5d1dd6eebe71caa925704" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/d52321f0e2b596bd03b5d1dd6eebe71caa925704", - "reference": "d52321f0e2b596bd03b5d1dd6eebe71caa925704", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Stopwatch\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Stopwatch Component", - "homepage": "https://symfony.com", - "time": "2018-01-03T07:38:00+00:00" - }, - { - "name": "symfony/yaml", - "version": "v3.2.6", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "093e416ad096355149e265ea2e4cc1f9ee40ab1a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/093e416ad096355149e265ea2e4cc1f9ee40ab1a", - "reference": "093e416ad096355149e265ea2e4cc1f9ee40ab1a", - "shasum": "" - }, - "require": { - "php": ">=5.5.9" - }, - "require-dev": { - "symfony/console": "~2.8|~3.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2017-03-07T16:47:02+00:00" - }, - { - "name": "tecnickcom/tcpdf", - "version": "6.2.12", - "source": { - "type": "git", - "url": "https://github.com/tecnickcom/TCPDF.git", - "reference": "2f732eaa91b5665274689b1d40b285a7bacdc37f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/2f732eaa91b5665274689b1d40b285a7bacdc37f", - "reference": "2f732eaa91b5665274689b1d40b285a7bacdc37f", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "fonts", - "config", - "include", - "tcpdf.php", - "tcpdf_parser.php", - "tcpdf_import.php", - "tcpdf_barcodes_1d.php", - "tcpdf_barcodes_2d.php", - "include/tcpdf_colors.php", - "include/tcpdf_filters.php", - "include/tcpdf_font_data.php", - "include/tcpdf_fonts.php", - "include/tcpdf_images.php", - "include/tcpdf_static.php", - "include/barcodes/datamatrix.php", - "include/barcodes/pdf417.php", - "include/barcodes/qrcode.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPLv3" - ], - "authors": [ - { - "name": "Nicola Asuni", - "email": "info@tecnick.com", - "homepage": "http://nicolaasuni.tecnick.com" - } - ], - "description": "TCPDF is a PHP class for generating PDF documents and barcodes.", - "homepage": "http://www.tcpdf.org/", - "keywords": [ - "PDFD32000-2008", - "TCPDF", - "barcodes", - "datamatrix", - "pdf", - "pdf417", - "qrcode" - ], - "time": "2015-09-12T10:08:34+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "time": "2016-11-23T20:04:58+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": { - "friendsofphp/php-cs-fixer": 0 - }, - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": "^5.6|^7.0", - "ext-ctype": "*", - "ext-dom": "*", - "ext-gd": "*", - "ext-iconv": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-simplexml": "*", - "ext-xml": "*", - "ext-xmlreader": "*", - "ext-xmlwriter": "*", - "ext-zip": "*", - "ext-zlib": "*" - }, - "platform-dev": [] -} diff --git a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Architecture.cd b/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Architecture.cd deleted file mode 100644 index afc1dbd0..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Architecture.cd +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - Classes\PHPExcel.cs - AAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAA= - - - - - - - - - Classes\Worksheet.cs - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= - - - - - - Classes\IReader.cs - AAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAA= - - - - - - - - - - - - - - Classes\IWriter.cs - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAA= - - - - - - - - - - - \ No newline at end of file diff --git a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Architecture.png b/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Architecture.png deleted file mode 100644 index 3fc7655a..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Architecture.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/ClassDiagrams.csproj b/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/ClassDiagrams.csproj deleted file mode 100644 index 5920f3d2..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/ClassDiagrams.csproj +++ /dev/null @@ -1,64 +0,0 @@ - - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {CC8CD7D2-8EFF-48E5-A17A-C1C482744D31} - Exe - Properties - ClassDiagrams - ClassDiagrams - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/ClassDiagrams.csproj.user b/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/ClassDiagrams.csproj.user deleted file mode 100644 index 6a34e7dc..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/ClassDiagrams.csproj.user +++ /dev/null @@ -1,5 +0,0 @@ - - - ShowAllFiles - - \ No newline at end of file diff --git a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/ClassDiagrams.sln b/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/ClassDiagrams.sln deleted file mode 100644 index 3ed77321..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/ClassDiagrams.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassDiagrams", "ClassDiagrams.csproj", "{CC8CD7D2-8EFF-48E5-A17A-C1C482744D31}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CC8CD7D2-8EFF-48E5-A17A-C1C482744D31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CC8CD7D2-8EFF-48E5-A17A-C1C482744D31}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CC8CD7D2-8EFF-48E5-A17A-C1C482744D31}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CC8CD7D2-8EFF-48E5-A17A-C1C482744D31}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/IReader.cs b/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/IReader.cs deleted file mode 100644 index 96c11afb..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/IReader.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ClassDiagrams -{ - public interface PHPExcel_Reader_IReader - { - PHPExcel reads - { - get; - set; - } - } -} diff --git a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/IWriter.cs b/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/IWriter.cs deleted file mode 100644 index d1d66425..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/IWriter.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ClassDiagrams -{ - public interface PHPExcel_Writer_IWriter - { - PHPExcel writes - { - get; - set; - } - } -} diff --git a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/PHPExcel.cs b/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/PHPExcel.cs deleted file mode 100644 index 5efaa5bd..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/PHPExcel.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ClassDiagrams -{ - public class PHPExcel - { - /// - public Worksheet Worksheets - { - get - { - throw new System.NotImplementedException(); - } - set - { - } - } - } - - public class PHPExcel_Writer_PDF : PHPExcel_Writer_IWriter - { - #region PHPExcel_Writer_IWriter Members - - public PHPExcel writes - { - get - { - throw new Exception("The method or operation is not implemented."); - } - set - { - throw new Exception("The method or operation is not implemented."); - } - } - - #endregion - } -} diff --git a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/PHPExcel_IOFactory.cs b/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/PHPExcel_IOFactory.cs deleted file mode 100644 index 444712cc..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/PHPExcel_IOFactory.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ClassDiagrams -{ - public class PHPExcel_IOFactory - { - public PHPExcel_Reader_IReader createsReader - { - get - { - throw new System.NotImplementedException(); - } - set - { - } - } - - public PHPExcel_Writer_IWriter createsWriter - { - get - { - throw new System.NotImplementedException(); - } - set - { - } - } - - public PHPExcel_Writer_IWriter createWriter() - { - throw new System.NotImplementedException(); - } - - public PHPExcel_Reader_IReader createReader() - { - throw new System.NotImplementedException(); - } - } -} diff --git a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/PHPExcel_Reader_Excel2007.cs b/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/PHPExcel_Reader_Excel2007.cs deleted file mode 100644 index 5cf6e3df..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/PHPExcel_Reader_Excel2007.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ClassDiagrams -{ - public class PHPExcel_Reader_Excel2007 : PHPExcel_Reader_IReader - { - #region IReader Members - - public PHPExcel reads - { - get - { - throw new Exception("The method or operation is not implemented."); - } - set - { - throw new Exception("The method or operation is not implemented."); - } - } - - #endregion - } -} diff --git a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/PHPExcel_Reader_Excel5.cs b/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/PHPExcel_Reader_Excel5.cs deleted file mode 100644 index e4072121..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/PHPExcel_Reader_Excel5.cs +++ /dev/null @@ -1,63 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ClassDiagrams -{ - public class PHPExcel_Reader_Excel5 : PHPExcel_Reader_IReader - { - #region PHPExcel_Writer_IReader Members - - public PHPExcel reads - { - get - { - throw new Exception("The method or operation is not implemented."); - } - set - { - throw new Exception("The method or operation is not implemented."); - } - } - - #endregion - } - - public class PHPExcel_Reader_Excel2003XML : PHPExcel_Reader_IReader - { - #region PHPExcel_Writer_IReader Members - - public PHPExcel reads - { - get - { - throw new Exception("The method or operation is not implemented."); - } - set - { - throw new Exception("The method or operation is not implemented."); - } - } - - #endregion - } - - public class PHPExcel_Reader_SYLK : PHPExcel_Reader_IReader - { - #region PHPExcel_Writer_IReader Members - - public PHPExcel reads - { - get - { - throw new Exception("The method or operation is not implemented."); - } - set - { - throw new Exception("The method or operation is not implemented."); - } - } - - #endregion - } -} diff --git a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/PHPExcel_Reader_Serialized.cs b/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/PHPExcel_Reader_Serialized.cs deleted file mode 100644 index ea114c88..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/PHPExcel_Reader_Serialized.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ClassDiagrams -{ - public class PHPExcel_Reader_Serialized : PHPExcel_Reader_IReader - { - #region IReader Members - - public PHPExcel reads - { - get - { - throw new Exception("The method or operation is not implemented."); - } - set - { - throw new Exception("The method or operation is not implemented."); - } - } - - #endregion - } - - public class PHPExcel_Reader_CSV : PHPExcel_Reader_IReader - { - #region IReader Members - - public PHPExcel reads - { - get - { - throw new Exception("The method or operation is not implemented."); - } - set - { - throw new Exception("The method or operation is not implemented."); - } - } - - #endregion - } -} diff --git a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/PHPExcel_Writer_Excel2007.cs b/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/PHPExcel_Writer_Excel2007.cs deleted file mode 100644 index 03edda93..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/PHPExcel_Writer_Excel2007.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ClassDiagrams -{ - public class PHPExcel_Writer_Excel2007 : PHPExcel_Writer_IWriter - { - #region IWriter Members - - public PHPExcel writes - { - get - { - throw new Exception("The method or operation is not implemented."); - } - set - { - throw new Exception("The method or operation is not implemented."); - } - } - - #endregion - } -} diff --git a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/PHPExcel_Writer_Serialized.cs b/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/PHPExcel_Writer_Serialized.cs deleted file mode 100644 index cf8af208..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/PHPExcel_Writer_Serialized.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ClassDiagrams -{ - public class PHPExcel_Writer_Serialized : PHPExcel_Writer_IWriter - { - #region IWriter Members - - public PHPExcel writes - { - get - { - throw new Exception("The method or operation is not implemented."); - } - set - { - throw new Exception("The method or operation is not implemented."); - } - } - - #endregion - } - - public class PHPExcel_Writer_CSV : PHPExcel_Writer_IWriter - { - #region IWriter Members - - public PHPExcel writes - { - get - { - throw new Exception("The method or operation is not implemented."); - } - set - { - throw new Exception("The method or operation is not implemented."); - } - } - - #endregion - } - - public class PHPExcel_Writer_Excel5 : PHPExcel_Writer_IWriter - { - #region IWriter Members - - public PHPExcel writes - { - get - { - throw new Exception("The method or operation is not implemented."); - } - set - { - throw new Exception("The method or operation is not implemented."); - } - } - - #endregion - } - - public class PHPExcel_Writer_HTML : PHPExcel_Writer_IWriter - { - #region IWriter Members - - public PHPExcel writes - { - get - { - throw new Exception("The method or operation is not implemented."); - } - set - { - throw new Exception("The method or operation is not implemented."); - } - } - - #endregion - } -} diff --git a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/Worksheet.cs b/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/Worksheet.cs deleted file mode 100644 index fdcf0ff7..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Classes/Worksheet.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace ClassDiagrams -{ - public class Worksheet - { - } - - public class CopyOfWorksheet - { - } -} diff --git a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Exports/Architecture.png b/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Exports/Architecture.png deleted file mode 100644 index 13248180..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Exports/Architecture.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Exports/ReaderWriter.png b/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Exports/ReaderWriter.png deleted file mode 100644 index b915faa7..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/Exports/ReaderWriter.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/ReaderWriter.cd b/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/ReaderWriter.cd deleted file mode 100644 index bbaf2912..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/ReaderWriter.cd +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - AAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAA= - Classes\PHPExcel_Reader_Excel2007.cs - - - - - - - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAA= - Classes\PHPExcel_Writer_Excel2007.cs - - - - - - - AAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAA= - Classes\PHPExcel_Reader_Serialized.cs - - - - - - - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAA= - Classes\PHPExcel_Writer_Serialized.cs - - - - - - - AAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAA= - Classes\PHPExcel_Reader_Serialized.cs - - - - - - - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAA= - Classes\PHPExcel_Writer_Serialized.cs - - - - - - - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAA= - Classes\PHPExcel_Writer_Serialized.cs - - - - - - - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAA= - Classes\PHPExcel_Writer_Serialized.cs - - - - - - - AAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAA= - Classes\PHPExcel_Reader_Excel5.cs - - - - - - - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAA= - Classes\PHPExcel.cs - - - - - - - - - - - - - - - - - AIAAAAAAAAEAAAAAAQAAAAAAAAAAAAAAAAABAAAAAAA= - Classes\PHPExcel_IOFactory.cs - - - - - - - - - - AAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAA= - Classes\PHPExcel_Reader_Excel5.cs - - - - - - - AAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAA= - Classes\PHPExcel_Reader_Excel5.cs - - - - - - - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAA= - Classes\IWriter.cs - - - - - - AAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAA= - Classes\IReader.cs - - - - \ No newline at end of file diff --git a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/ReaderWriter.png b/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/ReaderWriter.png deleted file mode 100644 index d76c98d9..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/assets/ClassDiagrams/ReaderWriter.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/assets/logo.svg b/vendor/phpoffice/phpspreadsheet/docs/assets/logo.svg deleted file mode 100644 index 229debc0..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/assets/logo.svg +++ /dev/null @@ -1,947 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/vendor/phpoffice/phpspreadsheet/docs/extra/extra.css b/vendor/phpoffice/phpspreadsheet/docs/extra/extra.css deleted file mode 100644 index 2addeb79..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/extra/extra.css +++ /dev/null @@ -1,8 +0,0 @@ -/* Make the huge table always visible */ -table.features-cross-reference { - overflow: visible !important; -} -.rst-content table.features-cross-reference.docutils th, -.rst-content table.features-cross-reference.docutils td { - background-color: white; -} diff --git a/vendor/phpoffice/phpspreadsheet/docs/faq.md b/vendor/phpoffice/phpspreadsheet/docs/faq.md deleted file mode 100644 index 19f5f8fc..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/faq.md +++ /dev/null @@ -1,57 +0,0 @@ -# Frequently asked questions - -## There seems to be a problem with character encoding... - -It is necessary to use UTF-8 encoding for all texts in PhpSpreadsheet. -If the script uses different encoding then you can convert those texts -with PHP's `iconv()` or `mb_convert_encoding()` functions. - -## Fatal error: Allowed memory size of xxx bytes exhausted (tried to allocate yyy bytes) in zzz on line aaa - -PhpSpreadsheet holds an "in memory" representation of a spreadsheet, so -it is susceptible to PHP's memory limitations. The memory made available -to PHP can be increased by editing the value of the `memory_limit` -directive in your `php.ini` file, or by using -`ini_set('memory_limit', '128M')` within your code. - -Some Readers and Writers are faster than others, and they also use -differing amounts of memory. - -## Protection on my worksheet is not working? - -When you make use of any of the worksheet protection features (e.g. cell -range protection, prohibiting deleting rows, ...), make sure you enable -worksheet security. This can for example be done like this: - -``` php -$spreadsheet->getActiveSheet()->getProtection()->setSheet(true); -``` - -## Feature X is not working with Reader\_Y / Writer\_Z - -Not all features of PhpSpreadsheet are implemented in all of the Reader -/ Writer classes. This is mostly due to underlying libraries not -supporting a specific feature or not having implemented a specific -feature. - -For example autofilter is not implemented in PEAR -Spreadsheet\_Excel\_writer, which is the base of our Xls writer. - -We are slowly building up a list of features, together with the -different readers and writers that support them, in the [features cross -reference](./references/features-cross-reference.md). - -## Formulas don't seem to be calculated in Excel2003 using compatibility pack? - -This is normal behaviour of the compatibility pack, `Xlsx` displays this -correctly. Use `\PhpOffice\PhpSpreadsheet\Writer\Xls` if you really need -calculated values, or force recalculation in Excel2003. - -## Setting column width is not 100% accurate - -Trying to set column width, I experience one problem. When I open the -file in Excel, the actual width is 0.71 less than it should be. - -The short answer is that PhpSpreadsheet uses a measure where padding is -included. See [how to set a column's width](./topics/recipes.md#setting-a-columns-width) -for more details. diff --git a/vendor/phpoffice/phpspreadsheet/docs/index.md b/vendor/phpoffice/phpspreadsheet/docs/index.md deleted file mode 100644 index 08a91995..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/index.md +++ /dev/null @@ -1,104 +0,0 @@ -# Welcome to PhpSpreadsheet's documentation - -![Logo](./assets/logo.svg) - -PhpSpreadsheet is a library written in pure PHP and providing a set of -classes that allow you to read from and to write to different -spreadsheet file formats, like Excel and LibreOffice Calc. - -## File formats supported - -|Format |Reading|Writing| -|--------------------------------------------|:-----:|:-----:| -|Open Document Format/OASIS (.ods) | ✓ | ✓ | -|Office Open XML (.xlsx) Excel 2007 and above| ✓ | ✓ | -|BIFF 8 (.xls) Excel 97 and above | ✓ | ✓ | -|BIFF 5 (.xls) Excel 95 | ✓ | | -|SpreadsheetML (.xml) Excel 2003 | ✓ | | -|Gnumeric | ✓ | | -|HTML | ✓ | ✓ | -|SYLK | ✓ | | -|CSV | ✓ | ✓ | -|PDF (using either the TCPDF, Dompdf or mPDF libraries, which need to be installed separately)| | ✓ | - -# Getting started - -## Software requirements - -The following software is required to develop using PhpSpreadsheet: - -- PHP version 5.6 or newer -- PHP extension php\_zip enabled -- PHP extension php\_xml enabled -- PHP extension php\_gd2 enabled (if not compiled in) - -### PHP version support - -Support for PHP versions will only be maintained for a period of six months beyond the end-of-life of that PHP version - -## Installation - -Use [composer](https://getcomposer.org/) to install PhpSpreadsheet into your project: - -```sh -composer require phpoffice/phpspreadsheet -``` - -**Note:** If you want the unreleased, unstable development version use -`phpoffice/phpspreadsheet:dev-develop` instead. - -## Hello World - -This would be the simplest way to write a spreadsheet: - -```php -getActiveSheet(); -$sheet->setCellValue('A1', 'Hello World !'); - -$writer = new Xlsx($spreadsheet); -$writer->save('hello world.xlsx'); -``` - -## Learn by example - -A good way to get started is to run some of the samples. Serve the samples via -PHP built-in webserver: - -```sh -php -S localhost:8000 -t vendor/phpoffice/phpspreadsheet/samples -``` - -Then point your browser to: - -> http://localhost:8000/ - -The samples may also be run directly from the command line, for example: - -```sh -php vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple.php -``` - -## Learn by documentation - -For more in-depth documentation, you may read about an [overview of the -architecture](./topics/architecture.md), -[creating a spreadsheet](./topics/creating-spreadsheet.md), -[worksheets](./topics/worksheets.md), -[accessing cells](./topics/accessing-cells.md) and -[reading and writing to files](./topics/reading-and-writing-to-file.md). - -Or browse the [API documentation](https://phpoffice.github.io/PhpSpreadsheet/master). - -# Credits - -Please refer to the [contributor -list](https://github.com/PHPOffice/PhpSpreadsheet/graphs/contributors) -for up-to-date credits. diff --git a/vendor/phpoffice/phpspreadsheet/docs/references/features-cross-reference.md b/vendor/phpoffice/phpspreadsheet/docs/references/features-cross-reference.md deleted file mode 100644 index 716a3787..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/references/features-cross-reference.md +++ /dev/null @@ -1,1591 +0,0 @@ -# Features cross reference - -- ✔ Supported -- ● Partially supported -- ✖ Not supported -- N/A Cannot be supported - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ReadersWritersMethods
    XLSXLSXExcel2003XMLOdsGnumericCSVSYLKXLSXLSXOdsCSVHTMLPDFGettersSetters
    Reader Options✔✔●●✔N/AN/AN/AN/AN/AN/AN/AN/A
    Read Data Only (no formatting)✔✔✖✖✔N/AN/AN/AN/AN/AN/AN/AN/A$reader->getReadDataOnly()$reader->setReadDataOnly()
    Read Only Specified Worksheets✔✔✔✔✔N/AN/AN/AN/AN/AN/AN/AN/A$reader->getLoadSheetsOnly()$reader->setLoadSheetsOnly()
    $reader->setLoadAllSheets()
    Read Only Specified Cells✔✔✔✔✔N/AN/AN/AN/AN/AN/AN/AN/A$reader->getReadFilter()$reader->setReadFilter()
    Document Properties●✔✔✔✔N/AN/A●✔✔N/AN/A●
    Standard Properties✔✔✔✔✔N/AN/A✔✔●N/AN/A●
    Creator✔✔✔✔✔N/AN/A✔✔✔N/A✔✔$spreadsheet->getProperties()->getCreator()$spreadsheet->getProperties()->setCreator()
    Creation Date/Time✔✔✔✔✔N/AN/A✔✔✔N/AN/A✖$spreadsheet->getProperties()->getCreated()$spreadsheet->getProperties()->setCreated()
    Modifier✔✔✔N/AN/AN/AN/A✔✔✖N/AN/A✖$spreadsheet->getProperties()->getLastModifiedBy()$spreadsheet->getProperties()->setLastModifiedBy()
    Modified Date/Time✔✔✔✔N/AN/AN/A✔✔✖N/AN/A✖$spreadsheet->getProperties()->getModified()$spreadsheet->getProperties()->setModified()
    Title✔✔✔✔✔N/AN/A✔✔✔N/A✔✔$spreadsheet->getProperties()->getTitle()$spreadsheet->getProperties()->setTitle()
    Description✔✔✔✔✔N/AN/A✔✔✔N/AN/A✖$spreadsheet->getProperties()->getDescription()$spreadsheet->getProperties()->setDescription()
    Subject✔✔✔✔✔N/AN/A✔✔✔N/A✔✔$spreadsheet->getProperties()->getSubject()$spreadsheet->getProperties()->setSubject()
    Keywords✔✔✔✔✔N/AN/A✔✔✔N/A✔✔$spreadsheet->getProperties()->getKeywords()$spreadsheet->getProperties()->setKeywords()
    Extended Properties✔✔✔N/A✔N/AN/A✔●N/AN/A
    Category✔✔✔N/A✔N/AN/A✔✔N/AN/A$spreadsheet->getProperties()->getCategory()$spreadsheet->getProperties()->setCategory()
    Company✔✔✔N/A✔N/AN/A✔✔N/AN/A$spreadsheet->getProperties()->getCompany()$spreadsheet->getProperties()->setCompany()
    Manager✔✔✔N/A✔N/AN/A✔✖N/AN/A$spreadsheet->getProperties()->getManager()$spreadsheet->getProperties()->setManager()
    User-Defined (Custom) Properties✖✔✔✔N/AN/AN/A✔✖N/AN/A$spreadsheet->getProperties()->getCustomProperties()
    $spreadsheet->getProperties()->isCustomPropertySet()
    $spreadsheet->getProperties()->getCustomPropertyValue()
    $spreadsheet->getProperties()->getCustomPropertyType()
    $spreadsheet->getProperties()->setCustomProperty()
    Text Properties✖✔✔✔N/AN/AN/A✔✖N/AN/A
    Number Properties✖✔✔✔N/AN/AN/A✔✖N/AN/A
    Date Properties✖✔✔✔N/AN/AN/A✔✖N/AN/A
    Yes/No (Boolean) Properties✖✔✔✔N/AN/AN/A✔✖N/AN/A
    Cell Data Types●●
    Empty/NULL✔
    Boolean✔
    Integer✔
    Floating Point✔
    String✔
    Error✔
    Formula✔
    Array✖
    Rich Text✔✔✖N/A✖✔N/A
    Conditional Formatting✖✔N/A✖✔N/A
    Rows and Column Properties✔
    Row Height/Column Width✔
    Hidden✔
    Worksheet Properties✖
    Frozen Panes✖
    Coloured TabsN/A
    Drawing hyperlink✔✔$drawing->getHyperlink()->getUrl()$drawing->setHyperlink()->setUrl($url)
    Cell Formatting●
    Number Format Mask✔✔✔
    Alignment✔
    Horizontal✔
    Vertical✔
    Wrapping✔
    Shring-to-Fit✔
    Indent✔
    Background Colour✔●
    Patterned✔
    Font Attributes✔●
    Font Face✔✔
    Font Size✔✔
    Bold✔✔
    Italic✔✔
    Strikethrough✔✖
    Underline✔✔
    Superscript✔✖
    Subscript✔✖
    Borders✔
    Line Style✔
    Position✔
    Diagonal✔
    Hyperlinks✔✔✔✔✖✖✖✔✔✖✖✔✖$cell->getHyperlink()->getUrl($url)$cell->getHyperlink()->setUrl($url)
    http✖
    Merged Cells✔
    Cell Comments●●●●✔N/AN/A✖●●N/A● 1N/A
    Rich Text✖ 2✔✖✖N/AN/AN/A✖✔✖N/AN/A
    Alignment✖ 3✖✖✖N/AN/AN/A✖✖✖N/AN/A
    Cell Validation✔✔✖✖✖N/AN/A✔✔✖N/AN/AN/A$cell->getDataValidation()$cell->setDataValidation()
    AutoFilters●●●●$sheet->getAutoFilter()$sheet->setAutoFilter()
    AutoFilter Expressions✖●✖●
    Filter✖✔✖✔
    Custom Filter✖✔✖✔
    DateGroup Filter✖✔✖✔
    Dynamic Filter✖✔✖✔
    Colour Filter✖✖✖✖
    Icon Filter✖✖✖✖
    Top 10 Filter✖✔✖✔
    Macros✖✔✖✖✖✖✖✖✔✖✖✖✖$spreadsheet->getMacrosCode();$spreadsheet->setMacrosCode();
    Form Controls✖✖✖✖✖✖✖✖✖✖✖✖✖✖✖
    Security●●✖✖✖✖✖✖✖✖✖✖✖✖✖
    Protection (prevent editing)✔✔✖✖✖✖✖✔✔✖✖✖✖$sheet->getProtection()$sheet->getProtection()->setSheet(true)
    Encryption (prevent viewing)✔✖✖✖✖✖✖✖✖✖✖✖✖
    XLSXLSXExcel2003XMLOdsGnumericCSVSYLKXLSXLSXOdsCSVHTMLPDFGettersSetters
    ReadersWritersMethods
    - -1. Only text contents -2. Only BIFF8 files support Rich Text. Prior to that, comments could only be plain text -3. Only BIFF8 files support alignment and rotation. Prior to that, comments could only be unformatted text diff --git a/vendor/phpoffice/phpspreadsheet/docs/references/function-list-by-category.md b/vendor/phpoffice/phpspreadsheet/docs/references/function-list-by-category.md deleted file mode 100644 index 185bf4c0..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/references/function-list-by-category.md +++ /dev/null @@ -1,445 +0,0 @@ -# Function list by category - -## CATEGORY_CUBE - -Excel Function | PhpSpreadsheet Function ---------------------|------------------------------------------- -CUBEKPIMEMBER | **Not yet Implemented** -CUBEMEMBER | **Not yet Implemented** -CUBEMEMBERPROPERTY | **Not yet Implemented** -CUBERANKEDMEMBER | **Not yet Implemented** -CUBESET | **Not yet Implemented** -CUBESETCOUNT | **Not yet Implemented** -CUBEVALUE | **Not yet Implemented** - -## CATEGORY_DATABASE - -Excel Function | PhpSpreadsheet Function ---------------------|------------------------------------------- -DAVERAGE | \PhpOffice\PhpSpreadsheet\Calculation\Database::DAVERAGE -DCOUNT | \PhpOffice\PhpSpreadsheet\Calculation\Database::DCOUNT -DCOUNTA | \PhpOffice\PhpSpreadsheet\Calculation\Database::DCOUNTA -DGET | \PhpOffice\PhpSpreadsheet\Calculation\Database::DGET -DMAX | \PhpOffice\PhpSpreadsheet\Calculation\Database::DMAX -DMIN | \PhpOffice\PhpSpreadsheet\Calculation\Database::DMIN -DPRODUCT | \PhpOffice\PhpSpreadsheet\Calculation\Database::DPRODUCT -DSTDEV | \PhpOffice\PhpSpreadsheet\Calculation\Database::DSTDEV -DSTDEVP | \PhpOffice\PhpSpreadsheet\Calculation\Database::DSTDEVP -DSUM | \PhpOffice\PhpSpreadsheet\Calculation\Database::DSUM -DVAR | \PhpOffice\PhpSpreadsheet\Calculation\Database::DVAR -DVARP | \PhpOffice\PhpSpreadsheet\Calculation\Database::DVARP - -## CATEGORY_DATE_AND_TIME - -Excel Function | PhpSpreadsheet Function ---------------------|------------------------------------------- -DATE | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATE -DATEDIF | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATEDIF -DATEVALUE | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATEVALUE -DAY | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DAYOFMONTH -DAYS360 | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DAYS360 -EDATE | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::EDATE -EOMONTH | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::EOMONTH -HOUR | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::HOUROFDAY -ISOWEEKNUM | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::ISOWEEKNUM -MINUTE | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::MINUTE -MONTH | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::MONTHOFYEAR -NETWORKDAYS | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::NETWORKDAYS -NOW | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATETIMENOW -SECOND | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::SECOND -TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::TIME -TIMEVALUE | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::TIMEVALUE -TODAY | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATENOW -WEEKDAY | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::WEEKDAY -WEEKNUM | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::WEEKNUM -WORKDAY | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::WORKDAY -YEAR | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::YEAR -YEARFRAC | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::YEARFRAC - -## CATEGORY_ENGINEERING - -Excel Function | PhpSpreadsheet Function ---------------------|------------------------------------------- -BESSELI | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELI -BESSELJ | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELJ -BESSELK | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELK -BESSELY | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELY -BIN2DEC | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BINTODEC -BIN2HEX | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BINTOHEX -BIN2OCT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BINTOOCT -COMPLEX | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::COMPLEX -CONVERT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::CONVERTUOM -DEC2BIN | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::DECTOBIN -DEC2HEX | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::DECTOHEX -DEC2OCT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::DECTOOCT -DELTA | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::DELTA -ERF | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::ERF -ERF.PRECISE | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::ERFPRECISE -ERFC | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::ERFC -ERFC.PRECISE | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::ERFC -GESTEP | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::GESTEP -HEX2BIN | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::HEXTOBIN -HEX2DEC | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::HEXTODEC -HEX2OCT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::HEXTOOCT -IMABS | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMABS -IMAGINARY | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMAGINARY -IMARGUMENT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMARGUMENT -IMCONJUGATE | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCONJUGATE -IMCOS | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCOS -IMCOSH | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCOSH -IMCOT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCOT -IMCSC | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCSC -IMCSCH | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCSCH -IMDIV | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMDIV -IMEXP | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMEXP -IMLN | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMLN -IMLOG10 | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMLOG10 -IMLOG2 | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMLOG2 -IMPOWER | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMPOWER -IMPRODUCT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMPRODUCT -IMREAL | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMREAL -IMSEC | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSEC -IMSECH | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSECH -IMSIN | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSIN -IMSINH | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSINH -IMSQRT | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSQRT -IMSUB | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSUB -IMSUM | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSUM -IMTAN | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMTAN -OCT2BIN | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::OCTTOBIN -OCT2DEC | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::OCTTODEC -OCT2HEX | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::OCTTOHEX - -## CATEGORY_FINANCIAL - -Excel Function | PhpSpreadsheet Function ---------------------|------------------------------------------- -ACCRINT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::ACCRINT -ACCRINTM | \PhpOffice\PhpSpreadsheet\Calculation\Financial::ACCRINTM -AMORDEGRC | \PhpOffice\PhpSpreadsheet\Calculation\Financial::AMORDEGRC -AMORLINC | \PhpOffice\PhpSpreadsheet\Calculation\Financial::AMORLINC -COUPDAYBS | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPDAYBS -COUPDAYS | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPDAYS -COUPDAYSNC | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPDAYSNC -COUPNCD | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPNCD -COUPNUM | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPNUM -COUPPCD | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPPCD -CUMIPMT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::CUMIPMT -CUMPRINC | \PhpOffice\PhpSpreadsheet\Calculation\Financial::CUMPRINC -DB | \PhpOffice\PhpSpreadsheet\Calculation\Financial::DB -DDB | \PhpOffice\PhpSpreadsheet\Calculation\Financial::DDB -DISC | \PhpOffice\PhpSpreadsheet\Calculation\Financial::DISC -DOLLARDE | \PhpOffice\PhpSpreadsheet\Calculation\Financial::DOLLARDE -DOLLARFR | \PhpOffice\PhpSpreadsheet\Calculation\Financial::DOLLARFR -DURATION | **Not yet Implemented** -EFFECT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::EFFECT -FV | \PhpOffice\PhpSpreadsheet\Calculation\Financial::FV -FVSCHEDULE | \PhpOffice\PhpSpreadsheet\Calculation\Financial::FVSCHEDULE -INTRATE | \PhpOffice\PhpSpreadsheet\Calculation\Financial::INTRATE -IPMT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::IPMT -IRR | \PhpOffice\PhpSpreadsheet\Calculation\Financial::IRR -ISPMT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::ISPMT -MDURATION | **Not yet Implemented** -MIRR | \PhpOffice\PhpSpreadsheet\Calculation\Financial::MIRR -NOMINAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::NOMINAL -NPER | \PhpOffice\PhpSpreadsheet\Calculation\Financial::NPER -NPV | \PhpOffice\PhpSpreadsheet\Calculation\Financial::NPV -ODDFPRICE | **Not yet Implemented** -ODDFYIELD | **Not yet Implemented** -ODDLPRICE | **Not yet Implemented** -ODDLYIELD | **Not yet Implemented** -PDURATION | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PDURATION -PMT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PMT -PPMT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PPMT -PRICE | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PRICE -PRICEDISC | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PRICEDISC -PRICEMAT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PRICEMAT -PV | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PV -RATE | \PhpOffice\PhpSpreadsheet\Calculation\Financial::RATE -RECEIVED | \PhpOffice\PhpSpreadsheet\Calculation\Financial::RECEIVED -RRI | \PhpOffice\PhpSpreadsheet\Calculation\Financial::RRI -SLN | \PhpOffice\PhpSpreadsheet\Calculation\Financial::SLN -SYD | \PhpOffice\PhpSpreadsheet\Calculation\Financial::SYD -TBILLEQ | \PhpOffice\PhpSpreadsheet\Calculation\Financial::TBILLEQ -TBILLPRICE | \PhpOffice\PhpSpreadsheet\Calculation\Financial::TBILLPRICE -TBILLYIELD | \PhpOffice\PhpSpreadsheet\Calculation\Financial::TBILLYIELD -USDOLLAR | **Not yet Implemented** -VDB | **Not yet Implemented** -XIRR | \PhpOffice\PhpSpreadsheet\Calculation\Financial::XIRR -XNPV | \PhpOffice\PhpSpreadsheet\Calculation\Financial::XNPV -YIELD | **Not yet Implemented** -YIELDDISC | \PhpOffice\PhpSpreadsheet\Calculation\Financial::YIELDDISC -YIELDMAT | \PhpOffice\PhpSpreadsheet\Calculation\Financial::YIELDMAT - -## CATEGORY_INFORMATION - -Excel Function | PhpSpreadsheet Function ---------------------|------------------------------------------- -CELL | **Not yet Implemented** -ERROR.TYPE | \PhpOffice\PhpSpreadsheet\Calculation\Functions::ERROR_TYPE -INFO | **Not yet Implemented** -ISBLANK | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_BLANK -ISERR | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_ERR -ISERROR | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_ERROR -ISEVEN | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_EVEN -ISFORMULA | \PhpOffice\PhpSpreadsheet\Calculation\Functions::ISFORMULA -ISLOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_LOGICAL -ISNA | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_NA -ISNONTEXT | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_NONTEXT -ISNUMBER | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_NUMBER -ISODD | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_ODD -ISREF | **Not yet Implemented** -ISTEXT | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_TEXT -N | \PhpOffice\PhpSpreadsheet\Calculation\Functions::N -NA | \PhpOffice\PhpSpreadsheet\Calculation\Functions::NA -TYPE | \PhpOffice\PhpSpreadsheet\Calculation\Functions::TYPE - -## CATEGORY_LOGICAL - -Excel Function | PhpSpreadsheet Function ---------------------|------------------------------------------- -AND | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalAnd -FALSE | \PhpOffice\PhpSpreadsheet\Calculation\Logical::FALSE -IF | \PhpOffice\PhpSpreadsheet\Calculation\Logical::STATEMENT_IF -IFERROR | \PhpOffice\PhpSpreadsheet\Calculation\Logical::IFERROR -NOT | \PhpOffice\PhpSpreadsheet\Calculation\Logical::NOT -OR | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalOr -TRUE | \PhpOffice\PhpSpreadsheet\Calculation\Logical::TRUE -XOR | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalXor - -## CATEGORY_LOOKUP_AND_REFERENCE - -Excel Function | PhpSpreadsheet Function ---------------------|------------------------------------------- -ADDRESS | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::CELL_ADDRESS -AREAS | **Not yet Implemented** -CHOOSE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::CHOOSE -COLUMN | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::COLUMN -COLUMNS | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::COLUMNS -FORMULATEXT | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::FORMULATEXT -GETPIVOTDATA | **Not yet Implemented** -HLOOKUP | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::HLOOKUP -HYPERLINK | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::HYPERLINK -INDEX | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::INDEX -INDIRECT | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::INDIRECT -LOOKUP | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::LOOKUP -MATCH | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::MATCH -OFFSET | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::OFFSET -ROW | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::ROW -ROWS | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::ROWS -RTD | **Not yet Implemented** -TRANSPOSE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::TRANSPOSE -VLOOKUP | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::VLOOKUP - -## CATEGORY_MATH_AND_TRIG - -Excel Function | PhpSpreadsheet Function ---------------------|------------------------------------------- -ABS | abs -ACOS | acos -ACOSH | acosh -ACOT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ACOT -ACOTH | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ACOTH -ASIN | asin -ASINH | asinh -ATAN | atan -ATAN2 | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::REVERSE_ATAN2 -ATANH | atanh -CEILING | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::CEILING -COMBIN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::COMBIN -COS | cos -COSH | cosh -COT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::COT -COTH | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::COTH -CSC | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::CSC -CSCH | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::CSCH -DEGREES | rad2deg -EVEN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::EVEN -EXP | exp -FACT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::FACT -FACTDOUBLE | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::FACTDOUBLE -FLOOR | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::FLOOR -GCD | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::GCD -INT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::INT -LCM | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::LCM -LN | log -LOG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::LOG_BASE -LOG10 | log10 -MDETERM | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MDETERM -MINVERSE | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MINVERSE -MMULT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MMULT -MOD | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MOD -MROUND | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MROUND -MULTINOMIAL | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MULTINOMIAL -ODD | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ODD -PI | pi -POWER | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::POWER -PRODUCT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::PRODUCT -QUOTIENT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::QUOTIENT -RADIANS | deg2rad -RAND | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::RAND -RANDBETWEEN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::RAND -ROMAN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ROMAN -ROUND | round -ROUNDDOWN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ROUNDDOWN -ROUNDUP | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ROUNDUP -SEC | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SEC -SECH | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SECH -SERIESSUM | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SERIESSUM -SIGN | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SIGN -SIN | sin -SINH | sinh -SQRT | sqrt -SQRTPI | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SQRTPI -SUBTOTAL | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUBTOTAL -SUM | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUM -SUMIF | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMIF -SUMIFS | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMIFS -SUMPRODUCT | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMPRODUCT -SUMSQ | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMSQ -SUMX2MY2 | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMX2MY2 -SUMX2PY2 | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMX2PY2 -SUMXMY2 | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMXMY2 -TAN | tan -TANH | tanh -TRUNC | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::TRUNC - -## CATEGORY_STATISTICAL - -Excel Function | PhpSpreadsheet Function ---------------------|------------------------------------------- -AVEDEV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::AVEDEV -AVERAGE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::AVERAGE -AVERAGEA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::AVERAGEA -AVERAGEIF | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::AVERAGEIF -AVERAGEIFS | **Not yet Implemented** -BETADIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::BETADIST -BETAINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::BETAINV -BINOMDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::BINOMDIST -CHIDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CHIDIST -CHIINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CHIINV -CHITEST | **Not yet Implemented** -CONFIDENCE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CONFIDENCE -CORREL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CORREL -COUNT | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COUNT -COUNTA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COUNTA -COUNTBLANK | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COUNTBLANK -COUNTIF | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COUNTIF -COUNTIFS | **Not yet Implemented** -COVAR | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COVAR -CRITBINOM | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CRITBINOM -DEVSQ | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::DEVSQ -EXPONDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::EXPONDIST -FDIST | **Not yet Implemented** -FINV | **Not yet Implemented** -FISHER | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::FISHER -FISHERINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::FISHERINV -FORECAST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::FORECAST -FREQUENCY | **Not yet Implemented** -FTEST | **Not yet Implemented** -GAMMADIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GAMMADIST -GAMMAINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GAMMAINV -GAMMALN | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GAMMALN -GEOMEAN | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GEOMEAN -GROWTH | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GROWTH -HARMEAN | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::HARMEAN -HYPGEOMDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::HYPGEOMDIST -INTERCEPT | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::INTERCEPT -KURT | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::KURT -LARGE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LARGE -LINEST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LINEST -LOGEST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LOGEST -LOGINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LOGINV -LOGNORMDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LOGNORMDIST -MAX | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MAX -MAXA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MAXA -MAXIF | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MAXIF -MEDIAN | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MEDIAN -MEDIANIF | **Not yet Implemented** -MIN | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MIN -MINA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MINA -MINIF | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MINIF -MODE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MODE -MODE.SNGL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MODE -NEGBINOMDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NEGBINOMDIST -NORMDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NORMDIST -NORMINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NORMINV -NORMSDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NORMSDIST -NORMSINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NORMSINV -PEARSON | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CORREL -PERCENTILE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::PERCENTILE -PERCENTRANK | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::PERCENTRANK -PERMUT | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::PERMUT -POISSON | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::POISSON -PROB | **Not yet Implemented** -QUARTILE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::QUARTILE -RANK | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::RANK -RSQ | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::RSQ -SKEW | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::SKEW -SLOPE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::SLOPE -SMALL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::SMALL -STANDARDIZE | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STANDARDIZE -STDEV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEV -STDEV.S | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEV -STDEV.P | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVP -STDEVA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVA -STDEVP | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVP -STDEVPA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVPA -STEYX | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STEYX -TDIST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::TDIST -TINV | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::TINV -TREND | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::TREND -TRIMMEAN | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::TRIMMEAN -TTEST | **Not yet Implemented** -VAR | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARFunc -VAR.P | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARP -VAR.S | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARFunc -VARA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARA -VARP | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARP -VARPA | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARPA -WEIBULL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::WEIBULL -ZTEST | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::ZTEST - -## CATEGORY_TEXT_AND_DATA - -Excel Function | PhpSpreadsheet Function ---------------------|------------------------------------------- -ASC | **Not yet Implemented** -BAHTTEXT | **Not yet Implemented** -CHAR | \PhpOffice\PhpSpreadsheet\Calculation\TextData::CHARACTER -CLEAN | \PhpOffice\PhpSpreadsheet\Calculation\TextData::TRIMNONPRINTABLE -CODE | \PhpOffice\PhpSpreadsheet\Calculation\TextData::ASCIICODE -CONCAT | \PhpOffice\PhpSpreadsheet\Calculation\TextData::CONCATENATE -CONCATENATE | \PhpOffice\PhpSpreadsheet\Calculation\TextData::CONCATENATE -DOLLAR | \PhpOffice\PhpSpreadsheet\Calculation\TextData::DOLLAR -EXACT | \PhpOffice\PhpSpreadsheet\Calculation\TextData::EXACT -FIND | \PhpOffice\PhpSpreadsheet\Calculation\TextData::SEARCHSENSITIVE -FINDB | \PhpOffice\PhpSpreadsheet\Calculation\TextData::SEARCHSENSITIVE -FIXED | \PhpOffice\PhpSpreadsheet\Calculation\TextData::FIXEDFORMAT -JIS | **Not yet Implemented** -LEFT | \PhpOffice\PhpSpreadsheet\Calculation\TextData::LEFT -LEFTB | \PhpOffice\PhpSpreadsheet\Calculation\TextData::LEFT -LEN | \PhpOffice\PhpSpreadsheet\Calculation\TextData::STRINGLENGTH -LENB | \PhpOffice\PhpSpreadsheet\Calculation\TextData::STRINGLENGTH -LOWER | \PhpOffice\PhpSpreadsheet\Calculation\TextData::LOWERCASE -MID | \PhpOffice\PhpSpreadsheet\Calculation\TextData::MID -MIDB | \PhpOffice\PhpSpreadsheet\Calculation\TextData::MID -NUMBERVALUE | \PhpOffice\PhpSpreadsheet\Calculation\TextData::NUMBERVALUE -PHONETIC | **Not yet Implemented** -PROPER | \PhpOffice\PhpSpreadsheet\Calculation\TextData::PROPERCASE -REPLACE | \PhpOffice\PhpSpreadsheet\Calculation\TextData::REPLACE -REPLACEB | \PhpOffice\PhpSpreadsheet\Calculation\TextData::REPLACE -REPT | str_repeat -RIGHT | \PhpOffice\PhpSpreadsheet\Calculation\TextData::RIGHT -RIGHTB | \PhpOffice\PhpSpreadsheet\Calculation\TextData::RIGHT -SEARCH | \PhpOffice\PhpSpreadsheet\Calculation\TextData::SEARCHINSENSITIVE -SEARCHB | \PhpOffice\PhpSpreadsheet\Calculation\TextData::SEARCHINSENSITIVE -SUBSTITUTE | \PhpOffice\PhpSpreadsheet\Calculation\TextData::SUBSTITUTE -T | \PhpOffice\PhpSpreadsheet\Calculation\TextData::RETURNSTRING -TEXT | \PhpOffice\PhpSpreadsheet\Calculation\TextData::TEXTFORMAT -TEXTJOIN | \PhpOffice\PhpSpreadsheet\Calculation\TextData::TEXTJOIN -TRIM | \PhpOffice\PhpSpreadsheet\Calculation\TextData::TRIMSPACES -UNICHAR | \PhpOffice\PhpSpreadsheet\Calculation\TextData::CHARACTER -UNICODE | \PhpOffice\PhpSpreadsheet\Calculation\TextData::ASCIICODE -UPPER | \PhpOffice\PhpSpreadsheet\Calculation\TextData::UPPERCASE -VALUE | \PhpOffice\PhpSpreadsheet\Calculation\TextData::VALUE diff --git a/vendor/phpoffice/phpspreadsheet/docs/references/function-list-by-name.md b/vendor/phpoffice/phpspreadsheet/docs/references/function-list-by-name.md deleted file mode 100644 index a8caca6c..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/references/function-list-by-name.md +++ /dev/null @@ -1,521 +0,0 @@ -# Function list by name - -## A - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -ABS | CATEGORY_MATH_AND_TRIG | abs -ACCRINT | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::ACCRINT -ACCRINTM | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::ACCRINTM -ACOS | CATEGORY_MATH_AND_TRIG | acos -ACOSH | CATEGORY_MATH_AND_TRIG | acosh -ACOT | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ACOT -ACOTH | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ACOTH -ADDRESS | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::CELL_ADDRESS -AMORDEGRC | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::AMORDEGRC -AMORLINC | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::AMORLINC -AND | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalAnd -AREAS | CATEGORY_LOOKUP_AND_REFERENCE | **Not yet Implemented** -ASC | CATEGORY_TEXT_AND_DATA | **Not yet Implemented** -ASIN | CATEGORY_MATH_AND_TRIG | asin -ASINH | CATEGORY_MATH_AND_TRIG | asinh -ATAN | CATEGORY_MATH_AND_TRIG | atan -ATAN2 | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::REVERSE_ATAN2 -ATANH | CATEGORY_MATH_AND_TRIG | atanh -AVEDEV | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::AVEDEV -AVERAGE | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::AVERAGE -AVERAGEA | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::AVERAGEA -AVERAGEIF | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::AVERAGEIF -AVERAGEIFS | CATEGORY_STATISTICAL | **Not yet Implemented** - -## B - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -BAHTTEXT | CATEGORY_TEXT_AND_DATA | **Not yet Implemented** -BESSELI | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELI -BESSELJ | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELJ -BESSELK | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELK -BESSELY | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BESSELY -BETADIST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::BETADIST -BETAINV | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::BETAINV -BIN2DEC | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BINTODEC -BIN2HEX | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BINTOHEX -BIN2OCT | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::BINTOOCT -BINOMDIST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::BINOMDIST - -## C - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -CEILING | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::CEILING -CELL | CATEGORY_INFORMATION | **Not yet Implemented** -CHAR | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::CHARACTER -CHIDIST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CHIDIST -CHIINV | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CHIINV -CHITEST | CATEGORY_STATISTICAL | **Not yet Implemented** -CHOOSE | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::CHOOSE -CLEAN | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::TRIMNONPRINTABLE -CODE | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::ASCIICODE -COLUMN | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::COLUMN -COLUMNS | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::COLUMNS -COMBIN | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::COMBIN -COMPLEX | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::COMPLEX -CONCAT | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::CONCATENATE -CONCATENATE | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::CONCATENATE -CONFIDENCE | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CONFIDENCE -CONVERT | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::CONVERTUOM -CORREL | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CORREL -COS | CATEGORY_MATH_AND_TRIG | cos -COSH | CATEGORY_MATH_AND_TRIG | cosh -COT | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::COT -COTH | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::COTH -COUNT | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COUNT -COUNTA | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COUNTA -COUNTBLANK | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COUNTBLANK -COUNTIF | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COUNTIF -COUNTIFS | CATEGORY_STATISTICAL | **Not yet Implemented** -COUPDAYBS | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPDAYBS -COUPDAYS | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPDAYS -COUPDAYSNC | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPDAYSNC -COUPNCD | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPNCD -COUPNUM | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPNUM -COUPPCD | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::COUPPCD -COVAR | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::COVAR -CRITBINOM | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CRITBINOM -CSC | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::CSC -CSCH | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::CSCH -CUBEKPIMEMBER | CATEGORY_CUBE | **Not yet Implemented** -CUBEMEMBER | CATEGORY_CUBE | **Not yet Implemented** -CUBEMEMBERPROPERTY | CATEGORY_CUBE | **Not yet Implemented** -CUBERANKEDMEMBER | CATEGORY_CUBE | **Not yet Implemented** -CUBESET | CATEGORY_CUBE | **Not yet Implemented** -CUBESETCOUNT | CATEGORY_CUBE | **Not yet Implemented** -CUBEVALUE | CATEGORY_CUBE | **Not yet Implemented** -CUMIPMT | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::CUMIPMT -CUMPRINC | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::CUMPRINC - -## D - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -DATE | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATE -DATEDIF | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATEDIF -DATEVALUE | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATEVALUE -DAVERAGE | CATEGORY_DATABASE | \PhpOffice\PhpSpreadsheet\Calculation\Database::DAVERAGE -DAY | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DAYOFMONTH -DAYS360 | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DAYS360 -DB | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::DB -DCOUNT | CATEGORY_DATABASE | \PhpOffice\PhpSpreadsheet\Calculation\Database::DCOUNT -DCOUNTA | CATEGORY_DATABASE | \PhpOffice\PhpSpreadsheet\Calculation\Database::DCOUNTA -DDB | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::DDB -DEC2BIN | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::DECTOBIN -DEC2HEX | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::DECTOHEX -DEC2OCT | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::DECTOOCT -DEGREES | CATEGORY_MATH_AND_TRIG | rad2deg -DELTA | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::DELTA -DEVSQ | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::DEVSQ -DGET | CATEGORY_DATABASE | \PhpOffice\PhpSpreadsheet\Calculation\Database::DGET -DISC | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::DISC -DMAX | CATEGORY_DATABASE | \PhpOffice\PhpSpreadsheet\Calculation\Database::DMAX -DMIN | CATEGORY_DATABASE | \PhpOffice\PhpSpreadsheet\Calculation\Database::DMIN -DOLLAR | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::DOLLAR -DOLLARDE | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::DOLLARDE -DOLLARFR | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::DOLLARFR -DPRODUCT | CATEGORY_DATABASE | \PhpOffice\PhpSpreadsheet\Calculation\Database::DPRODUCT -DSTDEV | CATEGORY_DATABASE | \PhpOffice\PhpSpreadsheet\Calculation\Database::DSTDEV -DSTDEVP | CATEGORY_DATABASE | \PhpOffice\PhpSpreadsheet\Calculation\Database::DSTDEVP -DSUM | CATEGORY_DATABASE | \PhpOffice\PhpSpreadsheet\Calculation\Database::DSUM -DURATION | CATEGORY_FINANCIAL | **Not yet Implemented** -DVAR | CATEGORY_DATABASE | \PhpOffice\PhpSpreadsheet\Calculation\Database::DVAR -DVARP | CATEGORY_DATABASE | \PhpOffice\PhpSpreadsheet\Calculation\Database::DVARP - -## E - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -EDATE | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::EDATE -EFFECT | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::EFFECT -EOMONTH | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::EOMONTH -ERF | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::ERF -ERF.PRECISE | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::ERFPRECISE -ERFC | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::ERFC -ERFC.PRECISE | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::ERFC -ERROR.TYPE | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::ERROR_TYPE -EVEN | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::EVEN -EXACT | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::EXACT -EXP | CATEGORY_MATH_AND_TRIG | exp -EXPONDIST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::EXPONDIST - -## F - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -FACT | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::FACT -FACTDOUBLE | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::FACTDOUBLE -FALSE | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::FALSE -FDIST | CATEGORY_STATISTICAL | **Not yet Implemented** -FIND | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::SEARCHSENSITIVE -FINDB | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::SEARCHSENSITIVE -FINV | CATEGORY_STATISTICAL | **Not yet Implemented** -FISHER | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::FISHER -FISHERINV | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::FISHERINV -FIXED | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::FIXEDFORMAT -FLOOR | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::FLOOR -FORECAST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::FORECAST -FORMULATEXT | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::FORMULATEXT -FREQUENCY | CATEGORY_STATISTICAL | **Not yet Implemented** -FTEST | CATEGORY_STATISTICAL | **Not yet Implemented** -FV | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::FV -FVSCHEDULE | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::FVSCHEDULE - -## G - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -GAMMADIST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GAMMADIST -GAMMAINV | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GAMMAINV -GAMMALN | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GAMMALN -GCD | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::GCD -GEOMEAN | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GEOMEAN -GESTEP | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::GESTEP -GETPIVOTDATA | CATEGORY_LOOKUP_AND_REFERENCE | **Not yet Implemented** -GROWTH | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::GROWTH - -## H - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -HARMEAN | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::HARMEAN -HEX2BIN | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::HEXTOBIN -HEX2DEC | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::HEXTODEC -HEX2OCT | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::HEXTOOCT -HLOOKUP | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::HLOOKUP -HOUR | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::HOUROFDAY -HYPERLINK | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::HYPERLINK -HYPGEOMDIST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::HYPGEOMDIST - -## I - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -IF | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::STATEMENT_IF -IFERROR | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::IFERROR -IMABS | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMABS -IMAGINARY | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMAGINARY -IMARGUMENT | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMARGUMENT -IMCONJUGATE | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCONJUGATE -IMCOS | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCOS -IMCOSH | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCOSH -IMCOT | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCOT -IMCSC | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCSC -IMCSCH | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMCSCH -IMDIV | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMDIV -IMEXP | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMEXP -IMLN | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMLN -IMLOG10 | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMLOG10 -IMLOG2 | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMLOG2 -IMPOWER | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMPOWER -IMPRODUCT | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMPRODUCT -IMREAL | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMREAL -IMSEC | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSEC -IMSECH | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSECH -IMSIN | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSIN -IMSINH | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSINH -IMSQRT | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSQRT -IMSUB | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSUB -IMSUM | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMSUM -IMTAN | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::IMTAN -INDEX | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::INDEX -INDIRECT | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::INDIRECT -INFO | CATEGORY_INFORMATION | **Not yet Implemented** -INT | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::INT -INTERCEPT | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::INTERCEPT -INTRATE | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::INTRATE -IPMT | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::IPMT -IRR | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::IRR -ISBLANK | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_BLANK -ISERR | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_ERR -ISERROR | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_ERROR -ISEVEN | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_EVEN -ISFORMULA | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::ISFORMULA -ISLOGICAL | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_LOGICAL -ISNA | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_NA -ISNONTEXT | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_NONTEXT -ISNUMBER | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_NUMBER -ISODD | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_ODD -ISOWEEKNUM | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::ISOWEEKNUM -ISPMT | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::ISPMT -ISREF | CATEGORY_INFORMATION | **Not yet Implemented** -ISTEXT | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::IS_TEXT - -## J - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -JIS | CATEGORY_TEXT_AND_DATA | **Not yet Implemented** - -## K - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -KURT | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::KURT - -## L - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -LARGE | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LARGE -LCM | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::LCM -LEFT | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::LEFT -LEFTB | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::LEFT -LEN | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::STRINGLENGTH -LENB | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::STRINGLENGTH -LINEST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LINEST -LN | CATEGORY_MATH_AND_TRIG | log -LOG | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::LOG_BASE -LOG10 | CATEGORY_MATH_AND_TRIG | log10 -LOGEST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LOGEST -LOGINV | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LOGINV -LOGNORMDIST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::LOGNORMDIST -LOOKUP | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::LOOKUP -LOWER | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::LOWERCASE - -## M - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -MATCH | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::MATCH -MAX | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MAX -MAXA | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MAXA -MAXIF | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MAXIF -MDETERM | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MDETERM -MDURATION | CATEGORY_FINANCIAL | **Not yet Implemented** -MEDIAN | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MEDIAN -MEDIANIF | CATEGORY_STATISTICAL | **Not yet Implemented** -MID | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::MID -MIDB | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::MID -MIN | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MIN -MINA | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MINA -MINIF | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MINIF -MINUTE | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::MINUTE -MINVERSE | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MINVERSE -MIRR | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::MIRR -MMULT | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MMULT -MOD | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MOD -MODE | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MODE -MODE.SNGL | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::MODE -MONTH | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::MONTHOFYEAR -MROUND | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MROUND -MULTINOMIAL | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::MULTINOMIAL - -## N - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -N | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::N -NA | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::NA -NEGBINOMDIST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NEGBINOMDIST -NETWORKDAYS | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::NETWORKDAYS -NOMINAL | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::NOMINAL -NORMDIST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NORMDIST -NORMINV | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NORMINV -NORMSDIST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NORMSDIST -NORMSINV | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::NORMSINV -NOT | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::NOT -NOW | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATETIMENOW -NPER | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::NPER -NPV | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::NPV -NUMBERVALUE | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::NUMBERVALUE - -## O - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -OCT2BIN | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::OCTTOBIN -OCT2DEC | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::OCTTODEC -OCT2HEX | CATEGORY_ENGINEERING | \PhpOffice\PhpSpreadsheet\Calculation\Engineering::OCTTOHEX -ODD | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ODD -ODDFPRICE | CATEGORY_FINANCIAL | **Not yet Implemented** -ODDFYIELD | CATEGORY_FINANCIAL | **Not yet Implemented** -ODDLPRICE | CATEGORY_FINANCIAL | **Not yet Implemented** -ODDLYIELD | CATEGORY_FINANCIAL | **Not yet Implemented** -OFFSET | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::OFFSET -OR | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalOr - -## P - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -PDURATION | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PDURATION -PEARSON | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::CORREL -PERCENTILE | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::PERCENTILE -PERCENTRANK | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::PERCENTRANK -PERMUT | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::PERMUT -PHONETIC | CATEGORY_TEXT_AND_DATA | **Not yet Implemented** -PI | CATEGORY_MATH_AND_TRIG | pi -PMT | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PMT -POISSON | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::POISSON -POWER | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::POWER -PPMT | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PPMT -PRICE | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PRICE -PRICEDISC | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PRICEDISC -PRICEMAT | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PRICEMAT -PROB | CATEGORY_STATISTICAL | **Not yet Implemented** -PRODUCT | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::PRODUCT -PROPER | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::PROPERCASE -PV | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::PV - -## Q - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -QUARTILE | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::QUARTILE -QUOTIENT | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::QUOTIENT - -## R - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -RADIANS | CATEGORY_MATH_AND_TRIG | deg2rad -RAND | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::RAND -RANDBETWEEN | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::RAND -RANK | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::RANK -RATE | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::RATE -RECEIVED | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::RECEIVED -REPLACE | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::REPLACE -REPLACEB | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::REPLACE -REPT | CATEGORY_TEXT_AND_DATA | str_repeat -RIGHT | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::RIGHT -RIGHTB | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::RIGHT -ROMAN | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ROMAN -ROUND | CATEGORY_MATH_AND_TRIG | round -ROUNDDOWN | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ROUNDDOWN -ROUNDUP | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::ROUNDUP -ROW | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::ROW -ROWS | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::ROWS -RRI | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::RRI -RSQ | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::RSQ -RTD | CATEGORY_LOOKUP_AND_REFERENCE | **Not yet Implemented** - -## S - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -SEARCH | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::SEARCHINSENSITIVE -SEARCHB | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::SEARCHINSENSITIVE -SEC | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SEC -SECH | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SECH -SECOND | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::SECOND -SERIESSUM | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SERIESSUM -SIGN | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SIGN -SIN | CATEGORY_MATH_AND_TRIG | sin -SINH | CATEGORY_MATH_AND_TRIG | sinh -SKEW | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::SKEW -SLN | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::SLN -SLOPE | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::SLOPE -SMALL | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::SMALL -SQRT | CATEGORY_MATH_AND_TRIG | sqrt -SQRTPI | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SQRTPI -STANDARDIZE | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STANDARDIZE -STDEV | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEV -STDEV.S | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEV -STDEV.P | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVP -STDEVA | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVA -STDEVP | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVP -STDEVPA | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STDEVPA -STEYX | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::STEYX -SUBSTITUTE | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::SUBSTITUTE -SUBTOTAL | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUBTOTAL -SUM | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUM -SUMIF | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMIF -SUMIFS | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMIFS -SUMPRODUCT | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMPRODUCT -SUMSQ | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMSQ -SUMX2MY2 | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMX2MY2 -SUMX2PY2 | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMX2PY2 -SUMXMY2 | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::SUMXMY2 -SYD | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::SYD - -## T - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -T | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::RETURNSTRING -TAN | CATEGORY_MATH_AND_TRIG | tan -TANH | CATEGORY_MATH_AND_TRIG | tanh -TBILLEQ | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::TBILLEQ -TBILLPRICE | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::TBILLPRICE -TBILLYIELD | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::TBILLYIELD -TDIST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::TDIST -TEXT | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::TEXTFORMAT -TEXTJOIN | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::TEXTJOIN -TIME | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::TIME -TIMEVALUE | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::TIMEVALUE -TINV | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::TINV -TODAY | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::DATENOW -TRANSPOSE | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::TRANSPOSE -TREND | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::TREND -TRIM | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::TRIMSPACES -TRIMMEAN | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::TRIMMEAN -TRUE | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::TRUE -TRUNC | CATEGORY_MATH_AND_TRIG | \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::TRUNC -TTEST | CATEGORY_STATISTICAL | **Not yet Implemented** -TYPE | CATEGORY_INFORMATION | \PhpOffice\PhpSpreadsheet\Calculation\Functions::TYPE - -## U - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -UNICHAR | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::CHARACTER -UNICODE | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::ASCIICODE -UPPER | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::UPPERCASE -USDOLLAR | CATEGORY_FINANCIAL | **Not yet Implemented** - -## V - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -VALUE | CATEGORY_TEXT_AND_DATA | \PhpOffice\PhpSpreadsheet\Calculation\TextData::VALUE -VAR | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARFunc -VAR.P | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARP -VAR.S | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARFunc -VARA | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARA -VARP | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARP -VARPA | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::VARPA -VDB | CATEGORY_FINANCIAL | **Not yet Implemented** -VLOOKUP | CATEGORY_LOOKUP_AND_REFERENCE | \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::VLOOKUP - -## W - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -WEEKDAY | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::WEEKDAY -WEEKNUM | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::WEEKNUM -WEIBULL | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::WEIBULL -WORKDAY | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::WORKDAY - -## X - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -XIRR | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::XIRR -XNPV | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::XNPV -XOR | CATEGORY_LOGICAL | \PhpOffice\PhpSpreadsheet\Calculation\Logical::logicalXor - - -## Y - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -YEAR | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::YEAR -YEARFRAC | CATEGORY_DATE_AND_TIME | \PhpOffice\PhpSpreadsheet\Calculation\DateTime::YEARFRAC -YIELD | CATEGORY_FINANCIAL | **Not yet Implemented** -YIELDDISC | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::YIELDDISC -YIELDMAT | CATEGORY_FINANCIAL | \PhpOffice\PhpSpreadsheet\Calculation\Financial::YIELDMAT - -## Z - -Excel Function | Category | PhpSpreadsheet Function ---------------------|--------------------------------|------------------------------------------- -ZTEST | CATEGORY_STATISTICAL | \PhpOffice\PhpSpreadsheet\Calculation\Statistical::ZTEST diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/accessing-cells.md b/vendor/phpoffice/phpspreadsheet/docs/topics/accessing-cells.md deleted file mode 100644 index f14e2bde..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/topics/accessing-cells.md +++ /dev/null @@ -1,474 +0,0 @@ -# Accessing cells - -Accessing cells in a Spreadsheet should be pretty straightforward. This -topic lists some of the options to access a cell. - -## Setting a cell value by coordinate - -Setting a cell value by coordinate can be done using the worksheet's -`setCellValue()` method. - -``` php -// Set cell A1 with a string value -$spreadsheet->getActiveSheet()->setCellValue('A1', 'PhpSpreadsheet'); - -// Set cell A2 with a numeric value -$spreadsheet->getActiveSheet()->setCellValue('A2', 12345.6789); - -// Set cell A3 with a boolean value -$spreadsheet->getActiveSheet()->setCellValue('A3', TRUE); - -// Set cell A4 with a formula -$spreadsheet->getActiveSheet()->setCellValue( - 'A4', - '=IF(A3, CONCATENATE(A1, " ", A2), CONCATENATE(A2, " ", A1))' -); -``` - -Alternatively, you can retrieve the cell object, and then call the -cell’s `setValue()` method: - -``` php -$spreadsheet->getActiveSheet() - ->getCell('B8') - ->setValue('Some value'); -``` - -## Excel DataTypes - -MS Excel supports 7 basic datatypes: - -- string -- number -- boolean -- null -- formula -- error -- Inline (or rich text) string - -By default, when you call the worksheet's `setCellValue()` method or the -cell's `setValue()` method, PhpSpreadsheet will use the appropriate -datatype for PHP nulls, booleans, floats or integers; or cast any string -data value that you pass to the method into the most appropriate -datatype, so numeric strings will be cast to numbers, while string -values beginning with `=` will be converted to a formula. Strings that -aren't numeric, or that don't begin with a leading `=` will be treated -as genuine string values. - -This "conversion" is handled by a cell "value binder", and you can write -custom "value binders" to change the behaviour of these "conversions". -The standard PhpSpreadsheet package also provides an "advanced value -binder" that handles a number of more complex conversions, such as -converting strings with a fractional format like "3/4" to a number value -(0.75 in this case) and setting an appropriate "fraction" number format -mask. Similarly, strings like "5%" will be converted to a value of 0.05, -and a percentage number format mask applied, and strings containing -values that look like dates will be converted to Excel serialized -datetimestamp values, and a corresponding mask applied. This is -particularly useful when loading data from csv files, or setting cell -values from a database. - -Formats handled by the advanced value binder include: - -- TRUE or FALSE (dependent on locale settings) are converted to booleans. -- Numeric strings identified as scientific (exponential) format are - converted to numbers. -- Fractions and vulgar fractions are converted to numbers, and - an appropriate number format mask applied. -- Percentages are converted - to numbers, divided by 100, and an appropriate number format mask - applied. -- Dates and times are converted to Excel timestamp values - (numbers), and an appropriate number format mask applied. -- When strings contain a newline character (`\n`), then the cell styling is - set to wrap. - -You can read more about value binders later in this section of the -documentation. - -### Setting a date and/or time value in a cell - -Date or time values are held as timestamp in Excel (a simple floating -point value), and a number format mask is used to show how that value -should be formatted; so if we want to store a date in a cell, we need to -calculate the correct Excel timestamp, and set a number format mask. - -``` php -// Get the current date/time and convert to an Excel date/time -$dateTimeNow = time(); -$excelDateValue = \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel( $dateTimeNow ); -// Set cell A6 with the Excel date/time value -$spreadsheet->getActiveSheet()->setCellValue( - 'A6', - $excelDateValue -); -// Set the number format mask so that the excel timestamp will be displayed as a human-readable date/time -$spreadsheet->getActiveSheet()->getStyle('A6') - ->getNumberFormat() - ->setFormatCode( - \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DATETIME - ); -``` - -### Setting a number with leading zeroes - -By default, PhpSpreadsheet will automatically detect the value type and -set it to the appropriate Excel numeric datatype. This type conversion -is handled by a value binder, as described in the section of this -document entitled "Using value binders to facilitate data entry". - -Numbers don't have leading zeroes, so if you try to set a numeric value -that does have leading zeroes (such as a telephone number) then these -will be normally be lost as the value is cast to a number, so -"01513789642" will be displayed as 1513789642. - -There are two ways you can force PhpSpreadsheet to override this -behaviour. - -Firstly, you can set the datatype explicitly as a string so that it is -not converted to a number. - -``` php -// Set cell A8 with a numeric value, but tell PhpSpreadsheet it should be treated as a string -$spreadsheet->getActiveSheet()->setCellValueExplicit( - 'A8', - "01513789642", - \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING -); -``` - -Alternatively, you can use a number format mask to display the value -with leading zeroes. - -``` php -// Set cell A9 with a numeric value -$spreadsheet->getActiveSheet()->setCellValue('A9', 1513789642); -// Set a number format mask to display the value as 11 digits with leading zeroes -$spreadsheet->getActiveSheet()->getStyle('A9') - ->getNumberFormat() - ->setFormatCode( - '00000000000' - ); -``` - -With number format masking, you can even break up the digits into groups -to make the value more easily readable. - -``` php -// Set cell A10 with a numeric value -$spreadsheet->getActiveSheet()->setCellValue('A10', 1513789642); -// Set a number format mask to display the value as 11 digits with leading zeroes -$spreadsheet->getActiveSheet()->getStyle('A10') - ->getNumberFormat() - ->setFormatCode( - '0000-000-0000' - ); -``` - -![07-simple-example-1.png](./images/07-simple-example-1.png) - -**Note:** that not all complex format masks such as this one will work -when retrieving a formatted value to display "on screen", or for certain -writers such as HTML or PDF, but it will work with the true spreadsheet -writers (Xlsx and Xls). - -## Setting a range of cells from an array - -It is also possible to set a range of cell values in a single call by -passing an array of values to the `fromArray()` method. - -``` php -$arrayData = [ - [NULL, 2010, 2011, 2012], - ['Q1', 12, 15, 21], - ['Q2', 56, 73, 86], - ['Q3', 52, 61, 69], - ['Q4', 30, 32, 0], -]; -$spreadsheet->getActiveSheet() - ->fromArray( - $arrayData, // The data to set - NULL, // Array values with this value will not be set - 'C3' // Top left coordinate of the worksheet range where - // we want to set these values (default is A1) - ); -``` - -![07-simple-example-2.png](./images/07-simple-example-2.png) - -If you pass a 2-d array, then this will be treated as a series of rows -and columns. A 1-d array will be treated as a single row, which is -particularly useful if you're fetching an array of data from a database. - -``` php -$rowArray = ['Value1', 'Value2', 'Value3', 'Value4']; -$spreadsheet->getActiveSheet() - ->fromArray( - $rowArray, // The data to set - NULL, // Array values with this value will not be set - 'C3' // Top left coordinate of the worksheet range where - // we want to set these values (default is A1) - ); -``` - -![07-simple-example-3.png](./images/07-simple-example-3.png) - -If you have a simple 1-d array, and want to write it as a column, then -the following will convert it into an appropriately structured 2-d array -that can be fed to the `fromArray()` method: - -``` php -$rowArray = ['Value1', 'Value2', 'Value3', 'Value4']; -$columnArray = array_chunk($rowArray, 1); -$spreadsheet->getActiveSheet() - ->fromArray( - $columnArray, // The data to set - NULL, // Array values with this value will not be set - 'C3' // Top left coordinate of the worksheet range where - // we want to set these values (default is A1) - ); -``` - -![07-simple-example-4.png](./images/07-simple-example-4.png) - -## Retrieving a cell value by coordinate - -To retrieve the value of a cell, the cell should first be retrieved from -the worksheet using the `getCell()` method. A cell's value can be read -using the `getValue()` method. - -``` php -// Get the value from cell A1 -$cellValue = $spreadsheet->getActiveSheet()->getCell('A1')->getValue(); -``` - -This will retrieve the raw, unformatted value contained in the cell. - -If a cell contains a formula, and you need to retrieve the calculated -value rather than the formula itself, then use the cell's -`getCalculatedValue()` method. This is further explained in -[the calculation engine](./calculation-engine.md). - -``` php -// Get the value from cell A4 -$cellValue = $spreadsheet->getActiveSheet()->getCell('A4')->getCalculatedValue(); -``` - -Alternatively, if you want to see the value with any cell formatting -applied (e.g. for a human-readable date or time value), then you can use -the cell's `getFormattedValue()` method. - -``` php -// Get the value from cell A6 -$cellValue = $spreadsheet->getActiveSheet()->getCell('A6')->getFormattedValue(); -``` - -## Setting a cell value by column and row - -Setting a cell value by coordinate can be done using the worksheet's -`setCellValueByColumnAndRow()` method. - -``` php -// Set cell A5 with a string value -$spreadsheet->getActiveSheet()->setCellValueByColumnAndRow(1, 5, 'PhpSpreadsheet'); -``` - -**Note:** that column references start with `1` for column `A`. - -## Retrieving a cell value by column and row - -To retrieve the value of a cell, the cell should first be retrieved from -the worksheet using the `getCellByColumnAndRow()` method. A cell’s value can -be read again using the following line of code: - -``` php -// Get the value from cell B5 -$cellValue = $spreadsheet->getActiveSheet()->getCellByColumnAndRow(2, 5)->getValue(); -``` - -If you need the calculated value of a cell, use the following code. This -is further explained in [the calculation engine](./calculation-engine.md). - -``` php -// Get the value from cell A4 -$cellValue = $spreadsheet->getActiveSheet()->getCellByColumnAndRow(1, 4)->getCalculatedValue(); -``` - -## Retrieving a range of cell values to an array - -It is also possible to retrieve a range of cell values to an array in a -single call using the `toArray()`, `rangeToArray()` or -`namedRangeToArray()` methods. - -``` php -$dataArray = $spreadsheet->getActiveSheet() - ->rangeToArray( - 'C3:E5', // The worksheet range that we want to retrieve - NULL, // Value that should be returned for empty cells - TRUE, // Should formulas be calculated (the equivalent of getCalculatedValue() for each cell) - TRUE, // Should values be formatted (the equivalent of getFormattedValue() for each cell) - TRUE // Should the array be indexed by cell row and cell column - ); -``` - -These methods will all return a 2-d array of rows and columns. The -`toArray()` method will return the whole worksheet; `rangeToArray()` -will return a specified range or cells; while `namedRangeToArray()` will -return the cells within a defined `named range`. - -## Looping through cells - -### Looping through cells using iterators - -The easiest way to loop cells is by using iterators. Using iterators, -one can use foreach to loop worksheets, rows within a worksheet, and -cells within a row. - -Below is an example where we read all the values in a worksheet and -display them in a table. - -``` php -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx'); -$reader->setReadDataOnly(TRUE); -$spreadsheet = $reader->load("test.xlsx"); - -$worksheet = $spreadsheet->getActiveSheet(); - -echo '' . PHP_EOL; -foreach ($worksheet->getRowIterator() as $row) { - echo '' . PHP_EOL; - $cellIterator = $row->getCellIterator(); - $cellIterator->setIterateOnlyExistingCells(FALSE); // This loops through all cells, - // even if a cell value is not set. - // By default, only cells that have a value - // set will be iterated. - foreach ($cellIterator as $cell) { - echo '' . PHP_EOL; - } - echo '' . PHP_EOL; -} -echo '
    ' . - $cell->getValue() . - '
    ' . PHP_EOL; -``` - -Note that we have set the cell iterator's -`setIterateOnlyExistingCells()` to FALSE. This makes the iterator loop -all cells within the worksheet range, even if they have not been set. - -The cell iterator will return a `null` as the cell value if it is not -set in the worksheet. Setting the cell iterator's -`setIterateOnlyExistingCells()` to `false` will loop all cells in the -worksheet that can be available at that moment. This will create new -cells if required and increase memory usage! Only use it if it is -intended to loop all cells that are possibly available. - -### Looping through cells using indexes - -One can use the possibility to access cell values by column and row -index like `[1, 1]` instead of `'A1'` for reading and writing cell values in -loops. - -**Note:** In PhpSpreadsheet column index and row index are 1-based. That means `'A1'` ~ `[1, 1]` - -Below is an example where we read all the values in a worksheet and -display them in a table. - -``` php -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx'); -$reader->setReadDataOnly(TRUE); -$spreadsheet = $reader->load("test.xlsx"); - -$worksheet = $spreadsheet->getActiveSheet(); -// Get the highest row and column numbers referenced in the worksheet -$highestRow = $worksheet->getHighestRow(); // e.g. 10 -$highestColumn = $worksheet->getHighestColumn(); // e.g 'F' -$highestColumnIndex = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString($highestColumn); // e.g. 5 - -echo '' . "\n"; -for ($row = 1; $row <= $highestRow; ++$row) { - echo '' . PHP_EOL; - for ($col = 1; $col <= $highestColumnIndex; ++$col) { - $value = $worksheet->getCellByColumnAndRow($col, $row)->getValue(); - echo '' . PHP_EOL; - } - echo '' . PHP_EOL; -} -echo '
    ' . $value . '
    ' . PHP_EOL; -``` - -Alternatively, you can take advantage of PHP's "Perl-style" character -incrementors to loop through the cells by coordinate: - -``` php -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx'); -$reader->setReadDataOnly(TRUE); -$spreadsheet = $reader->load("test.xlsx"); - -$worksheet = $spreadsheet->getActiveSheet(); -// Get the highest row number and column letter referenced in the worksheet -$highestRow = $worksheet->getHighestRow(); // e.g. 10 -$highestColumn = $worksheet->getHighestColumn(); // e.g 'F' -// Increment the highest column letter -$highestColumn++; - -echo '' . "\n"; -for ($row = 1; $row <= $highestRow; ++$row) { - echo '' . PHP_EOL; - for ($col = 'A'; $col != $highestColumn; ++$col) { - echo '' . PHP_EOL; - } - echo '' . PHP_EOL; -} -echo '
    ' . - $worksheet->getCell($col . $row) - ->getValue() . - '
    ' . PHP_EOL; -``` - -Note that we can't use a `<=` comparison here, because `'AA'` would match -as `<= 'B'`, so we increment the highest column letter and then loop -while `$col !=` the incremented highest column. - -## Using value binders to facilitate data entry - -Internally, PhpSpreadsheet uses a default -`\PhpOffice\PhpSpreadsheet\Cell\IValueBinder` implementation -(\PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder) to determine data -types of entered data using a cell's `setValue()` method (the -`setValueExplicit()` method bypasses this check). - -Optionally, the default behaviour of PhpSpreadsheet can be modified, -allowing easier data entry. For example, a -`\PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder` class is available. -It automatically converts percentages, number in scientific format, and -dates entered as strings to the correct format, also setting the cell's -style information. The following example demonstrates how to set the -value binder in PhpSpreadsheet: - -``` php -/** PhpSpreadsheet */ -require_once 'src/Boostrap.php'; - -// Set value binder -\PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() ); - -// Create new Spreadsheet object -$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet(); - -// ... -// Add some data, resembling some different data types -$spreadsheet->getActiveSheet()->setCellValue('A4', 'Percentage value:'); -// Converts the string value to 0.1 and sets percentage cell style -$spreadsheet->getActiveSheet()->setCellValue('B4', '10%'); - -$spreadsheet->getActiveSheet()->setCellValue('A5', 'Date/time value:'); -// Converts the string value to an Excel datestamp and sets the date format cell style -$spreadsheet->getActiveSheet()->setCellValue('B5', '21 December 1983'); -``` - -**Creating your own value binder is easy.** When advanced value binding -is required, you can implement the -`\PhpOffice\PhpSpreadsheet\Cell\IValueBinder` interface or extend the -`\PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder` or -`\PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder` classes. diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/architecture.md b/vendor/phpoffice/phpspreadsheet/docs/topics/architecture.md deleted file mode 100644 index 0295d672..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/topics/architecture.md +++ /dev/null @@ -1,75 +0,0 @@ -# Architecture - -## Schematical - -![01-schematic.png](./images/01-schematic.png "Basic Architecture Schematic") - -## AutoLoader - -PhpSpreadsheet relies on Composer autoloader. So before working with -PhpSpreadsheet in standalone, be sure to run `composer install`. Or add it to a -pre-existing project with `composer require phpoffice/phpspreadsheet`. - -## Spreadsheet in memory - -PhpSpreadsheet's architecture is built in a way that it can serve as an -in-memory spreadsheet. This means that, if one would want to create a -web based view of a spreadsheet which communicates with PhpSpreadsheet's -object model, he would only have to write the front-end code. - -Just like desktop spreadsheet software, PhpSpreadsheet represents a -spreadsheet containing one or more worksheets, which contain cells with -data, formulas, images, ... - -## Readers and writers - -On its own, the `Spreadsheet` class does not provide the functionality -to read from or write to a persisted spreadsheet (on disk or in a -database). To provide that functionality, readers and writers can be -used. - -By default, the PhpSpreadsheet package provides some readers and -writers, including one for the Open XML spreadsheet format (a.k.a. Excel -2007 file format). You are not limited to the default readers and -writers, as you are free to implement the -`\PhpOffice\PhpSpreadsheet\Reader\IReader` and -`\PhpOffice\PhpSpreadsheet\Writer\IWriter` interface in a custom class. - -![02-readers-writers.png](./images/02-readers-writers.png "Readers/Writers") - -## Fluent interfaces - -PhpSpreadsheet supports fluent interfaces in most locations. This means -that you can easily "chain" calls to specific methods without requiring -a new PHP statement. For example, take the following code: - -``` php -$spreadsheet->getProperties()->setCreator("Maarten Balliauw"); -$spreadsheet->getProperties()->setLastModifiedBy("Maarten Balliauw"); -$spreadsheet->getProperties()->setTitle("Office 2007 XLSX Test Document"); -$spreadsheet->getProperties()->setSubject("Office 2007 XLSX Test Document"); -$spreadsheet->getProperties()->setDescription("Test document for Office 2007 XLSX, generated using PHP classes."); -$spreadsheet->getProperties()->setKeywords("office 2007 openxml php"); -$spreadsheet->getProperties()->setCategory("Test result file"); -``` - -This can be rewritten as: - -``` php -$spreadsheet->getProperties() - ->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.") - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); -``` - -> **Using fluent interfaces is not required** Fluent interfaces have -> been implemented to provide a convenient programming API. Use of them -> is not required, but can make your code easier to read and maintain. -> It can also improve performance, as you are reducing the overall -> number of calls to PhpSpreadsheet methods: in the above example, the -> `getProperties()` method is being called only once rather than 7 times -> in the non-fluent version. diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/autofilters.md b/vendor/phpoffice/phpspreadsheet/docs/topics/autofilters.md deleted file mode 100644 index 66321ee9..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/topics/autofilters.md +++ /dev/null @@ -1,530 +0,0 @@ -# AutoFilter Reference - -## Introduction - -Each worksheet in an Excel Workbook can contain a single autoFilter -range. Filtered data displays only the rows that meet criteria that you -specify and hides rows that you do not want displayed. You can filter by -more than one column: filters are additive, which means that each -additional filter is based on the current filter and further reduces the -subset of data. - -![01-01-autofilter.png](./images/01-01-autofilter.png) - -When an AutoFilter is applied to a range of cells, the first row in an -autofilter range will be the heading row, which displays the autoFilter -dropdown icons. It is not part of the actual autoFiltered data. All -subsequent rows are the autoFiltered data. So an AutoFilter range should -always contain the heading row and one or more data rows (one data row -is pretty meaningless), but PhpSpreadsheet won't actually stop you -specifying a meaningless range: it's up to you as a developer to avoid -such errors. - -To determine if a filter is applied, note the icon in the column -heading. A drop-down arrow -(![01-03-filter-icon-1.png](./images/01-03-filter-icon-1.png)) means -that filtering is enabled but not applied. In MS Excel, when you hover -over the heading of a column with filtering enabled but not applied, a -screen tip displays the cell text for the first row in that column, and -the message "(Showing All)". - -![01-02-autofilter.png](./images/01-02-autofilter.png) - -A Filter button -(![01-03-filter-icon-2.png](./images/01-03-filter-icon-2.png)) means -that a filter is applied. When you hover over the heading of a filtered -column, a screen tip displays the filter that has been applied to that -column, such as "Equals a red cell color" or "Larger than 150". - -![01-04-autofilter.png](./images/01-04-autofilter.png) - -## Setting an AutoFilter area on a worksheet - -To set an autoFilter on a range of cells. - -``` php -$spreadsheet->getActiveSheet()->setAutoFilter('A1:E20'); -``` - -The first row in an autofilter range will be the heading row, which -displays the autoFilter dropdown icons. It is not part of the actual -autoFiltered data. All subsequent rows are the autoFiltered data. So an -AutoFilter range should always contain the heading row and one or more -data rows (one data row is pretty meaningless, but PhpSpreadsheet won't -actually stop you specifying a meaningless range: it's up to you as a -developer to avoid such errors. - -If you want to set the whole worksheet as an autofilter region - -``` php -$spreadsheet->getActiveSheet()->setAutoFilter( - $spreadsheet->getActiveSheet() - ->calculateWorksheetDimension() -); -``` - -This enables filtering, but does not actually apply any filters. - -## Autofilter Expressions - -PHPEXcel 1.7.8 introduced the ability to actually create, read and write -filter expressions; initially only for Xlsx files, but later releases -will extend this to other formats. - -To apply a filter expression to an autoFilter range, you first need to -identify which column you're going to be applying this filter to. - -``` php -$autoFilter = $spreadsheet->getActiveSheet()->getAutoFilter(); -$columnFilter = $autoFilter->getColumn('C'); -``` - -This returns an autoFilter column object, and you can then apply filter -expressions to that column. - -There are a number of different types of autofilter expressions. The -most commonly used are: - -- Simple Filters -- DateGroup Filters -- Custom filters -- Dynamic Filters -- Top Ten Filters - -These different types are mutually exclusive within any single column. -You should not mix the different types of filter in the same column. -PhpSpreadsheet will not actively prevent you from doing this, but the -results are unpredictable. - -Other filter expression types (such as cell colour filters) are not yet -supported. - -### Simple filters - -In MS Excel, Simple Filters are a dropdown list of all values used in -that column, and the user can select which ones they want to display and -which ones they want to hide by ticking and unticking the checkboxes -alongside each option. When the filter is applied, rows containing the -checked entries will be displayed, rows that don't contain those values -will be hidden. - -![04-01-simple-autofilter.png](./images/04-01-simple-autofilter.png) - -To create a filter expression, we need to start by identifying the -filter type. In this case, we're just going to specify that this filter -is a standard filter. - -``` php -$columnFilter->setFilterType( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER -); -``` - -Now we've identified the filter type, we can create a filter rule and -set the filter values: - -When creating a simple filter in PhpSpreadsheet, you only need to -specify the values for "checked" columns: you do this by creating a -filter rule for each value. - -``` php -$columnFilter->createRule() - ->setRule( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - 'France' - ); - -$columnFilter->createRule() - ->setRule( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - 'Germany' - ); -``` - -This creates two filter rules: the column will be filtered by values -that match "France" OR "Germany". For Simple Filters, you can create as -many rules as you want - -Simple filters are always a comparison match of EQUALS, and multiple -standard filters are always treated as being joined by an OR condition. - -#### Matching Blanks - -If you want to create a filter to select blank cells, you would use: - -``` php -$columnFilter->createRule() - ->setRule( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - '' - ); -``` - -### DateGroup Filters - -In MS Excel, DateGroup filters provide a series of dropdown filter -selectors for date values, so you can specify entire years, or months -within a year, or individual days within each month. - -![04-02-dategroup-autofilter.png](./images/04-02-dategroup-autofilter.png) - -DateGroup filters are still applied as a Standard Filter type. - -``` php -$columnFilter->setFilterType( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_FILTER -); -``` - -Creating a dateGroup filter in PhpSpreadsheet, you specify the values -for "checked" columns as an associative array of year. month, day, hour -minute and second. To select a year and month, you need to create a -DateGroup rule identifying the selected year and month: - -``` php -$columnFilter->createRule() - ->setRule( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - [ - 'year' => 2012, - 'month' => 1 - ] - ) - ->setRuleType( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DATEGROUP - ); -``` - -The key values for the associative array are: - -- year -- month -- day -- hour -- minute -- second - -Like Standard filters, DateGroup filters are always a match of EQUALS, -and multiple standard filters are always treated as being joined by an -OR condition. - -Note that we alse specify a ruleType: to differentiate this from a -standard filter, we explicitly set the Rule's Type to -AUTOFILTER\_RULETYPE\_DATEGROUP. As with standard filters, we can create -any number of DateGroup Filters. - -### Custom filters - -In MS Excel, Custom filters allow us to select more complex conditions -using an operator as well as a value. Typical examples might be values -that fall within a range (e.g. between -20 and +20), or text values with -wildcards (e.g. beginning with the letter U). To handle this, they - -![04-03-custom-autofilter-1.png](./images/04-03-custom-autofilter-1.png) - -![04-03-custom-autofilter-2.png](./images/04-03-custom-autofilter-2.png) - -Custom filters are limited to 2 rules, and these can be joined using -either an AND or an OR. - -We start by specifying a Filter type, this time a CUSTOMFILTER. - -``` php -$columnFilter->setFilterType( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER -); -``` - -And then define our rules. - -The following shows a simple wildcard filter to show all column entries -beginning with the letter `U`. - -``` php -$columnFilter->createRule() - ->setRule( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - 'U*' - ) - ->setRuleType( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER - ); -``` - -MS Excel uses \* as a wildcard to match any number of characters, and ? -as a wildcard to match a single character. 'U\*' equates to "begins with -a 'U'"; '\*U' equates to "ends with a 'U'"; and '\*U\*' equates to -"contains a 'U'" - -If you want to match explicitly against a \* or a ? character, you can -escape it with a tilde (\~), so ?\~\*\* would explicitly match for a \* -character as the second character in the cell value, followed by any -number of other characters. The only other character that needs escaping -is the \~ itself. - -To create a "between" condition, we need to define two rules: - -``` php -$columnFilter->createRule() - ->setRule( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL, - -20 - ) - ->setRuleType( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER - ); -$columnFilter->createRule() - ->setRule( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL, - 20 - ) - ->setRuleType( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER - ); -``` - -We also set the rule type to CUSTOMFILTER. - -This defined two rules, filtering numbers that are `>= -20` OR `<= -20`, so we also need to modify the join condition to reflect AND rather -than OR. - -``` php -$columnFilter->setAndOr( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_COLUMN_ANDOR_AND -); -``` - -The valid set of operators for Custom Filters are defined in the -`\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule` class, and -comprise: - -Operator Constant | Value -------------------------------------------|---------------------- -AUTOFILTER_COLUMN_RULE_EQUAL | 'equal' -AUTOFILTER_COLUMN_RULE_NOTEQUAL | 'notEqual' -AUTOFILTER_COLUMN_RULE_GREATERTHAN | 'greaterThan' -AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL | 'greaterThanOrEqual' -AUTOFILTER_COLUMN_RULE_LESSTHAN | 'lessThan' -AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL | 'lessThanOrEqual' - -### Dynamic Filters - -Dynamic Filters are based on a dynamic comparison condition, where the -value we're comparing against the cell values is variable, such as -'today'; or when we're testing against an aggregate of the cell data -(e.g. 'aboveAverage'). Only a single dynamic filter can be applied to a -column at a time. - -![04-04-dynamic-autofilter.png](./images/04-04-dynamic-autofilter.png) - -Again, we start by specifying a Filter type, this time a DYNAMICFILTER. - -``` php -$columnFilter->setFilterType( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER -); -``` - -When defining the rule for a dynamic filter, we don't define a value (we -can simply set that to NULL) but we do specify the dynamic filter -category. - -``` php -$columnFilter->createRule() - ->setRule( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - NULL, - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE - ) - ->setRuleType( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER - ); -``` - -We also set the rule type to DYNAMICFILTER. - -The valid set of dynamic filter categories is defined in the -`\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule` class, and -comprises: - -Operator Constant | Value ------------------------------------------|---------------- -AUTOFILTER_RULETYPE_DYNAMIC_YESTERDAY | 'yesterday' -AUTOFILTER_RULETYPE_DYNAMIC_TODAY | 'today' -AUTOFILTER_RULETYPE_DYNAMIC_TOMORROW | 'tomorrow' -AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE | 'yearToDate' -AUTOFILTER_RULETYPE_DYNAMIC_THISYEAR | 'thisYear' -AUTOFILTER_RULETYPE_DYNAMIC_THISQUARTER | 'thisQuarter' -AUTOFILTER_RULETYPE_DYNAMIC_THISMONTH | 'thisMonth' -AUTOFILTER_RULETYPE_DYNAMIC_THISWEEK | 'thisWeek' -AUTOFILTER_RULETYPE_DYNAMIC_LASTYEAR | 'lastYear' -AUTOFILTER_RULETYPE_DYNAMIC_LASTQUARTER | 'lastQuarter' -AUTOFILTER_RULETYPE_DYNAMIC_LASTMONTH | 'lastMonth' -AUTOFILTER_RULETYPE_DYNAMIC_LASTWEEK | 'lastWeek' -AUTOFILTER_RULETYPE_DYNAMIC_NEXTYEAR | 'nextYear' -AUTOFILTER_RULETYPE_DYNAMIC_NEXTQUARTER | 'nextQuarter' -AUTOFILTER_RULETYPE_DYNAMIC_NEXTMONTH | 'nextMonth' -AUTOFILTER_RULETYPE_DYNAMIC_NEXTWEEK | 'nextWeek' -AUTOFILTER_RULETYPE_DYNAMIC_MONTH_1 | 'M1' -AUTOFILTER_RULETYPE_DYNAMIC_JANUARY | 'M1' -AUTOFILTER_RULETYPE_DYNAMIC_MONTH_2 | 'M2' -AUTOFILTER_RULETYPE_DYNAMIC_FEBRUARY | 'M2' -AUTOFILTER_RULETYPE_DYNAMIC_MONTH_3 | 'M3' -AUTOFILTER_RULETYPE_DYNAMIC_MARCH | 'M3' -AUTOFILTER_RULETYPE_DYNAMIC_MONTH_4 | 'M4' -AUTOFILTER_RULETYPE_DYNAMIC_APRIL | 'M4' -AUTOFILTER_RULETYPE_DYNAMIC_MONTH_5 | 'M5' -AUTOFILTER_RULETYPE_DYNAMIC_MAY | 'M5' -AUTOFILTER_RULETYPE_DYNAMIC_MONTH_6 | 'M6' -AUTOFILTER_RULETYPE_DYNAMIC_JUNE | 'M6' -AUTOFILTER_RULETYPE_DYNAMIC_MONTH_7 | 'M7' -AUTOFILTER_RULETYPE_DYNAMIC_JULY | 'M7' -AUTOFILTER_RULETYPE_DYNAMIC_MONTH_8 | 'M8' -AUTOFILTER_RULETYPE_DYNAMIC_AUGUST | 'M8' -AUTOFILTER_RULETYPE_DYNAMIC_MONTH_9 | 'M9' -AUTOFILTER_RULETYPE_DYNAMIC_SEPTEMBER | 'M9' -AUTOFILTER_RULETYPE_DYNAMIC_MONTH_10 | 'M10' -AUTOFILTER_RULETYPE_DYNAMIC_OCTOBER | 'M10' -AUTOFILTER_RULETYPE_DYNAMIC_MONTH_11 | 'M11' -AUTOFILTER_RULETYPE_DYNAMIC_NOVEMBER | 'M11' -AUTOFILTER_RULETYPE_DYNAMIC_MONTH_12 | 'M12' -AUTOFILTER_RULETYPE_DYNAMIC_DECEMBER | 'M12' -AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_1 | 'Q1' -AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_2 | 'Q2' -AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_3 | 'Q3' -AUTOFILTER_RULETYPE_DYNAMIC_QUARTER_4 | 'Q4' -AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE | 'aboveAverage' -AUTOFILTER_RULETYPE_DYNAMIC_BELOWAVERAGE | 'belowAverage' - -We can only apply a single Dynamic Filter rule to a column at a time. - -### Top Ten Filters - -Top Ten Filters are similar to Dynamic Filters in that they are based on -a summarisation of the actual data values in the cells. However, unlike -Dynamic Filters where you can only select a single option, Top Ten -Filters allow you to select based on a number of criteria: - -![04-05-custom-topten-1.png](./images/04-05-topten-autofilter-1.png) - -![04-05-custom-topten-2.png](./images/04-05-topten-autofilter-2.png) - -You can identify whether you want the top (highest) or bottom (lowest) -values.You can identify how many values you wish to select in the -filterYou can identify whether this should be a percentage or a number -of items. - -Like Dynamic Filters, only a single Top Ten filter can be applied to a -column at a time. - -We start by specifying a Filter type, this time a DYNAMICFILTER. - -``` php -$columnFilter->setFilterType( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::AUTOFILTER_FILTERTYPE_TOPTENFILTER -); -``` - -Then we create the rule: - -``` php -$columnFilter->createRule() - ->setRule( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT, - 5, - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP - ) - ->setRuleType( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_TOPTENFILTER - ); -``` - -This will filter the Top 5 percent of values in the column. - -To specify the lowest (bottom 2 values), we would specify a rule of: - -``` php -$columnFilter->createRule() - ->setRule( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE, - 5, - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM - ) - ->setRuleType( - \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_TOPTENFILTER - ); -``` - -The option values for TopTen Filters top/bottom value/percent are all -defined in the -`\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule` class, and -comprise: - -Operator Constant | Value ----------------------------------------|------------- -AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE | 'byValue' -AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT | 'byPercent' - -and - -Operator Constant | Value --------------------------------------|---------- -AUTOFILTER_COLUMN_RULE_TOPTEN_TOP | 'top' -AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM | 'bottom' - -## Executing an AutoFilter - -When an autofilter is applied in MS Excel, it sets the row -hidden/visible flags for each row of the autofilter area based on the -selected criteria, so that only those rows that match the filter -criteria are displayed. - -PhpSpreadsheet will not execute the equivalent function automatically -when you set or change a filter expression, but only when the file is -saved. - -### Applying the Filter - -If you wish to execute your filter from within a script, you need to do -this manually. You can do this using the autofilters `showHideRows()` -method. - -``` php -$autoFilter = $spreadsheet->getActiveSheet()->getAutoFilter(); -$autoFilter->showHideRows(); -``` - -This will set all rows that match the filter criteria to visible, while -hiding all other rows within the autofilter area. - -### Displaying Filtered Rows - -Simply looping through the rows in an autofilter area will still access -ever row, whether it matches the filter criteria or not. To selectively -access only the filtered rows, you need to test each row’s visibility -settings. - -``` php -foreach ($spreadsheet->getActiveSheet()->getRowIterator() as $row) { - if ($spreadsheet->getActiveSheet() - ->getRowDimension($row->getRowIndex())->getVisible()) { - echo ' Row number - ' , $row->getRowIndex() , ' '; - echo $spreadsheet->getActiveSheet() - ->getCell( - 'C'.$row->getRowIndex() - ) - ->getValue(), ' '; - echo $spreadsheet->getActiveSheet() - ->getCell( - 'D'.$row->getRowIndex() - )->getFormattedValue(), ' '; - echo PHP_EOL; - } -} -``` - -## AutoFilter Sorting - -In MS Excel, Autofiltering also allows the rows to be sorted. This -feature is ***not*** supported by PhpSpreadsheet. diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/calculation-engine.md b/vendor/phpoffice/phpspreadsheet/docs/topics/calculation-engine.md deleted file mode 100644 index f1d1c2c1..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/topics/calculation-engine.md +++ /dev/null @@ -1,2074 +0,0 @@ -# Calculation Engine - -## Using the PhpSpreadsheet calculation engine - -### Performing formula calculations - -As PhpSpreadsheet represents an in-memory spreadsheet, it also offers -formula calculation capabilities. A cell can be of a value type -(containing a number or text), or a formula type (containing a formula -which can be evaluated). For example, the formula `=SUM(A1:A10)` -evaluates to the sum of values in A1, A2, ..., A10. - -To calculate a formula, you can call the cell containing the formula’s -method `getCalculatedValue()`, for example: - -``` php -$spreadsheet->getActiveSheet()->getCell('E11')->getCalculatedValue(); -``` - -If you write the following line of code in the invoice demo included -with PhpSpreadsheet, it evaluates to the value "64": - -![09-command-line-calculation.png](./images/09-command-line-calculation.png) - -Another nice feature of PhpSpreadsheet's formula parser, is that it can -automatically adjust a formula when inserting/removing rows/columns. -Here's an example: - -![09-formula-in-cell-1.png](./images/09-formula-in-cell-1.png) - -You see that the formula contained in cell E11 is "SUM(E4:E9)". Now, -when I write the following line of code, two new product lines are -added: - -``` php -$spreadsheet->getActiveSheet()->insertNewRowBefore(7, 2); -``` - -![09-formula-in-cell-2.png](./images/09-formula-in-cell-2.png) - -Did you notice? The formula in the former cell E11 (now E13, as I -inserted 2 new rows), changed to "SUM(E4:E11)". Also, the inserted cells -duplicate style information of the previous cell, just like Excel's -behaviour. Note that you can both insert rows and columns. - -## Known limitations - -There are some known limitations to the PhpSpreadsheet calculation -engine. Most of them are due to the fact that an Excel formula is -converted into PHP code before being executed. This means that Excel -formula calculation is subject to PHP's language characteristics. - -### Function that are not Supported in Xls - -Not all functions are supported, for a comprehensive list, read the -[function list by name](../references/function-list-by-name.md). - -#### Operator precedence - -In Excel `+` wins over `&`, just like `*` wins over `+` in ordinary -algebra. The former rule is not what one finds using the calculation -engine shipped with PhpSpreadsheet. - -- [Reference for Excel](https://support.office.com/en-us/article/Calculation-operators-and-precedence-in-Excel-48be406d-4975-4d31-b2b8-7af9e0e2878a) -- [Reference for PHP](http://php.net/manual/en/language.operators.php) - -#### Formulas involving numbers and text - -Formulas involving numbers and text may produce unexpected results or -even unreadable file contents. For example, the formula `=3+"Hello "` is -expected to produce an error in Excel (\#VALUE!). Due to the fact that -PHP converts `"Hello "` to a numeric value (zero), the result of this -formula is evaluated as 3 instead of evaluating as an error. This also -causes the Excel document being generated as containing unreadable -content. - -- [Reference for this behaviour in PHP](http://php.net/manual/en/language.types.string.php#language.types.string.conversion) - -#### Formulas don’t seem to be calculated in Excel2003 using compatibility pack? - -This is normal behaviour of the compatibility pack, Xlsx displays this -correctly. Use `\PhpOffice\PhpSpreadsheet\Writer\Xls` if you really need -calculated values, or force recalculation in Excel2003. - -## Handling Date and Time Values - -### Excel functions that return a Date and Time value - -Any of the Date and Time functions that return a date value in Excel can -return either an Excel timestamp or a PHP timestamp or `DateTime` object. - -It is possible for scripts to change the data type used for returning -date values by calling the -`\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType()` -method: - -``` php -\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType($returnDateType); -``` - -where the following constants can be used for `$returnDateType`: - -- `\PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_PHP_NUMERIC` -- `\PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_PHP_OBJECT` -- `\PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_EXCEL` - -The method will return a Boolean True on success, False on failure (e.g. -if an invalid value is passed in for the return date type). - -The `\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType()` -method can be used to determine the current value of this setting: - -``` php -$returnDateType = \PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType(); -``` - -The default is `RETURNDATE_PHP_NUMERIC`. - -#### PHP Timestamps - -If `RETURNDATE_PHP_NUMERIC` is set for the Return Date Type, then any -date value returned to the calling script by any access to the Date and -Time functions in Excel will be an integer value that represents the -number of seconds from the PHP/Unix base date. The PHP/Unix base date -(0) is 00:00 UST on 1st January 1970. This value can be positive or -negative: so a value of -3600 would be 23:00 hrs on 31st December 1969; -while a value of +3600 would be 01:00 hrs on 1st January 1970. This -gives PHP a date range of between 14th December 1901 and 19th January -2038. - -#### PHP `DateTime` Objects - -If the Return Date Type is set for `RETURNDATE_PHP_OBJECT`, then any -date value returned to the calling script by any access to the Date and -Time functions in Excel will be a PHP `DateTime` object. - -#### Excel Timestamps - -If `RETURNDATE_EXCEL` is set for the Return Date Type, then the returned -date value by any access to the Date and Time functions in Excel will be -a floating point value that represents a number of days from the Excel -base date. The Excel base date is determined by which calendar Excel -uses: the Windows 1900 or the Mac 1904 calendar. 1st January 1900 is the -base date for the Windows 1900 calendar while 1st January 1904 is the -base date for the Mac 1904 calendar. - -It is possible for scripts to change the calendar used for calculating -Excel date values by calling the -`\PhpOffice\PhpSpreadsheet\Shared\Date::setExcelCalendar()` method: - -``` php -\PhpOffice\PhpSpreadsheet\Shared\Date::setExcelCalendar($baseDate); -``` - -where the following constants can be used for `$baseDate`: - -- `\PhpOffice\PhpSpreadsheet\Shared\Date::CALENDAR_WINDOWS_1900` -- `\PhpOffice\PhpSpreadsheet\Shared\Date::CALENDAR_MAC_1904` - -The method will return a Boolean True on success, False on failure (e.g. -if an invalid value is passed in). - -The `\PhpOffice\PhpSpreadsheet\Shared\Date::getExcelCalendar()` method can -be used to determine the current value of this setting: - -``` php -$baseDate = \PhpOffice\PhpSpreadsheet\Shared\Date::getExcelCalendar(); -``` - -The default is `CALENDAR_WINDOWS_1900`. - -#### Functions that return a Date/Time Value - -- DATE -- DATEVALUE -- EDATE -- EOMONTH -- NOW -- TIME -- TIMEVALUE -- TODAY - -### Excel functions that accept Date and Time values as parameters - -Date values passed in as parameters to a function can be an Excel -timestamp or a PHP timestamp; or `DateTime` object; or a string containing a -date value (e.g. '1-Jan-2009'). PhpSpreadsheet will attempt to identify -their type based on the PHP datatype: - -An integer numeric value will be treated as a PHP/Unix timestamp. A real -(floating point) numeric value will be treated as an Excel -date/timestamp. Any PHP `DateTime` object will be treated as a `DateTime` -object. Any string value (even one containing straight numeric data) -will be converted to a `DateTime` object for validation as a date value -based on the server locale settings, so passing through an ambiguous -value of '07/08/2008' will be treated as 7th August 2008 if your server -settings are UK, but as 8th July 2008 if your server settings are US. -However, if you pass through a value such as '31/12/2008' that would be -considered an error by a US-based server, but which is not ambiguous, -then PhpSpreadsheet will attempt to correct this to 31st December 2008. -If the content of the string doesn’t match any of the formats recognised -by the php `DateTime` object implementation of `strtotime()` (which can -handle a wider range of formats than the normal `strtotime()` function), -then the function will return a `#VALUE` error. However, Excel -recommends that you should always use date/timestamps for your date -functions, and the recommendation for PhpSpreadsheet is the same: avoid -strings because the result is not predictable. - -The same principle applies when data is being written to Excel. Cells -containing date actual values (rather than Excel functions that return a -date value) are always written as Excel dates, converting where -necessary. If a cell formatted as a date contains an integer or -`DateTime` object value, then it is converted to an Excel value for -writing: if a cell formatted as a date contains a real value, then no -conversion is required. Note that string values are written as strings -rather than converted to Excel date timestamp values. - -#### Functions that expect a Date/Time Value - -- DATEDIF -- DAY -- DAYS360 -- EDATE -- EOMONTH -- HOUR -- MINUTE -- MONTH -- NETWORKDAYS -- SECOND -- WEEKDAY -- WEEKNUM -- WORKDAY -- YEAR -- YEARFRAC - -### Helper Methods - -In addition to the `setExcelCalendar()` and `getExcelCalendar()` methods, a -number of other methods are available in the -`\PhpOffice\PhpSpreadsheet\Shared\Date` class that can help when working -with dates: - -#### \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDate) - -Converts a date/time from an Excel date timestamp to return a PHP -serialized date/timestamp. - -Note that this method does not trap for Excel dates that fall outside of -the valid range for a PHP date timestamp. - -#### \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($excelDate) - -Converts a date from an Excel date/timestamp to return a PHP `DateTime` -object. - -#### \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($PHPDate) - -Converts a PHP serialized date/timestamp or a PHP `DateTime` object to -return an Excel date timestamp. - -#### \PhpOffice\PhpSpreadsheet\Shared\Date::formattedPHPToExcel($year, $month, $day, $hours=0, $minutes=0, $seconds=0) - -Takes year, month and day values (and optional hour, minute and second -values) and returns an Excel date timestamp value. - -### Timezone support for Excel date timestamp conversions - -The default timezone for the date functions in PhpSpreadsheet is UST (Universal Standard Time). -If a different timezone needs to be used, these methods are available: - -#### \PhpOffice\PhpSpreadsheet\Shared\Date::getDefaultTimezone() - -Returns the current timezone value PhpSpeadsheet is using to handle dates and times. - -#### \PhpOffice\PhpSpreadsheet\Shared\Date::setDefaultTimezone($timeZone) - -Sets the timezone for Excel date timestamp conversions to $timeZone, -which must be a valid PHP DateTimeZone value. -The return value is a Boolean, where true is success, -and false is failure (e.g. an invalid DateTimeZone value was passed.) - -#### \PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($excelDate, $timeZone) -#### \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimeStamp($excelDate, $timeZone) - -These functions support a timezone as an optional second parameter. -This applies a specific timezone to that function call without affecting the default PhpSpreadsheet Timezone. - -## Function Reference - -### Database Functions - -#### DAVERAGE - -The DAVERAGE function returns the average value of the cells in a column -of a list or database that match conditions you specify. - -##### Syntax - - DAVERAGE (database, field, criteria) - -##### Parameters - -**database** The range of cells that makes up the list or database. - -A database is a list of related data in which rows of related -information are records, and columns of data are fields. The first row -of the list contains labels for each column. - -**field** Indicates which column of the database is used in the -function. - -Enter the column label as a string (enclosed between double quotation -marks), such as "Age" or "Yield," or as a number (without quotation -marks) that represents the position of the column within the list: 1 for -the first column, 2 for the second column, and so on. - -**criteria** The range of cells that contains the conditions you -specify. - -You can use any range for the criteria argument, as long as it includes -at least one column label and at least one cell below the column label -in which you specify a condition for the column. - -##### Return Value - -**float** The average value of the matching cells. - -This is the statistical mean. - -##### Examples - -``` php -$database = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ], - [ 'Apple', 18, 20, 14, 105.00 ], - [ 'Pear', 12, 12, 10, 96.00 ], - [ 'Cherry', 13, 14, 9, 105.00 ], - [ 'Apple', 14, 15, 10, 75.00 ], - [ 'Pear', 9, 8, 8, 76.80 ], - [ 'Apple', 8, 9, 6, 45.00 ], -]; - -$criteria = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ], - [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ], - [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ], -]; - -$worksheet->fromArray( $criteria, NULL, 'A1' ) - ->fromArray( $database, NULL, 'A4' ); - -$worksheet->setCellValue('A12', '=DAVERAGE(A4:E10,"Yield",A1:B2)'); - -$retVal = $worksheet->getCell('A12')->getCalculatedValue(); -// $retVal = 12 -``` - -##### Notes - -There are no additional notes on this function - -#### DCOUNT - -The DCOUNT function returns the count of cells that contain a number in -a column of a list or database matching conditions that you specify. - -##### Syntax - - DCOUNT(database, [field], criteria) - -##### Parameters - -**database** The range of cells that makes up the list or database. - -A database is a list of related data in which rows of related -information are records, and columns of data are fields. The first row -of the list contains labels for each column. - -**field** Indicates which column of the database is used in the -function. - -Enter the column label as a string (enclosed between double quotation -marks), such as "Age" or "Yield," or as a number (without quotation -marks) that represents the position of the column within the list: 1 for -the first column, 2 for the second column, and so on. - -**criteria** The range of cells that contains the conditions you -specify. - -You can use any range for the criteria argument, as long as it includes -at least one column label and at least one cell below the column label -in which you specify a condition for the column. - -##### Return Value - -**float** The count of the matching cells. - -##### Examples - -``` php -$database = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ], - [ 'Apple', 18, 20, 14, 105.00 ], - [ 'Pear', 12, 12, 10, 96.00 ], - [ 'Cherry', 13, 14, 9, 105.00 ], - [ 'Apple', 14, 15, 10, 75.00 ], - [ 'Pear', 9, 8, 8, 76.80 ], - [ 'Apple', 8, 9, 6, 45.00 ], -]; - -$criteria = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ], - [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ], - [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ], -]; - -$worksheet->fromArray( $criteria, NULL, 'A1' ) - ->fromArray( $database, NULL, 'A4' ); - -$worksheet->setCellValue('A12', '=DCOUNT(A4:E10,"Height",A1:B3)'); - -$retVal = $worksheet->getCell('A12')->getCalculatedValue(); - -// $retVal = 3 -``` - -##### Notes - -In MS Excel, The field argument is optional. If field is omitted, DCOUNT -counts all records in the database that match the criteria. This logic -has not yet been implemented in PhpSpreadsheet. - -#### DCOUNTA - -The DCOUNT function returns the count of cells that aren’t blank in a -column of a list or database and that match conditions that you specify. - -##### Syntax - - DCOUNTA(database, [field], criteria) - -##### Parameters - -**database** The range of cells that makes up the list or database. - -A database is a list of related data in which rows of related -information are records, and columns of data are fields. The first row -of the list contains labels for each column. - -**field** Indicates which column of the database is used in the -function. - -Enter the column label as a string (enclosed between double quotation -marks), such as "Age" or "Yield," or as a number (without quotation -marks) that represents the position of the column within the list: 1 for -the first column, 2 for the second column, and so on. - -**criteria** The range of cells that contains the conditions you -specify. - -You can use any range for the criteria argument, as long as it includes -at least one column label and at least one cell below the column label -in which you specify a condition for the column. - -##### Return Value - -**float** The count of the matching cells. - -##### Examples - -``` php -$database = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ], - [ 'Apple', 18, 20, 14, 105.00 ], - [ 'Pear', 12, 12, 10, 96.00 ], - [ 'Cherry', 13, 14, 9, 105.00 ], - [ 'Apple', 14, 15, 10, 75.00 ], - [ 'Pear', 9, 8, 8, 76.80 ], - [ 'Apple', 8, 9, 6, 45.00 ], -]; - -$criteria = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ], - [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ], - [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ], -]; - -$worksheet->fromArray( $criteria, NULL, 'A1' ) - ->fromArray( $database, NULL, 'A4' ); - -$worksheet->setCellValue('A12', '=DCOUNTA(A4:E10,"Yield",A1:A3)'); - -$retVal = $worksheet->getCell('A12')->getCalculatedValue(); - -// $retVal = 5 -``` - -##### Notes - -In MS Excel, The field argument is optional. If field is omitted, -DCOUNTA counts all records in the database that match the criteria. This -logic has not yet been implemented in PhpSpreadsheet. - -#### DGET - -The DGET function extracts a single value from a column of a list or -database that matches conditions that you specify. - -##### Syntax - - DGET(database, field, criteria) - -##### Parameters - -**database** The range of cells that makes up the list or database. - -A database is a list of related data in which rows of related -information are records, and columns of data are fields. The first row -of the list contains labels for each column. - -**field** Indicates which column of the database is used in the -function. - -Enter the column label as a string (enclosed between double quotation -marks), such as "Age" or "Yield," or as a number (without quotation -marks) that represents the position of the column within the list: 1 for -the first column, 2 for the second column, and so on. - -**criteria** The range of cells that contains the conditions you -specify. - -You can use any range for the criteria argument, as long as it includes -at least one column label and at least one cell below the column label -in which you specify a condition for the column. - -##### Return Value - -**mixed** The value from the selected column of the matching row. - -#### Examples - -``` php -$database = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ], - [ 'Apple', 18, 20, 14, 105.00 ], - [ 'Pear', 12, 12, 10, 96.00 ], - [ 'Cherry', 13, 14, 9, 105.00 ], - [ 'Apple', 14, 15, 10, 75.00 ], - [ 'Pear', 9, 8, 8, 76.80 ], - [ 'Apple', 8, 9, 6, 45.00 ], -]; - -$criteria = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ], - [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ], - [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ], -]; - -$worksheet->fromArray( $criteria, NULL, 'A1' ) - ->fromArray( $database, NULL, 'A4' ); - -$worksheet->setCellValue('A12', '=GET(A4:E10,"Age",A1:F2)'); - -$retVal = $worksheet->getCell('A12')->getCalculatedValue(); -// $retVal = 14 -``` - -##### Notes - -There are no additional notes on this function - -#### DMAX - -The DMAX function returns the largest number in a column of a list or -database that matches conditions you specify. - -##### Syntax - - DMAX(database, field, criteria) - -##### Parameters - -**database** The range of cells that makes up the list or database. - -A database is a list of related data in which rows of related -information are records, and columns of data are fields. The first row -of the list contains labels for each column. - -**field** Indicates which column of the database is used in the -function. - -Enter the column label as a string (enclosed between double quotation -marks), such as "Age" or "Yield," or as a number (without quotation -marks) that represents the position of the column within the list: 1 for -the first column, 2 for the second column, and so on. - -**criteria** The range of cells that contains the conditions you -specify. - -You can use any range for the criteria argument, as long as it includes -at least one column label and at least one cell below the column label -in which you specify a condition for the column. - -##### Return Value - -**float** The maximum value of the matching cells. - -##### Examples - -``` php -$database = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ], - [ 'Apple', 18, 20, 14, 105.00 ], - [ 'Pear', 12, 12, 10, 96.00 ], - [ 'Cherry', 13, 14, 9, 105.00 ], - [ 'Apple', 14, 15, 10, 75.00 ], - [ 'Pear', 9, 8, 8, 76.80 ], - [ 'Apple', 8, 9, 6, 45.00 ], -]; - -$criteria = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ], - [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ], - [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ], -]; - -$worksheet->fromArray( $criteria, NULL, 'A1' ) - ->fromArray( $database, NULL, 'A4' ); - -$worksheet->setCellValue('A12', '=DMAX(A4:E10,"Profit",A1:B2)'); - -$retVal = $worksheet->getCell('A12')->getCalculatedValue(); -// $retVal = 105 -``` - -##### Notes - -There are no additional notes on this function - -#### DMIN - -The DMIN function returns the smallest number in a column of a list or -database that matches conditions you specify. - -##### Syntax - - DMIN(database, field, criteria) - -##### Parameters - -**database** The range of cells that makes up the list or database. - -A database is a list of related data in which rows of related -information are records, and columns of data are fields. The first row -of the list contains labels for each column. - -**field** Indicates which column of the database is used in the -function. - -Enter the column label as a string (enclosed between double quotation -marks), such as "Age" or "Yield," or as a number (without quotation -marks) that represents the position of the column within the list: 1 for -the first column, 2 for the second column, and so on. - -**criteria** The range of cells that contains the conditions you -specify. - -You can use any range for the criteria argument, as long as it includes -at least one column label and at least one cell below the column label -in which you specify a condition for the column. - -##### Return Value - -**float** The minimum value of the matching cells. - -##### Examples - -``` php -$database = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ], - [ 'Apple', 18, 20, 14, 105.00 ], - [ 'Pear', 12, 12, 10, 96.00 ], - [ 'Cherry', 13, 14, 9, 105.00 ], - [ 'Apple', 14, 15, 10, 75.00 ], - [ 'Pear', 9, 8, 8, 76.80 ], - [ 'Apple', 8, 9, 6, 45.00 ], -]; - -$criteria = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ], - [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ], - [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ], -]; - -$worksheet->fromArray( $criteria, NULL, 'A1' ) - ->fromArray( $database, NULL, 'A4' ); - -$worksheet->setCellValue('A12', '=DMIN(A4:E10,"Yield",A1:A3)'); - -$retVal = $worksheet->getCell('A12')->getCalculatedValue(); -// $retVal = 6 -``` - -##### Notes - -There are no additional notes on this function - -#### DPRODUCT - -The DPRODUCT function multiplies the values in a column of a list or -database that match conditions that you specify. - -##### Syntax - - DPRODUCT(database, field, criteria) - -##### Parameters - -**database** The range of cells that makes up the list or database. - -A database is a list of related data in which rows of related -information are records, and columns of data are fields. The first row -of the list contains labels for each column. - -**field** Indicates which column of the database is used in the -function. - -Enter the column label as a string (enclosed between double quotation -marks), such as "Age" or "Yield," or as a number (without quotation -marks) that represents the position of the column within the list: 1 for -the first column, 2 for the second column, and so on. - -**criteria** The range of cells that contains the conditions you -specify. - -You can use any range for the criteria argument, as long as it includes -at least one column label and at least one cell below the column label -in which you specify a condition for the column. - -##### Return Value - -**float** The product of the matching cells. - -##### Examples - -``` php -$database = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ], - [ 'Apple', 18, 20, 14, 105.00 ], - [ 'Pear', 12, 12, 10, 96.00 ], - [ 'Cherry', 13, 14, 9, 105.00 ], - [ 'Apple', 14, 15, 10, 75.00 ], - [ 'Pear', 9, 8, 8, 76.80 ], - [ 'Apple', 8, 9, 6, 45.00 ], -]; - -$criteria = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ], - [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ], - [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ], -]; - -$worksheet->fromArray( $criteria, NULL, 'A1' ) - ->fromArray( $database, NULL, 'A4' ); - -$worksheet->setCellValue('A12', '=DPRODUCT(A4:E10,"Yield",A1:B2)'); - -$retVal = $worksheet->getCell('A12')->getCalculatedValue(); -// $retVal = 140 -``` - -##### Notes - -There are no additional notes on this function - -#### DSTDEV - -The DSTDEV function estimates the standard deviation of a population -based on a sample by using the numbers in a column of a list or database -that match conditions that you specify. - -##### Syntax - - DSTDEV(database, field, criteria) - -##### Parameters - -**database** The range of cells that makes up the list or database. - -A database is a list of related data in which rows of related -information are records, and columns of data are fields. The first row -of the list contains labels for each column. - -**field** Indicates which column of the database is used in the -function. - -Enter the column label as a string (enclosed between double quotation -marks), such as "Age" or "Yield," or as a number (without quotation -marks) that represents the position of the column within the list: 1 for -the first column, 2 for the second column, and so on. - -**criteria** The range of cells that contains the conditions you -specify. - -You can use any range for the criteria argument, as long as it includes -at least one column label and at least one cell below the column label -in which you specify a condition for the column. - -##### Return Value - -**float** The estimated standard deviation of the matching cells. - -##### Examples - -``` php -$database = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ], - [ 'Apple', 18, 20, 14, 105.00 ], - [ 'Pear', 12, 12, 10, 96.00 ], - [ 'Cherry', 13, 14, 9, 105.00 ], - [ 'Apple', 14, 15, 10, 75.00 ], - [ 'Pear', 9, 8, 8, 76.80 ], - [ 'Apple', 8, 9, 6, 45.00 ], -]; - -$criteria = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ], - [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ], - [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ], -]; - -$worksheet->fromArray( $criteria, NULL, 'A1' ) - ->fromArray( $database, NULL, 'A4' ); - -$worksheet->setCellValue('A12', '=DSTDEV(A4:E10,"Yield",A1:A3)'); - -$retVal = $worksheet->getCell('A12')->getCalculatedValue(); -// $retVal = 2.97 -``` - -##### Notes - -There are no additional notes on this function - -#### DSTDEVP - -The DSTDEVP function calculates the standard deviation of a population -based on the entire population by using the numbers in a column of a -list or database that match conditions that you specify. - -##### Syntax - - DSTDEVP(database, field, criteria) - -##### Parameters - -**database** The range of cells that makes up the list or database. - -A database is a list of related data in which rows of related -information are records, and columns of data are fields. The first row -of the list contains labels for each column. - -**field** Indicates which column of the database is used in the -function. - -Enter the column label as a string (enclosed between double quotation -marks), such as "Age" or "Yield," or as a number (without quotation -marks) that represents the position of the column within the list: 1 for -the first column, 2 for the second column, and so on. - -**criteria** The range of cells that contains the conditions you -specify. - -You can use any range for the criteria argument, as long as it includes -at least one column label and at least one cell below the column label -in which you specify a condition for the column. - -##### Return Value - -**float** The estimated standard deviation of the matching cells. - -##### Examples - -``` php -$database = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ], - [ 'Apple', 18, 20, 14, 105.00 ], - [ 'Pear', 12, 12, 10, 96.00 ], - [ 'Cherry', 13, 14, 9, 105.00 ], - [ 'Apple', 14, 15, 10, 75.00 ], - [ 'Pear', 9, 8, 8, 76.80 ], - [ 'Apple', 8, 9, 6, 45.00 ], -]; - -$criteria = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ], - [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ], - [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ], -]; - -$worksheet->fromArray( $criteria, NULL, 'A1' ) - ->fromArray( $database, NULL, 'A4' ); - -$worksheet->setCellValue('A12', '=DSTDEVP(A4:E10,"Yield",A1:A3)'); - -$retVal = $worksheet->getCell('A12')->getCalculatedValue(); -// $retVal = 2.65 -``` - -##### Notes - -There are no additional notes on this function - -#### DSUM - -The DSUM function adds the numbers in a column of a list or database -that matches conditions you specify. - -##### Syntax - - DSUM(database, field, criteria) - -##### Parameters - -**database** The range of cells that makes up the list or database. - -A database is a list of related data in which rows of related -information are records, and columns of data are fields. The first row -of the list contains labels for each column. - -**field** Indicates which column of the database is used in the -function. - -Enter the column label as a string (enclosed between double quotation -marks), such as "Age" or "Yield," or as a number (without quotation -marks) that represents the position of the column within the list: 1 for -the first column, 2 for the second column, and so on. - -**criteria** The range of cells that contains the conditions you -specify. - -You can use any range for the criteria argument, as long as it includes -at least one column label and at least one cell below the column label -in which you specify a condition for the column. - -##### Return Value - -**float** The total value of the matching cells. - -##### Examples - -``` php -$database = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit' ], - [ 'Apple', 18, 20, 14, 105.00 ], - [ 'Pear', 12, 12, 10, 96.00 ], - [ 'Cherry', 13, 14, 9, 105.00 ], - [ 'Apple', 14, 15, 10, 75.00 ], - [ 'Pear', 9, 8, 8, 76.80 ], - [ 'Apple', 8, 9, 6, 45.00 ], -]; - -$criteria = [ - [ 'Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height' ], - [ '="=Apple"', '>10', NULL, NULL, NULL, '<16' ], - [ '="=Pear"', NULL, NULL, NULL, NULL, NULL ], -]; - -$worksheet->fromArray( $criteria, NULL, 'A1' ) - ->fromArray( $database, NULL, 'A4' ); - -$worksheet->setCellValue('A12', '=DMIN(A4:E10,"Profit",A1:A2)'); - -$retVal = $worksheet->getCell('A12')->getCalculatedValue(); -// $retVal = 225 -``` - -##### Notes - -There are no additional notes on this function - -#### DVAR - -Not yet documented. - -#### DVARP - -Not yet documented. - -### Date and Time Functions - -Excel provides a number of functions for the manipulation of dates and -times, and calculations based on date/time values. it is worth spending -some time reading the section titled "Date and Time Values" on passing -date parameters and returning date values to understand how -PhpSpreadsheet reconciles the differences between dates and times in -Excel and in PHP. - -#### DATE - -The DATE function returns an Excel timestamp or a PHP timestamp or `DateTime` -object representing the date that is referenced by the parameters. - -##### Syntax - - DATE(year, month, day) - -##### Parameters - -**year** The year number. - -If this value is between 0 (zero) and 1899 inclusive (for the Windows -1900 calendar), or between 4 and 1903 inclusive (for the Mac 1904), then -PhpSpreadsheet adds it to the Calendar base year, so a value of 108 will -interpret the year as 2008 when using the Windows 1900 calendar, or 2012 -when using the Mac 1904 calendar. - -**month** The month number. - -If this value is greater than 12, the DATE function adds that number of -months to the first month in the year specified. For example, -DATE(2008,14,2) returns a value representing February 2, 2009. - -If the value of **month** is less than 1, then that value will be -adjusted by -1, and that will then be subtracted from the first month of -the year specified. For example, DATE(2008,0,2) returns a value -representing December 2, 2007; while DATE(2008,-1,2) returns a value -representing November 2, 2007. - -**day** The day number. - -If this value is greater than the number of days in the month (and year) -specified, the DATE function adds that number of days to the first day -in the month. For example, DATE(2008,1,35) returns a value representing -February 4, 2008. - -If the value of **day** is less than 1, then that value will be adjusted -by -1, and that will then be subtracted from the first month of the year -specified. For example, DATE(2008,3,0) returns a value representing -February 29, 2008; while DATE(2008,3,-2) returns a value representing -February 27, 2008. - -##### Return Value - -**mixed** A date/time stamp that corresponds to the given date. - -This could be a PHP timestamp value (integer), a PHP `DateTime` object, -or an Excel timestamp value (real), depending on the value of -`\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType()`. - -##### Examples - -``` php -$worksheet->setCellValue('A1', 'Year') - ->setCellValue('A2', 'Month') - ->setCellValue('A3', 'Day'); - -$worksheet->setCellValue('B1', 2008) - ->setCellValue('B2', 12) - ->setCellValue('B3', 31); - -$worksheet->setCellValue('D1', '=DATE(B1,B2,B3)'); - -$retVal = $worksheet->getCell('D1')->getCalculatedValue(); -// $retVal = 1230681600 -``` - -``` php -// We're going to be calling the same cell calculation multiple times, -// and expecting different return values, so disable calculation cacheing -\PhpOffice\PhpSpreadsheet\Calculation\Calculation::getInstance()->setCalculationCacheEnabled(FALSE); - -$saveFormat = \PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType(); - -\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType( - \PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_EXCEL -); - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATE'], - [2008, 12, 31] -); -// $retVal = 39813.0 - -\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType( - \PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_PHP_NUMERIC -); - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATE'], - [2008, 12, 31] -); -// $retVal = 1230681600 - -\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType($saveFormat); -``` - -##### Notes - -There are no additional notes on this function - -#### DATEDIF - -The DATEDIF function computes the difference between two dates in a -variety of different intervals, such number of years, months, or days. - -##### Syntax - - DATEDIF(date1, date2 [, unit]) - -##### Parameters - -**date1** First Date. - -An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date -represented as a string. - -**date2** Second Date. - -An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date -represented as a string. - -**unit** The interval type to use for the calculation - -This is a string, comprising one of the values listed below: - -Unit | Meaning | Description ------|---------------------------------|-------------------------------- -m | Months | Complete calendar months between the dates. -d | Days | Number of days between the dates. -y | Years | Complete calendar years between the dates. -ym | Months Excluding Years | Complete calendar months between the dates as if they were of the same year. -yd | Days Excluding Years | Complete calendar days between the dates as if they were of the same year. -md | Days Excluding Years And Months | Complete calendar days between the dates as if they were of the same month and same year. - -The unit value is not case sensitive, and defaults to `d`. - -##### Return Value - -**integer** An integer value that reflects the difference between the -two dates. - -This could be the number of full days, months or years between the two -dates, depending on the interval unit value passed into the function as -the third parameter. - -##### Examples - -``` php -$worksheet->setCellValue('A1', 'Year') - ->setCellValue('A2', 'Month') - ->setCellValue('A3', 'Day'); - -$worksheet->setCellValue('B1', 2001) - ->setCellValue('C1', 2009) - ->setCellValue('B2', 7) - ->setCellValue('C2', 12) - ->setCellValue('B3', 1) - ->setCellValue('C3', 31); - -$worksheet->setCellValue('D1', '=DATEDIF(DATE(B1,B2,B3),DATE(C1,C2,C3),"d")') - ->setCellValue('D2', '=DATEDIF(DATE(B1,B2,B3),DATE(C1,C2,C3),"m")') - ->setCellValue('D3', '=DATEDIF(DATE(B1,B2,B3),DATE(C1,C2,C3),"y")') - ->setCellValue('D4', '=DATEDIF(DATE(B1,B2,B3),DATE(C1,C2,C3),"ym")') - ->setCellValue('D5', '=DATEDIF(DATE(B1,B2,B3),DATE(C1,C2,C3),"yd")') - ->setCellValue('D6', '=DATEDIF(DATE(B1,B2,B3),DATE(C1,C2,C3),"md")'); - -$retVal = $worksheet->getCell('D1')->getCalculatedValue(); -// $retVal = 3105 - -$retVal = $worksheet->getCell('D2')->getCalculatedValue(); -// $retVal = 101 - -$retVal = $worksheet->getCell('D3')->getCalculatedValue(); -// $retVal = 8 - -$retVal = $worksheet->getCell('D4')->getCalculatedValue(); -// $retVal = 5 - -$retVal = $worksheet->getCell('D5')->getCalculatedValue(); -// $retVal = 183 - -$retVal = $worksheet->getCell('D6')->getCalculatedValue(); -// $retVal = 30 -``` - -``` php -$date1 = 1193317015; // PHP timestamp for 25-Oct-2007 -$date2 = 1449579415; // PHP timestamp for 8-Dec-2015 - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'], - [$date1, $date2, 'd'] -); -// $retVal = 2966 - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'], - [$date1, $date2, 'm'] -); -// $retVal = 97 - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'], - [$date1, $date2, 'y'] -); -// $retVal = 8 - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'], - [$date1, $date2, 'ym'] -); -// $retVal = 1 - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'], - [$date1, $date2, 'yd'] -); -// $retVal = 44 - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEDIF'], - [$date1, $date2, 'md'] -); -// $retVal = 13 -``` - -##### Notes - -If Date1 is later than Date2, DATEDIF will return a \#NUM! error. - -#### DATEVALUE - -The DATEVALUE function returns the date represented by a date formatted -as a text string. Use DATEVALUE to convert a date represented by text to -a serial number. - -##### Syntax - - DATEVALUE(dateString) - -##### Parameters - -**date** Date String. - -A string, representing a date value. - -##### Return Value - -**mixed** A date/time stamp that corresponds to the given date. - -This could be a PHP timestamp value (integer), a PHP `DateTime` object, -or an Excel timestamp value (real), depending on the value of -`\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType()`. - -##### Examples - -``` php -$worksheet->setCellValue('A1', 'Date String'); - ->setCellValue('A2', '31-Dec-2008') - ->setCellValue('A3', '31/12/2008') - ->setCellValue('A4', '12-31-2008'); - -$worksheet->setCellValue('B2', '=DATEVALUE(A2)') - ->setCellValue('B3', '=DATEVALUE(A3)') - ->setCellValue('B4', '=DATEVALUE(A4)'); - -\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType( - \PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_EXCEL -); - -$retVal = $worksheet->getCell('B2')->getCalculatedValue(); - -$retVal = $worksheet->getCell('B3')->getCalculatedValue(); - -$retVal = $worksheet->getCell('B4')->getCalculatedValue(); -// $retVal = 39813.0 for all cases -``` - -``` php -// We're going to be calling the same cell calculation multiple times, -// and expecting different return values, so disable calculation cacheing -\PhpOffice\PhpSpreadsheet\Calculation\Calculation::getInstance()->setCalculationCacheEnabled(FALSE); - -$saveFormat = \PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType(); - -\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType( - \PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_EXCEL -); - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEVALUE'], - ['31-Dec-2008'] -); -// $retVal = 39813.0 - -\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType( - \PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_PHP_NUMERIC -); - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DATEVALUE'], - ['31-Dec-2008'] -); -// $retVal = 1230681600 - -\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType($saveFormat); -``` - -##### Notes - -DATEVALUE uses the php `DateTime` object implementation of `strtotime()` -(which can handle a wider range of formats than the normal `strtotime()` -function), and it is also called for any date parameter passed to other -date functions (such as DATEDIF) when the parameter value is a string. - -**WARNING:-** PhpSpreadsheet accepts a wider range of date formats than -MS Excel, so it is entirely possible that Excel will return a \#VALUE! -error when passed a date string that it can’t interpret, while -PhpSpreadsheet is able to translate that same string into a correct date -value. - -Care should be taken in workbooks that use string formatted dates in -calculations when writing to Xls or Xlsx. - -#### DAY - -The DAY function returns the day of a date. The day is given as an -integer ranging from 1 to 31. - -##### Syntax - - DAY(datetime) - -##### Parameters - -**datetime** Date. - -An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date -represented as a string. - -##### Return Value - -**integer** An integer value that reflects the day of the month. - -This is an integer ranging from 1 to 31. - -##### Examples - -``` php -$worksheet->setCellValue('A1', 'Date String') - ->setCellValue('A2', '31-Dec-2008') - ->setCellValue('A3', '14-Feb-2008'); - -$worksheet->setCellValue('B2', '=DAY(A2)') - ->setCellValue('B3', '=DAY(A3)'); - -$retVal = $worksheet->getCell('B2')->getCalculatedValue(); -// $retVal = 31 - -$retVal = $worksheet->getCell('B3')->getCalculatedValue(); -// $retVal = 14 -``` - -``` php -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DAYOFMONTH'], - ['25-Dec-2008'] -); -// $retVal = 25 -``` - -##### Notes - -Note that the PhpSpreadsheet function is -`\PhpOffice\PhpSpreadsheet\Calculation\Functions::DAYOFMONTH()` when the -method is called statically. - -#### DAYS360 - -The DAYS360 function computes the difference between two dates based on -a 360 day year (12 equal periods of 30 days each) used by some -accounting systems. - -##### Syntax - - DAYS360(date1, date2 [, method]) - -#### Parameters - -**date1** First Date. - -An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date -represented as a string. - -**date2** Second Date. - -An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date -represented as a string. - -**method** A boolean flag (TRUE or FALSE) - -This is a flag that determines which method to use in the calculation, -based on the values listed below: - -method | Description --------|------------ -FALSE | U.S. (NASD) method. If the starting date is the last day of a month, it becomes equal to the 30th of the same month. If the ending date is the last day of a month and the starting date is earlier than the 30th of a month, the ending date becomes equal to the 1st of the next month; otherwise the ending date becomes equal to the 30th of the same month. -TRUE | European method. Starting dates and ending dates that occur on the 31st of a month become equal to the 30th of the same month. - -The method value defaults to FALSE. - -##### Return Value - -**integer** An integer value that reflects the difference between the -two dates. - -This is the number of full days between the two dates, based on a 360 -day year. - -##### Examples - -``` php -$worksheet->setCellValue('B1', 'Start Date') - ->setCellValue('C1', 'End Date') - ->setCellValue('A2', 'Year') - ->setCellValue('A3', 'Month') - ->setCellValue('A4', 'Day'); - -$worksheet->setCellValue('B2', 2003) - ->setCellValue('B3', 2) - ->setCellValue('B4', 3); - -$worksheet->setCellValue('C2', 2007) - ->setCellValue('C3', 5) - ->setCellValue('C4', 31); - -$worksheet->setCellValue('E2', '=DAYS360(DATE(B2,B3,B4),DATE(C2,C3,C4))') - ->setCellValue('E4', '=DAYS360(DATE(B2,B3,B4),DATE(C2,C3,C4),FALSE)'); - -$retVal = $worksheet->getCell('E2')->getCalculatedValue(); -// $retVal = 1558 - -$retVal = $worksheet->getCell('E4')->getCalculatedValue(); -// $retVal = 1557 -``` - -``` php -$date1 = 37655.0; // Excel timestamp for 25-Oct-2007 -$date2 = 39233.0; // Excel timestamp for 8-Dec-2015 - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DAYS360'], - [$date1, $date2] -); -// $retVal = 1558 - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'DAYS360'], - [$date1, $date2, TRUE] -); -// $retVal = 1557 -``` - -##### Notes - -**WARNING:-** This function does not currently work with the Xls Writer -when a PHP Boolean is used for the third (optional) parameter (as shown -in the example above), and the writer will generate and error. It will -work if a numeric 0 or 1 is used for the method parameter; or if the -Excel `TRUE()` and `FALSE()` functions are used instead. - -#### EDATE - -The EDATE function returns an Excel timestamp or a PHP timestamp or `DateTime` -object representing the date that is the indicated number of months -before or after a specified date (the start\_date). Use EDATE to -calculate maturity dates or due dates that fall on the same day of the -month as the date of issue. - -##### Syntax - - EDATE(baseDate, months) - -##### Parameters - -**baseDate** Start Date. - -An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date -represented as a string. - -**months** Number of months to add. - -An integer value indicating the number of months before or after -baseDate. A positive value for months yields a future date; a negative -value yields a past date. - -##### Return Value - -**mixed** A date/time stamp that corresponds to the basedate + months. - -This could be a PHP timestamp value (integer), a PHP `DateTime` object, -or an Excel timestamp value (real), depending on the value of -`\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType()`. - -##### Examples - -``` php -$worksheet->setCellValue('A1', 'Date String') - ->setCellValue('A2', '1-Jan-2008') - ->setCellValue('A3', '29-Feb-2008'); - -$worksheet->setCellValue('B2', '=EDATE(A2,5)') - ->setCellValue('B3', '=EDATE(A3,-12)'); - -\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType( - \PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_EXCEL -); - -$retVal = $worksheet->getCell('B2')->getCalculatedValue(); -// $retVal = 39600.0 (1-Jun-2008) - -$retVal = $worksheet->getCell('B3')->getCalculatedValue(); -// $retVal = 39141.0 (28-Feb-2007) -``` - -``` php -\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType( - \PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_EXCEL -); - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'EDATE'], - ['31-Oct-2008', 25] -); -// $retVal = 40512.0 (30-Nov-2010) -``` - -###### Notes - -**WARNING:-** This function is currently not supported by the Xls Writer -because it is not a standard function within Excel 5, but an add-in from -the Analysis ToolPak. - -#### EOMONTH - -The EOMONTH function returns an Excel timestamp or a PHP timestamp or -`DateTime` object representing the date of the last day of the month that is -the indicated number of months before or after a specified date (the -start\_date). Use EOMONTH to calculate maturity dates or due dates that -fall on the last day of the month. - -##### Syntax - - EOMONTH(baseDate, months) - -##### Parameters - -**baseDate** Start Date. - -An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date -represented as a string. - -**months** Number of months to add. - -An integer value indicating the number of months before or after -baseDate. A positive value for months yields a future date; a negative -value yields a past date. - -##### Return Value - -**mixed** A date/time stamp that corresponds to the last day of basedate -+ months. - -This could be a PHP timestamp value (integer), a PHP `DateTime` object, -or an Excel timestamp value (real), depending on the value of -`\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType()`. - -##### Examples - -``` php -$worksheet->setCellValue('A1', 'Date String') - ->setCellValue('A2', '1-Jan-2000') - ->setCellValue('A3', '14-Feb-2009'); - -$worksheet->setCellValue('B2', '=EOMONTH(A2,5)') - ->setCellValue('B3', '=EOMONTH(A3,-12)'); - -\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType(\PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_EXCEL); - -$retVal = $worksheet->getCell('B2')->getCalculatedValue(); -// $retVal = 39629.0 (30-Jun-2008) - -$retVal = $worksheet->getCell('B3')->getCalculatedValue(); -// $retVal = 39507.0 (29-Feb-2008) -``` - -``` php -\PhpOffice\PhpSpreadsheet\Calculation\Functions::setReturnDateType( - \PhpOffice\PhpSpreadsheet\Calculation\Functions::RETURNDATE_EXCEL -); - -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'EOMONTH'], - ['31-Oct-2008', 13] -); -// $retVal = 40147.0 (30-Nov-2010) -``` - -##### Notes - -**WARNING:-** This function is currently not supported by the Xls Writer -because it is not a standard function within Excel 5, but an add-in from -the Analysis ToolPak. - -#### HOUR - -The HOUR function returns the hour of a time value. The hour is given as -an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.). - -##### Syntax - - HOUR(datetime) - -##### Parameters - -**datetime** Time. - -An Excel date/time value, PHP date timestamp, PHP `DateTime` object, or a -date/time represented as a string. - -##### Return Value - -**integer** An integer value that reflects the hour of the day. - -This is an integer ranging from 0 to 23. - -##### Examples - -``` php -$worksheet->setCellValue('A1', 'Time String') - ->setCellValue('A2', '31-Dec-2008 17:30') - ->setCellValue('A3', '14-Feb-2008 4:20 AM') - ->setCellValue('A4', '14-Feb-2008 4:20 PM'); - -$worksheet->setCellValue('B2', '=HOUR(A2)') - ->setCellValue('B3', '=HOUR(A3)') - ->setCellValue('B4', '=HOUR(A4)'); - -$retVal = $worksheet->getCell('B2')->getCalculatedValue(); -// $retVal = 17 - -$retVal = $worksheet->getCell('B3')->getCalculatedValue(); -// $retVal = 4 - -$retVal = $worksheet->getCell('B4')->getCalculatedValue(); -// $retVal = 16 -``` - -``` php -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'HOUROFDAY'], - ['09:30'] -); -// $retVal = 9 -``` - -##### Notes - -Note that the PhpSpreadsheet function is -`\PhpOffice\PhpSpreadsheet\Calculation\Functions::HOUROFDAY()` when the -method is called statically. - -#### MINUTE - -The MINUTE function returns the minutes of a time value. The minute is -given as an integer, ranging from 0 to 59. - -##### Syntax - - MINUTE(datetime) - -##### Parameters - -**datetime** Time. - -An Excel date/time value, PHP date timestamp, PHP `DateTime` object, or a -date/time represented as a string. - -##### Return Value - -**integer** An integer value that reflects the minutes within the hour. - -This is an integer ranging from 0 to 59. - -##### Examples - -``` php -$worksheet->setCellValue('A1', 'Time String') - ->setCellValue('A2', '31-Dec-2008 17:30') - ->setCellValue('A3', '14-Feb-2008 4:20 AM') - ->setCellValue('A4', '14-Feb-2008 4:45 PM'); - -$worksheet->setCellValue('B2', '=MINUTE(A2)') - ->setCellValue('B3', '=MINUTE(A3)') - ->setCellValue('B4', '=MINUTE(A4)'); - -$retVal = $worksheet->getCell('B2')->getCalculatedValue(); -// $retVal = 30 - -$retVal = $worksheet->getCell('B3')->getCalculatedValue(); -// $retVal = 20 - -$retVal = $worksheet->getCell('B4')->getCalculatedValue(); -// $retVal = 45 -``` - -``` php -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'MINUTE'], - ['09:30'] -); -// $retVal = 30 -``` - -##### Notes - -Note that the PhpSpreadsheet function is -`\PhpOffice\PhpSpreadsheet\Calculation\Functions::MINUTE()` when the -method is called statically. - -#### MONTH - -The MONTH function returns the month of a date. The month is given as an -integer ranging from 1 to 12. - -##### Syntax - - MONTH(datetime) - -##### Parameters - -**datetime** Date. - -An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date -represented as a string. - -##### Return Value - -**integer** An integer value that reflects the month of the year. - -This is an integer ranging from 1 to 12. - -##### Examples - -``` php -$worksheet->setCellValue('A1', 'Date String'); -$worksheet->setCellValue('A2', '31-Dec-2008'); -$worksheet->setCellValue('A3', '14-Feb-2008'); - -$worksheet->setCellValue('B2', '=MONTH(A2)'); -$worksheet->setCellValue('B3', '=MONTH(A3)'); - -$retVal = $worksheet->getCell('B2')->getCalculatedValue(); -// $retVal = 12 - -$retVal = $worksheet->getCell('B3')->getCalculatedValue(); -// $retVal = 2 -``` - -``` php -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'MONTHOFYEAR'], - ['14-July-2008'] -); -// $retVal = 7 -``` - -#### Notes - -Note that the PhpSpreadsheet function is -`\PhpOffice\PhpSpreadsheet\Calculation\Functions::MONTHOFYEAR()` when the -method is called statically. - -#### NETWORKDAYS - -The NETWORKDAYS function returns the number of whole working days -between a *start date* and an *end date*. Working days exclude weekends -and any dates identified in *holidays*. Use NETWORKDAYS to calculate -employee benefits that accrue based on the number of days worked during -a specific term. - -##### Syntax - - NETWORKDAYS(startDate, endDate [, holidays]) - -##### Parameters - -**startDate** Start Date of the period. - -An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date -represented as a string. - -**endDate** End Date of the period. - -An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date -represented as a string. - -**holidays** Optional array of Holiday dates. - -An optional range of one or more dates to exclude from the working -calendar, such as state and federal holidays and floating holidays. - -The list can be either a range of cells that contains the dates or an -array constant of Excel date values, PHP date timestamps, PHP date -objects, or dates represented as strings. - -##### Return Value - -**integer** Number of working days. - -The number of working days between startDate and endDate. - -##### Examples - -``` php -``` - -``` php -``` - -##### Notes - -There are no additional notes on this function - -#### NOW - -The NOW function returns the current date and time. - -##### Syntax - - NOW() - -##### Parameters - -There are no parameters for the `NOW()` function. - -##### Return Value - -**mixed** A date/time stamp that corresponds to the current date and -time. - -This could be a PHP timestamp value (integer), a PHP `DateTime` object, -or an Excel timestamp value (real), depending on the value of -`\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType()`. - -##### Examples - -``` php -``` - -``` php -``` - -##### Notes - -Note that the PhpSpreadsheet function is -`\PhpOffice\PhpSpreadsheet\Calculation\Functions::DATETIMENOW()` when the -method is called statically. - -#### SECOND - -The SECOND function returns the seconds of a time value. The second is -given as an integer, ranging from 0 to 59. - -##### Syntax - - SECOND(datetime) - -##### Parameters - -**datetime** Time. - -An Excel date/time value, PHP date timestamp, PHP `DateTime` object, or a -date/time represented as a string. - -##### Return Value - -**integer** An integer value that reflects the seconds within the -minute. - -This is an integer ranging from 0 to 59. - -##### Examples - -``` php -$worksheet->setCellValue('A1', 'Time String') - ->setCellValue('A2', '31-Dec-2008 17:30:20') - ->setCellValue('A3', '14-Feb-2008 4:20 AM') - ->setCellValue('A4', '14-Feb-2008 4:45:59 PM'); - -$worksheet->setCellValue('B2', '=SECOND(A2)') - ->setCellValue('B3', '=SECOND(A3)'); - ->setCellValue('B4', '=SECOND(A4)'); - -$retVal = $worksheet->getCell('B2')->getCalculatedValue(); -// $retVal = 20 - -$retVal = $worksheet->getCell('B3')->getCalculatedValue(); -// $retVal = 0 - -$retVal = $worksheet->getCell('B4')->getCalculatedValue(); -// $retVal = 59 -``` - -``` php -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'SECOND'], - ['09:30:17'] -); -// $retVal = 17 -``` - -##### Notes - -Note that the PhpSpreadsheet function is -`\PhpOffice\PhpSpreadsheet\Calculation\Functions::SECOND()` when the -method is called statically. - -#### TIME - -Not yet documented. - -#### TIMEVALUE - -Not yet documented. - -#### TODAY - -Not yet documented. - -#### WEEKDAY - -The WEEKDAY function returns the day of the week for a given date. The -day is given as an integer ranging from 1 to 7, although this can be -modified to return a value between 0 and 6. - -##### Syntax - - WEEKDAY(datetime [, method]) - -##### Parameters - -**datetime** Date. - -An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date -represented as a string. - -**method** An integer flag (values 0, 1 or 2) - -This is a flag that determines which method to use in the calculation, -based on the values listed below: - - method | Description - :-----:|------------------------------------------ - 0 | Returns 1 (Sunday) through 7 (Saturday). - 1 | Returns 1 (Monday) through 7 (Sunday). - 2 | Returns 0 (Monday) through 6 (Sunday). - -The method value defaults to 1. - -##### Return Value - -**integer** An integer value that reflects the day of the week. - -This is an integer ranging from 1 to 7, or 0 to 6, depending on the -value of method. - -##### Examples - -``` php -$worksheet->setCellValue('A1', 'Date String') - ->setCellValue('A2', '31-Dec-2008') - ->setCellValue('A3', '14-Feb-2008'); - -$worksheet->setCellValue('B2', '=WEEKDAY(A2)') - ->setCellValue('B3', '=WEEKDAY(A3,0)') - ->setCellValue('B4', '=WEEKDAY(A3,2)'); - -$retVal = $worksheet->getCell('B2')->getCalculatedValue(); -// $retVal = 12 - -$retVal = $worksheet->getCell('B3')->getCalculatedValue(); -// $retVal = 2 - -$retVal = $worksheet->getCell('B4')->getCalculatedValue(); -// $retVal = 2 -``` - -``` php -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'WEEKDAY'], - ['14-July-2008'] -); -// $retVal = 7 -``` - -##### Notes - -Note that the PhpSpreadsheet function is -`\PhpOffice\PhpSpreadsheet\Calculation\Functions::WEEKDAY()` when the -method is called statically. - -#### WEEKNUM - -Not yet documented. - -#### WORKDAY - -Not yet documented. - -#### YEAR - -The YEAR function returns the year of a date. - -##### Syntax - - YEAR(datetime) - -##### Parameters - -**datetime** Date. - -An Excel date value, PHP date timestamp, PHP `DateTime` object, or a date -represented as a string. - -##### Return Value - -**integer** An integer value that reflects the month of the year. - -This is an integer year value. - -##### Examples - -``` php -$worksheet->setCellValue('A1', 'Date String') - ->setCellValue('A2', '17-Jul-1982') - ->setCellValue('A3', '16-Apr-2009'); - -$worksheet->setCellValue('B2', '=YEAR(A2)') - ->setCellValue('B3', '=YEAR(A3)'); - -$retVal = $worksheet->getCell('B2')->getCalculatedValue(); -// $retVal = 1982 - -$retVal = $worksheet->getCell('B3')->getCalculatedValue(); -// $retVal = 2009 -``` - -``` php -$retVal = call_user_func_array( - ['\PhpOffice\PhpSpreadsheet\Calculation\Functions', 'YEAR'], - ['14-July-2001'] -); -// $retVal = 2001 -``` - -##### Notes - -There are no additional notes on this function - -### YEARFRAC - -Not yet documented. diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/creating-spreadsheet.md b/vendor/phpoffice/phpspreadsheet/docs/topics/creating-spreadsheet.md deleted file mode 100644 index dceafe4b..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/topics/creating-spreadsheet.md +++ /dev/null @@ -1,59 +0,0 @@ -# Creating a spreadsheet - -## The `Spreadsheet` class - -The `Spreadsheet` class is the core of PhpSpreadsheet. It contains -references to the contained worksheets, document security settings and -document meta data. - -To simplify the PhpSpreadsheet concept: the `Spreadsheet` class -represents your workbook. - -Typically, you will create a workbook in one of two ways, either by -loading it from a spreadsheet file, or creating it manually. A third -option, though less commonly used, is cloning an existing workbook that -has been created using one of the previous two methods. - -### Loading a Workbook from a file - -Details of the different spreadsheet formats supported, and the options -available to read them into a Spreadsheet object are described fully in -the [Reading Files](./reading-files.md) document. - -``` php -$inputFileName = './sampleData/example1.xls'; - -/** Load $inputFileName to a Spreadsheet object **/ -$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName); -``` - -### Creating a new workbook - -If you want to create a new workbook, rather than load one from file, -then you simply need to instantiate it as a new Spreadsheet object. - -``` php -/** Create a new Spreadsheet Object **/ -$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet(); -``` - -A new workbook will always be created with a single worksheet. - -## Clearing a Workbook from memory - -The PhpSpreadsheet object contains cyclic references (e.g. the workbook -is linked to the worksheets, and the worksheets are linked to their -parent workbook) which cause problems when PHP tries to clear the -objects from memory when they are `unset()`, or at the end of a function -when they are in local scope. The result of this is "memory leaks", -which can easily use a large amount of PHP's limited memory. - -This can only be resolved manually: if you need to unset a workbook, -then you also need to "break" these cyclic references before doing so. -PhpSpreadsheet provides the `disconnectWorksheets()` method for this -purpose. - -``` php -$spreadsheet->disconnectWorksheets(); -unset($spreadsheet); -``` diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/file-formats.md b/vendor/phpoffice/phpspreadsheet/docs/topics/file-formats.md deleted file mode 100644 index d447a2f0..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/topics/file-formats.md +++ /dev/null @@ -1,121 +0,0 @@ -# File Formats - -PhpSpreadsheet can read a number of different spreadsheet and file -formats, although not all features are supported by all of the readers. -Check the [features cross -reference](../references/features-cross-reference.md) for a list that -identifies which features are supported by which readers. - -Currently, PhpSpreadsheet supports the following File Types for Reading: - -### Xls - -The Microsoft Excel™ Binary file format (BIFF5 and BIFF8) is a binary -file format that was used by Microsoft Excel™ between versions 95 and 2003. -The format is supported (to various extents) by most spreadsheet -programs. BIFF files normally have an extension of .xls. Documentation -describing the format can be [read online](https://msdn.microsoft.com/en-us/library/cc313154(v=office.12).aspx) -or [downloaded as PDF](http://download.microsoft.com/download/2/4/8/24862317-78F0-4C4B-B355-C7B2C1D997DB/%5BMS-XLS%5D.pdf). - -### Xml - -Microsoft Excel™ 2003 included options for a file format called -SpreadsheetML. This file is a zipped XML document. It is not very -common, but its core features are supported. Documentation for the -format can be [read online](https://msdn.microsoft.com/en-us/library/aa140066(office.10).aspx) -though it’s sadly rather sparse in its detail. - -### Xlsx - -Microsoft Excel™ 2007 shipped with a new file format, namely Microsoft -Office Open XML SpreadsheetML, and Excel 2010 extended this still -further with its new features such as sparklines. These files typically -have an extension of .xlsx. This format is based around a zipped -collection of eXtensible Markup Language (XML) files. Microsoft Office -Open XML SpreadsheetML is mostly standardized in [ECMA 376](http://www.ecma-international.org/news/TC45_current_work/TC45_available_docs.htm) -and ISO 29500. - -### Ods - -aka Open Document Format (ODF) or OASIS, this is the OpenOffice.org XML -file format for spreadsheets. It comprises a zip archive including -several components all of which are text files, most of these with -markup in the eXtensible Markup Language (XML). It is the standard file -format for OpenOffice.org Calc and StarCalc, and files typically have an -extension of .ods. The published specification for the file format is -available from [the OASIS Open Office XML Format Technical Committee web -page](https://www.oasis-open.org/committees/tc_home.php?wg_abbrev=office). -Other information is available from [the OpenOffice.org XML File Format -web page](http://www.openoffice.org/xml/), part of the -OpenOffice.org project. - -### Slk - -This is the Microsoft Multiplan Symbolic Link Interchange (SYLK) file -format. Multiplan was a predecessor to Microsoft Excel™. Files normally -have an extension of .slk. While not common, there are still a few -applications that generate SYLK files as a cross-platform option, -because (despite being limited to a single worksheet) it is a simple -format to implement, and supports some basic data and cell formatting -options (unlike CSV files). - -### Gnumeric - -The [Gnumeric file format](https://help.gnome.org/users/gnumeric/stable/sect-file-formats.html.en#file-format-gnumeric) -is used by the Gnome Gnumeric spreadsheet -application, and typically files have an extension of `.gnumeric`. The -file contents are stored using eXtensible Markup Language (XML) markup, -and the file is then compressed using the GNU project's gzip compression -library. - -### Csv - -Comma Separated Value (CSV) file format is a common structuring strategy -for text format files. In CSV flies, each line in the file represents a -row of data and (within each line of the file) the different data fields -(or columns) are separated from one another using a comma (`,`). If a -data field contains a comma, then it should be enclosed (typically in -quotation marks (`"`). Sometimes tabs `\t`, or the pipe symbol (`|`), or a -semi-colon (`;`) are used as separators instead of a comma, although -other symbols can be used. Because CSV is a text-only format, it doesn't -support any data formatting options. - -"CSV" is not a single, well-defined format (although see RFC 4180 for -one definition that is commonly used). Rather, in practice the term -"CSV" refers to any file that: - -- is plain text using a character set such as ASCII, Unicode, EBCDIC, - or Shift JIS, -- consists of records (typically one record per line), -- with the records divided into fields separated by delimiters - (typically a single reserved character such as comma, semicolon, or - tab, -- where every record has the same sequence of fields. - -Within these general constraints, many variations are in use. Therefore -"CSV" files are not entirely portable. Nevertheless, the variations are -fairly small, and many implementations allow users to glance at the file -(which is feasible because it is plain text), and then specify the -delimiter character(s), quoting rules, etc. - -**Warning:** Microsoft Excel™ will open .csv files, but depending on the -system's regional settings, it may expect a semicolon as a separator -instead of a comma, since in some languages the comma is used as the -decimal separator. Also, many regional versions of Excel will not be -able to deal with Unicode characters in a CSV file. - -### Html - -HyperText Markup Language (HTML) is the main markup language for -creating web pages and other information that can be displayed in a web -browser. Files typically have an extension of .html or .htm. HTML markup -provides a means to create structured documents by denoting structural -semantics for text such as headings, paragraphs, lists, links, quotes -and other items. Since 1996, the HTML specifications have been -maintained, with input from commercial software vendors, by the World -Wide Web Consortium (W3C). However, in 2000, HTML also became an -international standard (ISO/IEC 15445:2000). HTML 4.01 was published in -late 1999, with further errata published through 2001. In 2004 -development began on HTML5 in the Web Hypertext Application Technology -Working Group (WHATWG), which became a joint deliverable with the W3C in -2008. diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-01-autofilter.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-01-autofilter.png deleted file mode 100644 index 8b5c4fad..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-01-autofilter.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-02-autofilter.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-02-autofilter.png deleted file mode 100644 index a2d6c9b9..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-02-autofilter.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-03-filter-icon-1.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-03-filter-icon-1.png deleted file mode 100644 index e5a7e7dc..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-03-filter-icon-1.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-03-filter-icon-2.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-03-filter-icon-2.png deleted file mode 100644 index 1567245f..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-03-filter-icon-2.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-04-autofilter.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-04-autofilter.png deleted file mode 100644 index b88f4c4f..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-04-autofilter.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-schematic.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-schematic.png deleted file mode 100644 index 8b677920..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/01-schematic.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/02-readers-writers.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/02-readers-writers.png deleted file mode 100644 index 0600788a..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/02-readers-writers.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-01-simple-autofilter.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-01-simple-autofilter.png deleted file mode 100644 index 5dcc6a47..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-01-simple-autofilter.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-02-dategroup-autofilter.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-02-dategroup-autofilter.png deleted file mode 100644 index da1f089b..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-02-dategroup-autofilter.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-03-custom-autofilter-1.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-03-custom-autofilter-1.png deleted file mode 100644 index 0098d98a..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-03-custom-autofilter-1.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-03-custom-autofilter-2.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-03-custom-autofilter-2.png deleted file mode 100644 index 96ff2cf0..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-03-custom-autofilter-2.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-04-dynamic-autofilter.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-04-dynamic-autofilter.png deleted file mode 100644 index 6cb905d9..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-04-dynamic-autofilter.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-05-topten-autofilter-1.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-05-topten-autofilter-1.png deleted file mode 100644 index 207e6457..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-05-topten-autofilter-1.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-05-topten-autofilter-2.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-05-topten-autofilter-2.png deleted file mode 100644 index 4db51252..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/04-05-topten-autofilter-2.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/07-simple-example-1.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/07-simple-example-1.png deleted file mode 100644 index 30d19368..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/07-simple-example-1.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/07-simple-example-2.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/07-simple-example-2.png deleted file mode 100644 index e2b68506..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/07-simple-example-2.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/07-simple-example-3.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/07-simple-example-3.png deleted file mode 100644 index 459261f3..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/07-simple-example-3.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/07-simple-example-4.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/07-simple-example-4.png deleted file mode 100644 index 70725452..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/07-simple-example-4.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-cell-comment.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-cell-comment.png deleted file mode 100644 index bd8f8e66..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-cell-comment.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-column-width.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-column-width.png deleted file mode 100644 index 14199434..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-column-width.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-page-setup-margins.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-page-setup-margins.png deleted file mode 100644 index 36e07a9b..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-page-setup-margins.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-page-setup-scaling-options.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-page-setup-scaling-options.png deleted file mode 100644 index 80fb5f00..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-page-setup-scaling-options.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-styling-border-options.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-styling-border-options.png deleted file mode 100644 index 4ef59707..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/08-styling-border-options.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/09-command-line-calculation.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/09-command-line-calculation.png deleted file mode 100644 index ceb2b309..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/09-command-line-calculation.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/09-formula-in-cell-1.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/09-formula-in-cell-1.png deleted file mode 100644 index e50c6cc8..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/09-formula-in-cell-1.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/images/09-formula-in-cell-2.png b/vendor/phpoffice/phpspreadsheet/docs/topics/images/09-formula-in-cell-2.png deleted file mode 100644 index 46daf090..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/docs/topics/images/09-formula-in-cell-2.png and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/memory_saving.md b/vendor/phpoffice/phpspreadsheet/docs/topics/memory_saving.md deleted file mode 100644 index c7f9a0cb..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/topics/memory_saving.md +++ /dev/null @@ -1,107 +0,0 @@ -# Memory saving - -PhpSpreadsheet uses an average of about 1k per cell in your worksheets, so -large workbooks can quickly use up available memory. Cell caching -provides a mechanism that allows PhpSpreadsheet to maintain the cell -objects in a smaller size of memory, or off-memory (eg: on disk, in APCu, -memcache or redis). This allows you to reduce the memory usage for large -workbooks, although at a cost of speed to access cell data. - -By default, PhpSpreadsheet holds all cell objects in memory, but -you can specify alternatives by providing your own -[PSR-16](http://www.php-fig.org/psr/psr-16/) implementation. PhpSpreadsheet keys -are automatically namespaced, and cleaned up after use, so a single cache -instance may be shared across several usage of PhpSpreadsheet or even with other -cache usages. - -To enable cell caching, you must provide your own implementation of cache like so: - -``` php -$cache = new MyCustomPsr16Implementation(); - -\PhpOffice\PhpSpreadsheet\Settings::setCache($cache); -``` - -A separate cache is maintained for each individual worksheet, and is -automatically created when the worksheet is instantiated based on the -settings that you have configured. You cannot change -the configuration settings once you have started to read a workbook, or -have created your first worksheet. - -## Beware of TTL - -As opposed to common cache concept, PhpSpreadsheet data cannot be re-generated -from scratch. If some data is stored and later is not retrievable, -PhpSpreadsheet will throw an exception. - -That means that the data stored in cache **must not be deleted** by a -third-party or via TTL mechanism. - -So be sure that TTL is either de-activated or long enough to cover the entire -usage of PhpSpreadsheet. - -## Common use cases - -PhpSpreadsheet does not ship with alternative cache implementation. It is up to -you to select the most appropriate implementation for your environment. You -can either implement [PSR-16](http://www.php-fig.org/psr/psr-16/) from scratch, -or use [pre-existing libraries](https://packagist.org/search/?q=psr-16). - -One such library is [PHP Cache](https://www.php-cache.com/) which -provides a wide range of alternatives. Refers to their documentation for -details, but here are a few suggestions that should get you started. - -### APCu - -Require the packages into your project: - -```sh -composer require cache/simple-cache-bridge cache/apcu-adapter -``` - -Configure PhpSpreadsheet with something like: - -```php -$pool = new \Cache\Adapter\Apcu\ApcuCachePool(); -$simpleCache = new \Cache\Bridge\SimpleCache\SimpleCacheBridge($pool); - -\PhpOffice\PhpSpreadsheet\Settings::setCache($simpleCache); -``` - -### Redis - -Require the packages into your project: - -```sh -composer require cache/simple-cache-bridge cache/redis-adapter -``` - -Configure PhpSpreadsheet with something like: - -```php -$client = new \Redis(); -$client->connect('127.0.0.1', 6379); -$pool = new \Cache\Adapter\Redis\RedisCachePool($client); -$simpleCache = new \Cache\Bridge\SimpleCache\SimpleCacheBridge($pool); - -\PhpOffice\PhpSpreadsheet\Settings::setCache($simpleCache); -``` - -### Memcache - -Require the packages into your project: - -```sh -composer require cache/simple-cache-bridge cache/memcache-adapter -``` - -Configure PhpSpreadsheet with something like: - -```php -$client = new \Memcache(); -$client->connect('localhost', 11211); -$pool = new \Cache\Adapter\Memcache\MemcacheCachePool($client); -$simpleCache = new \Cache\Bridge\SimpleCache\SimpleCacheBridge($pool); - -\PhpOffice\PhpSpreadsheet\Settings::setCache($simpleCache); -``` diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/migration-from-PHPExcel.md b/vendor/phpoffice/phpspreadsheet/docs/topics/migration-from-PHPExcel.md deleted file mode 100644 index ae1cb28b..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/topics/migration-from-PHPExcel.md +++ /dev/null @@ -1,433 +0,0 @@ -# Migration from PHPExcel - -PhpSpreadsheet introduced many breaking changes by introducing -namespaces and renaming some classes. To help you migrate existing -project, a tool was written to replace all references to PHPExcel -classes to their new names. But there are also manual changes that -need to be done. - -## Automated tool - -The tool is included in PhpSpreadsheet. It scans recursively all files -and directories, starting from the current directory. Assuming it was -installed with composer, it can be run like so: - -``` sh -cd /project/to/migrate/src -/project/to/migrate/vendor/phpoffice/phpspreadsheet/bin/migrate-from-phpexcel -``` - -**Important** The tool will irreversibly modify your sources, be sure to -backup everything, and double check the result before committing. - -## Manual changes - -In addition to automated changes, a few things need to be migrated manually. - -### Renamed readers and writers - -When using `IOFactory::createReader()`, `IOFactory::createWriter()` and -`IOFactory::identify()`, the reader/writer short names are used. Those were -changed, along as their corresponding class, to remove ambiguity: - -Before | After ------------------|--------- -`'CSV'` | `'Csv'` -`'Excel2003XML'` | `'Xml'` -`'Excel2007'` | `'Xlsx'` -`'Excel5'` | `'Xls'` -`'Gnumeric'` | `'Gnumeric'` -`'HTML'` | `'Html'` -`'OOCalc'` | `'Ods'` -`'OpenDocument'` | `'Ods'` -`'PDF'` | `'Pdf'` -`'SYLK'` | `'Slk'` - -### Simplified IOFactory - -The following methods : - -- `PHPExcel_IOFactory::getSearchLocations()` -- `PHPExcel_IOFactory::setSearchLocations()` -- `PHPExcel_IOFactory::addSearchLocation()` - -were replaced by `IOFactory::registerReader()` and `IOFactory::registerWriter()`. That means -IOFactory now relies on classes autoloading. - -Before: - -```php -\PHPExcel_IOFactory::addSearchLocation($type, $location, $classname); -``` - -After: - -```php -\PhpOffice\PhpSpreadsheet\IOFactory::registerReader($type, $classname); -``` - -### Removed deprecated things - -#### Worksheet::duplicateStyleArray() - -``` php -// Before -$worksheet->duplicateStyleArray($styles, $range, $advanced); - -// After -$worksheet->getStyle($range)->applyFromArray($styles, $advanced); -``` - -#### DataType::dataTypeForValue() - -``` php -// Before -DataType::dataTypeForValue($value); - -// After -DefaultValueBinder::dataTypeForValue($value); -``` - -#### Conditional::getCondition() - -``` php -// Before -$conditional->getCondition(); - -// After -$conditional->getConditions()[0]; -``` - -#### Conditional::setCondition() - -``` php -// Before -$conditional->setCondition($value); - -// After -$conditional->setConditions($value); -``` - -#### Worksheet::getDefaultStyle() - -``` php -// Before -$worksheet->getDefaultStyle(); - -// After -$worksheet->getParent()->getDefaultStyle(); -``` - -#### Worksheet::setDefaultStyle() - -``` php -// Before -$worksheet->setDefaultStyle($value); - -// After -$worksheet->getParent()->getDefaultStyle()->applyFromArray([ - 'font' => [ - 'name' => $pValue->getFont()->getName(), - 'size' => $pValue->getFont()->getSize(), - ], -]); - -``` - -#### Worksheet::setSharedStyle() - -``` php -// Before -$worksheet->setSharedStyle($sharedStyle, $range); - -// After -$worksheet->duplicateStyle($sharedStyle, $range); -``` - -#### Worksheet::getSelectedCell() - -``` php -// Before -$worksheet->getSelectedCell(); - -// After -$worksheet->getSelectedCells(); -``` - -#### Writer\Xls::setTempDir() - -``` php -// Before -$writer->setTempDir(); - -// After, there is no way to set temporary storage directory anymore -``` - -### Autoloader - -The class `PHPExcel_Autoloader` was removed entirely and is replaced by composer -autoloading mechanism. - -### Writing PDF - -PDF libraries must be installed via composer. And the following methods were removed -and are replaced by `IOFactory::registerWriter()` instead: - -- `PHPExcel_Settings::getPdfRenderer()` -- `PHPExcel_Settings::setPdfRenderer()` -- `PHPExcel_Settings::getPdfRendererName()` -- `PHPExcel_Settings::setPdfRendererName()` - -Before: - -```php -\PHPExcel_Settings::setPdfRendererName(PHPExcel_Settings::PDF_RENDERER_MPDF); -\PHPExcel_Settings::setPdfRenderer($somePath); -$writer = \PHPExcel_IOFactory::createWriter($spreadsheet, 'PDF'); -``` - -After: - -```php -$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Mpdf'); - -// Or alternatively -\PhpOffice\PhpSpreadsheet\IOFactory::registerWriter('Pdf', \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf::class); -$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Pdf'); - -// Or alternatively -$writer = new \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf($spreadsheet); -``` - -### Rendering charts - -When rendering charts for HTML or PDF outputs, the process was also simplified. And while -JpGraph support is still available, it is unfortunately not up to date for latest PHP versions -and it will generate various warnings. - -If you rely on this feature, please consider -contributing either patches to JpGraph or another `IRenderer` implementation (a good -candidate might be [CpChart](https://github.com/szymach/c-pchart)). - -Before: - -```php -$rendererName = \PHPExcel_Settings::CHART_RENDERER_JPGRAPH; -$rendererLibrary = 'jpgraph3.5.0b1/src/'; -$rendererLibraryPath = '/php/libraries/Charts/' . $rendererLibrary; - -\PHPExcel_Settings::setChartRenderer($rendererName, $rendererLibraryPath); -``` - -After: - -Require the dependency via composer: - -```sh -composer require jpgraph/jpgraph -``` - -And then: - -```php -Settings::setChartRenderer(\PhpOffice\PhpSpreadsheet\Chart\Renderer\JpGraph::class); -``` - -### PclZip and ZipArchive - -Support for PclZip were dropped in favor of the more complete and modern -[PHP extension ZipArchive](http://php.net/manual/en/book.zip.php). -So the following were removed: - -- `PclZip` -- `PHPExcel_Settings::setZipClass()` -- `PHPExcel_Settings::getZipClass()` -- `PHPExcel_Shared_ZipArchive` -- `PHPExcel_Shared_ZipStreamWrapper` - -### Cell caching - -Cell caching was heavily refactored to leverage -[PSR-16](http://www.php-fig.org/psr/psr-16/). That means most classes -related to that feature were removed: - -- `PHPExcel_CachedObjectStorage_APC` -- `PHPExcel_CachedObjectStorage_DiscISAM` -- `PHPExcel_CachedObjectStorage_ICache` -- `PHPExcel_CachedObjectStorage_Igbinary` -- `PHPExcel_CachedObjectStorage_Memcache` -- `PHPExcel_CachedObjectStorage_Memory` -- `PHPExcel_CachedObjectStorage_MemoryGZip` -- `PHPExcel_CachedObjectStorage_MemorySerialized` -- `PHPExcel_CachedObjectStorage_PHPTemp` -- `PHPExcel_CachedObjectStorage_SQLite` -- `PHPExcel_CachedObjectStorage_SQLite3` -- `PHPExcel_CachedObjectStorage_Wincache` - -In addition to that, `\PhpOffice\PhpSpreadsheet::getCellCollection()` was renamed -to `\PhpOffice\PhpSpreadsheet::getCoordinates()` and -`\PhpOffice\PhpSpreadsheet::getCellCacheController()` to -`\PhpOffice\PhpSpreadsheet::getCellCollection()` for clarity. - -Refer to [the new documentation](./memory_saving.md) to see how to migrate. - -### Dropped conditionally returned cell - -For all the following methods, it is no more possible to change the type of -returned value. It always return the Worksheet and never the Cell or Rule: - -- Worksheet::setCellValue() -- Worksheet::setCellValueByColumnAndRow() -- Worksheet::setCellValueExplicit() -- Worksheet::setCellValueExplicitByColumnAndRow() -- Worksheet::addRule() - -Migration would be similar to: - -``` php -// Before -$cell = $worksheet->setCellValue('A1', 'value', true); - -// After -$cell = $worksheet->getCell('A1')->setValue('value'); -``` - -### Standardized keys for styling - -Array keys used for styling have been standardized for a more coherent experience. -It now uses the same wording and casing as the getter and setter: - -```php -// Before -$style = [ - 'numberformat' => [ - 'code' => NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE, - ], - 'font' => [ - 'strike' => true, - 'superScript' => true, - 'subScript' => true, - ], - 'alignment' => [ - 'rotation' => 90, - 'readorder' => Alignment::READORDER_RTL, - 'wrap' => true, - ], - 'borders' => [ - 'diagonaldirection' => Borders::DIAGONAL_BOTH, - 'allborders' => [ - 'style' => Border::BORDER_THIN, - ], - ], - 'fill' => [ - 'type' => Fill::FILL_GRADIENT_LINEAR, - 'startcolor' => [ - 'argb' => 'FFA0A0A0', - ], - 'endcolor' => [ - 'argb' => 'FFFFFFFF', - ], - ], -]; - -// After -$style = [ - 'numberFormat' => [ - 'formatCode' => NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE, - ], - 'font' => [ - 'strikethrough' => true, - 'superscript' => true, - 'subscript' => true, - ], - 'alignment' => [ - 'textRotation' => 90, - 'readOrder' => Alignment::READORDER_RTL, - 'wrapText' => true, - ], - 'borders' => [ - 'diagonalDirection' => Borders::DIAGONAL_BOTH, - 'allBorders' => [ - 'borderStyle' => Border::BORDER_THIN, - ], - ], - 'fill' => [ - 'fillType' => Fill::FILL_GRADIENT_LINEAR, - 'startColor' => [ - 'argb' => 'FFA0A0A0', - ], - 'endColor' => [ - 'argb' => 'FFFFFFFF', - ], - ], -]; -``` - -### Dedicated class to manipulate coordinates - -Methods to manipulate coordinates that used to exists in `PHPExcel_Cell` were extracted -to a dedicated new class `\PhpOffice\PhpSpreadsheet\Cell\Coordinate`. The methods are: - -- `absoluteCoordinate()` -- `absoluteReference()` -- `buildRange()` -- `columnIndexFromString()` -- `coordinateFromString()` -- `extractAllCellReferencesInRange()` -- `getRangeBoundaries()` -- `mergeRangesInCollection()` -- `rangeBoundaries()` -- `rangeDimension()` -- `splitRange()` -- `stringFromColumnIndex()` - -### Column index based on 1 - -Column indexes are now based on 1. So column `A` is the index `1`. This is consistent -with rows starting at 1 and Excel function `COLUMN()` that returns `1` for column `A`. -So the code must be adapted with something like: - -```php -// Before -$cell = $worksheet->getCellByColumnAndRow($column, $row); - -for ($column = 0; $column < $max; $column++) { - $worksheet->setCellValueByColumnAndRow($column, $row, 'value ' . $column); -} - -// After -$cell = $worksheet->getCellByColumnAndRow($column + 1, $row); - -for ($column = 1; $column <= $max; $column++) { - $worksheet->setCellValueByColumnAndRow($column, $row, 'value ' . $column); -} -``` - -All the following methods are affected: - -- `PHPExcel_Worksheet::cellExistsByColumnAndRow()` -- `PHPExcel_Worksheet::freezePaneByColumnAndRow()` -- `PHPExcel_Worksheet::getCellByColumnAndRow()` -- `PHPExcel_Worksheet::getColumnDimensionByColumn()` -- `PHPExcel_Worksheet::getCommentByColumnAndRow()` -- `PHPExcel_Worksheet::getStyleByColumnAndRow()` -- `PHPExcel_Worksheet::insertNewColumnBeforeByIndex()` -- `PHPExcel_Worksheet::mergeCellsByColumnAndRow()` -- `PHPExcel_Worksheet::protectCellsByColumnAndRow()` -- `PHPExcel_Worksheet::removeColumnByIndex()` -- `PHPExcel_Worksheet::setAutoFilterByColumnAndRow()` -- `PHPExcel_Worksheet::setBreakByColumnAndRow()` -- `PHPExcel_Worksheet::setCellValueByColumnAndRow()` -- `PHPExcel_Worksheet::setCellValueExplicitByColumnAndRow()` -- `PHPExcel_Worksheet::setSelectedCellByColumnAndRow()` -- `PHPExcel_Worksheet::stringFromColumnIndex()` -- `PHPExcel_Worksheet::unmergeCellsByColumnAndRow()` -- `PHPExcel_Worksheet::unprotectCellsByColumnAndRow()` -- `PHPExcel_Worksheet_PageSetup::addPrintAreaByColumnAndRow()` -- `PHPExcel_Worksheet_PageSetup::setPrintAreaByColumnAndRow()` - -### Removed default values - -Default values for many methods were removed when it did not make sense. Typically, -setter methods should not have default values. For a complete list of methods and -their original default values, see [that commit](https://github.com/PHPOffice/PhpSpreadsheet/commit/033a4bdad56340795a5bf7ec3c8a2fde005cda24). diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/reading-and-writing-to-file.md b/vendor/phpoffice/phpspreadsheet/docs/topics/reading-and-writing-to-file.md deleted file mode 100644 index cf58e549..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/topics/reading-and-writing-to-file.md +++ /dev/null @@ -1,877 +0,0 @@ -# Reading and writing to file - -As you already know from the [architecture](./architecture.md#readers-and-writers), -reading and writing to a -persisted storage is not possible using the base PhpSpreadsheet classes. -For this purpose, PhpSpreadsheet provides readers and writers, which are -implementations of `\PhpOffice\PhpSpreadsheet\Reader\IReader` and -`\PhpOffice\PhpSpreadsheet\Writer\IWriter`. - -## \PhpOffice\PhpSpreadsheet\IOFactory - -The PhpSpreadsheet API offers multiple methods to create a -`\PhpOffice\PhpSpreadsheet\Reader\IReader` or -`\PhpOffice\PhpSpreadsheet\Writer\IWriter` instance: - -Direct creation via `\PhpOffice\PhpSpreadsheet\IOFactory`. All examples -underneath demonstrate the direct creation method. Note that you can -also use the `\PhpOffice\PhpSpreadsheet\IOFactory` class to do this. - -### Creating `\PhpOffice\PhpSpreadsheet\Reader\IReader` using `\PhpOffice\PhpSpreadsheet\IOFactory` - -There are 2 methods for reading in a file into PhpSpreadsheet: using -automatic file type resolving or explicitly. - -Automatic file type resolving checks the different -`\PhpOffice\PhpSpreadsheet\Reader\IReader` distributed with -PhpSpreadsheet. If one of them can load the specified file name, the -file is loaded using that `\PhpOffice\PhpSpreadsheet\Reader\IReader`. -Explicit mode requires you to specify which -`\PhpOffice\PhpSpreadsheet\Reader\IReader` should be used. - -You can create a `\PhpOffice\PhpSpreadsheet\Reader\IReader` instance using -`\PhpOffice\PhpSpreadsheet\IOFactory` in automatic file type resolving -mode using the following code sample: - -``` php -$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load("05featuredemo.xlsx"); -``` - -A typical use of this feature is when you need to read files uploaded by -your users, and you don’t know whether they are uploading xls or xlsx -files. - -If you need to set some properties on the reader, (e.g. to only read -data, see more about this later), then you may instead want to use this -variant: - -``` php -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReaderForFile("05featuredemo.xlsx"); -$reader->setReadDataOnly(true); -$reader->load("05featuredemo.xlsx"); -``` - -You can create a `\PhpOffice\PhpSpreadsheet\Reader\IReader` instance using -`\PhpOffice\PhpSpreadsheet\IOFactory` in explicit mode using the following -code sample: - -``` php -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader("Xlsx"); -$spreadsheet = $reader->load("05featuredemo.xlsx"); -``` - -Note that automatic type resolving mode is slightly slower than explicit -mode. - -### Creating `\PhpOffice\PhpSpreadsheet\Writer\IWriter` using `\PhpOffice\PhpSpreadsheet\IOFactory` - -You can create a `\PhpOffice\PhpSpreadsheet\Writer\IWriter` instance using -`\PhpOffice\PhpSpreadsheet\IOFactory`: - -``` php -$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, "Xlsx"); -$writer->save("05featuredemo.xlsx"); -``` - -## Excel 2007 (SpreadsheetML) file format - -Xlsx file format is the main file format of PhpSpreadsheet. It allows -outputting the in-memory spreadsheet to a .xlsx file. - -### \PhpOffice\PhpSpreadsheet\Reader\Xlsx - -#### Reading a spreadsheet - -You can read an .xlsx file using the following code: - -``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx(); -$spreadsheet = $reader->load("05featuredemo.xlsx"); -``` - -#### Read data only - -You can set the option setReadDataOnly on the reader, to instruct the -reader to ignore styling, data validation, … and just read cell data: - -``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx(); -$reader->setReadDataOnly(true); -$spreadsheet = $reader->load("05featuredemo.xlsx"); -``` - -#### Read specific sheets only - -You can set the option setLoadSheetsOnly on the reader, to instruct the -reader to only load the sheets with a given name: - -``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx(); -$reader->setLoadSheetsOnly(["Sheet 1", "My special sheet"]); -$spreadsheet = $reader->load("05featuredemo.xlsx"); -``` - -#### Read specific cells only - -You can set the option setReadFilter on the reader, to instruct the -reader to only load the cells which match a given rule. A read filter -can be any class which implements -`\PhpOffice\PhpSpreadsheet\Reader\IReadFilter`. By default, all cells are -read using the `\PhpOffice\PhpSpreadsheet\Reader\DefaultReadFilter`. - -The following code will only read row 1 and rows 20 – 30 of any sheet in -the Excel file: - -``` php -class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter { - - public function readCell($column, $row, $worksheetName = '') { - // Read title row and rows 20 - 30 - if ($row == 1 || ($row >= 20 && $row <= 30)) { - return true; - } - return false; - } -} - -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx(); -$reader->setReadFilter( new MyReadFilter() ); -$spreadsheet = $reader->load("06largescale.xlsx"); -``` - -### \PhpOffice\PhpSpreadsheet\Writer\Xlsx - -#### Writing a spreadsheet - -You can write an .xlsx file using the following code: - -``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet); -$writer->save("05featuredemo.xlsx"); -``` - -#### Formula pre-calculation - -By default, this writer pre-calculates all formulas in the spreadsheet. -This can be slow on large spreadsheets, and maybe even unwanted. You can -however disable formula pre-calculation: - -``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet); -$writer->setPreCalculateFormulas(false); -$writer->save("05featuredemo.xlsx"); -``` - -#### Office 2003 compatibility pack - -Because of a bug in the Office2003 compatibility pack, there can be some -small issues when opening Xlsx spreadsheets (mostly related to formula -calculation). You can enable Office2003 compatibility with the following -code: - - $writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet); - $writer->setOffice2003Compatibility(true); - $writer->save("05featuredemo.xlsx"); - -**Office2003 compatibility should only be used when needed** Office2003 -compatibility option should only be used when needed. This option -disables several Office2007 file format options, resulting in a -lower-featured Office2007 spreadsheet when this option is used. - -## Excel 5 (BIFF) file format - -Xls file format is the old Excel file format, implemented in -PhpSpreadsheet to provide a uniform manner to create both .xlsx and .xls -files. It is basically a modified version of [PEAR -Spreadsheet\_Excel\_Writer](http://pear.php.net/package/Spreadsheet_Excel_Writer), -although it has been extended and has fewer limitations and more -features than the old PEAR library. This can read all BIFF versions that -use OLE2: BIFF5 (introduced with office 95) through BIFF8, but cannot -read earlier versions. - -Xls file format will not be developed any further, it just provides an -additional file format for PhpSpreadsheet. - -**Excel5 (BIFF) limitations** Please note that BIFF file format has some -limits regarding to styling cells and handling large spreadsheets via -PHP. - -### \PhpOffice\PhpSpreadsheet\Reader\Xls - -#### Reading a spreadsheet - -You can read an .xls file using the following code: - -``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xls(); -$spreadsheet = $reader->load("05featuredemo.xls"); -``` - -#### Read data only - -You can set the option setReadDataOnly on the reader, to instruct the -reader to ignore styling, data validation, … and just read cell data: - -``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xls(); -$reader->setReadDataOnly(true); -$spreadsheet = $reader->load("05featuredemo.xls"); -``` - -#### Read specific sheets only - -You can set the option setLoadSheetsOnly on the reader, to instruct the -reader to only load the sheets with a given name: - -``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xls(); -$reader->setLoadSheetsOnly(["Sheet 1", "My special sheet"]); -$spreadsheet = $reader->load("05featuredemo.xls"); -``` - -#### Read specific cells only - -You can set the option setReadFilter on the reader, to instruct the -reader to only load the cells which match a given rule. A read filter -can be any class which implements -`\PhpOffice\PhpSpreadsheet\Reader\IReadFilter`. By default, all cells are -read using the `\PhpOffice\PhpSpreadsheet\Reader\DefaultReadFilter`. - -The following code will only read row 1 and rows 20 to 30 of any sheet -in the Excel file: - -``` php -class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter { - - public function readCell($column, $row, $worksheetName = '') { - // Read title row and rows 20 - 30 - if ($row == 1 || ($row >= 20 && $row <= 30)) { - return true; - } - return false; - } -} - -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xls(); -$reader->setReadFilter( new MyReadFilter() ); -$spreadsheet = $reader->load("06largescale.xls"); -``` - -### \PhpOffice\PhpSpreadsheet\Writer\Xls - -#### Writing a spreadsheet - -You can write an .xls file using the following code: - -``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xls($spreadsheet); -$writer->save("05featuredemo.xls"); -``` - -## Excel 2003 XML file format - -Excel 2003 XML file format is a file format which can be used in older -versions of Microsoft Excel. - -**Excel 2003 XML limitations** Please note that Excel 2003 XML format -has some limits regarding to styling cells and handling large -spreadsheets via PHP. - -### \PhpOffice\PhpSpreadsheet\Reader\Xml - -#### Reading a spreadsheet - -You can read an Excel 2003 .xml file using the following code: - -``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xml(); -$spreadsheet = $reader->load("05featuredemo.xml"); -``` - -#### Read specific cells only - -You can set the option setReadFilter on the reader, to instruct the -reader to only load the cells which match a given rule. A read filter -can be any class which implements -`\PhpOffice\PhpSpreadsheet\Reader\IReadFilter`. By default, all cells are -read using the `\PhpOffice\PhpSpreadsheet\Reader\DefaultReadFilter`. - -The following code will only read row 1 and rows 20 to 30 of any sheet -in the Excel file: - -``` php -class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter { - - public function readCell($column, $row, $worksheetName = '') { - // Read title row and rows 20 - 30 - if ($row == 1 || ($row >= 20 && $row <= 30)) { - return true; - } - return false; - } - -} - -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xml(); -$reader->setReadFilter( new MyReadFilter() ); -$spreadsheet = $reader->load("06largescale.xml"); -``` - -## Symbolic LinK (SYLK) - -Symbolic Link (SYLK) is a Microsoft file format typically used to -exchange data between applications, specifically spreadsheets. SYLK -files conventionally have a .slk suffix. Composed of only displayable -ANSI characters, it can be easily created and processed by other -applications, such as databases. - -**SYLK limitations** Please note that SYLK file format has some limits -regarding to styling cells and handling large spreadsheets via PHP. - -### \PhpOffice\PhpSpreadsheet\Reader\Slk - -#### Reading a spreadsheet - -You can read an .slk file using the following code: - -``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Slk(); -$spreadsheet = $reader->load("05featuredemo.slk"); -``` - -#### Read specific cells only - -You can set the option setReadFilter on the reader, to instruct the -reader to only load the cells which match a given rule. A read filter -can be any class which implements -`\PhpOffice\PhpSpreadsheet\Reader\IReadFilter`. By default, all cells are -read using the `\PhpOffice\PhpSpreadsheet\Reader\DefaultReadFilter`. - -The following code will only read row 1 and rows 20 to 30 of any sheet -in the SYLK file: - -``` php -class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter { - - public function readCell($column, $row, $worksheetName = '') { - // Read title row and rows 20 - 30 - if ($row == 1 || ($row >= 20 && $row <= 30)) { - return true; - } - return false; - } - -} - -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Slk(); -$reader->setReadFilter( new MyReadFilter() ); -$spreadsheet = $reader->load("06largescale.slk"); -``` - -## Open/Libre Office (.ods) - -Open Office or Libre Office .ods files are the standard file format for -Open Office or Libre Office Calc files. - -### \PhpOffice\PhpSpreadsheet\Reader\Ods - -#### Reading a spreadsheet - -You can read an .ods file using the following code: - -``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Ods(); -$spreadsheet = $reader->load("05featuredemo.ods"); -``` - -#### Read specific cells only - -You can set the option setReadFilter on the reader, to instruct the -reader to only load the cells which match a given rule. A read filter -can be any class which implements -`\PhpOffice\PhpSpreadsheet\Reader\IReadFilter`. By default, all cells are -read using the `\PhpOffice\PhpSpreadsheet\Reader\DefaultReadFilter`. - -The following code will only read row 1 and rows 20 to 30 of any sheet -in the Calc file: - -``` php -class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter { - - public function readCell($column, $row, $worksheetName = '') { - // Read title row and rows 20 - 30 - if ($row == 1 || ($row >= 20 && $row <= 30)) { - return true; - } - return false; - } - -} - -$reader = new PhpOffice\PhpSpreadsheet\Reader\Ods(); -$reader->setReadFilter( new MyReadFilter() ); -$spreadsheet = $reader->load("06largescale.ods"); -``` - -## CSV (Comma Separated Values) - -CSV (Comma Separated Values) are often used as an import/export file -format with other systems. PhpSpreadsheet allows reading and writing to -CSV files. - -**CSV limitations** Please note that CSV file format has some limits -regarding to styling cells, number formatting, ... - -### \PhpOffice\PhpSpreadsheet\Reader\Csv - -#### Reading a CSV file - -You can read a .csv file using the following code: - -``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Csv(); -$spreadsheet = $reader->load("sample.csv"); -``` - -#### Setting CSV options - -Often, CSV files are not really "comma separated", or use semicolon (`;`) -as a separator. You can instruct -`\PhpOffice\PhpSpreadsheet\Reader\Csv` some options before reading a CSV -file. - -The separator will be auto-detected, so in most cases it should not be necessary -to specify it. But in cases where auto-detection does not fit the use-case, then -it can be set manually. - -Note that `\PhpOffice\PhpSpreadsheet\Reader\Csv` by default assumes that -the loaded CSV file is UTF-8 encoded. If you are reading CSV files that -were created in Microsoft Office Excel the correct input encoding may -rather be Windows-1252 (CP1252). Always make sure that the input -encoding is set appropriately. - -``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Csv(); -$reader->setInputEncoding('CP1252'); -$reader->setDelimiter(';'); -$reader->setEnclosure(''); -$reader->setSheetIndex(0); - -$spreadsheet = $reader->load("sample.csv"); -``` - -#### Read a specific worksheet - -CSV files can only contain one worksheet. Therefore, you can specify -which sheet to read from CSV: - -``` php -$reader->setSheetIndex(0); -``` - -#### Read into existing spreadsheet - -When working with CSV files, it might occur that you want to import CSV -data into an existing `Spreadsheet` object. The following code loads a -CSV file into an existing `$spreadsheet` containing some sheets, and -imports onto the 6th sheet: - -``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Csv(); -$reader->setDelimiter(';'); -$reader->setEnclosure(''); -$reader->setSheetIndex(5); - -$reader->loadIntoExisting("05featuredemo.csv", $spreadsheet); -``` - -### \PhpOffice\PhpSpreadsheet\Writer\Csv - -#### Writing a CSV file - -You can write a .csv file using the following code: - -``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\Csv($spreadsheet); -$writer->save("05featuredemo.csv"); -``` - -#### Setting CSV options - -Often, CSV files are not really "comma separated", or use semicolon (`;`) -as a separator. You can instruct -`\PhpOffice\PhpSpreadsheet\Writer\Csv` some options before writing a CSV -file: - -``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\Csv($spreadsheet); -$writer->setDelimiter(';'); -$writer->setEnclosure(''); -$writer->setLineEnding("\r\n"); -$writer->setSheetIndex(0); - -$writer->save("05featuredemo.csv"); -``` - -#### Write a specific worksheet - -CSV files can only contain one worksheet. Therefore, you can specify -which sheet to write to CSV: - -``` php -$writer->setSheetIndex(0); -``` - -#### Formula pre-calculation - -By default, this writer pre-calculates all formulas in the spreadsheet. -This can be slow on large spreadsheets, and maybe even unwanted. You can -however disable formula pre-calculation: - -``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\Csv($spreadsheet); -$writer->setPreCalculateFormulas(false); -$writer->save("05featuredemo.csv"); -``` - -#### Writing UTF-8 CSV files - -A CSV file can be marked as UTF-8 by writing a BOM file header. This can -be enabled by using the following code: - -``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\Csv($spreadsheet); -$writer->setUseBOM(true); -$writer->save("05featuredemo.csv"); -``` - -#### Decimal and thousands separators - -If the worksheet you are exporting contains numbers with decimal or -thousands separators then you should think about what characters you -want to use for those before doing the export. - -By default PhpSpreadsheet looks up in the server's locale settings to -decide what characters to use. But to avoid problems it is recommended -to set the characters explicitly as shown below. - -English users will want to use this before doing the export: - -``` php -\PhpOffice\PhpSpreadsheet\Shared\StringHelper::setDecimalSeparator('.'); -\PhpOffice\PhpSpreadsheet\Shared\StringHelper::setThousandsSeparator(','); -``` - -German users will want to use the opposite values. - -``` php -\PhpOffice\PhpSpreadsheet\Shared\StringHelper::setDecimalSeparator(','); -\PhpOffice\PhpSpreadsheet\Shared\StringHelper::setThousandsSeparator('.'); -``` - -Note that the above code sets decimal and thousand separators as global -options. This also affects how HTML and PDF is exported. - -## HTML - -PhpSpreadsheet allows you to read or write a spreadsheet as HTML format, -for quick representation of the data in it to anyone who does not have a -spreadsheet application on their PC, or loading files saved by other -scripts that simply create HTML markup and give it a .xls file -extension. - -**HTML limitations** Please note that HTML file format has some limits -regarding to styling cells, number formatting, ... - -### \PhpOffice\PhpSpreadsheet\Reader\Html - -#### Reading a spreadsheet - -You can read an .html or .htm file using the following code: - -``` php -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Html(); - -$spreadsheet = $reader->load("05featuredemo.html"); -``` - -**HTML limitations** Please note that HTML reader is still experimental -and does not yet support merged cells or nested tables cleanly - -### \PhpOffice\PhpSpreadsheet\Writer\Html - -Please note that `\PhpOffice\PhpSpreadsheet\Writer\Html` only outputs the -first worksheet by default. - -#### Writing a spreadsheet - -You can write a .htm file using the following code: - -``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\Html($spreadsheet); - -$writer->save("05featuredemo.htm"); -``` - -#### Write all worksheets - -HTML files can contain one or more worksheets. If you want to write all -sheets into a single HTML file, use the following code: - -``` php -$writer->writeAllSheets(); -``` - -#### Write a specific worksheet - -HTML files can contain one or more worksheets. Therefore, you can -specify which sheet to write to HTML: - -``` php -$writer->setSheetIndex(0); -``` - -#### Setting the images root of the HTML file - -There might be situations where you want to explicitly set the included -images root. For example, instead of: - - ``` html - - ``` - -You might want to see: - -``` html - -``` - -You can use the following code to achieve this result: - -``` php -$writer->setImagesRoot('http://www.example.com'); -``` - -#### Formula pre-calculation - -By default, this writer pre-calculates all formulas in the spreadsheet. -This can be slow on large spreadsheets, and maybe even unwanted. You can -however disable formula pre-calculation: - -``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\Html($spreadsheet); -$writer->setPreCalculateFormulas(false); - -$writer->save("05featuredemo.htm"); -``` - -#### Embedding generated HTML in a web page - -There might be a situation where you want to embed the generated HTML in -an existing website. \PhpOffice\PhpSpreadsheet\Writer\Html provides -support to generate only specific parts of the HTML code, which allows -you to use these parts in your website. - -Supported methods: - -- `generateHTMLHeader()` -- `generateStyles()` -- `generateSheetData()` -- `generateHTMLFooter()` - -Here's an example which retrieves all parts independently and merges -them into a resulting HTML page: - -``` php -generateHTMLHeader(); -?> - - -?> - ---> - - -generateSheetData(); -echo $writer->generateHTMLFooter(); -?> -``` - -#### Writing UTF-8 HTML files - -A HTML file can be marked as UTF-8 by writing a BOM file header. This -can be enabled by using the following code: - -``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\Html($spreadsheet); -$writer->setUseBOM(true); - -$writer->save("05featuredemo.htm"); -``` - -#### Decimal and thousands separators - -See section `\PhpOffice\PhpSpreadsheet\Writer\Csv` how to control the -appearance of these. - -## PDF - -PhpSpreadsheet allows you to write a spreadsheet into PDF format, for -fast distribution of represented data. - -**PDF limitations** Please note that PDF file format has some limits -regarding to styling cells, number formatting, ... - -### \PhpOffice\PhpSpreadsheet\Writer\Pdf - -PhpSpreadsheet’s PDF Writer is a wrapper for a 3rd-Party PDF Rendering -library such as TCPDF, mPDF or Dompdf. You must now install a PDF -rendering library yourself; but PhpSpreadsheet will work with a number -of different libraries. - -Currently, the following libraries are supported: - -Library | Downloadable from | PhpSpreadsheet writer ---------|-------------------------------------|---------------------- -TCPDF | https://github.com/tecnickcom/tcpdf | Tcpdf -mPDF | https://github.com/mpdf/mpdf | Mpdf -Dompdf | https://github.com/dompdf/dompdf | Dompdf - -The different libraries have different strengths and weaknesses. Some -generate better formatted output than others, some are faster or use -less memory than others, while some generate smaller .pdf files. It is -the developers choice which one they wish to use, appropriate to their -own circumstances. - -You can instantiate a writer with its specific name, like so: - -``` php -$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Mpdf'); -``` - -Or you can register which writer you are using with a more generic name, -so you don't need to remember which library you chose, only that you want -to write PDF files: - -``` php -$class = \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf::class; -\PhpOffice\PhpSpreadsheet\IOFactory::registerWriter('Pdf', $class); -$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Pdf'); -``` - -Or you can instantiate directly the writer of your choice like so: - -``` php -$writer = \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf($spreadsheet); -``` - -#### Custom implementation or configuration - -If you need a custom implementation, or custom configuration, of a supported -PDF library. You can extends the PDF library, and the PDF writer like so: - -``` php -class My_Custom_TCPDF extends TCPDF -{ - // ... -} - -class My_Custom_TCPDF_Writer extends \PhpOffice\PhpSpreadsheet\Writer\Pdf\Tcpdf -{ - protected function createExternalWriterInstance($orientation, $unit, $paperSize) - { - $instance = new My_Custom_TCPDF($orientation, $unit, $paperSize); - - // more configuration of $instance - - return $instance; - } -} - -\PhpOffice\PhpSpreadsheet\IOFactory::registerWriter('Pdf', MY_TCPDF_WRITER::class); -``` - -#### Writing a spreadsheet - -Once you have identified the Renderer that you wish to use for PDF -generation, you can write a .pdf file using the following code: - -``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf($spreadsheet); -$writer->save("05featuredemo.pdf"); -``` - -Please note that `\PhpOffice\PhpSpreadsheet\Writer\Pdf` only outputs the -first worksheet by default. - -#### Write all worksheets - -PDF files can contain one or more worksheets. If you want to write all -sheets into a single PDF file, use the following code: - -``` php -$writer->writeAllSheets(); -``` - -#### Write a specific worksheet - -PDF files can contain one or more worksheets. Therefore, you can specify -which sheet to write to PDF: - -``` php -$writer->setSheetIndex(0); -``` - -#### Formula pre-calculation - -By default, this writer pre-calculates all formulas in the spreadsheet. -This can be slow on large spreadsheets, and maybe even unwanted. You can -however disable formula pre-calculation: - -``` php -$writer = new \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf($spreadsheet); -$writer->setPreCalculateFormulas(false); - -$writer->save("05featuredemo.pdf"); -``` - -#### Decimal and thousands separators - -See section `\PhpOffice\PhpSpreadsheet\Writer\Csv` how to control the -appearance of these. - -## Generating Excel files from templates (read, modify, write) - -Readers and writers are the tools that allow you to generate Excel files -from templates. This requires less coding effort than generating the -Excel file from scratch, especially if your template has many styles, -page setup properties, headers etc. - -Here is an example how to open a template file, fill in a couple of -fields and save it again: - -``` php -$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load('template.xlsx'); - -$worksheet = $spreadsheet->getActiveSheet(); - -$worksheet->getCell('A1')->setValue('John'); -$worksheet->getCell('A2')->setValue('Smith'); - -$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls'); -$writer->save('write.xls'); -``` - -Notice that it is ok to load an xlsx file and generate an xls file. diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/reading-files.md b/vendor/phpoffice/phpspreadsheet/docs/topics/reading-files.md deleted file mode 100644 index 779082dc..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/topics/reading-files.md +++ /dev/null @@ -1,689 +0,0 @@ -# Reading Files - -## Security - -XML-based formats such as OfficeOpen XML, Excel2003 XML, OASIS and -Gnumeric are susceptible to XML External Entity Processing (XXE) -injection attacks when reading spreadsheet files. This can lead to: - -- Disclosure whether a file is existent -- Server Side Request Forgery -- Command Execution (depending on the installed PHP wrappers) - -To prevent this, by default every XML-based Reader looks for XML -entities declared inside the DOCTYPE and if any is found an exception -is raised. - -Read more [about of XXE injection](https://websec.io/2012/08/27/Preventing-XXE-in-PHP.html). - -## Loading a Spreadsheet File - -The simplest way to load a workbook file is to let PhpSpreadsheet's IO -Factory identify the file type and load it, calling the static `load()` -method of the `\PhpOffice\PhpSpreadsheet\IOFactory` class. - -``` php -$inputFileName = './sampleData/example1.xls'; - -/** Load $inputFileName to a Spreadsheet Object **/ -$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName); -``` - -See `samples/Reader/01_Simple_file_reader_using_IOFactory.php` for a working -example of this code. - -The `load()` method will attempt to identify the file type, and -instantiate a loader for that file type; using it to load the file and -store the data and any formatting in a `Spreadsheet` object. - -The method makes an initial guess at the loader to instantiate based on -the file extension; but will test the file before actually executing the -load: so if (for example) the file is actually a CSV file or contains -HTML markup, but that has been given a .xls extension (quite a common -practise), it will reject the Xls loader that it would normally use for -a .xls file; and test the file using the other loaders until it finds -the appropriate loader, and then use that to read the file. - -While easy to implement in your code, and you don't need to worry about -the file type; this isn't the most efficient method to load a file; and -it lacks the flexibility to configure the loader in any way before -actually reading the file into a `Spreadsheet` object. - -## Creating a Reader and Loading a Spreadsheet File - -If you know the file type of the spreadsheet file that you need to load, -you can instantiate a new reader object for that file type, then use the -reader's `load()` method to read the file to a `Spreadsheet` object. It is -possible to instantiate the reader objects for each of the different -supported filetype by name. However, you may get unpredictable results -if the file isn't of the right type (e.g. it is a CSV with an extension -of .xls), although this type of exception should normally be trapped. - -``` php -$inputFileName = './sampleData/example1.xls'; - -/** Create a new Xls Reader **/ -$reader = new \PhpOffice\PhpSpreadsheet\Reader\Xls(); -// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xlsx(); -// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Xml(); -// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Ods(); -// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Slk(); -// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Gnumeric(); -// $reader = new \PhpOffice\PhpSpreadsheet\Reader\Csv(); -/** Load $inputFileName to a Spreadsheet Object **/ -$spreadsheet = $reader->load($inputFileName); -``` - -See `samples/Reader/02_Simple_file_reader_using_a_specified_reader.php` -for a working example of this code. - -Alternatively, you can use the IO Factory's `createReader()` method to -instantiate the reader object for you, simply telling it the file type -of the reader that you want instantiating. - -``` php -$inputFileType = 'Xls'; -// $inputFileType = 'Xlsx'; -// $inputFileType = 'Xml'; -// $inputFileType = 'Ods'; -// $inputFileType = 'Slk'; -// $inputFileType = 'Gnumeric'; -// $inputFileType = 'Csv'; -$inputFileName = './sampleData/example1.xls'; - -/** Create a new Reader of the type defined in $inputFileType **/ -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); -/** Load $inputFileName to a Spreadsheet Object **/ -$spreadsheet = $reader->load($inputFileName); -``` - -See `samples/Reader/03_Simple_file_reader_using_the_IOFactory_to_return_a_reader.php` -for a working example of this code. - -If you're uncertain of the filetype, you can use the `IOFactory::identify()` -method to identify the reader that you need, before using the -`createReader()` method to instantiate the reader object. - -``` php -$inputFileName = './sampleData/example1.xls'; - -/** Identify the type of $inputFileName **/ -$inputFileType = \PhpOffice\PhpSpreadsheet\IOFactory::identify($inputFileName); -/** Create a new Reader of the type that has been identified **/ -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); -/** Load $inputFileName to a Spreadsheet Object **/ -$spreadsheet = $reader->load($inputFileName); -``` - -See `samples/Reader/04_Simple_file_reader_using_the_IOFactory_to_identify_a_reader_to_use.php` -for a working example of this code. - -## Spreadsheet Reader Options - -Once you have created a reader object for the workbook that you want to -load, you have the opportunity to set additional options before -executing the `load()` method. - -### Reading Only Data from a Spreadsheet File - -If you're only interested in the cell values in a workbook, but don't -need any of the cell formatting information, then you can set the reader -to read only the data values and any formulae from each cell using the -`setReadDataOnly()` method. - -``` php -$inputFileType = 'Xls'; -$inputFileName = './sampleData/example1.xls'; - -/** Create a new Reader of the type defined in $inputFileType **/ -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); -/** Advise the Reader that we only want to load cell data **/ -$reader->setReadDataOnly(true); -/** Load $inputFileName to a Spreadsheet Object **/ -$spreadsheet = $reader->load($inputFileName); -``` - -See `samples/Reader/05_Simple_file_reader_using_the_read_data_only_option.php` -for a working example of this code. - -It is important to note that Workbooks (and PhpSpreadsheet) store dates -and times as simple numeric values: they can only be distinguished from -other numeric values by the format mask that is applied to that cell. -When setting read data only to true, PhpSpreadsheet doesn't read the -cell format masks, so it is not possible to differentiate between -dates/times and numbers. - -The Gnumeric loader has been written to read the format masks for date -values even when read data only has been set to true, so it can -differentiate between dates/times and numbers; but this change hasn't -yet been implemented for the other readers. - -Reading Only Data from a Spreadsheet File applies to Readers: - -Reader | Y/N |Reader | Y/N |Reader | Y/N | -----------|:---:|--------|:---:|--------------|:---:| -Xlsx | YES | Xls | YES | Xml | YES | -Ods | YES | SYLK | NO | Gnumeric | YES | -CSV | NO | HTML | NO - -### Reading Only Named WorkSheets from a File - -If your workbook contains a number of worksheets, but you are only -interested in reading some of those, then you can use the -`setLoadSheetsOnly()` method to identify those sheets you are interested -in reading. - -To read a single sheet, you can pass that sheet name as a parameter to -the `setLoadSheetsOnly()` method. - -``` php -$inputFileType = 'Xls'; -$inputFileName = './sampleData/example1.xls'; -$sheetname = 'Data Sheet #2'; - -/** Create a new Reader of the type defined in $inputFileType **/ -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); -/** Advise the Reader of which WorkSheets we want to load **/ -$reader->setLoadSheetsOnly($sheetname); -/** Load $inputFileName to a Spreadsheet Object **/ -$spreadsheet = $reader->load($inputFileName); -``` - -See `samples/Reader/07_Simple_file_reader_loading_a_single_named_worksheet.php` -for a working example of this code. - -If you want to read more than just a single sheet, you can pass a list -of sheet names as an array parameter to the `setLoadSheetsOnly()` method. - -``` php -$inputFileType = 'Xls'; -$inputFileName = './sampleData/example1.xls'; -$sheetnames = ['Data Sheet #1','Data Sheet #3']; - -/** Create a new Reader of the type defined in $inputFileType **/ -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); -/** Advise the Reader of which WorkSheets we want to load **/ -$reader->setLoadSheetsOnly($sheetnames); -/** Load $inputFileName to a Spreadsheet Object **/ -$spreadsheet = $reader->load($inputFileName); -``` - -See `samples/Reader/08_Simple_file_reader_loading_several_named_worksheets.php` -for a working example of this code. - -To reset this option to the default, you can call the `setLoadAllSheets()` -method. - -``` php -$inputFileType = 'Xls'; -$inputFileName = './sampleData/example1.xls'; - -/** Create a new Reader of the type defined in $inputFileType **/ -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); -/** Advise the Reader to load all Worksheets **/ -$reader->setLoadAllSheets(); -/** Load $inputFileName to a Spreadsheet Object **/ -$spreadsheet = $reader->load($inputFileName); -``` - -See `samples/Reader/06_Simple_file_reader_loading_all_worksheets.php` for a -working example of this code. - -Reading Only Named WorkSheets from a File applies to Readers: - -Reader | Y/N |Reader | Y/N |Reader | Y/N | -----------|:---:|--------|:---:|--------------|:---:| -Xlsx | YES | Xls | YES | Xml | YES | -Ods | YES | SYLK | NO | Gnumeric | YES | -CSV | NO | HTML | NO - -### Reading Only Specific Columns and Rows from a File (Read Filters) - -If you are only interested in reading part of a worksheet, then you can -write a filter class that identifies whether or not individual cells -should be read by the loader. A read filter must implement the -`\PhpOffice\PhpSpreadsheet\Reader\IReadFilter` interface, and contain a -`readCell()` method that accepts arguments of `$column`, `$row` and -`$worksheetName`, and return a boolean true or false that indicates -whether a workbook cell identified by those arguments should be read or -not. - -``` php -$inputFileType = 'Xls'; -$inputFileName = './sampleData/example1.xls'; -$sheetname = 'Data Sheet #3'; - -/** Define a Read Filter class implementing \PhpOffice\PhpSpreadsheet\Reader\IReadFilter */ -class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter -{ - public function readCell($column, $row, $worksheetName = '') { - // Read rows 1 to 7 and columns A to E only - if ($row >= 1 && $row <= 7) { - if (in_array($column,range('A','E'))) { - return true; - } - } - return false; - } -} - -/** Create an Instance of our Read Filter **/ -$filterSubset = new MyReadFilter(); - -/** Create a new Reader of the type defined in $inputFileType **/ -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); -/** Tell the Reader that we want to use the Read Filter **/ -$reader->setReadFilter($filterSubset); -/** Load only the rows and columns that match our filter to Spreadsheet **/ -$spreadsheet = $reader->load($inputFileName); -``` - -See `samples/Reader/09_Simple_file_reader_using_a_read_filter.php` for a -working example of this code. - -This example is not particularly useful, because it can only be used in -a very specific circumstance (when you only want cells in the range -A1:E7 from your worksheet. A generic Read Filter would probably be more -useful: - -``` php -/** Define a Read Filter class implementing \PhpOffice\PhpSpreadsheet\Reader\IReadFilter */ -class MyReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter -{ - private $startRow = 0; - private $endRow = 0; - private $columns = []; - - /** Get the list of rows and columns to read */ - public function __construct($startRow, $endRow, $columns) { - $this->startRow = $startRow; - $this->endRow = $endRow; - $this->columns = $columns; - } - - public function readCell($column, $row, $worksheetName = '') { - // Only read the rows and columns that were configured - if ($row >= $this->startRow && $row <= $this->endRow) { - if (in_array($column,$this->columns)) { - return true; - } - } - return false; - } -} - -/** Create an Instance of our Read Filter, passing in the cell range **/ -$filterSubset = new MyReadFilter(9,15,range('G','K')); -``` - -See `samples/Reader/10_Simple_file_reader_using_a_configurable_read_filter.php` -for a working example of this code. - -This can be particularly useful for conserving memory, by allowing you -to read and process a large workbook in "chunks": an example of this -usage might be when transferring data from an Excel worksheet to a -database. - -``` php -$inputFileType = 'Xls'; -$inputFileName = './sampleData/example2.xls'; - -/** Define a Read Filter class implementing \PhpOffice\PhpSpreadsheet\Reader\IReadFilter */ -class ChunkReadFilter implements \PhpOffice\PhpSpreadsheet\Reader\IReadFilter -{ - private $startRow = 0; - private $endRow = 0; - - /** Set the list of rows that we want to read */ - public function setRows($startRow, $chunkSize) { - $this->startRow = $startRow; - $this->endRow = $startRow + $chunkSize; - } - - public function readCell($column, $row, $worksheetName = '') { - // Only read the heading row, and the configured rows - if (($row == 1) || ($row >= $this->startRow && $row < $this->endRow)) { - return true; - } - return false; - } -} - -/** Create a new Reader of the type defined in $inputFileType **/ -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); - -/** Define how many rows we want to read for each "chunk" **/ -$chunkSize = 2048; -/** Create a new Instance of our Read Filter **/ -$chunkFilter = new ChunkReadFilter(); - -/** Tell the Reader that we want to use the Read Filter **/ -$reader->setReadFilter($chunkFilter); - -/** Loop to read our worksheet in "chunk size" blocks **/ -for ($startRow = 2; $startRow <= 65536; $startRow += $chunkSize) { - /** Tell the Read Filter which rows we want this iteration **/ - $chunkFilter->setRows($startRow,$chunkSize); - /** Load only the rows that match our filter **/ - $spreadsheet = $reader->load($inputFileName); - // Do some processing here -} -``` - -See `samples/Reader/12_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_` -for a working example of this code. - -Using Read Filters applies to: - -Reader | Y/N |Reader | Y/N |Reader | Y/N | -----------|:---:|--------|:---:|--------------|:---:| -Xlsx | YES | Xls | YES | Xml | YES | -Ods | YES | SYLK | NO | Gnumeric | YES | -CSV | YES | HTML | NO | | | - -### Combining Multiple Files into a Single Spreadsheet Object - -While you can limit the number of worksheets that are read from a -workbook file using the `setLoadSheetsOnly()` method, certain readers also -allow you to combine several individual "sheets" from different files -into a single `Spreadsheet` object, where each individual file is a -single worksheet within that workbook. For each file that you read, you -need to indicate which worksheet index it should be loaded into using -the `setSheetIndex()` method of the `$reader`, then use the -`loadIntoExisting()` method rather than the `load()` method to actually read -the file into that worksheet. - -``` php -$inputFileType = 'Csv'; -$inputFileNames = [ - './sampleData/example1.csv', - './sampleData/example2.csv' - './sampleData/example3.csv' -]; - -/** Create a new Reader of the type defined in $inputFileType **/ -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); - -/** Extract the first named file from the array list **/ -$inputFileName = array_shift($inputFileNames); -/** Load the initial file to the first worksheet in a `Spreadsheet` Object **/ -$spreadsheet = $reader->load($inputFileName); -/** Set the worksheet title (to the filename that we've loaded) **/ -$spreadsheet->getActiveSheet() - ->setTitle(pathinfo($inputFileName,PATHINFO_BASENAME)); - -/** Loop through all the remaining files in the list **/ -foreach($inputFileNames as $sheet => $inputFileName) { - /** Increment the worksheet index pointer for the Reader **/ - $reader->setSheetIndex($sheet+1); - /** Load the current file into a new worksheet in Spreadsheet **/ - $reader->loadIntoExisting($inputFileName,$spreadsheet); - /** Set the worksheet title (to the filename that we've loaded) **/ - $spreadsheet->getActiveSheet() - ->setTitle(pathinfo($inputFileName,PATHINFO_BASENAME)); -} -``` - -See `samples/Reader/13_Simple_file_reader_for_multiple_CSV_files.php` for a -working example of this code. - -Note that using the same sheet index for multiple sheets won't append -files into the same sheet, but overwrite the results of the previous -load. You cannot load multiple CSV files into the same worksheet. - -Combining Multiple Files into a Single Spreadsheet Object applies to: - -Reader | Y/N |Reader | Y/N |Reader | Y/N | -----------|:---:|--------|:---:|--------------|:---:| -Xlsx | NO | Xls | NO | Xml | NO | -Ods | NO | SYLK | YES | Gnumeric | NO | -CSV | YES | HTML | NO - -### Combining Read Filters with the `setSheetIndex()` method to split a large CSV file across multiple Worksheets - -An Xls BIFF .xls file is limited to 65536 rows in a worksheet, while the -Xlsx Microsoft Office Open XML SpreadsheetML .xlsx file is limited to -1,048,576 rows in a worksheet; but a CSV file is not limited other than -by available disk space. This means that we wouldn’t ordinarily be able -to read all the rows from a very large CSV file that exceeded those -limits, and save it as an Xls or Xlsx file. However, by using Read -Filters to read the CSV file in "chunks" (using the ChunkReadFilter -Class that we defined in [the above section](#reading-only-specific-columns-and-rows-from-a-file-read-filters), -and the `setSheetIndex()` method of the `$reader`, we can split the CSV -file across several individual worksheets. - -``` php -$inputFileType = 'Csv'; -$inputFileName = './sampleData/example2.csv'; - -echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory with a defined reader type of ',$inputFileType,'
    '; -/** Create a new Reader of the type defined in $inputFileType **/ -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); - -/** Define how many rows we want to read for each "chunk" **/ -$chunkSize = 65530; -/** Create a new Instance of our Read Filter **/ -$chunkFilter = new ChunkReadFilter(); - -/** Tell the Reader that we want to use the Read Filter **/ -/** and that we want to store it in contiguous rows/columns **/ - -$reader->setReadFilter($chunkFilter) - ->setContiguous(true); - -/** Instantiate a new Spreadsheet object manually **/ -$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet(); - -/** Set a sheet index **/ -$sheet = 0; -/** Loop to read our worksheet in "chunk size" blocks **/ -/** $startRow is set to 2 initially because we always read the headings in row #1 **/ -for ($startRow = 2; $startRow <= 1000000; $startRow += $chunkSize) { - /** Tell the Read Filter which rows we want to read this loop **/ - $chunkFilter->setRows($startRow,$chunkSize); - - /** Increment the worksheet index pointer for the Reader **/ - $reader->setSheetIndex($sheet); - /** Load only the rows that match our filter into a new worksheet **/ - $reader->loadIntoExisting($inputFileName,$spreadsheet); - /** Set the worksheet title for the sheet that we've justloaded) **/ - /** and increment the sheet index as well **/ - $spreadsheet->getActiveSheet()->setTitle('Country Data #'.(++$sheet)); -} -``` - -See `samples/Reader/14_Reading_a_large_CSV_file_in_chunks_to_split_across_multiple_worksheets.php` -for a working example of this code. - -This code will read 65,530 rows at a time from the CSV file that we’re -loading, and store each "chunk" in a new worksheet. - -The `setContiguous()` method for the Reader is important here. It is -applicable only when working with a Read Filter, and identifies whether -or not the cells should be stored by their position within the CSV file, -or their position relative to the filter. - -For example, if the filter returned true for cells in the range B2:C3, -then with setContiguous set to false (the default) these would be loaded -as B2:C3 in the `Spreadsheet` object; but with setContiguous set to -true, they would be loaded as A1:B2. - -Splitting a single loaded file across multiple worksheets applies to: - -Reader | Y/N |Reader | Y/N |Reader | Y/N | -----------|:---:|--------|:---:|--------------|:---:| -Xlsx | NO | Xls | NO | Xml | NO | -Ods | NO | SYLK | NO | Gnumeric | NO | -CSV | YES | HTML | NO - -### Pipe or Tab Separated Value Files - -The CSV loader will attempt to auto-detect the separator used in the file. If it -cannot auto-detect, it will default to the comma. If this does not fit your -use-case, you can manually specify a separator by using the `setDelimiter()` -method. - -``` php -$inputFileType = 'Csv'; -$inputFileName = './sampleData/example1.tsv'; - -/** Create a new Reader of the type defined in $inputFileType **/ -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); -/** Set the delimiter to a TAB character **/ -$reader->setDelimiter("\t"); -// $reader->setDelimiter('|'); - -/** Load the file to a Spreadsheet Object **/ -$spreadsheet = $reader->load($inputFileName); -``` - -See `samples/Reader/15_Simple_file_reader_for_tab_separated_value_file_using_the_Advanced_Value_Binder.php` -for a working example of this code. - -In addition to the delimiter, you can also use the following methods to -set other attributes for the data load: - -Method | Default --------------------|---------- -setEnclosure() | `"` -setInputEncoding() | `UTF-8` - -Setting CSV delimiter applies to: - -Reader | Y/N |Reader | Y/N |Reader | Y/N | -----------|:---:|--------|:---:|--------------|:---:| -Xlsx | NO | Xls | NO | Xml | NO | -Ods | NO | SYLK | NO | Gnumeric | NO | -CSV | YES | HTML | NO - -### A Brief Word about the Advanced Value Binder - -When loading data from a file that contains no formatting information, -such as a CSV file, then data is read either as strings or numbers -(float or integer). This means that PhpSpreadsheet does not -automatically recognise dates/times (such as `16-Apr-2009` or `13:30`), -booleans (`true` or `false`), percentages (`75%`), hyperlinks -(`https://www.example.com`), etc as anything other than simple strings. -However, you can apply additional processing that is executed against -these values during the load process within a Value Binder. - -A Value Binder is a class that implement the -`\PhpOffice\PhpSpreadsheet\Cell\IValueBinder` interface. It must contain a -`bindValue()` method that accepts a `\PhpOffice\PhpSpreadsheet\Cell\Cell` and a -value as arguments, and return a boolean `true` or `false` that indicates -whether the workbook cell has been populated with the value or not. The -Advanced Value Binder implements such a class: amongst other tests, it -identifies a string comprising "TRUE" or "FALSE" (based on locale -settings) and sets it to a boolean; or a number in scientific format -(e.g. "1.234e-5") and converts it to a float; or dates and times, -converting them to their Excel timestamp value – before storing the -value in the cell object. It also sets formatting for strings that are -identified as dates, times or percentages. It could easily be extended -to provide additional handling (including text or cell formatting) when -it encountered a hyperlink, or HTML markup within a CSV file. - -So using a Value Binder allows a great deal more flexibility in the -loader logic when reading unformatted text files. - -``` php -/** Tell PhpSpreadsheet that we want to use the Advanced Value Binder **/ -\PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() ); - -$inputFileType = 'Csv'; -$inputFileName = './sampleData/example1.tsv'; - -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); -$reader->setDelimiter("\t"); -$spreadsheet = $reader->load($inputFileName); -``` - -See `samples/Reader/15_Simple_file_reader_for_tab_separated_value_file_using_the_Advanced_Value_Binder.php` -for a working example of this code. - -Loading using a Value Binder applies to: - -Reader | Y/N |Reader | Y/N |Reader | Y/N -----------|:---:|--------|:---:|--------------|:---: -Xlsx | NO | Xls | NO | Xml | NO -Ods | NO | SYLK | NO | Gnumeric | NO -CSV | YES | HTML | YES - -## Error Handling - -Of course, you should always apply some error handling to your scripts -as well. PhpSpreadsheet throws exceptions, so you can wrap all your code -that accesses the library methods within Try/Catch blocks to trap for -any problems that are encountered, and deal with them in an appropriate -manner. - -The PhpSpreadsheet Readers throw a -`\PhpOffice\PhpSpreadsheet\Reader\Exception`. - -``` php -$inputFileName = './sampleData/example-1.xls'; - -try { - /** Load $inputFileName to a Spreadsheet Object **/ - $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName); -} catch(\PhpOffice\PhpSpreadsheet\Reader\Exception $e) { - die('Error loading file: '.$e->getMessage()); -} -``` - -See `samples/Reader/16_Handling_loader_exceptions_using_TryCatch.php` for a -working example of this code. - -## Helper Methods - -You can retrieve a list of worksheet names contained in a file without -loading the whole file by using the Reader’s `listWorksheetNames()` -method; similarly, a `listWorksheetInfo()` method will retrieve the -dimensions of worksheet in a file without needing to load and parse the -whole file. - -### listWorksheetNames - -The `listWorksheetNames()` method returns a simple array listing each -worksheet name within the workbook: - -``` php -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); - -$worksheetNames = $reader->listWorksheetNames($inputFileName); - -echo '

    Worksheet Names

    '; -echo '
      '; -foreach ($worksheetNames as $worksheetName) { - echo '
    1. ', $worksheetName, '
    2. '; -} -echo '
    '; -``` - -See `samples/Reader/18_Reading_list_of_worksheets_without_loading_entire_file.php` -for a working example of this code. - -### listWorksheetInfo - -The `listWorksheetInfo()` method returns a nested array, with each entry -listing the name and dimensions for a worksheet: - -``` php -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); - -$worksheetData = $reader->listWorksheetInfo($inputFileName); - -echo '

    Worksheet Information

    '; -echo '
      '; -foreach ($worksheetData as $worksheet) { - echo '
    1. ', $worksheet['worksheetName'], '
      '; - echo 'Rows: ', $worksheet['totalRows'], - ' Columns: ', $worksheet['totalColumns'], '
      '; - echo 'Cell Range: A1:', - $worksheet['lastColumnLetter'], $worksheet['totalRows']; - echo '
    2. '; -} -echo '
    '; -``` - -See `samples/Reader/19_Reading_worksheet_information_without_loading_entire_file.php` -for a working example of this code. diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/recipes.md b/vendor/phpoffice/phpspreadsheet/docs/topics/recipes.md deleted file mode 100644 index 0b40cf34..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/topics/recipes.md +++ /dev/null @@ -1,1506 +0,0 @@ -# Recipes - -The following pages offer you some widely-used PhpSpreadsheet recipes. -Please note that these do NOT offer complete documentation on specific -PhpSpreadsheet API functions, but just a bump to get you started. If you -need specific API functions, please refer to the [API documentation](https://phpoffice.github.io/PhpSpreadsheet/master). - -For example, [setting a worksheet's page orientation and size -](#setting-a-worksheets-page-orientation-and-size) covers setting a page -orientation to A4. Other paper formats, like US Letter, are not covered -in this document, but in the PhpSpreadsheet [API documentation](https://phpoffice.github.io/PhpSpreadsheet/master). - -## Setting a spreadsheet's metadata - -PhpSpreadsheet allows an easy way to set a spreadsheet's metadata, using -document property accessors. Spreadsheet metadata can be useful for -finding a specific document in a file repository or a document -management system. For example Microsoft Sharepoint uses document -metadata to search for a specific document in its document lists. - -Setting spreadsheet metadata is done as follows: - -``` php -$spreadsheet->getProperties() - ->setCreator("Maarten Balliauw") - ->setLastModifiedBy("Maarten Balliauw") - ->setTitle("Office 2007 XLSX Test Document") - ->setSubject("Office 2007 XLSX Test Document") - ->setDescription( - "Test document for Office 2007 XLSX, generated using PHP classes." - ) - ->setKeywords("office 2007 openxml php") - ->setCategory("Test result file"); -``` - -## Setting a spreadsheet's active sheet - -The following line of code sets the active sheet index to the first -sheet: - -``` php -$spreadsheet->setActiveSheetIndex(0); -``` - -You can also set the active sheet by its name/title - -``` php -$spreadsheet->setActiveSheetIndexByName('DataSheet') -``` - -will change the currently active sheet to the worksheet called -"DataSheet". - -## Write a date or time into a cell - -In Excel, dates and Times are stored as numeric values counting the -number of days elapsed since 1900-01-01. For example, the date -'2008-12-31' is represented as 39813. You can verify this in Microsoft -Office Excel by entering that date in a cell and afterwards changing the -number format to 'General' so the true numeric value is revealed. -Likewise, '3:15 AM' is represented as 0.135417. - -PhpSpreadsheet works with UST (Universal Standard Time) date and Time -values, but does no internal conversions; so it is up to the developer -to ensure that values passed to the date/time conversion functions are -UST. - -Writing a date value in a cell consists of 2 lines of code. Select the -method that suits you the best. Here are some examples: - -``` php - -// MySQL-like timestamp '2008-12-31' or date string -\PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() ); - -$spreadsheet->getActiveSheet() - ->setCellValue('D1', '2008-12-31'); - -$spreadsheet->getActiveSheet()->getStyle('D1') - ->getNumberFormat() - ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDDSLASH); - -// PHP-time (Unix time) -$time = gmmktime(0,0,0,12,31,2008); // int(1230681600) -$spreadsheet->getActiveSheet() - ->setCellValue('D1', \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel($time)); -$spreadsheet->getActiveSheet()->getStyle('D1') - ->getNumberFormat() - ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDDSLASH); - -// Excel-date/time -$spreadsheet->getActiveSheet()->setCellValue('D1', 39813) -$spreadsheet->getActiveSheet()->getStyle('D1') - ->getNumberFormat() - ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_YYYYMMDDSLASH); -``` - -The above methods for entering a date all yield the same result. -`\PhpOffice\PhpSpreadsheet\Style\NumberFormat` provides a lot of -pre-defined date formats. - -The `\PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel()` method will also -work with a PHP DateTime object. - -Similarly, times (or date and time values) can be entered in the same -fashion: just remember to use an appropriate format code. - -**Note:** - -See section "Using value binders to facilitate data entry" to learn more -about the AdvancedValueBinder used in the first example. Excel can also -operate in a 1904-based calendar (default for workbooks saved on Mac). -Normally, you do not have to worry about this when using PhpSpreadsheet. - -## Write a formula into a cell - -Inside the Excel file, formulas are always stored as they would appear -in an English version of Microsoft Office Excel, and PhpSpreadsheet -handles all formulae internally in this format. This means that the -following rules hold: - -- Decimal separator is `.` (period) -- Function argument separator is `,` (comma) -- Matrix row separator is `;` (semicolon) -- English function names must be used - -This is regardless of which language version of Microsoft Office Excel -may have been used to create the Excel file. - -When the final workbook is opened by the user, Microsoft Office Excel -will take care of displaying the formula according the applications -language. Translation is taken care of by the application! - -The following line of code writes the formula -`=IF(C4>500,"profit","loss")` into the cell B8. Note that the -formula must start with `=` to make PhpSpreadsheet recognise this as a -formula. - -``` php -$spreadsheet->getActiveSheet()->setCellValue('B8','=IF(C4>500,"profit","loss")'); -``` - -If you want to write a string beginning with an `=` character to a -cell, then you should use the `setCellValueExplicit()` method. - -``` php -$spreadsheet->getActiveSheet() - ->setCellValueExplicit( - 'B8', - '=IF(C4>500,"profit","loss")', - \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING - ); -``` - -A cell's formula can be read again using the following line of code: - -``` php -$formula = $spreadsheet->getActiveSheet()->getCell('B8')->getValue(); -``` - -If you need the calculated value of a cell, use the following code. This -is further explained in [the calculation engine](./calculation-engine.md). - -``` php -$value = $spreadsheet->getActiveSheet()->getCell('B8')->getCalculatedValue(); -``` - -## Locale Settings for Formulae - -Some localisation elements have been included in PhpSpreadsheet. You can -set a locale by changing the settings. To set the locale to Russian you -would use: - -``` php -$locale = 'ru'; -$validLocale = \PhpOffice\PhpSpreadsheet\Settings::setLocale($locale); -if (!$validLocale) { - echo 'Unable to set locale to '.$locale." - reverting to en_us
    \n"; -} -``` - -If Russian language files aren't available, the `setLocale()` method -will return an error, and English settings will be used throughout. - -Once you have set a locale, you can translate a formula from its -internal English coding. - -``` php -$formula = $spreadsheet->getActiveSheet()->getCell('B8')->getValue(); -$translatedFormula = \PhpOffice\PhpSpreadsheet\Calculation\Calculation::getInstance()->_translateFormulaToLocale($formula); -``` - -You can also create a formula using the function names and argument -separators appropriate to the defined locale; then translate it to -English before setting the cell value: - -``` php -$formula = '=ДНЕЙ360(ДАТА(2010;2;5);ДАТА(2010;12;31);ИСТИНА)'; -$internalFormula = \PhpOffice\PhpSpreadsheet\Calculation\Calculation::getInstance()->translateFormulaToEnglish($formula); -$spreadsheet->getActiveSheet()->setCellValue('B8',$internalFormula); -``` - -Currently, formula translation only translates the function names, the -constants TRUE and FALSE, and the function argument separators. - -At present, the following locale settings are supported: - -Language | | Locale Code ----------------------|----------------------|------------- -Czech | Ceština | cs -Danish | Dansk | da -German | Deutsch | de -Spanish | Español | es -Finnish | Suomi | fi -French | Français | fr -Hungarian | Magyar | hu -Italian | Italiano | it -Dutch | Nederlands | nl -Norwegian | Norsk | no -Polish | Jezyk polski | pl -Portuguese | Português | pt -Brazilian Portuguese | Português Brasileiro | pt_br -Russian | русский язык | ru -Swedish | Svenska | sv -Turkish | Türkçe | tr - -## Write a newline character "\n" in a cell (ALT+"Enter") - -In Microsoft Office Excel you get a line break in a cell by hitting -ALT+"Enter". When you do that, it automatically turns on "wrap text" for -the cell. - -Here is how to achieve this in PhpSpreadsheet: - -``` php -$spreadsheet->getActiveSheet()->getCell('A1')->setValue("hello\nworld"); -$spreadsheet->getActiveSheet()->getStyle('A1')->getAlignment()->setWrapText(true); -``` - -**Tip** - -Read more about formatting cells using `getStyle()` elsewhere. - -**Tip** - -AdvancedValuebinder.php automatically turns on "wrap text" for the cell -when it sees a newline character in a string that you are inserting in a -cell. Just like Microsoft Office Excel. Try this: - -``` php -\PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() ); - -$spreadsheet->getActiveSheet()->getCell('A1')->setValue("hello\nworld"); -``` - -Read more about AdvancedValueBinder.php elsewhere. - -## Explicitly set a cell's datatype - -You can set a cell's datatype explicitly by using the cell's -setValueExplicit method, or the setCellValueExplicit method of a -worksheet. Here's an example: - -``` php -$spreadsheet->getActiveSheet()->getCell('A1') - ->setValueExplicit( - '25', - \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_NUMERIC - ); -``` - -## Change a cell into a clickable URL - -You can make a cell a clickable URL by setting its hyperlink property: - -``` php -$spreadsheet->getActiveSheet()->setCellValue('E26', 'www.phpexcel.net'); -$spreadsheet->getActiveSheet()->getCell('E26')->getHyperlink()->setUrl('https://www.example.com'); -``` - -If you want to make a hyperlink to another worksheet/cell, use the -following code: - -``` php -$spreadsheet->getActiveSheet()->setCellValue('E26', 'www.phpexcel.net'); -$spreadsheet->getActiveSheet()->getCell('E26')->getHyperlink()->setUrl("sheet://'Sheetname'!A1"); -``` - -## Setting Printer Options for Excel files - -### Setting a worksheet's page orientation and size - -Setting a worksheet's page orientation and size can be done using the -following lines of code: - -``` php -$spreadsheet->getActiveSheet()->getPageSetup() - ->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE); -$spreadsheet->getActiveSheet()->getPageSetup() - ->setPaperSize(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4); -``` - -Note that there are additional page settings available. Please refer to -the [API documentation](https://phpoffice.github.io/PhpSpreadsheet/master) for all possible options. - -### Page Setup: Scaling options - -The page setup scaling options in PhpSpreadsheet relate directly to the -scaling options in the "Page Setup" dialog as shown in the illustration. - -Default values in PhpSpreadsheet correspond to default values in MS -Office Excel as shown in illustration - -![08-page-setup-scaling-options.png](./images/08-page-setup-scaling-options.png) - -method | initial value | calling method will trigger | Note ---------------------|:-------------:|-----------------------------|------ -setFitToPage(...) | FALSE | - | -setScale(...) | 100 | setFitToPage(FALSE) | -setFitToWidth(...) | 1 | setFitToPage(TRUE) | value 0 means do-not-fit-to-width -setFitToHeight(...) | 1 | setFitToPage(TRUE) | value 0 means do-not-fit-to-height - -#### Example - -Here is how to fit to 1 page wide by infinite pages tall: - -``` php -$spreadsheet->getActiveSheet()->getPageSetup()->setFitToWidth(1); -$spreadsheet->getActiveSheet()->getPageSetup()->setFitToHeight(0); -``` - -As you can see, it is not necessary to call setFitToPage(TRUE) since -setFitToWidth(...) and setFitToHeight(...) triggers this. - -If you use `setFitToWidth()` you should in general also specify -`setFitToHeight()` explicitly like in the example. Be careful relying on -the initial values. - -### Page margins - -To set page margins for a worksheet, use this code: - -``` php -$spreadsheet->getActiveSheet()->getPageMargins()->setTop(1); -$spreadsheet->getActiveSheet()->getPageMargins()->setRight(0.75); -$spreadsheet->getActiveSheet()->getPageMargins()->setLeft(0.75); -$spreadsheet->getActiveSheet()->getPageMargins()->setBottom(1); -``` - -Note that the margin values are specified in inches. - -![08-page-setup-margins.png](./images/08-page-setup-margins.png) - -### Center a page horizontally/vertically - -To center a page horizontally/vertically, you can use the following -code: - -``` php -$spreadsheet->getActiveSheet()->getPageSetup()->setHorizontalCentered(true); -$spreadsheet->getActiveSheet()->getPageSetup()->setVerticalCentered(false); -``` - -### Setting the print header and footer of a worksheet - -Setting a worksheet's print header and footer can be done using the -following lines of code: - -``` php -$spreadsheet->getActiveSheet()->getHeaderFooter() - ->setOddHeader('&C&HPlease treat this document as confidential!'); -$spreadsheet->getActiveSheet()->getHeaderFooter() - ->setOddFooter('&L&B' . $spreadsheet->getProperties()->getTitle() . '&RPage &P of &N'); -``` - -Substitution and formatting codes (starting with &) can be used inside -headers and footers. There is no required order in which these codes -must appear. - -The first occurrence of the following codes turns the formatting ON, the -second occurrence turns it OFF again: - -- Strikethrough -- Superscript -- Subscript - -Superscript and subscript cannot both be ON at same time. Whichever -comes first wins and the other is ignored, while the first is ON. - -The following codes are supported by Xlsx: - -Code | Meaning --------------------------|----------- -`&L` | Code for "left section" (there are three header / footer locations, "left", "center", and "right"). When two or more occurrences of this section marker exist, the contents from all markers are concatenated, in the order of appearance, and placed into the left section. -`&P` | Code for "current page #" -`&N` | Code for "total pages" -`&font size` | Code for "text font size", where font size is a font size in points. -`&K` | Code for "text font color" - RGB Color is specified as RRGGBB Theme Color is specifed as TTSNN where TT is the theme color Id, S is either "+" or "-" of the tint/shade value, NN is the tint/shade value. -`&S` | Code for "text strikethrough" on / off -`&X` | Code for "text super script" on / off -`&Y` | Code for "text subscript" on / off -`&C` | Code for "center section". When two or more occurrences of this section marker exist, the contents from all markers are concatenated, in the order of appearance, and placed into the center section. -`&D` | Code for "date" -`&T` | Code for "time" -`&G` | Code for "picture as background" - Please make sure to add the image to the header/footer (see Tip for picture) -`&U` | Code for "text single underline" -`&E` | Code for "double underline" -`&R` | Code for "right section". When two or more occurrences of this section marker exist, the contents from all markers are concatenated, in the order of appearance, and placed into the right section. -`&Z` | Code for "this workbook's file path" -`&F` | Code for "this workbook's file name" -`&A` | Code for "sheet tab name" -`&+` | Code for add to page # -`&-` | Code for subtract from page # -`&"font name,font type"` | Code for "text font name" and "text font type", where font name and font type are strings specifying the name and type of the font, separated by a comma. When a hyphen appears in font name, it means "none specified". Both of font name and font type can be localized values. -`&"-,Bold"` | Code for "bold font style" -`&B` | Code for "bold font style" -`&"-,Regular"` | Code for "regular font style" -`&"-,Italic"` | Code for "italic font style" -`&I` | Code for "italic font style" -`&"-,Bold Italic"` | Code for "bold italic font style" -`&O` | Code for "outline style" -`&H` | Code for "shadow style" - -**Tip** - -The above table of codes may seem overwhelming first time you are trying to -figure out how to write some header or footer. Luckily, there is an easier way. -Let Microsoft Office Excel do the work for you.For example, create in Microsoft - Office Excel an xlsx file where you insert the header and footer as desired -using the programs own interface. Save file as test.xlsx. Now, take that file -and read off the values using PhpSpreadsheet as follows: - -```php -$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load('test.xlsx'); -$worksheet = $spreadsheet->getActiveSheet(); - -var_dump($worksheet->getHeaderFooter()->getOddFooter()); -var_dump($worksheet->getHeaderFooter()->getEvenFooter()); -var_dump($worksheet->getHeaderFooter()->getOddHeader()); -var_dump($worksheet->getHeaderFooter()->getEvenHeader()); -``` - -That reveals the codes for the even/odd header and footer. Experienced -users may find it easier to rename test.xlsx to test.zip, unzip it, and -inspect directly the contents of the relevant xl/worksheets/sheetX.xml -to find the codes for header/footer. - -**Tip for picture** - -```php -$drawing = new \PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooterDrawing(); -$drawing->setName('PhpSpreadsheet logo'); -$drawing->setPath('./images/PhpSpreadsheet_logo.png'); -$drawing->setHeight(36); -$spreadsheet->getActiveSheet()->getHeaderFooter()->addImage($drawing, \PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooter::IMAGE_HEADER_LEFT); -``` - -### Setting printing breaks on a row or column - -To set a print break, use the following code, which sets a row break on -row 10. - -``` php -$spreadsheet->getActiveSheet()->setBreak('A10', \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::BREAK_ROW); -``` - -The following line of code sets a print break on column D: - -``` php -$spreadsheet->getActiveSheet()->setBreak('D10', \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::BREAK_COLUMN); -``` - -### Show/hide gridlines when printing - -To show/hide gridlines when printing, use the following code: - -```php -$spreadsheet->getActiveSheet()->setShowGridlines(true); -``` - -### Setting rows/columns to repeat at top/left - -PhpSpreadsheet can repeat specific rows/cells at top/left of a page. The -following code is an example of how to repeat row 1 to 5 on each printed -page of a specific worksheet: - -``` php -$spreadsheet->getActiveSheet()->getPageSetup()->setRowsToRepeatAtTopByStartAndEnd(1, 5); -``` - -### Specify printing area - -To specify a worksheet's printing area, use the following code: - -``` php -$spreadsheet->getActiveSheet()->getPageSetup()->setPrintArea('A1:E5'); -``` - -There can also be multiple printing areas in a single worksheet: - -``` php -$spreadsheet->getActiveSheet()->getPageSetup()->setPrintArea('A1:E5,G4:M20'); -``` - -## Styles - -### Formatting cells - -A cell can be formatted with font, border, fill, ... style information. -For example, one can set the foreground colour of a cell to red, aligned -to the right, and the border to black and thick border style. Let's do -that on cell B2: - -``` php -$spreadsheet->getActiveSheet()->getStyle('B2') - ->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_RED); -$spreadsheet->getActiveSheet()->getStyle('B2') - ->getAlignment()->setHorizontal(\PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT); -$spreadsheet->getActiveSheet()->getStyle('B2') - ->getBorders()->getTop()->setBorderStyle(\PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK); -$spreadsheet->getActiveSheet()->getStyle('B2') - ->getBorders()->getBottom()->setBorderStyle(\PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK); -$spreadsheet->getActiveSheet()->getStyle('B2') - ->getBorders()->getLeft()->setBorderStyle(\PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK); -$spreadsheet->getActiveSheet()->getStyle('B2') - ->getBorders()->getRight()->setBorderStyle(\PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK); -$spreadsheet->getActiveSheet()->getStyle('B2') - ->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID); -$spreadsheet->getActiveSheet()->getStyle('B2') - ->getFill()->getStartColor()->setARGB('FFFF0000'); -``` - -`getStyle()` also accepts a cell range as a parameter. For example, you -can set a red background color on a range of cells: - -``` php -$spreadsheet->getActiveSheet()->getStyle('B3:B7')->getFill() - ->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID) - ->getStartColor()->setARGB('FFFF0000'); -``` - -**Tip** It is recommended to style many cells at once, using e.g. -getStyle('A1:M500'), rather than styling the cells individually in a -loop. This is much faster compared to looping through cells and styling -them individually. - -There is also an alternative manner to set styles. The following code -sets a cell's style to font bold, alignment right, top border thin and a -gradient fill: - -``` php -$styleArray = [ - 'font' => [ - 'bold' => true, - ], - 'alignment' => [ - 'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT, - ], - 'borders' => [ - 'top' => [ - 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN, - ], - ], - 'fill' => [ - 'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_GRADIENT_LINEAR, - 'rotation' => 90, - 'startColor' => [ - 'argb' => 'FFA0A0A0', - ], - 'endColor' => [ - 'argb' => 'FFFFFFFF', - ], - ], -]; - -$spreadsheet->getActiveSheet()->getStyle('A3')->applyFromArray($styleArray); -``` - -Or with a range of cells: - -``` php -$spreadsheet->getActiveSheet()->getStyle('B3:B7')->applyFromArray($styleArray); -``` - -This alternative method using arrays should be faster in terms of -execution whenever you are setting more than one style property. But the -difference may barely be measurable unless you have many different -styles in your workbook. - -### Number formats - -You often want to format numbers in Excel. For example you may want a -thousands separator plus a fixed number of decimals after the decimal -separator. Or perhaps you want some numbers to be zero-padded. - -In Microsoft Office Excel you may be familiar with selecting a number -format from the "Format Cells" dialog. Here there are some predefined -number formats available including some for dates. The dialog is -designed in a way so you don't have to interact with the underlying raw -number format code unless you need a custom number format. - -In PhpSpreadsheet, you can also apply various predefined number formats. -Example: - -``` php -$spreadsheet->getActiveSheet()->getStyle('A1')->getNumberFormat() - ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1); -``` - -This will format a number e.g. 1587.2 so it shows up as 1,587.20 when -you open the workbook in MS Office Excel. (Depending on settings for -decimal and thousands separators in Microsoft Office Excel it may show -up as 1.587,20) - -You can achieve exactly the same as the above by using this: - -``` php -$spreadsheet->getActiveSheet()->getStyle('A1')->getNumberFormat() - ->setFormatCode('#,##0.00'); -``` - -In Microsoft Office Excel, as well as in PhpSpreadsheet, you will have -to interact with raw number format codes whenever you need some special -custom number format. Example: - -``` php -$spreadsheet->getActiveSheet()->getStyle('A1')->getNumberFormat() - ->setFormatCode('[Blue][>=3000]$#,##0;[Red][<0]$#,##0;$#,##0'); -``` - -Another example is when you want numbers zero-padded with leading zeros -to a fixed length: - -``` php -$spreadsheet->getActiveSheet()->getCell('A1')->setValue(19); -$spreadsheet->getActiveSheet()->getStyle('A1')->getNumberFormat() - ->setFormatCode('0000'); // will show as 0019 in Excel -``` - -**Tip** The rules for composing a number format code in Excel can be -rather complicated. Sometimes you know how to create some number format -in Microsoft Office Excel, but don't know what the underlying number -format code looks like. How do you find it? - -The readers shipped with PhpSpreadsheet come to the rescue. Load your -template workbook using e.g. Xlsx reader to reveal the number format -code. Example how read a number format code for cell A1: - -``` php -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx'); -$spreadsheet = $reader->load('template.xlsx'); -var_dump($spreadsheet->getActiveSheet()->getStyle('A1')->getNumberFormat()->getFormatCode()); -``` - -Advanced users may find it faster to inspect the number format code -directly by renaming template.xlsx to template.zip, unzipping, and -looking for the relevant piece of XML code holding the number format -code in *xl/styles.xml*. - -### Alignment and wrap text - -Let's set vertical alignment to the top for cells A1:D4 - -``` php -$spreadsheet->getActiveSheet()->getStyle('A1:D4') - ->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_TOP); -``` - -Here is how to achieve wrap text: - -``` php -$spreadsheet->getActiveSheet()->getStyle('A1:D4') - ->getAlignment()->setWrapText(true); -``` - -### Setting the default style of a workbook - -It is possible to set the default style of a workbook. Let's set the -default font to Arial size 8: - -``` php -$spreadsheet->getDefaultStyle()->getFont()->setName('Arial'); -$spreadsheet->getDefaultStyle()->getFont()->setSize(8); -``` - -### Styling cell borders - -In PhpSpreadsheet it is easy to apply various borders on a rectangular -selection. Here is how to apply a thick red border outline around cells -B2:G8. - -``` php -$styleArray = [ - 'borders' => [ - 'outline' => [ - 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK, - 'color' => ['argb' => 'FFFF0000'], - ], - ], -]; - -$worksheet->getStyle('B2:G8')->applyFromArray($styleArray); -``` - -In Microsoft Office Excel, the above operation would correspond to -selecting the cells B2:G8, launching the style dialog, choosing a thick -red border, and clicking on the "Outline" border component. - -Note that the border outline is applied to the rectangular selection -B2:G8 as a whole, not on each cell individually. - -You can achieve any border effect by using just the 5 basic borders and -operating on a single cell at a time: - -- left -- right -- top -- bottom -- diagonal - -Additional shortcut borders come in handy like in the example above. -These are the shortcut borders available: - -- allBorders -- outline -- inside -- vertical -- horizontal - -An overview of all border shortcuts can be seen in the following image: - -![08-styling-border-options.png](./images/08-styling-border-options.png) - -If you simultaneously set e.g. allBorders and vertical, then we have -"overlapping" borders, and one of the components has to win over the -other where there is border overlap. In PhpSpreadsheet, from weakest to -strongest borders, the list is as follows: allBorders, outline/inside, -vertical/horizontal, left/right/top/bottom/diagonal. - -This border hierarchy can be utilized to achieve various effects in an -easy manner. - -### Valid array keys for style `applyFromArray()` - -The following table lists the valid array keys for -`\PhpOffice\PhpSpreadsheet\Style\Style::applyFromArray()` classes. If the "Maps -to property" column maps a key to a setter, the value provided for that -key will be applied directly. If the "Maps to property" column maps a -key to a getter, the value provided for that key will be applied as -another style array. - -**\PhpOffice\PhpSpreadsheet\Style\Style** - -Array key | Maps to property --------------|------------------- -fill | getFill() -font | getFont() -borders | getBorders() -alignment | getAlignment() -numberFormat | getNumberFormat() -protection | getProtection() - -**\PhpOffice\PhpSpreadsheet\Style\Fill** - -Array key | Maps to property ------------|------------------- -fillType | setFillType() -rotation | setRotation() -startColor | getStartColor() -endColor | getEndColor() -color | getStartColor() - -**\PhpOffice\PhpSpreadsheet\Style\Font** - -Array key | Maps to property -------------|------------------- -name | setName() -bold | setBold() -italic | setItalic() -underline | setUnderline() -strikethrough | setStrikethrough() -color | getColor() -size | setSize() -superscript | setSuperscript() -subscript | setSubscript() - -**\PhpOffice\PhpSpreadsheet\Style\Borders** - -Array key | Maps to property -------------------|------------------- -allBorders | getLeft(); getRight(); getTop(); getBottom() -left | getLeft() -right | getRight() -top | getTop() -bottom | getBottom() -diagonal | getDiagonal() -vertical | getVertical() -horizontal | getHorizontal() -diagonalDirection | setDiagonalDirection() -outline | setOutline() - -**\PhpOffice\PhpSpreadsheet\Style\Border** - -Array key | Maps to property -------------|------------------- -borderStyle | setBorderStyle() -color | getColor() - -**\PhpOffice\PhpSpreadsheet\Style\Alignment** - -Array key | Maps to property -------------|------------------- -horizontal | setHorizontal() -vertical | setVertical() -textRotation| setTextRotation() -wrapText | setWrapText() -shrinkToFit | setShrinkToFit() -indent | setIndent() - -**\PhpOffice\PhpSpreadsheet\Style\NumberFormat** - -Array key | Maps to property -----------|------------------- -formatCode | setFormatCode() - -**\PhpOffice\PhpSpreadsheet\Style\Protection** - -Array key | Maps to property -----------|------------------- -locked | setLocked() -hidden | setHidden() - -## Conditional formatting a cell - -A cell can be formatted conditionally, based on a specific rule. For -example, one can set the foreground colour of a cell to red if its value -is below zero, and to green if its value is zero or more. - -One can set a conditional style ruleset to a cell using the following -code: - -``` php -$conditional1 = new \PhpOffice\PhpSpreadsheet\Style\Conditional(); -$conditional1->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS); -$conditional1->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_LESSTHAN); -$conditional1->addCondition('0'); -$conditional1->getStyle()->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_RED); -$conditional1->getStyle()->getFont()->setBold(true); - -$conditional2 = new \PhpOffice\PhpSpreadsheet\Style\Conditional(); -$conditional2->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS); -$conditional2->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_GREATERTHANOREQUAL); -$conditional2->addCondition('0'); -$conditional2->getStyle()->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_GREEN); -$conditional2->getStyle()->getFont()->setBold(true); - -$conditionalStyles = $spreadsheet->getActiveSheet()->getStyle('B2')->getConditionalStyles(); -$conditionalStyles[] = $conditional1; -$conditionalStyles[] = $conditional2; - -$spreadsheet->getActiveSheet()->getStyle('B2')->setConditionalStyles($conditionalStyles); -``` - -If you want to copy the ruleset to other cells, you can duplicate the -style object: - -``` php -$spreadsheet->getActiveSheet() - ->duplicateStyle( - $spreadsheet->getActiveSheet()->getStyle('B2'), - 'B3:B7' - ); -``` - -## Add a comment to a cell - -To add a comment to a cell, use the following code. The example below -adds a comment to cell E11: - -``` php -$spreadsheet->getActiveSheet() - ->getComment('E11') - ->setAuthor('Mark Baker'); -$commentRichText = $spreadsheet->getActiveSheet() - ->getComment('E11') - ->getText()->createTextRun('PhpSpreadsheet:'); -$commentRichText->getFont()->setBold(true); -$spreadsheet->getActiveSheet() - ->getComment('E11') - ->getText()->createTextRun("\r\n"); -$spreadsheet->getActiveSheet() - ->getComment('E11') - ->getText()->createTextRun('Total amount on the current invoice, excluding VAT.'); -``` - -![08-cell-comment.png](./images/08-cell-comment.png) - -## Apply autofilter to a range of cells - -To apply an autofilter to a range of cells, use the following code: - -``` php -$spreadsheet->getActiveSheet()->setAutoFilter('A1:C9'); -``` - -**Make sure that you always include the complete filter range!** Excel -does support setting only the captionrow, but that's **not** a best -practice... - -## Setting security on a spreadsheet - -Excel offers 3 levels of "protection": - -- Document: allows you to set a password on a complete -spreadsheet, allowing changes to be made only when that password is -entered. -- Worksheet: offers other security options: you can -disallow inserting rows on a specific sheet, disallow sorting, ... -- Cell: offers the option to lock/unlock a cell as well as show/hide -the internal formula. - -An example on setting document security: - -``` php -$spreadsheet->getSecurity()->setLockWindows(true); -$spreadsheet->getSecurity()->setLockStructure(true); -$spreadsheet->getSecurity()->setWorkbookPassword("PhpSpreadsheet"); -``` - -An example on setting worksheet security: - -``` php -$spreadsheet->getActiveSheet() - ->getProtection()->setPassword('PhpSpreadsheet'); -$spreadsheet->getActiveSheet() - ->getProtection()->setSheet(true); -$spreadsheet->getActiveSheet() - ->getProtection()->setSort(true); -$spreadsheet->getActiveSheet() - ->getProtection()->setInsertRows(true); -$spreadsheet->getActiveSheet() - ->getProtection()->setFormatCells(true); -``` - -An example on setting cell security: - -``` php -$spreadsheet->getActiveSheet()->getStyle('B1') - ->getProtection() - ->setLocked(\PhpOffice\PhpSpreadsheet\Style\Protection::PROTECTION_UNPROTECTED); -``` - -**Make sure you enable worksheet protection if you need any of the -worksheet protection features!** This can be done using the following -code: - -``` php -$spreadsheet->getActiveSheet()->getProtection()->setSheet(true); -``` - -## Setting data validation on a cell - -Data validation is a powerful feature of Xlsx. It allows to specify an -input filter on the data that can be inserted in a specific cell. This -filter can be a range (i.e. value must be between 0 and 10), a list -(i.e. value must be picked from a list), ... - -The following piece of code only allows numbers between 10 and 20 to be -entered in cell B3: - -``` php -$validation = $spreadsheet->getActiveSheet()->getCell('B3') - ->getDataValidation(); -$validation->setType( \PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_WHOLE ); -$validation->setErrorStyle( \PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_STOP ); -$validation->setAllowBlank(true); -$validation->setShowInputMessage(true); -$validation->setShowErrorMessage(true); -$validation->setErrorTitle('Input error'); -$validation->setError('Number is not allowed!'); -$validation->setPromptTitle('Allowed input'); -$validation->setPrompt('Only numbers between 10 and 20 are allowed.'); -$validation->setFormula1(10); -$validation->setFormula2(20); -``` - -The following piece of code only allows an item picked from a list of -data to be entered in cell B3: - -``` php -$validation = $spreadsheet->getActiveSheet()->getCell('B5') - ->getDataValidation(); -$validation->setType( \PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST ); -$validation->setErrorStyle( \PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION ); -$validation->setAllowBlank(false); -$validation->setShowInputMessage(true); -$validation->setShowErrorMessage(true); -$validation->setShowDropDown(true); -$validation->setErrorTitle('Input error'); -$validation->setError('Value is not in list.'); -$validation->setPromptTitle('Pick from list'); -$validation->setPrompt('Please pick a value from the drop-down list.'); -$validation->setFormula1('"Item A,Item B,Item C"'); -``` - -When using a data validation list like above, make sure you put the list -between `"` and `"` and that you split the items with a comma (`,`). - -It is important to remember that any string participating in an Excel -formula is allowed to be maximum 255 characters (not bytes). This sets a -limit on how many items you can have in the string "Item A,Item B,Item -C". Therefore it is normally a better idea to type the item values -directly in some cell range, say A1:A3, and instead use, say, -`$validation->setFormula1('Sheet!$A$1:$A$3')`. Another benefit is that -the item values themselves can contain the comma `,` character itself. - -If you need data validation on multiple cells, one can clone the -ruleset: - -``` php -$spreadsheet->getActiveSheet()->getCell('B8')->setDataValidation(clone $validation); -``` - -## Setting a column's width - -A column's width can be set using the following code: - -``` php -$spreadsheet->getActiveSheet()->getColumnDimension('D')->setWidth(12); -``` - -If you want PhpSpreadsheet to perform an automatic width calculation, -use the following code. PhpSpreadsheet will approximate the column with -to the width of the widest column value. - -``` php -$spreadsheet->getActiveSheet()->getColumnDimension('B')->setAutoSize(true); -``` - -![08-column-width.png](./images/08-column-width.png) - -The measure for column width in PhpSpreadsheet does **not** correspond -exactly to the measure you may be used to in Microsoft Office Excel. -Column widths are difficult to deal with in Excel, and there are several -measures for the column width. - -1. Inner width in character units -(e.g. 8.43 this is probably what you are familiar with in Excel) -2. Full width in pixels (e.g. 64 pixels) -3. Full width in character units (e.g. 9.140625, value -1 indicates unset width) - -**PhpSpreadsheet always -operates with "3. Full width in character units"** which is in fact the -only value that is stored in any Excel file, hence the most reliable -measure. Unfortunately, **Microsoft Office Excel does not present you -with this measure**. Instead measures 1 and 2 are computed by the -application when the file is opened and these values are presented in -various dialogues and tool tips. - -The character width unit is the width of -a `0` (zero) glyph in the workbooks default font. Therefore column -widths measured in character units in two different workbooks can only -be compared if they have the same default workbook font.If you have some -Excel file and need to know the column widths in measure 3, you can -read the Excel file with PhpSpreadsheet and echo the retrieved values. - -## Show/hide a column - -To set a worksheet's column visibility, you can use the following code. -The first line explicitly shows the column C, the second line hides -column D. - -``` php -$spreadsheet->getActiveSheet()->getColumnDimension('C')->setVisible(true); -$spreadsheet->getActiveSheet()->getColumnDimension('D')->setVisible(false); -``` - -## Group/outline a column - -To group/outline a column, you can use the following code: - -``` php -$spreadsheet->getActiveSheet()->getColumnDimension('E')->setOutlineLevel(1); -``` - -You can also collapse the column. Note that you should also set the -column invisible, otherwise the collapse will not be visible in Excel -2007. - -``` php -$spreadsheet->getActiveSheet()->getColumnDimension('E')->setCollapsed(true); -$spreadsheet->getActiveSheet()->getColumnDimension('E')->setVisible(false); -``` - -Please refer to the section "group/outline a row" for a complete example -on collapsing. - -You can instruct PhpSpreadsheet to add a summary to the right (default), -or to the left. The following code adds the summary to the left: - -``` php -$spreadsheet->getActiveSheet()->setShowSummaryRight(false); -``` - -## Setting a row's height - -A row's height can be set using the following code: - -``` php -$spreadsheet->getActiveSheet()->getRowDimension('10')->setRowHeight(100); -``` - -Excel measures row height in points, where 1 pt is 1/72 of an inch (or -about 0.35mm). The default value is 12.75 pts; and the permitted range -of values is between 0 and 409 pts, where 0 pts is a hidden row. - -## Show/hide a row - -To set a worksheet''s row visibility, you can use the following code. -The following example hides row number 10. - -``` php -$spreadsheet->getActiveSheet()->getRowDimension('10')->setVisible(false); -``` - -Note that if you apply active filters using an AutoFilter, then this -will override any rows that you hide or unhide manually within that -AutoFilter range if you save the file. - -## Group/outline a row - -To group/outline a row, you can use the following code: - -``` php -$spreadsheet->getActiveSheet()->getRowDimension('5')->setOutlineLevel(1); -``` - -You can also collapse the row. Note that you should also set the row -invisible, otherwise the collapse will not be visible in Excel 2007. - -``` php -$spreadsheet->getActiveSheet()->getRowDimension('5')->setCollapsed(true); -$spreadsheet->getActiveSheet()->getRowDimension('5')->setVisible(false); -``` - -Here's an example which collapses rows 50 to 80: - -``` php -for ($i = 51; $i <= 80; $i++) { - $spreadsheet->getActiveSheet()->setCellValue('A' . $i, "FName $i"); - $spreadsheet->getActiveSheet()->setCellValue('B' . $i, "LName $i"); - $spreadsheet->getActiveSheet()->setCellValue('C' . $i, "PhoneNo $i"); - $spreadsheet->getActiveSheet()->setCellValue('D' . $i, "FaxNo $i"); - $spreadsheet->getActiveSheet()->setCellValue('E' . $i, true); - $spreadsheet->getActiveSheet()->getRowDimension($i)->setOutlineLevel(1); - $spreadsheet->getActiveSheet()->getRowDimension($i)->setVisible(false); -} - -$spreadsheet->getActiveSheet()->getRowDimension(81)->setCollapsed(true); -``` - -You can instruct PhpSpreadsheet to add a summary below the collapsible -rows (default), or above. The following code adds the summary above: - -``` php -$spreadsheet->getActiveSheet()->setShowSummaryBelow(false); -``` - -## Merge/unmerge cells - -If you have a big piece of data you want to display in a worksheet, you -can merge two or more cells together, to become one cell. This can be -done using the following code: - -``` php -$spreadsheet->getActiveSheet()->mergeCells('A18:E22'); -``` - -Removing a merge can be done using the unmergeCells method: - -``` php -$spreadsheet->getActiveSheet()->unmergeCells('A18:E22'); -``` - -## Inserting rows/columns - -You can insert/remove rows/columns at a specific position. The following -code inserts 2 new rows, right before row 7: - -``` php -$spreadsheet->getActiveSheet()->insertNewRowBefore(7, 2); -``` - -## Add a drawing to a worksheet - -A drawing is always represented as a separate object, which can be added -to a worksheet. Therefore, you must first instantiate a new -`\PhpOffice\PhpSpreadsheet\Worksheet\Drawing`, and assign its properties a -meaningful value: - -``` php -$drawing = new \PhpOffice\PhpSpreadsheet\Worksheet\Drawing(); -$drawing->setName('Logo'); -$drawing->setDescription('Logo'); -$drawing->setPath('./images/officelogo.jpg'); -$drawing->setHeight(36); -``` - -To add the above drawing to the worksheet, use the following snippet of -code. PhpSpreadsheet creates the link between the drawing and the -worksheet: - -``` php -$drawing->setWorksheet($spreadsheet->getActiveSheet()); -``` - -You can set numerous properties on a drawing, here are some examples: - -``` php -$drawing->setName('Paid'); -$drawing->setDescription('Paid'); -$drawing->setPath('./images/paid.png'); -$drawing->setCoordinates('B15'); -$drawing->setOffsetX(110); -$drawing->setRotation(25); -$drawing->getShadow()->setVisible(true); -$drawing->getShadow()->setDirection(45); -``` - -You can also add images created using GD functions without needing to -save them to disk first as In-Memory drawings. - -``` php -// Use GD to create an in-memory image -$gdImage = @imagecreatetruecolor(120, 20) or die('Cannot Initialize new GD image stream'); -$textColor = imagecolorallocate($gdImage, 255, 255, 255); -imagestring($gdImage, 1, 5, 5, 'Created with PhpSpreadsheet', $textColor); - -// Add the In-Memory image to a worksheet -$drawing = new \PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing(); -$drawing->setName('In-Memory image 1'); -$drawing->setDescription('In-Memory image 1'); -$drawing->setCoordinates('A1'); -$drawing->setImageResource($gdImage); -$drawing->setRenderingFunction( - \PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::RENDERING_JPEG -); -$drawing->setMimeType(\PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::MIMETYPE_DEFAULT); -$drawing->setHeight(36); -$drawing->setWorksheet($spreadsheet->getActiveSheet()); -``` - -## Reading Images from a worksheet - -A commonly asked question is how to retrieve the images from a workbook -that has been loaded, and save them as individual image files to disk. - -The following code extracts images from the current active worksheet, -and writes each as a separate file. - -``` php -$i = 0; -foreach ($spreadsheet->getActiveSheet()->getDrawingCollection() as $drawing) { - if ($drawing instanceof \PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing) { - ob_start(); - call_user_func( - $drawing->getRenderingFunction(), - $drawing->getImageResource() - ); - $imageContents = ob_get_contents(); - ob_end_clean(); - switch ($drawing->getMimeType()) { - case \PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::MIMETYPE_PNG : - $extension = 'png'; - break; - case \PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::MIMETYPE_GIF: - $extension = 'gif'; - break; - case \PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::MIMETYPE_JPEG : - $extension = 'jpg'; - break; - } - } else { - $zipReader = fopen($drawing->getPath(),'r'); - $imageContents = ''; - while (!feof($zipReader)) { - $imageContents .= fread($zipReader,1024); - } - fclose($zipReader); - $extension = $drawing->getExtension(); - } - $myFileName = '00_Image_'.++$i.'.'.$extension; - file_put_contents($myFileName,$imageContents); -} -``` - -## Add rich text to a cell - -Adding rich text to a cell can be done using -`\PhpOffice\PhpSpreadsheet\RichText\RichText` instances. Here''s an example, which -creates the following rich text string: - -> This invoice is ***payable within thirty days after the end of the -> month*** unless specified otherwise on the invoice. - -``` php -$richText = new \PhpOffice\PhpSpreadsheet\RichText\RichText(); -$richText->createText('This invoice is '); -$payable = $richText->createTextRun('payable within thirty days after the end of the month'); -$payable->getFont()->setBold(true); -$payable->getFont()->setItalic(true); -$payable->getFont()->setColor( new \PhpOffice\PhpSpreadsheet\Style\Color( \PhpOffice\PhpSpreadsheet\Style\Color::COLOR_DARKGREEN ) ); -$richText->createText(', unless specified otherwise on the invoice.'); -$spreadsheet->getActiveSheet()->getCell('A18')->setValue($richText); -``` - -## Define a named range - -PhpSpreadsheet supports the definition of named ranges. These can be -defined using the following code: - -``` php -// Add some data -$spreadsheet->setActiveSheetIndex(0); -$spreadsheet->getActiveSheet()->setCellValue('A1', 'Firstname:'); -$spreadsheet->getActiveSheet()->setCellValue('A2', 'Lastname:'); -$spreadsheet->getActiveSheet()->setCellValue('B1', 'Maarten'); -$spreadsheet->getActiveSheet()->setCellValue('B2', 'Balliauw'); - -// Define named ranges -$spreadsheet->addNamedRange( new \PhpOffice\PhpSpreadsheet\NamedRange('PersonFN', $spreadsheet->getActiveSheet(), 'B1') ); -$spreadsheet->addNamedRange( new \PhpOffice\PhpSpreadsheet\NamedRange('PersonLN', $spreadsheet->getActiveSheet(), 'B2') ); -``` - -Optionally, a fourth parameter can be passed defining the named range -local (i.e. only usable on the current worksheet). Named ranges are -global by default. - -## Redirect output to a client's web browser - -Sometimes, one really wants to output a file to a client''s browser, -especially when creating spreadsheets on-the-fly. There are some easy -steps that can be followed to do this: - -1. Create your PhpSpreadsheet spreadsheet -2. Output HTTP headers for the type of document you wish to output -3. Use the `\PhpOffice\PhpSpreadsheet\Writer\*` of your choice, and save - to `'php://output'` - -`\PhpOffice\PhpSpreadsheet\Writer\Xlsx` uses temporary storage when -writing to `php://output`. By default, temporary files are stored in the -script's working directory. When there is no access, it falls back to -the operating system's temporary files location. - -**This may not be safe for unauthorized viewing!** Depending on the -configuration of your operating system, temporary storage can be read by -anyone using the same temporary storage folder. When confidentiality of -your document is needed, it is recommended not to use `php://output`. - -### HTTP headers - -Example of a script redirecting an Excel 2007 file to the client's -browser: - -``` php -/* Here there will be some code where you create $spreadsheet */ - -// redirect output to client browser -header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); -header('Content-Disposition: attachment;filename="myfile.xlsx"'); -header('Cache-Control: max-age=0'); - -$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->save('php://output'); -``` - -Example of a script redirecting an Xls file to the client's browser: - -``` php -/* Here there will be some code where you create $spreadsheet */ - -// redirect output to client browser -header('Content-Type: application/vnd.ms-excel'); -header('Content-Disposition: attachment;filename="myfile.xls"'); -header('Cache-Control: max-age=0'); - -$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls'); -$writer->save('php://output'); -``` - -**Caution:** - -Make sure not to include any echo statements or output any other -contents than the Excel file. There should be no whitespace before the -opening `` -tag (which can also be omitted to avoid problems). Make sure that your -script is saved without a BOM (Byte-order mark) because this counts as -echoing output. The same things apply to all included files. Failing to -follow the above guidelines may result in corrupt Excel files arriving -at the client browser, and/or that headers cannot be set by PHP -(resulting in warning messages). - -## Setting the default column width - -Default column width can be set using the following code: - -``` php -$spreadsheet->getActiveSheet()->getDefaultColumnDimension()->setWidth(12); -``` - -## Setting the default row height - -Default row height can be set using the following code: - -``` php -$spreadsheet->getActiveSheet()->getDefaultRowDimension()->setRowHeight(15); -``` - -## Add a GD drawing to a worksheet - -There might be a situation where you want to generate an in-memory image -using GD and add it to a `Spreadsheet` without first having to save this -file to a temporary location. - -Here''s an example which generates an image in memory and adds it to the -active worksheet: - -``` php -// Generate an image -$gdImage = @imagecreatetruecolor(120, 20) or die('Cannot Initialize new GD image stream'); -$textColor = imagecolorallocate($gdImage, 255, 255, 255); -imagestring($gdImage, 1, 5, 5, 'Created with PhpSpreadsheet', $textColor); - -// Add a drawing to the worksheet -$drawing = new \PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing(); -$drawing->setName('Sample image'); -$drawing->setDescription('Sample image'); -$drawing->setImageResource($gdImage); -$drawing->setRenderingFunction(\PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::RENDERING_JPEG); -$drawing->setMimeType(\PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::MIMETYPE_DEFAULT); -$drawing->setHeight(36); -$drawing->setWorksheet($spreadsheet->getActiveSheet()); -``` - -## Setting worksheet zoom level - -To set a worksheet's zoom level, the following code can be used: - -``` php -$spreadsheet->getActiveSheet()->getSheetView()->setZoomScale(75); -``` - -Note that zoom level should be in range 10 - 400. - -## Sheet tab color - -Sometimes you want to set a color for sheet tab. For example you can -have a red sheet tab: - -``` php -$worksheet->getTabColor()->setRGB('FF0000'); -``` - -## Creating worksheets in a workbook - -If you need to create more worksheets in the workbook, here is how: - -``` php -$worksheet1 = $spreadsheet->createSheet(); -$worksheet1->setTitle('Another sheet'); -``` - -Think of `createSheet()` as the "Insert sheet" button in Excel. When you -hit that button a new sheet is appended to the existing collection of -worksheets in the workbook. - -## Hidden worksheets (Sheet states) - -Set a worksheet to be **hidden** using this code: - -``` php -$spreadsheet->getActiveSheet() - ->setSheetState(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_HIDDEN); -``` - -Sometimes you may even want the worksheet to be **"very hidden"**. The -available sheet states are : - -- `\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_VISIBLE` -- `\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_HIDDEN` -- `\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_VERYHIDDEN` - -In Excel the sheet state "very hidden" can only be set programmatically, -e.g. with Visual Basic Macro. It is not possible to make such a sheet -visible via the user interface. - -## Right-to-left worksheet - -Worksheets can be set individually whether column `A` should start at -left or right side. Default is left. Here is how to set columns from -right-to-left. - -``` php -// right-to-left worksheet -$spreadsheet->getActiveSheet()->setRightToLeft(true); -``` diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/settings.md b/vendor/phpoffice/phpspreadsheet/docs/topics/settings.md deleted file mode 100644 index a9aae9f9..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/topics/settings.md +++ /dev/null @@ -1,45 +0,0 @@ -# Configuration Settings - -Once you have included the PhpSpreadsheet files in your script, but -before instantiating a `Spreadsheet` object or loading a workbook file, -there are a number of configuration options that can be set which will -affect the subsequent behaviour of the script. - -## Cell collection caching - -By default, PhpSpreadsheet holds all cell objects in memory, but -you can specify alternatives to reduce memory consumption at the cost of speed. -Read more about [memory saving](./memory_saving.md). - -To enable cell caching, you must provide your own implementation of cache like so: - -``` php -$cache = new MyCustomPsr16Implementation(); - -\PhpOffice\PhpSpreadsheet\Settings::setCache($cache); -``` - -## Language/Locale - -Some localisation elements have been included in PhpSpreadsheet. You can -set a locale by changing the settings. To set the locale to Brazilian -Portuguese you would use: - -``` php -$locale = 'pt_br'; -$validLocale = \PhpOffice\PhpSpreadsheet\Settings::setLocale($locale); -if (!$validLocale) { - echo 'Unable to set locale to ' . $locale . " - reverting to en_us" . PHP_EOL; -} -``` - -- If Brazilian Portuguese language files aren't available, then Portuguese -will be enabled instead -- If Portuguese language files aren't available, -then the `setLocale()` method will return an error, and American English -(en\_us) settings will be used throughout. - -More details of the features available once a locale has been set, -including a list of the languages and locales currently supported, can -be found in [Locale Settings for -Formulae](./recipes.md#locale-settings-for-formulae). diff --git a/vendor/phpoffice/phpspreadsheet/docs/topics/worksheets.md b/vendor/phpoffice/phpspreadsheet/docs/topics/worksheets.md deleted file mode 100644 index f97a0066..00000000 --- a/vendor/phpoffice/phpspreadsheet/docs/topics/worksheets.md +++ /dev/null @@ -1,128 +0,0 @@ -# Worksheets - -A worksheet is a collection of cells, formulae, images, graphs, etc. It -holds all data necessary to represent a spreadsheet worksheet. - -When you load a workbook from a spreadsheet file, it will be loaded with -all its existing worksheets (unless you specified that only certain -sheets should be loaded). When you load from non-spreadsheet files (such -as a CSV or HTML file) or from spreadsheet formats that don't identify -worksheets by name (such as SYLK), then a single worksheet called -"WorkSheet1" will be created containing the data from that file. - -When you instantiate a new workbook, PhpSpreadsheet will create it with -a single worksheet called "WorkSheet1". - -The `getSheetCount()` method will tell you the number of worksheets in -the workbook; while the `getSheetNames()` method will return a list of -all worksheets in the workbook, indexed by the order in which their -"tabs" would appear when opened in MS Excel (or other appropriate -Spreadsheet program). - -Individual worksheets can be accessed by name, or by their index -position in the workbook. The index position represents the order that -each worksheet "tab" is shown when the workbook is opened in MS Excel -(or other appropriate Spreadsheet program). To access a sheet by its -index, use the `getSheet()` method. - -``` php -// Get the second sheet in the workbook -// Note that sheets are indexed from 0 -$spreadsheet->getSheet(1); -``` - - -Methods also exist allowing you to reorder the worksheets in the -workbook. - -To access a sheet by name, use the `getSheetByName()` method, specifying -the name of the worksheet that you want to access. - -``` php -// Retrieve the worksheet called 'Worksheet 1' -$spreadsheet->getSheetByName('Worksheet 1'); -``` - -Alternatively, one worksheet is always the currently active worksheet, -and you can access that directly. The currently active worksheet is the -one that will be active when the workbook is opened in MS Excel (or -other appropriate Spreadsheet program). - -``` php -// Retrieve the current active worksheet -$spreadsheet->getActiveSheet(); -``` - -You can change the currently active sheet by index or by name using the -`setActiveSheetIndex()` and `setActiveSheetIndexByName()` methods. - -## Adding a new Worksheet - -You can add a new worksheet to the workbook using the `createSheet()` -method of the `Spreadsheet` object. By default, this will be created as -a new "last" sheet; but you can also specify an index position as an -argument, and the worksheet will be inserted at that position, shuffling -all subsequent worksheets in the collection down a place. - -``` php -$spreadsheet->createSheet(); -``` - -A new worksheet created using this method will be called -`Worksheet` where `` is the lowest number possible to -guarantee that the title is unique. - -Alternatively, you can instantiate a new worksheet (setting the title to -whatever you choose) and then insert it into your workbook using the -`addSheet()` method. - -``` php -// Create a new worksheet called "My Data" -$myWorkSheet = new \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet($spreadsheet, 'My Data'); - -// Attach the "My Data" worksheet as the first worksheet in the Spreadsheet object -$spreadsheet->addSheet($myWorkSheet, 0); -``` - -If you don't specify an index position as the second argument, then the -new worksheet will be added after the last existing worksheet. - -## Copying Worksheets - -Sheets within the same workbook can be copied by creating a clone of the -worksheet you wish to copy, and then using the `addSheet()` method to -insert the clone into the workbook. - -``` php -$clonedWorksheet = clone $spreadsheet->getSheetByName('Worksheet 1'); -$clonedWorksheet->setTitle('Copy of Worksheet 1'); -$spreadsheet->addSheet($clonedWorksheet); -``` - -You can also copy worksheets from one workbook to another, though this -is more complex as PhpSpreadsheet also has to replicate the styling -between the two workbooks. The `addExternalSheet()` method is provided for -this purpose. - - $clonedWorksheet = clone $spreadsheet1->getSheetByName('Worksheet 1'); - $spreadsheet->addExternalSheet($clonedWorksheet); - -In both cases, it is the developer's responsibility to ensure that -worksheet names are not duplicated. PhpSpreadsheet will throw an -exception if you attempt to copy worksheets that will result in a -duplicate name. - -## Removing a Worksheet - -You can delete a worksheet from a workbook, identified by its index -position, using the `removeSheetByIndex()` method - -``` php -$sheetIndex = $spreadsheet->getIndex( - $spreadsheet->getSheetByName('Worksheet 1') -); -$spreadsheet->removeSheetByIndex($sheetIndex); -``` - -If the currently active worksheet is deleted, then the sheet at the -previous index position will become the currently active sheet. diff --git a/vendor/phpoffice/phpspreadsheet/mkdocs.yml b/vendor/phpoffice/phpspreadsheet/mkdocs.yml deleted file mode 100644 index 1a224f5c..00000000 --- a/vendor/phpoffice/phpspreadsheet/mkdocs.yml +++ /dev/null @@ -1,7 +0,0 @@ -site_name: PhpSpreadsheet Documentation -repo_url: https://github.com/PHPOffice/phpspreadsheet -edit_uri: edit/develop/docs/ - -theme: readthedocs -extra_css: - - extra/extra.css diff --git a/vendor/phpoffice/phpspreadsheet/phpunit.xml.dist b/vendor/phpoffice/phpspreadsheet/phpunit.xml.dist deleted file mode 100644 index 6880d23e..00000000 --- a/vendor/phpoffice/phpspreadsheet/phpunit.xml.dist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - ./tests/PhpSpreadsheetTests - - - - ./src - - ./src/PhpSpreadsheet/Shared/JAMA - ./src/PhpSpreadsheet/Writer/PDF - - - - diff --git a/vendor/phpoffice/phpspreadsheet/samples/Autofilter/10_Autofilter.php b/vendor/phpoffice/phpspreadsheet/samples/Autofilter/10_Autofilter.php deleted file mode 100644 index db9de54a..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Autofilter/10_Autofilter.php +++ /dev/null @@ -1,101 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PhpSpreadsheet Test Document') - ->setSubject('PhpSpreadsheet Test Document') - ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') - ->setKeywords('office PhpSpreadsheet php') - ->setCategory('Test result file'); - -// Create the worksheet -$helper->log('Add data'); -$spreadsheet->setActiveSheetIndex(0); -$spreadsheet->getActiveSheet()->setCellValue('A1', 'Year') - ->setCellValue('B1', 'Quarter') - ->setCellValue('C1', 'Country') - ->setCellValue('D1', 'Sales'); - -$dataArray = [ - ['2010', 'Q1', 'United States', 790], - ['2010', 'Q2', 'United States', 730], - ['2010', 'Q3', 'United States', 860], - ['2010', 'Q4', 'United States', 850], - ['2011', 'Q1', 'United States', 800], - ['2011', 'Q2', 'United States', 700], - ['2011', 'Q3', 'United States', 900], - ['2011', 'Q4', 'United States', 950], - ['2010', 'Q1', 'Belgium', 380], - ['2010', 'Q2', 'Belgium', 390], - ['2010', 'Q3', 'Belgium', 420], - ['2010', 'Q4', 'Belgium', 460], - ['2011', 'Q1', 'Belgium', 400], - ['2011', 'Q2', 'Belgium', 350], - ['2011', 'Q3', 'Belgium', 450], - ['2011', 'Q4', 'Belgium', 500], - ['2010', 'Q1', 'UK', 690], - ['2010', 'Q2', 'UK', 610], - ['2010', 'Q3', 'UK', 620], - ['2010', 'Q4', 'UK', 600], - ['2011', 'Q1', 'UK', 720], - ['2011', 'Q2', 'UK', 650], - ['2011', 'Q3', 'UK', 580], - ['2011', 'Q4', 'UK', 510], - ['2010', 'Q1', 'France', 510], - ['2010', 'Q2', 'France', 490], - ['2010', 'Q3', 'France', 460], - ['2010', 'Q4', 'France', 590], - ['2011', 'Q1', 'France', 620], - ['2011', 'Q2', 'France', 650], - ['2011', 'Q3', 'France', 415], - ['2011', 'Q4', 'France', 570], - ['2010', 'Q1', 'Germany', 720], - ['2010', 'Q2', 'Germany', 680], - ['2010', 'Q3', 'Germany', 640], - ['2010', 'Q4', 'Germany', 660], - ['2011', 'Q1', 'Germany', 680], - ['2011', 'Q2', 'Germany', 620], - ['2011', 'Q3', 'Germany', 710], - ['2011', 'Q4', 'Germany', 690], - ['2010', 'Q1', 'Spain', 510], - ['2010', 'Q2', 'Spain', 490], - ['2010', 'Q3', 'Spain', 470], - ['2010', 'Q4', 'Spain', 420], - ['2011', 'Q1', 'Spain', 460], - ['2011', 'Q2', 'Spain', 390], - ['2011', 'Q3', 'Spain', 430], - ['2011', 'Q4', 'Spain', 415], - ['2010', 'Q1', 'Italy', 440], - ['2010', 'Q2', 'Italy', 410], - ['2010', 'Q3', 'Italy', 420], - ['2010', 'Q4', 'Italy', 450], - ['2011', 'Q1', 'Italy', 430], - ['2011', 'Q2', 'Italy', 370], - ['2011', 'Q3', 'Italy', 350], - ['2011', 'Q4', 'Italy', 335], -]; -$spreadsheet->getActiveSheet()->fromArray($dataArray, null, 'A2'); - -// Set title row bold -$helper->log('Set title row bold'); -$spreadsheet->getActiveSheet()->getStyle('A1:D1')->getFont()->setBold(true); - -// Set autofilter -$helper->log('Set autofilter'); -// Always include the complete filter range! -// Excel does support setting only the caption -// row, but that's not a best practise... -$spreadsheet->getActiveSheet()->setAutoFilter($spreadsheet->getActiveSheet()->calculateWorksheetDimension()); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Autofilter/10_Autofilter_selection_1.php b/vendor/phpoffice/phpspreadsheet/samples/Autofilter/10_Autofilter_selection_1.php deleted file mode 100644 index 30efc194..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Autofilter/10_Autofilter_selection_1.php +++ /dev/null @@ -1,156 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PhpSpreadsheet Test Document') - ->setSubject('PhpSpreadsheet Test Document') - ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') - ->setKeywords('office PhpSpreadsheet php') - ->setCategory('Test result file'); - -// Create the worksheet -$helper->log('Add data'); -$spreadsheet->setActiveSheetIndex(0); -$spreadsheet->getActiveSheet()->setCellValue('A1', 'Financial Year') - ->setCellValue('B1', 'Financial Period') - ->setCellValue('C1', 'Country') - ->setCellValue('D1', 'Date') - ->setCellValue('E1', 'Sales Value') - ->setCellValue('F1', 'Expenditure'); -$startYear = $endYear = $currentYear = date('Y'); ---$startYear; -++$endYear; - -$years = range($startYear, $endYear); -$periods = range(1, 12); -$countries = [ - 'United States', - 'UK', - 'France', - 'Germany', - 'Italy', - 'Spain', - 'Portugal', - 'Japan', -]; - -$row = 2; -foreach ($years as $year) { - foreach ($periods as $period) { - foreach ($countries as $country) { - $endDays = date('t', mktime(0, 0, 0, $period, 1, $year)); - for ($i = 1; $i <= $endDays; ++$i) { - $eDate = Date::formattedPHPToExcel( - $year, - $period, - $i - ); - $value = rand(500, 1000) * (1 + rand(-0.25, +0.25)); - $salesValue = $invoiceValue = null; - $incomeOrExpenditure = rand(-1, 1); - if ($incomeOrExpenditure == -1) { - $expenditure = rand(-500, -1000) * (1 + rand(-0.25, +0.25)); - $income = null; - } elseif ($incomeOrExpenditure == 1) { - $expenditure = rand(-500, -1000) * (1 + rand(-0.25, +0.25)); - $income = rand(500, 1000) * (1 + rand(-0.25, +0.25)); - } else { - $expenditure = null; - $income = rand(500, 1000) * (1 + rand(-0.25, +0.25)); - } - $dataArray = [$year, - $period, - $country, - $eDate, - $income, - $expenditure, - ]; - $spreadsheet->getActiveSheet()->fromArray($dataArray, null, 'A' . $row++); - } - } - } -} ---$row; - -// Set styling -$helper->log('Set styling'); -$spreadsheet->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true); -$spreadsheet->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(true); -$spreadsheet->getActiveSheet()->getColumnDimension('C')->setWidth(12.5); -$spreadsheet->getActiveSheet()->getColumnDimension('D')->setWidth(10.5); -$spreadsheet->getActiveSheet()->getStyle('D2:D' . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_DATE_YYYYMMDD2); -$spreadsheet->getActiveSheet()->getStyle('E2:F' . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_USD_SIMPLE); -$spreadsheet->getActiveSheet()->getColumnDimension('F')->setWidth(14); -$spreadsheet->getActiveSheet()->freezePane('A2'); - -// Set autofilter range -$helper->log('Set autofilter range'); -// Always include the complete filter range! -// Excel does support setting only the caption -// row, but that's not a best practise... -$spreadsheet->getActiveSheet()->setAutoFilter($spreadsheet->getActiveSheet()->calculateWorksheetDimension()); - -// Set active filters -$autoFilter = $spreadsheet->getActiveSheet()->getAutoFilter(); -$helper->log('Set active filters'); -// Filter the Country column on a filter value of countries beginning with the letter U (or Japan) -// We use * as a wildcard, so specify as U* and using a wildcard requires customFilter -$autoFilter->getColumn('C') - ->setFilterType(Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - 'u*' - ) - ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); -$autoFilter->getColumn('C') - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - 'japan' - ) - ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); -// Filter the Date column on a filter value of the first day of every period of the current year -// We us a dateGroup ruletype for this, although it is still a standard filter -foreach ($periods as $period) { - $endDate = date('t', mktime(0, 0, 0, $period, 1, $currentYear)); - - $autoFilter->getColumn('D') - ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - [ - 'year' => $currentYear, - 'month' => $period, - 'day' => $endDate, - ] - ) - ->setRuleType(Rule::AUTOFILTER_RULETYPE_DATEGROUP); -} -// Display only sales values that are blank -// Standard filter, operator equals, and value of NULL -$autoFilter->getColumn('E') - ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - '' - ); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Autofilter/10_Autofilter_selection_2.php b/vendor/phpoffice/phpspreadsheet/samples/Autofilter/10_Autofilter_selection_2.php deleted file mode 100644 index 1520c972..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Autofilter/10_Autofilter_selection_2.php +++ /dev/null @@ -1,148 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PhpSpreadsheet Test Document') - ->setSubject('PhpSpreadsheet Test Document') - ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') - ->setKeywords('office PhpSpreadsheet php') - ->setCategory('Test result file'); - -// Create the worksheet -$helper->log('Add data'); -$spreadsheet->setActiveSheetIndex(0); -$spreadsheet->getActiveSheet()->setCellValue('A1', 'Financial Year') - ->setCellValue('B1', 'Financial Period') - ->setCellValue('C1', 'Country') - ->setCellValue('D1', 'Date') - ->setCellValue('E1', 'Sales Value') - ->setCellValue('F1', 'Expenditure'); -$startYear = $endYear = $currentYear = date('Y'); ---$startYear; -++$endYear; - -$years = range($startYear, $endYear); -$periods = range(1, 12); -$countries = [ - 'United States', - 'UK', - 'France', - 'Germany', - 'Italy', - 'Spain', - 'Portugal', - 'Japan', -]; - -$row = 2; -foreach ($years as $year) { - foreach ($periods as $period) { - foreach ($countries as $country) { - $endDays = date('t', mktime(0, 0, 0, $period, 1, $year)); - for ($i = 1; $i <= $endDays; ++$i) { - $eDate = Date::formattedPHPToExcel( - $year, - $period, - $i - ); - $value = rand(500, 1000) * (1 + rand(-0.25, +0.25)); - $salesValue = $invoiceValue = null; - $incomeOrExpenditure = rand(-1, 1); - if ($incomeOrExpenditure == -1) { - $expenditure = rand(-500, -1000) * (1 + rand(-0.25, +0.25)); - $income = null; - } elseif ($incomeOrExpenditure == 1) { - $expenditure = rand(-500, -1000) * (1 + rand(-0.25, +0.25)); - $income = rand(500, 1000) * (1 + rand(-0.25, +0.25)); - } else { - $expenditure = null; - $income = rand(500, 1000) * (1 + rand(-0.25, +0.25)); - } - $dataArray = [$year, - $period, - $country, - $eDate, - $income, - $expenditure, - ]; - $spreadsheet->getActiveSheet()->fromArray($dataArray, null, 'A' . $row++); - } - } - } -} ---$row; - -// Set styling -$helper->log('Set styling'); -$spreadsheet->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true); -$spreadsheet->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(true); -$spreadsheet->getActiveSheet()->getColumnDimension('C')->setWidth(12.5); -$spreadsheet->getActiveSheet()->getColumnDimension('D')->setWidth(10.5); -$spreadsheet->getActiveSheet()->getStyle('D2:D' . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_DATE_YYYYMMDD2); -$spreadsheet->getActiveSheet()->getStyle('E2:F' . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_USD_SIMPLE); -$spreadsheet->getActiveSheet()->getColumnDimension('F')->setWidth(14); -$spreadsheet->getActiveSheet()->freezePane('A2'); - -// Set autofilter range -$helper->log('Set autofilter range'); -// Always include the complete filter range! -// Excel does support setting only the caption -// row, but that's not a best practise... -$spreadsheet->getActiveSheet()->setAutoFilter($spreadsheet->getActiveSheet()->calculateWorksheetDimension()); - -// Set active filters -$autoFilter = $spreadsheet->getActiveSheet()->getAutoFilter(); -$helper->log('Set active filters'); -// Filter the Country column on a filter value of Germany -// As it's just a simple value filter, we can use FILTERTYPE_FILTER -$autoFilter->getColumn('C') - ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - 'Germany' - ); -// Filter the Date column on a filter value of the year to date -$autoFilter->getColumn('D') - ->setFilterType(Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - null, - Rule::AUTOFILTER_RULETYPE_DYNAMIC_YEARTODATE - ) - ->setRuleType(Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER); -// Display only sales values that are between 400 and 600 -$autoFilter->getColumn('E') - ->setFilterType(Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL, - 400 - ) - ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); -$autoFilter->getColumn('E') - ->setJoin(Column::AUTOFILTER_COLUMN_JOIN_AND) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL, - 600 - ) - ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Autofilter/10_Autofilter_selection_display.php b/vendor/phpoffice/phpspreadsheet/samples/Autofilter/10_Autofilter_selection_display.php deleted file mode 100644 index 50986bfa..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Autofilter/10_Autofilter_selection_display.php +++ /dev/null @@ -1,170 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PhpSpreadsheet Test Document') - ->setSubject('PhpSpreadsheet Test Document') - ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') - ->setKeywords('office PhpSpreadsheet php') - ->setCategory('Test result file'); - -// Create the worksheet -$helper->log('Add data'); -$spreadsheet->setActiveSheetIndex(0); -$spreadsheet->getActiveSheet()->setCellValue('A1', 'Financial Year') - ->setCellValue('B1', 'Financial Period') - ->setCellValue('C1', 'Country') - ->setCellValue('D1', 'Date') - ->setCellValue('E1', 'Sales Value') - ->setCellValue('F1', 'Expenditure'); -$startYear = $endYear = $currentYear = date('Y'); ---$startYear; -++$endYear; - -$years = range($startYear, $endYear); -$periods = range(1, 12); -$countries = [ - 'United States', - 'UK', - 'France', - 'Germany', - 'Italy', - 'Spain', - 'Portugal', - 'Japan', -]; - -$row = 2; -foreach ($years as $year) { - foreach ($periods as $period) { - foreach ($countries as $country) { - $endDays = date('t', mktime(0, 0, 0, $period, 1, $year)); - for ($i = 1; $i <= $endDays; ++$i) { - $eDate = Date::formattedPHPToExcel( - $year, - $period, - $i - ); - $value = rand(500, 1000) * (1 + rand(-0.25, +0.25)); - $salesValue = $invoiceValue = null; - $incomeOrExpenditure = rand(-1, 1); - if ($incomeOrExpenditure == -1) { - $expenditure = rand(-500, -1000) * (1 + rand(-0.25, +0.25)); - $income = null; - } elseif ($incomeOrExpenditure == 1) { - $expenditure = rand(-500, -1000) * (1 + rand(-0.25, +0.25)); - $income = rand(500, 1000) * (1 + rand(-0.25, +0.25)); - } else { - $expenditure = null; - $income = rand(500, 1000) * (1 + rand(-0.25, +0.25)); - } - $dataArray = [$year, - $period, - $country, - $eDate, - $income, - $expenditure, - ]; - $spreadsheet->getActiveSheet()->fromArray($dataArray, null, 'A' . $row++); - } - } - } -} ---$row; - -// Set styling -$helper->log('Set styling'); -$spreadsheet->getActiveSheet()->getStyle('A1:F1')->getFont()->setBold(true); -$spreadsheet->getActiveSheet()->getStyle('A1:F1')->getAlignment()->setWrapText(true); -$spreadsheet->getActiveSheet()->getColumnDimension('C')->setWidth(12.5); -$spreadsheet->getActiveSheet()->getColumnDimension('D')->setWidth(10.5); -$spreadsheet->getActiveSheet()->getStyle('D2:D' . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_DATE_YYYYMMDD2); -$spreadsheet->getActiveSheet()->getStyle('E2:F' . $row)->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_USD_SIMPLE); -$spreadsheet->getActiveSheet()->getColumnDimension('F')->setWidth(14); -$spreadsheet->getActiveSheet()->freezePane('A2'); - -// Set autofilter range -$helper->log('Set autofilter range'); -// Always include the complete filter range! -// Excel does support setting only the caption -// row, but that's not a best practise... -$spreadsheet->getActiveSheet()->setAutoFilter($spreadsheet->getActiveSheet()->calculateWorksheetDimension()); - -// Set active filters -$autoFilter = $spreadsheet->getActiveSheet()->getAutoFilter(); -$helper->log('Set active filters'); -// Filter the Country column on a filter value of countries beginning with the letter U (or Japan) -// We use * as a wildcard, so specify as U* and using a wildcard requires customFilter -$autoFilter->getColumn('C') - ->setFilterType(Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - 'u*' - ) - ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); -$autoFilter->getColumn('C') - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - 'japan' - ) - ->setRuleType(Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER); -// Filter the Date column on a filter value of the first day of every period of the current year -// We us a dateGroup ruletype for this, although it is still a standard filter -foreach ($periods as $period) { - $endDate = date('t', mktime(0, 0, 0, $period, 1, $currentYear)); - - $autoFilter->getColumn('D') - ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - [ - 'year' => $currentYear, - 'month' => $period, - 'day' => $endDate, - ] - ) - ->setRuleType(Rule::AUTOFILTER_RULETYPE_DATEGROUP); -} -// Display only sales values that are blank -// Standard filter, operator equals, and value of NULL -$autoFilter->getColumn('E') - ->setFilterType(Column::AUTOFILTER_FILTERTYPE_FILTER) - ->createRule() - ->setRule( - Rule::AUTOFILTER_COLUMN_RULE_EQUAL, - '' - ); - -// Execute filtering -$helper->log('Execute filtering'); -$autoFilter->showHideRows(); - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$spreadsheet->setActiveSheetIndex(0); - -// Display Results of filtering -$helper->log('Display filtered rows'); -foreach ($spreadsheet->getActiveSheet()->getRowIterator() as $row) { - if ($spreadsheet->getActiveSheet()->getRowDimension($row->getRowIndex())->getVisible()) { - $helper->log(' Row number - ' . $row->getRowIndex()); - $helper->log($spreadsheet->getActiveSheet()->getCell('C' . $row->getRowIndex())->getValue()); - $helper->log($spreadsheet->getActiveSheet()->getCell('D' . $row->getRowIndex())->getFormattedValue()); - } -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple.php deleted file mode 100644 index 89aca6d0..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple.php +++ /dev/null @@ -1,65 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties() - ->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PhpSpreadsheet Test Document') - ->setSubject('PhpSpreadsheet Test Document') - ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') - ->setKeywords('office PhpSpreadsheet php') - ->setCategory('Test result file'); - -// Add some data -$helper->log('Add some data'); -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!') - ->setCellValue('C1', 'Hello') - ->setCellValue('D2', 'world!'); - -// Miscellaneous glyphs, UTF-8 -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A4', 'Miscellaneous glyphs') - ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); - -$spreadsheet->getActiveSheet() - ->setCellValue('A8', "Hello\nWorld"); -$spreadsheet->getActiveSheet() - ->getRowDimension(8) - ->setRowHeight(-1); -$spreadsheet->getActiveSheet() - ->getStyle('A8') - ->getAlignment() - ->setWrapText(true); - -$value = "-ValueA\n-Value B\n-Value C"; -$spreadsheet->getActiveSheet() - ->setCellValue('A10', $value); -$spreadsheet->getActiveSheet() - ->getRowDimension(10) - ->setRowHeight(-1); -$spreadsheet->getActiveSheet() - ->getStyle('A10') - ->getAlignment() - ->setWrapText(true); -$spreadsheet->getActiveSheet() - ->getStyle('A10') - ->setQuotePrefix(true); - -// Rename worksheet -$helper->log('Rename worksheet'); -$spreadsheet->getActiveSheet() - ->setTitle('Simple'); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple_download_ods.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple_download_ods.php deleted file mode 100644 index 0c38a004..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple_download_ods.php +++ /dev/null @@ -1,61 +0,0 @@ -isCli()) { - $helper->log('This example should only be run from a Web Browser' . PHP_EOL); - - return; -} - -// Create new Spreadsheet object -$spreadsheet = new Spreadsheet(); - -// Set document properties -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Add some data -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!') - ->setCellValue('C1', 'Hello') - ->setCellValue('D2', 'world!'); - -// Miscellaneous glyphs, UTF-8 -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A4', 'Miscellaneous glyphs') - ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); - -// Rename worksheet -$spreadsheet->getActiveSheet()->setTitle('Simple'); - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$spreadsheet->setActiveSheetIndex(0); - -// Redirect output to a client’s web browser (Ods) -header('Content-Type: application/vnd.oasis.opendocument.spreadsheet'); -header('Content-Disposition: attachment;filename="01simple.ods"'); -header('Cache-Control: max-age=0'); -// If you're serving to IE 9, then the following may be needed -header('Cache-Control: max-age=1'); - -// If you're serving to IE over SSL, then the following may be needed -header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past -header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified -header('Cache-Control: cache, must-revalidate'); // HTTP/1.1 -header('Pragma: public'); // HTTP/1.0 - -$writer = IOFactory::createWriter($spreadsheet, 'Ods'); -$writer->save('php://output'); -exit; diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple_download_pdf.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple_download_pdf.php deleted file mode 100644 index 5f3e71d7..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple_download_pdf.php +++ /dev/null @@ -1,56 +0,0 @@ -isCli()) { - $helper->log('This example should only be run from a Web Browser' . PHP_EOL); - - return; -} - -// Create new Spreadsheet object -$spreadsheet = new Spreadsheet(); - -// Set document properties -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PDF Test Document') - ->setSubject('PDF Test Document') - ->setDescription('Test document for PDF, generated using PHP classes.') - ->setKeywords('pdf php') - ->setCategory('Test result file'); - -// Add some data -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!') - ->setCellValue('C1', 'Hello') - ->setCellValue('D2', 'world!'); - -// Miscellaneous glyphs, UTF-8 -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A4', 'Miscellaneous glyphs') - ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); - -// Rename worksheet -$spreadsheet->getActiveSheet()->setTitle('Simple'); -$spreadsheet->getActiveSheet()->setShowGridLines(false); - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$spreadsheet->setActiveSheetIndex(0); - -IOFactory::registerWriter('Pdf', \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf::class); - -// Redirect output to a client’s web browser (PDF) -header('Content-Type: application/pdf'); -header('Content-Disposition: attachment;filename="01simple.pdf"'); -header('Cache-Control: max-age=0'); - -$writer = IOFactory::createWriter($spreadsheet, 'Pdf'); -$writer->save('php://output'); -exit; diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple_download_xls.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple_download_xls.php deleted file mode 100644 index 46d12022..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple_download_xls.php +++ /dev/null @@ -1,61 +0,0 @@ -isCli()) { - $helper->log('This example should only be run from a Web Browser' . PHP_EOL); - - return; -} - -// Create new Spreadsheet object -$spreadsheet = new Spreadsheet(); - -// Set document properties -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Add some data -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!') - ->setCellValue('C1', 'Hello') - ->setCellValue('D2', 'world!'); - -// Miscellaneous glyphs, UTF-8 -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A4', 'Miscellaneous glyphs') - ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); - -// Rename worksheet -$spreadsheet->getActiveSheet()->setTitle('Simple'); - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$spreadsheet->setActiveSheetIndex(0); - -// Redirect output to a client’s web browser (Xls) -header('Content-Type: application/vnd.ms-excel'); -header('Content-Disposition: attachment;filename="01simple.xls"'); -header('Cache-Control: max-age=0'); -// If you're serving to IE 9, then the following may be needed -header('Cache-Control: max-age=1'); - -// If you're serving to IE over SSL, then the following may be needed -header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past -header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified -header('Cache-Control: cache, must-revalidate'); // HTTP/1.1 -header('Pragma: public'); // HTTP/1.0 - -$writer = IOFactory::createWriter($spreadsheet, 'Xls'); -$writer->save('php://output'); -exit; diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple_download_xlsx.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple_download_xlsx.php deleted file mode 100644 index 93efe73d..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple_download_xlsx.php +++ /dev/null @@ -1,60 +0,0 @@ -isCli()) { - $helper->log('This example should only be run from a Web Browser' . PHP_EOL); - - return; -} -// Create new Spreadsheet object -$spreadsheet = new Spreadsheet(); - -// Set document properties -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Add some data -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!') - ->setCellValue('C1', 'Hello') - ->setCellValue('D2', 'world!'); - -// Miscellaneous glyphs, UTF-8 -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A4', 'Miscellaneous glyphs') - ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); - -// Rename worksheet -$spreadsheet->getActiveSheet()->setTitle('Simple'); - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$spreadsheet->setActiveSheetIndex(0); - -// Redirect output to a client’s web browser (Xlsx) -header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); -header('Content-Disposition: attachment;filename="01simple.xlsx"'); -header('Cache-Control: max-age=0'); -// If you're serving to IE 9, then the following may be needed -header('Cache-Control: max-age=1'); - -// If you're serving to IE over SSL, then the following may be needed -header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past -header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified -header('Cache-Control: cache, must-revalidate'); // HTTP/1.1 -header('Pragma: public'); // HTTP/1.0 - -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->save('php://output'); -exit; diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/02_Types.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/02_Types.php deleted file mode 100644 index 79f109f5..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/02_Types.php +++ /dev/null @@ -1,162 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties() - ->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Set default font -$helper->log('Set default font'); -$spreadsheet->getDefaultStyle() - ->getFont() - ->setName('Arial') - ->setSize(10); - -// Add some data, resembling some different data types -$helper->log('Add some data'); -$spreadsheet->getActiveSheet() - ->setCellValue('A1', 'String') - ->setCellValue('B1', 'Simple') - ->setCellValue('C1', 'PhpSpreadsheet'); - -$spreadsheet->getActiveSheet() - ->setCellValue('A2', 'String') - ->setCellValue('B2', 'Symbols') - ->setCellValue('C2', '!+&=()~§±æþ'); - -$spreadsheet->getActiveSheet() - ->setCellValue('A3', 'String') - ->setCellValue('B3', 'UTF-8') - ->setCellValue('C3', 'Создать MS Excel Книги из PHP скриптов'); - -$spreadsheet->getActiveSheet() - ->setCellValue('A4', 'Number') - ->setCellValue('B4', 'Integer') - ->setCellValue('C4', 12); - -$spreadsheet->getActiveSheet() - ->setCellValue('A5', 'Number') - ->setCellValue('B5', 'Float') - ->setCellValue('C5', 34.56); - -$spreadsheet->getActiveSheet() - ->setCellValue('A6', 'Number') - ->setCellValue('B6', 'Negative') - ->setCellValue('C6', -7.89); - -$spreadsheet->getActiveSheet() - ->setCellValue('A7', 'Boolean') - ->setCellValue('B7', 'True') - ->setCellValue('C7', true); - -$spreadsheet->getActiveSheet() - ->setCellValue('A8', 'Boolean') - ->setCellValue('B8', 'False') - ->setCellValue('C8', false); - -$dateTimeNow = time(); -$spreadsheet->getActiveSheet() - ->setCellValue('A9', 'Date/Time') - ->setCellValue('B9', 'Date') - ->setCellValue('C9', Date::PHPToExcel($dateTimeNow)); -$spreadsheet->getActiveSheet() - ->getStyle('C9') - ->getNumberFormat() - ->setFormatCode(NumberFormat::FORMAT_DATE_YYYYMMDD2); - -$spreadsheet->getActiveSheet() - ->setCellValue('A10', 'Date/Time') - ->setCellValue('B10', 'Time') - ->setCellValue('C10', Date::PHPToExcel($dateTimeNow)); -$spreadsheet->getActiveSheet() - ->getStyle('C10') - ->getNumberFormat() - ->setFormatCode(NumberFormat::FORMAT_DATE_TIME4); - -$spreadsheet->getActiveSheet() - ->setCellValue('A11', 'Date/Time') - ->setCellValue('B11', 'Date and Time') - ->setCellValue('C11', Date::PHPToExcel($dateTimeNow)); -$spreadsheet->getActiveSheet() - ->getStyle('C11') - ->getNumberFormat() - ->setFormatCode(NumberFormat::FORMAT_DATE_DATETIME); - -$spreadsheet->getActiveSheet() - ->setCellValue('A12', 'NULL') - ->setCellValue('C12', null); - -$richText = new RichText(); -$richText->createText('你好 '); - -$payable = $richText->createTextRun('你 好 吗?'); -$payable->getFont()->setBold(true); -$payable->getFont()->setItalic(true); -$payable->getFont()->setColor(new Color(Color::COLOR_DARKGREEN)); - -$richText->createText(', unless specified otherwise on the invoice.'); - -$spreadsheet->getActiveSheet() - ->setCellValue('A13', 'Rich Text') - ->setCellValue('C13', $richText); - -$richText2 = new RichText(); -$richText2->createText("black text\n"); - -$red = $richText2->createTextRun('red text'); -$red->getFont()->setColor(new Color(Color::COLOR_RED)); - -$spreadsheet->getActiveSheet() - ->getCell('C14') - ->setValue($richText2); -$spreadsheet->getActiveSheet() - ->getStyle('C14') - ->getAlignment()->setWrapText(true); - -$spreadsheet->getActiveSheet()->setCellValue('A17', 'Hyperlink'); - -$spreadsheet->getActiveSheet() - ->setCellValue('C17', 'PhpSpreadsheet Web Site'); -$spreadsheet->getActiveSheet() - ->getCell('C17') - ->getHyperlink() - ->setUrl('https://github.com/PHPOffice/PhpSpreadsheet') - ->setTooltip('Navigate to PhpSpreadsheet website'); - -$spreadsheet->getActiveSheet() - ->setCellValue('C18', '=HYPERLINK("mailto:abc@def.com","abc@def.com")'); - -$spreadsheet->getActiveSheet() - ->getColumnDimension('B') - ->setAutoSize(true); -$spreadsheet->getActiveSheet() - ->getColumnDimension('C') - ->setAutoSize(true); - -// Rename worksheet -$helper->log('Rename worksheet'); -$spreadsheet->getActiveSheet()->setTitle('Datatypes'); - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$spreadsheet->setActiveSheetIndex(0); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/03_Formulas.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/03_Formulas.php deleted file mode 100644 index e4538231..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/03_Formulas.php +++ /dev/null @@ -1,81 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Add some data, we will use some formulas here -$helper->log('Add some data'); -$spreadsheet->getActiveSheet() - ->setCellValue('A5', 'Sum:'); - -$spreadsheet->getActiveSheet()->setCellValue('B1', 'Range #1') - ->setCellValue('B2', 3) - ->setCellValue('B3', 7) - ->setCellValue('B4', 13) - ->setCellValue('B5', '=SUM(B2:B4)'); -$helper->log('Sum of Range #1 is ' . $spreadsheet->getActiveSheet()->getCell('B5')->getCalculatedValue()); - -$spreadsheet->getActiveSheet()->setCellValue('C1', 'Range #2') - ->setCellValue('C2', 5) - ->setCellValue('C3', 11) - ->setCellValue('C4', 17) - ->setCellValue('C5', '=SUM(C2:C4)'); -$helper->log('Sum of Range #2 is ' . $spreadsheet->getActiveSheet()->getCell('C5')->getCalculatedValue()); - -$spreadsheet->getActiveSheet() - ->setCellValue('A7', 'Total of both ranges:'); -$spreadsheet->getActiveSheet() - ->setCellValue('B7', '=SUM(B5:C5)'); -$helper->log('Sum of both Ranges is ' . $spreadsheet->getActiveSheet()->getCell('B7')->getCalculatedValue()); - -$spreadsheet->getActiveSheet() - ->setCellValue('A8', 'Minimum of both ranges:'); -$spreadsheet->getActiveSheet() - ->setCellValue('B8', '=MIN(B2:C4)'); -$helper->log('Minimum value in either Range is ' . $spreadsheet->getActiveSheet()->getCell('B8')->getCalculatedValue()); - -$spreadsheet->getActiveSheet() - ->setCellValue('A9', 'Maximum of both ranges:'); -$spreadsheet->getActiveSheet() - ->setCellValue('B9', '=MAX(B2:C4)'); -$helper->log('Maximum value in either Range is ' . $spreadsheet->getActiveSheet()->getCell('B9')->getCalculatedValue()); - -$spreadsheet->getActiveSheet() - ->setCellValue('A10', 'Average of both ranges:'); -$spreadsheet->getActiveSheet() - ->setCellValue('B10', '=AVERAGE(B2:C4)'); -$helper->log('Average value of both Ranges is ' . $spreadsheet->getActiveSheet()->getCell('B10')->getCalculatedValue()); -$spreadsheet->getActiveSheet() - ->getColumnDimension('A') - ->setAutoSize(true); - -// Rename worksheet -$helper->log('Rename worksheet'); -$spreadsheet->getActiveSheet() - ->setTitle('Formulas'); - -// -// If we set Pre Calculated Formulas to true then PhpSpreadsheet will calculate all formulae in the -// workbook before saving. This adds time and memory overhead, and can cause some problems with formulae -// using functions or features (such as array formulae) that aren't yet supported by the calculation engine -// If the value is false (the default) for the Xlsx Writer, then MS Excel (or the application used to -// open the file) will need to recalculate values itself to guarantee that the correct results are available. -// -//$writer->setPreCalculateFormulas(true); -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/04_Printing.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/04_Printing.php deleted file mode 100644 index 5e90fc91..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/04_Printing.php +++ /dev/null @@ -1,64 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Add some data, we will use printing features -$helper->log('Add some data'); -for ($i = 1; $i < 200; ++$i) { - $spreadsheet->getActiveSheet()->setCellValue('A' . $i, $i); - $spreadsheet->getActiveSheet()->setCellValue('B' . $i, 'Test value'); -} - -// Set header and footer. When no different headers for odd/even are used, odd header is assumed. -$helper->log('Set header/footer'); -$spreadsheet->getActiveSheet() - ->getHeaderFooter() - ->setOddHeader('&L&G&C&HPlease treat this document as confidential!'); -$spreadsheet->getActiveSheet() - ->getHeaderFooter() - ->setOddFooter('&L&B' . $spreadsheet->getProperties()->getTitle() . '&RPage &P of &N'); - -// Add a drawing to the header -$helper->log('Add a drawing to the header'); -$drawing = new HeaderFooterDrawing(); -$drawing->setName('PhpSpreadsheet logo'); -$drawing->setPath(__DIR__ . '/../images/PhpSpreadsheet_logo.png'); -$drawing->setHeight(36); -$spreadsheet->getActiveSheet() - ->getHeaderFooter() - ->addImage($drawing, HeaderFooter::IMAGE_HEADER_LEFT); - -// Set page orientation and size -$helper->log('Set page orientation and size'); -$spreadsheet->getActiveSheet() - ->getPageSetup() - ->setOrientation(PageSetup::ORIENTATION_LANDSCAPE); -$spreadsheet->getActiveSheet() - ->getPageSetup() - ->setPaperSize(PageSetup::PAPERSIZE_A4); - -// Rename worksheet -$helper->log('Rename worksheet'); -$spreadsheet->getActiveSheet()->setTitle('Printing'); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/05_Feature_demo.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/05_Feature_demo.php deleted file mode 100644 index a85ebbc2..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/05_Feature_demo.php +++ /dev/null @@ -1,7 +0,0 @@ -write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/06_Largescale.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/06_Largescale.php deleted file mode 100644 index 2e8a3e67..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/06_Largescale.php +++ /dev/null @@ -1,8 +0,0 @@ -write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/07_Reader.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/07_Reader.php deleted file mode 100644 index 4d9bd79e..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/07_Reader.php +++ /dev/null @@ -1,19 +0,0 @@ -getTemporaryFilename(); -$writer = new Xlsx($sampleSpreadsheet); -$writer->save($filename); - -$callStartTime = microtime(true); -$spreadsheet = IOFactory::load($filename); -$helper->logRead('Xlsx', $filename, $callStartTime); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/08_Conditional_formatting.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/08_Conditional_formatting.php deleted file mode 100644 index 2f548632..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/08_Conditional_formatting.php +++ /dev/null @@ -1,115 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Create a first sheet, representing sales data -$helper->log('Add some data'); -$spreadsheet->setActiveSheetIndex(0); -$spreadsheet->getActiveSheet()->setCellValue('A1', 'Description') - ->setCellValue('B1', 'Amount'); - -$spreadsheet->getActiveSheet()->setCellValue('A2', 'Paycheck received') - ->setCellValue('B2', 100); - -$spreadsheet->getActiveSheet()->setCellValue('A3', 'Cup of coffee bought') - ->setCellValue('B3', -1.5); - -$spreadsheet->getActiveSheet()->setCellValue('A4', 'Cup of coffee bought') - ->setCellValue('B4', -1.5); - -$spreadsheet->getActiveSheet()->setCellValue('A5', 'Cup of tea bought') - ->setCellValue('B5', -1.2); - -$spreadsheet->getActiveSheet()->setCellValue('A6', 'Found some money') - ->setCellValue('B6', 8); - -$spreadsheet->getActiveSheet()->setCellValue('A7', 'Total:') - ->setCellValue('B7', '=SUM(B2:B6)'); - -// Set column widths -$helper->log('Set column widths'); -$spreadsheet->getActiveSheet()->getColumnDimension('A')->setWidth(30); -$spreadsheet->getActiveSheet()->getColumnDimension('B')->setWidth(12); - -// Add conditional formatting -$helper->log('Add conditional formatting'); -$conditional1 = new Conditional(); -$conditional1->setConditionType(Conditional::CONDITION_CELLIS) - ->setOperatorType(Conditional::OPERATOR_BETWEEN) - ->addCondition('200') - ->addCondition('400'); -$conditional1->getStyle()->getFont()->getColor()->setARGB(Color::COLOR_YELLOW); -$conditional1->getStyle()->getFont()->setBold(true); -$conditional1->getStyle()->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE); - -$conditional2 = new Conditional(); -$conditional2->setConditionType(Conditional::CONDITION_CELLIS) - ->setOperatorType(Conditional::OPERATOR_LESSTHAN) - ->addCondition('0'); -$conditional2->getStyle()->getFont()->getColor()->setARGB(Color::COLOR_RED); -$conditional2->getStyle()->getFont()->setItalic(true); -$conditional2->getStyle()->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE); - -$conditional3 = new Conditional(); -$conditional3->setConditionType(Conditional::CONDITION_CELLIS) - ->setOperatorType(Conditional::OPERATOR_GREATERTHANOREQUAL) - ->addCondition('0'); -$conditional3->getStyle()->getFont()->getColor()->setARGB(Color::COLOR_GREEN); -$conditional3->getStyle()->getFont()->setItalic(true); -$conditional3->getStyle()->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE); - -$conditionalStyles = $spreadsheet->getActiveSheet()->getStyle('B2')->getConditionalStyles(); -$conditionalStyles[] = $conditional1; -$conditionalStyles[] = $conditional2; -$conditionalStyles[] = $conditional3; -$spreadsheet->getActiveSheet()->getStyle('B2')->setConditionalStyles($conditionalStyles); - -// duplicate the conditional styles across a range of cells -$helper->log('Duplicate the conditional formatting across a range of cells'); -$spreadsheet->getActiveSheet()->duplicateConditionalStyle( - $spreadsheet->getActiveSheet()->getStyle('B2')->getConditionalStyles(), - 'B3:B7' -); - -// Set fonts -$helper->log('Set fonts'); -$spreadsheet->getActiveSheet()->getStyle('A1:B1')->getFont()->setBold(true); -//$spreadsheet->getActiveSheet()->getStyle('B1')->getFont()->setBold(true); -$spreadsheet->getActiveSheet()->getStyle('A7:B7')->getFont()->setBold(true); -//$spreadsheet->getActiveSheet()->getStyle('B7')->getFont()->setBold(true); -// Set header and footer. When no different headers for odd/even are used, odd header is assumed. -$helper->log('Set header/footer'); -$spreadsheet->getActiveSheet()->getHeaderFooter()->setOddHeader('&L&BPersonal cash register&RPrinted on &D'); -$spreadsheet->getActiveSheet()->getHeaderFooter()->setOddFooter('&L&B' . $spreadsheet->getProperties()->getTitle() . '&RPage &P of &N'); - -// Set page orientation and size -$helper->log('Set page orientation and size'); -$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(PageSetup::ORIENTATION_PORTRAIT); -$spreadsheet->getActiveSheet()->getPageSetup()->setPaperSize(PageSetup::PAPERSIZE_A4); - -// Rename worksheet -$helper->log('Rename worksheet'); -$spreadsheet->getActiveSheet()->setTitle('Invoice'); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/08_Conditional_formatting_2.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/08_Conditional_formatting_2.php deleted file mode 100644 index 818cdd9f..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/08_Conditional_formatting_2.php +++ /dev/null @@ -1,70 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Create a first sheet, representing sales data -$helper->log('Add some data'); -$spreadsheet->setActiveSheetIndex(0); -$spreadsheet->getActiveSheet() - ->setCellValue('A1', '-0.5') - ->setCellValue('A2', '-0.25') - ->setCellValue('A3', '0.0') - ->setCellValue('A4', '0.25') - ->setCellValue('A5', '0.5') - ->setCellValue('A6', '0.75') - ->setCellValue('A7', '1.0') - ->setCellValue('A8', '1.25'); - -$spreadsheet->getActiveSheet()->getStyle('A1:A8') - ->getNumberFormat() - ->setFormatCode( - NumberFormat::FORMAT_PERCENTAGE_00 - ); - -// Add conditional formatting -$helper->log('Add conditional formatting'); -$conditional1 = new Conditional(); -$conditional1->setConditionType(Conditional::CONDITION_CELLIS) - ->setOperatorType(Conditional::OPERATOR_LESSTHAN) - ->addCondition('0'); -$conditional1->getStyle()->getFont()->getColor()->setARGB(Color::COLOR_RED); - -$conditional3 = new Conditional(); -$conditional3->setConditionType(Conditional::CONDITION_CELLIS) - ->setOperatorType(Conditional::OPERATOR_GREATERTHANOREQUAL) - ->addCondition('1'); -$conditional3->getStyle()->getFont()->getColor()->setARGB(Color::COLOR_GREEN); - -$conditionalStyles = $spreadsheet->getActiveSheet()->getStyle('A1')->getConditionalStyles(); -$conditionalStyles[] = $conditional1; -$conditionalStyles[] = $conditional3; -$spreadsheet->getActiveSheet()->getStyle('A1')->setConditionalStyles($conditionalStyles); - -// duplicate the conditional styles across a range of cells -$helper->log('Duplicate the conditional formatting across a range of cells'); -$spreadsheet->getActiveSheet()->duplicateConditionalStyle( - $spreadsheet->getActiveSheet()->getStyle('A1')->getConditionalStyles(), - 'A2:A8' -); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/09_Pagebreaks.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/09_Pagebreaks.php deleted file mode 100644 index ab99a079..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/09_Pagebreaks.php +++ /dev/null @@ -1,63 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Create a first sheet -$helper->log('Add data and page breaks'); -$spreadsheet->setActiveSheetIndex(0); -$spreadsheet->getActiveSheet()->setCellValue('A1', 'Firstname') - ->setCellValue('B1', 'Lastname') - ->setCellValue('C1', 'Phone') - ->setCellValue('D1', 'Fax') - ->setCellValue('E1', 'Is Client ?'); - -// Add data -for ($i = 2; $i <= 50; ++$i) { - $spreadsheet->getActiveSheet()->setCellValue('A' . $i, "FName $i"); - $spreadsheet->getActiveSheet()->setCellValue('B' . $i, "LName $i"); - $spreadsheet->getActiveSheet()->setCellValue('C' . $i, "PhoneNo $i"); - $spreadsheet->getActiveSheet()->setCellValue('D' . $i, "FaxNo $i"); - $spreadsheet->getActiveSheet()->setCellValue('E' . $i, true); - - // Add page breaks every 10 rows - if ($i % 10 == 0) { - // Add a page break - $spreadsheet->getActiveSheet()->setBreak('A' . $i, Worksheet::BREAK_ROW); - } -} - -// Set active sheet index to the first sheet, so Excel opens this as the first sheet -$spreadsheet->setActiveSheetIndex(0); -$spreadsheet->getActiveSheet()->setTitle('Printing Options'); - -// Set print headers -$spreadsheet->getActiveSheet() - ->getHeaderFooter()->setOddHeader('&C&24&K0000FF&B&U&A'); -$spreadsheet->getActiveSheet() - ->getHeaderFooter()->setEvenHeader('&C&24&K0000FF&B&U&A'); - -// Set print footers -$spreadsheet->getActiveSheet() - ->getHeaderFooter()->setOddFooter('&R&D &T&C&F&LPage &P / &N'); -$spreadsheet->getActiveSheet() - ->getHeaderFooter()->setEvenFooter('&L&D &T&C&F&RPage &P / &N'); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/11_Documentsecurity.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/11_Documentsecurity.php deleted file mode 100644 index ec537ab3..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/11_Documentsecurity.php +++ /dev/null @@ -1,48 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Add some data -$helper->log('Add some data'); -$spreadsheet->setActiveSheetIndex(0); -$spreadsheet->getActiveSheet()->setCellValue('A1', 'Hello'); -$spreadsheet->getActiveSheet()->setCellValue('B2', 'world!'); -$spreadsheet->getActiveSheet()->setCellValue('C1', 'Hello'); -$spreadsheet->getActiveSheet()->setCellValue('D2', 'world!'); - -// Rename worksheet -$helper->log('Rename worksheet'); -$spreadsheet->getActiveSheet()->setTitle('Simple'); - -// Set document security -$helper->log('Set document security'); -$spreadsheet->getSecurity()->setLockWindows(true); -$spreadsheet->getSecurity()->setLockStructure(true); -$spreadsheet->getSecurity()->setWorkbookPassword('PhpSpreadsheet'); - -// Set sheet security -$helper->log('Set sheet security'); -$spreadsheet->getActiveSheet()->getProtection()->setPassword('PhpSpreadsheet'); -$spreadsheet->getActiveSheet()->getProtection()->setSheet(true); // This should be enabled in order to enable any of the following! -$spreadsheet->getActiveSheet()->getProtection()->setSort(true); -$spreadsheet->getActiveSheet()->getProtection()->setInsertRows(true); -$spreadsheet->getActiveSheet()->getProtection()->setFormatCells(true); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/12_CellProtection.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/12_CellProtection.php deleted file mode 100644 index 8a1b2a0b..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/12_CellProtection.php +++ /dev/null @@ -1,47 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Mark Baker') - ->setLastModifiedBy('Mark Baker') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Add some data -$helper->log('Add some data'); -$spreadsheet->setActiveSheetIndex(0); -$spreadsheet->getActiveSheet()->setCellValue('A1', 'Crouching'); -$spreadsheet->getActiveSheet()->setCellValue('B1', 'Tiger'); -$spreadsheet->getActiveSheet()->setCellValue('A2', 'Hidden'); -$spreadsheet->getActiveSheet()->setCellValue('B2', 'Dragon'); - -// Rename worksheet -$helper->log('Rename worksheet'); -$spreadsheet->getActiveSheet()->setTitle('Simple'); - -// Set document security -$helper->log('Set cell protection'); - -// Set sheet security -$helper->log('Set sheet security'); -$spreadsheet->getActiveSheet()->getProtection()->setSheet(true); -$spreadsheet->getActiveSheet() - ->getStyle('A2:B2') - ->getProtection()->setLocked( - Protection::PROTECTION_UNPROTECTED - ); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/13_Calculation.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/13_Calculation.php deleted file mode 100644 index 087b443f..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/13_Calculation.php +++ /dev/null @@ -1,176 +0,0 @@ -log('List implemented functions'); -$calc = Calculation::getInstance(); -print_r($calc->getImplementedFunctionNames()); - -// Create new Spreadsheet object -$helper->log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Add some data, we will use some formulas here -$helper->log('Add some data and formulas'); -$spreadsheet->getActiveSheet()->setCellValue('A14', 'Count:') - ->setCellValue('A15', 'Sum:') - ->setCellValue('A16', 'Max:') - ->setCellValue('A17', 'Min:') - ->setCellValue('A18', 'Average:') - ->setCellValue('A19', 'Median:') - ->setCellValue('A20', 'Mode:'); - -$spreadsheet->getActiveSheet()->setCellValue('A22', 'CountA:') - ->setCellValue('A23', 'MaxA:') - ->setCellValue('A24', 'MinA:'); - -$spreadsheet->getActiveSheet()->setCellValue('A26', 'StDev:') - ->setCellValue('A27', 'StDevA:') - ->setCellValue('A28', 'StDevP:') - ->setCellValue('A29', 'StDevPA:'); - -$spreadsheet->getActiveSheet()->setCellValue('A31', 'DevSq:') - ->setCellValue('A32', 'Var:') - ->setCellValue('A33', 'VarA:') - ->setCellValue('A34', 'VarP:') - ->setCellValue('A35', 'VarPA:'); - -$spreadsheet->getActiveSheet()->setCellValue('A37', 'Date:'); - -$spreadsheet->getActiveSheet()->setCellValue('B1', 'Range 1') - ->setCellValue('B2', 2) - ->setCellValue('B3', 8) - ->setCellValue('B4', 10) - ->setCellValue('B5', true) - ->setCellValue('B6', false) - ->setCellValue('B7', 'Text String') - ->setCellValue('B9', '22') - ->setCellValue('B10', 4) - ->setCellValue('B11', 6) - ->setCellValue('B12', 12); - -$spreadsheet->getActiveSheet()->setCellValue('B14', '=COUNT(B2:B12)') - ->setCellValue('B15', '=SUM(B2:B12)') - ->setCellValue('B16', '=MAX(B2:B12)') - ->setCellValue('B17', '=MIN(B2:B12)') - ->setCellValue('B18', '=AVERAGE(B2:B12)') - ->setCellValue('B19', '=MEDIAN(B2:B12)') - ->setCellValue('B20', '=MODE(B2:B12)'); - -$spreadsheet->getActiveSheet()->setCellValue('B22', '=COUNTA(B2:B12)') - ->setCellValue('B23', '=MAXA(B2:B12)') - ->setCellValue('B24', '=MINA(B2:B12)'); - -$spreadsheet->getActiveSheet()->setCellValue('B26', '=STDEV(B2:B12)') - ->setCellValue('B27', '=STDEVA(B2:B12)') - ->setCellValue('B28', '=STDEVP(B2:B12)') - ->setCellValue('B29', '=STDEVPA(B2:B12)'); - -$spreadsheet->getActiveSheet()->setCellValue('B31', '=DEVSQ(B2:B12)') - ->setCellValue('B32', '=VAR(B2:B12)') - ->setCellValue('B33', '=VARA(B2:B12)') - ->setCellValue('B34', '=VARP(B2:B12)') - ->setCellValue('B35', '=VARPA(B2:B12)'); - -$spreadsheet->getActiveSheet()->setCellValue('B37', '=DATE(2007, 12, 21)') - ->setCellValue('B38', '=DATEDIF( DATE(2007, 12, 21), DATE(2007, 12, 22), "D" )') - ->setCellValue('B39', '=DATEVALUE("01-Feb-2006 10:06 AM")') - ->setCellValue('B40', '=DAY( DATE(2006, 1, 2) )') - ->setCellValue('B41', '=DAYS360( DATE(2002, 2, 3), DATE(2005, 5, 31) )'); - -$spreadsheet->getActiveSheet()->setCellValue('C1', 'Range 2') - ->setCellValue('C2', 1) - ->setCellValue('C3', 2) - ->setCellValue('C4', 2) - ->setCellValue('C5', 3) - ->setCellValue('C6', 3) - ->setCellValue('C7', 3) - ->setCellValue('C8', '0') - ->setCellValue('C9', 4) - ->setCellValue('C10', 4) - ->setCellValue('C11', 4) - ->setCellValue('C12', 4); - -$spreadsheet->getActiveSheet()->setCellValue('C14', '=COUNT(C2:C12)') - ->setCellValue('C15', '=SUM(C2:C12)') - ->setCellValue('C16', '=MAX(C2:C12)') - ->setCellValue('C17', '=MIN(C2:C12)') - ->setCellValue('C18', '=AVERAGE(C2:C12)') - ->setCellValue('C19', '=MEDIAN(C2:C12)') - ->setCellValue('C20', '=MODE(C2:C12)'); - -$spreadsheet->getActiveSheet()->setCellValue('C22', '=COUNTA(C2:C12)') - ->setCellValue('C23', '=MAXA(C2:C12)') - ->setCellValue('C24', '=MINA(C2:C12)'); - -$spreadsheet->getActiveSheet()->setCellValue('C26', '=STDEV(C2:C12)') - ->setCellValue('C27', '=STDEVA(C2:C12)') - ->setCellValue('C28', '=STDEVP(C2:C12)') - ->setCellValue('C29', '=STDEVPA(C2:C12)'); - -$spreadsheet->getActiveSheet()->setCellValue('C31', '=DEVSQ(C2:C12)') - ->setCellValue('C32', '=VAR(C2:C12)') - ->setCellValue('C33', '=VARA(C2:C12)') - ->setCellValue('C34', '=VARP(C2:C12)') - ->setCellValue('C35', '=VARPA(C2:C12)'); - -$spreadsheet->getActiveSheet()->setCellValue('D1', 'Range 3') - ->setCellValue('D2', 2) - ->setCellValue('D3', 3) - ->setCellValue('D4', 4); - -$spreadsheet->getActiveSheet()->setCellValue('D14', '=((D2 * D3) + D4) & " should be 10"'); - -$spreadsheet->getActiveSheet()->setCellValue('E12', 'Other functions') - ->setCellValue('E14', '=PI()') - ->setCellValue('E15', '=RAND()') - ->setCellValue('E16', '=RANDBETWEEN(5, 10)'); - -$spreadsheet->getActiveSheet()->setCellValue('E17', 'Count of both ranges:') - ->setCellValue('F17', '=COUNT(B2:C12)'); - -$spreadsheet->getActiveSheet()->setCellValue('E18', 'Total of both ranges:') - ->setCellValue('F18', '=SUM(B2:C12)'); - -$spreadsheet->getActiveSheet()->setCellValue('E19', 'Maximum of both ranges:') - ->setCellValue('F19', '=MAX(B2:C12)'); - -$spreadsheet->getActiveSheet()->setCellValue('E20', 'Minimum of both ranges:') - ->setCellValue('F20', '=MIN(B2:C12)'); - -$spreadsheet->getActiveSheet()->setCellValue('E21', 'Average of both ranges:') - ->setCellValue('F21', '=AVERAGE(B2:C12)'); - -$spreadsheet->getActiveSheet()->setCellValue('E22', 'Median of both ranges:') - ->setCellValue('F22', '=MEDIAN(B2:C12)'); - -$spreadsheet->getActiveSheet()->setCellValue('E23', 'Mode of both ranges:') - ->setCellValue('F23', '=MODE(B2:C12)'); - -// Calculated data -$helper->log('Calculated data'); -for ($col = 'B'; $col != 'G'; ++$col) { - for ($row = 14; $row <= 41; ++$row) { - if ((($formula = $spreadsheet->getActiveSheet()->getCell($col . $row)->getValue()) !== null) && - ($formula[0] == '=')) { - $helper->log('Value of ' . $col . $row . ' [' . $formula . ']: ' . $spreadsheet->getActiveSheet()->getCell($col . $row)->getCalculatedValue()); - } - } -} - -// -// If we set Pre Calculated Formulas to true then PhpSpreadsheet will calculate all formulae in the -// workbook before saving. This adds time and memory overhead, and can cause some problems with formulae -// using functions or features (such as array formulae) that aren't yet supported by the calculation engine -// If the value is false (the default) for the Xlsx Writer, then MS Excel (or the application used to -// open the file) will need to recalculate values itself to guarantee that the correct results are available. -// -//$writer->setPreCalculateFormulas(true); -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/13_CalculationCyclicFormulae.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/13_CalculationCyclicFormulae.php deleted file mode 100644 index 26e9784d..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/13_CalculationCyclicFormulae.php +++ /dev/null @@ -1,33 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Add some data, we will use some formulas here -$helper->log('Add some data and formulas'); -$spreadsheet->getActiveSheet()->setCellValue('A1', '=B1') - ->setCellValue('A2', '=B2+1') - ->setCellValue('B1', '=A1+1') - ->setCellValue('B2', '=A2'); - -Calculation::getInstance($spreadsheet)->cyclicFormulaCount = 100; - -// Calculated data -$helper->log('Calculated data'); -for ($row = 1; $row <= 2; ++$row) { - for ($col = 'A'; $col != 'C'; ++$col) { - if ((($formula = $spreadsheet->getActiveSheet()->getCell($col . $row)->getValue()) !== null) && - ($formula[0] == '=')) { - $helper->log('Value of ' . $col . $row . ' [' . $formula . ']: ' . $spreadsheet->getActiveSheet()->getCell($col . $row)->getCalculatedValue()); - } - } -} - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/14_Xls.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/14_Xls.php deleted file mode 100644 index ce27eb8c..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/14_Xls.php +++ /dev/null @@ -1,13 +0,0 @@ -getFilename(__FILE__, 'xls'); -$writer = IOFactory::createWriter($spreadsheet, 'Xls'); - -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/15_Datavalidation.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/15_Datavalidation.php deleted file mode 100644 index fb76b4dc..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/15_Datavalidation.php +++ /dev/null @@ -1,80 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Create a first sheet -$helper->log('Add data'); -$spreadsheet->setActiveSheetIndex(0); -$spreadsheet->getActiveSheet()->setCellValue('A1', 'Cell B3 and B5 contain data validation...') - ->setCellValue('A3', 'Number:') - ->setCellValue('B3', '10') - ->setCellValue('A5', 'List:') - ->setCellValue('B5', 'Item A') - ->setCellValue('A7', 'List #2:') - ->setCellValue('B7', 'Item #2') - ->setCellValue('D2', 'Item #1') - ->setCellValue('D3', 'Item #2') - ->setCellValue('D4', 'Item #3') - ->setCellValue('D5', 'Item #4') - ->setCellValue('D6', 'Item #5'); - -// Set data validation -$helper->log('Set data validation'); -$validation = $spreadsheet->getActiveSheet()->getCell('B3')->getDataValidation(); -$validation->setType(DataValidation::TYPE_WHOLE); -$validation->setErrorStyle(DataValidation::STYLE_STOP); -$validation->setAllowBlank(true); -$validation->setShowInputMessage(true); -$validation->setShowErrorMessage(true); -$validation->setErrorTitle('Input error'); -$validation->setError('Only numbers between 10 and 20 are allowed!'); -$validation->setPromptTitle('Allowed input'); -$validation->setPrompt('Only numbers between 10 and 20 are allowed.'); -$validation->setFormula1(10); -$validation->setFormula2(20); - -$validation = $spreadsheet->getActiveSheet()->getCell('B5')->getDataValidation(); -$validation->setType(DataValidation::TYPE_LIST); -$validation->setErrorStyle(DataValidation::STYLE_INFORMATION); -$validation->setAllowBlank(false); -$validation->setShowInputMessage(true); -$validation->setShowErrorMessage(true); -$validation->setShowDropDown(true); -$validation->setErrorTitle('Input error'); -$validation->setError('Value is not in list.'); -$validation->setPromptTitle('Pick from list'); -$validation->setPrompt('Please pick a value from the drop-down list.'); -$validation->setFormula1('"Item A,Item B,Item C"'); // Make sure to put the list items between " and " if your list is simply a comma-separated list of values !!! - -$validation = $spreadsheet->getActiveSheet()->getCell('B7')->getDataValidation(); -$validation->setType(DataValidation::TYPE_LIST); -$validation->setErrorStyle(DataValidation::STYLE_INFORMATION); -$validation->setAllowBlank(false); -$validation->setShowInputMessage(true); -$validation->setShowErrorMessage(true); -$validation->setShowDropDown(true); -$validation->setErrorTitle('Input error'); -$validation->setError('Value is not in list.'); -$validation->setPromptTitle('Pick from list'); -$validation->setPrompt('Please pick a value from the drop-down list.'); -$validation->setFormula1('$D$2:$D$6'); // Make sure NOT to put a range of cells or a formula between " and " - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/16_Csv.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/16_Csv.php deleted file mode 100644 index ceb8b2f5..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/16_Csv.php +++ /dev/null @@ -1,38 +0,0 @@ -log('Write to CSV format'); -$writer = IOFactory::createWriter($spreadsheet, 'Csv')->setDelimiter(',') - ->setEnclosure('"') - ->setSheetIndex(0); - -$callStartTime = microtime(true); -$filename = $helper->getTemporaryFilename('csv'); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); - -$helper->log('Read from CSV format'); - -$reader = IOFactory::createReader('Csv')->setDelimiter(',') - ->setEnclosure('"') - ->setSheetIndex(0); - -$callStartTime = microtime(true); -$spreadsheetFromCSV = $reader->load($filename); -$helper->logRead('Csv', $filename, $callStartTime); - -// Write Xlsx -$helper->write($spreadsheetFromCSV, __FILE__, ['Xlsx']); - -// Write CSV -$filenameCSV = $helper->getFilename(__FILE__, 'csv'); -$writerCSV = IOFactory::createWriter($spreadsheetFromCSV, 'Csv'); -$writerCSV->setExcelCompatibility(true); - -$callStartTime = microtime(true); -$writerCSV->save($filenameCSV); -$helper->logWrite($writerCSV, $filenameCSV, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/17_Html.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/17_Html.php deleted file mode 100644 index b90b7212..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/17_Html.php +++ /dev/null @@ -1,13 +0,0 @@ -getFilename(__FILE__, 'html'); -$writer = IOFactory::createWriter($spreadsheet, 'Html'); - -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/18_Extendedcalculation.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/18_Extendedcalculation.php deleted file mode 100644 index c1ec2c0a..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/18_Extendedcalculation.php +++ /dev/null @@ -1,69 +0,0 @@ -log('List implemented functions'); -$calc = Calculation::getInstance(); -print_r($calc->getImplementedFunctionNames()); - -// Create new Spreadsheet object -$helper->log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Add some data, we will use some formulas here -$helper->log('Add some data'); -$spreadsheet->getActiveSheet()->setCellValue('A14', 'Count:'); - -$spreadsheet->getActiveSheet()->setCellValue('B1', 'Range 1'); -$spreadsheet->getActiveSheet()->setCellValue('B2', 2); -$spreadsheet->getActiveSheet()->setCellValue('B3', 8); -$spreadsheet->getActiveSheet()->setCellValue('B4', 10); -$spreadsheet->getActiveSheet()->setCellValue('B5', true); -$spreadsheet->getActiveSheet()->setCellValue('B6', false); -$spreadsheet->getActiveSheet()->setCellValue('B7', 'Text String'); -$spreadsheet->getActiveSheet()->setCellValue('B9', '22'); -$spreadsheet->getActiveSheet()->setCellValue('B10', 4); -$spreadsheet->getActiveSheet()->setCellValue('B11', 6); -$spreadsheet->getActiveSheet()->setCellValue('B12', 12); - -$spreadsheet->getActiveSheet()->setCellValue('B14', '=COUNT(B2:B12)'); - -$spreadsheet->getActiveSheet()->setCellValue('C1', 'Range 2'); -$spreadsheet->getActiveSheet()->setCellValue('C2', 1); -$spreadsheet->getActiveSheet()->setCellValue('C3', 2); -$spreadsheet->getActiveSheet()->setCellValue('C4', 2); -$spreadsheet->getActiveSheet()->setCellValue('C5', 3); -$spreadsheet->getActiveSheet()->setCellValue('C6', 3); -$spreadsheet->getActiveSheet()->setCellValue('C7', 3); -$spreadsheet->getActiveSheet()->setCellValue('C8', '0'); -$spreadsheet->getActiveSheet()->setCellValue('C9', 4); -$spreadsheet->getActiveSheet()->setCellValue('C10', 4); -$spreadsheet->getActiveSheet()->setCellValue('C11', 4); -$spreadsheet->getActiveSheet()->setCellValue('C12', 4); - -$spreadsheet->getActiveSheet()->setCellValue('C14', '=COUNT(C2:C12)'); - -$spreadsheet->getActiveSheet()->setCellValue('D1', 'Range 3'); -$spreadsheet->getActiveSheet()->setCellValue('D2', 2); -$spreadsheet->getActiveSheet()->setCellValue('D3', 3); -$spreadsheet->getActiveSheet()->setCellValue('D4', 4); - -$spreadsheet->getActiveSheet()->setCellValue('D5', '=((D2 * D3) + D4) & " should be 10"'); - -$spreadsheet->getActiveSheet()->setCellValue('E1', 'Other functions'); -$spreadsheet->getActiveSheet()->setCellValue('E2', '=PI()'); -$spreadsheet->getActiveSheet()->setCellValue('E3', '=RAND()'); -$spreadsheet->getActiveSheet()->setCellValue('E4', '=RANDBETWEEN(5, 10)'); - -$spreadsheet->getActiveSheet()->setCellValue('E14', 'Count of both ranges:'); -$spreadsheet->getActiveSheet()->setCellValue('F14', '=COUNT(B2:C12)'); - -// Calculated data -$helper->log('Calculated data'); -$helper->log('Value of B14 [=COUNT(B2:B12)]: ' . $spreadsheet->getActiveSheet()->getCell('B14')->getCalculatedValue()); - -$helper->logEndingNotes(); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/19_Namedrange.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/19_Namedrange.php deleted file mode 100644 index d89e1b04..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/19_Namedrange.php +++ /dev/null @@ -1,70 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Add some data -$helper->log('Add some data'); -$spreadsheet->setActiveSheetIndex(0); -$spreadsheet->getActiveSheet()->setCellValue('A1', 'Firstname:') - ->setCellValue('A2', 'Lastname:') - ->setCellValue('A3', 'Fullname:') - ->setCellValue('B1', 'Maarten') - ->setCellValue('B2', 'Balliauw') - ->setCellValue('B3', '=B1 & " " & B2'); - -// Define named ranges -$helper->log('Define named ranges'); -$spreadsheet->addNamedRange(new NamedRange('PersonName', $spreadsheet->getActiveSheet(), 'B1')); -$spreadsheet->addNamedRange(new NamedRange('PersonLN', $spreadsheet->getActiveSheet(), 'B2')); - -// Rename named ranges -$helper->log('Rename named ranges'); -$spreadsheet->getNamedRange('PersonName')->setName('PersonFN'); - -// Rename worksheet -$helper->log('Rename worksheet'); -$spreadsheet->getActiveSheet()->setTitle('Person'); - -// Create a new worksheet, after the default sheet -$helper->log('Create new Worksheet object'); -$spreadsheet->createSheet(); - -// Add some data to the second sheet, resembling some different data types -$helper->log('Add some data'); -$spreadsheet->setActiveSheetIndex(1); -$spreadsheet->getActiveSheet()->setCellValue('A1', 'Firstname:') - ->setCellValue('A2', 'Lastname:') - ->setCellValue('A3', 'Fullname:') - ->setCellValue('B1', '=PersonFN') - ->setCellValue('B2', '=PersonLN') - ->setCellValue('B3', '=PersonFN & " " & PersonLN'); - -// Resolve range -$helper->log('Resolve range'); -$helper->log('Cell B1 {=PersonFN}: ' . $spreadsheet->getActiveSheet()->getCell('B1')->getCalculatedValue()); -$helper->log('Cell B3 {=PersonFN & " " & PersonLN}: ' . $spreadsheet->getActiveSheet()->getCell('B3')->getCalculatedValue()); -$helper->log('Cell Person!B1: ' . $spreadsheet->getActiveSheet()->getCell('Person!B1')->getCalculatedValue()); - -// Rename worksheet -$helper->log('Rename worksheet'); -$spreadsheet->getActiveSheet()->setTitle('Person (cloned)'); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Excel2003XML.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Excel2003XML.php deleted file mode 100644 index 44425e20..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Excel2003XML.php +++ /dev/null @@ -1,13 +0,0 @@ -logRead('Xml', $filename, $callStartTime); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Gnumeric.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Gnumeric.php deleted file mode 100644 index 2d6ce221..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Gnumeric.php +++ /dev/null @@ -1,13 +0,0 @@ -logRead('Gnumeric', $filename, $callStartTime); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Ods.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Ods.php deleted file mode 100644 index 64f54827..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Ods.php +++ /dev/null @@ -1,13 +0,0 @@ -logRead('Ods', $filename, $callStartTime); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Sylk.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Sylk.php deleted file mode 100644 index 1a064593..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Sylk.php +++ /dev/null @@ -1,13 +0,0 @@ -logRead('Slk', $filename, $callStartTime); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Xls.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Xls.php deleted file mode 100644 index 9e5fa014..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/20_Read_Xls.php +++ /dev/null @@ -1,22 +0,0 @@ -getTemporaryFilename('xls'); -$writer = IOFactory::createWriter($spreadsheet, 'Xls'); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); - -// Read Xls file -$callStartTime = microtime(true); -$spreadsheet = IOFactory::load($filename); -$helper->logRead('Xls', $filename, $callStartTime); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/22_Heavily_formatted.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/22_Heavily_formatted.php deleted file mode 100644 index d7ba861b..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/22_Heavily_formatted.php +++ /dev/null @@ -1,48 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Add some data -$helper->log('Add some data'); -$spreadsheet->setActiveSheetIndex(0); - -$spreadsheet->getActiveSheet()->getStyle('A1:T100')->applyFromArray( - ['fill' => [ - 'fillType' => Fill::FILL_SOLID, - 'color' => ['argb' => 'FFCCFFCC'], - ], - 'borders' => [ - 'bottom' => ['borderStyle' => Border::BORDER_THIN], - 'right' => ['borderStyle' => Border::BORDER_MEDIUM], - ], - ] -); - -$spreadsheet->getActiveSheet()->getStyle('C5:R95')->applyFromArray( - ['fill' => [ - 'fillType' => Fill::FILL_SOLID, - 'color' => ['argb' => 'FFFFFF00'], - ], - ] -); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/23_Sharedstyles.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/23_Sharedstyles.php deleted file mode 100644 index b5398883..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/23_Sharedstyles.php +++ /dev/null @@ -1,59 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Add some data -$helper->log('Add some data'); -$spreadsheet->setActiveSheetIndex(0); - -$sharedStyle1 = new Style(); -$sharedStyle2 = new Style(); - -$sharedStyle1->applyFromArray( - ['fill' => [ - 'fillType' => Fill::FILL_SOLID, - 'color' => ['argb' => 'FFCCFFCC'], - ], - 'borders' => [ - 'bottom' => ['borderStyle' => Border::BORDER_THIN], - 'right' => ['borderStyle' => Border::BORDER_MEDIUM], - ], - ] -); - -$sharedStyle2->applyFromArray( - ['fill' => [ - 'fillType' => Fill::FILL_SOLID, - 'color' => ['argb' => 'FFFFFF00'], - ], - 'borders' => [ - 'bottom' => ['borderStyle' => Border::BORDER_THIN], - 'right' => ['borderStyle' => Border::BORDER_MEDIUM], - ], - ] -); - -$spreadsheet->getActiveSheet()->duplicateStyle($sharedStyle1, 'A1:T100'); -$spreadsheet->getActiveSheet()->duplicateStyle($sharedStyle2, 'C5:R95'); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/24_Readfilter.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/24_Readfilter.php deleted file mode 100644 index 844996f2..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/24_Readfilter.php +++ /dev/null @@ -1,41 +0,0 @@ -getTemporaryFilename(); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); - -class MyReadFilter implements IReadFilter -{ - public function readCell($column, $row, $worksheetName = '') - { - // Read title row and rows 20 - 30 - if ($row == 1 || ($row >= 20 && $row <= 30)) { - return true; - } - - return false; - } -} - -$helper->log('Load from Xlsx file'); -$reader = IOFactory::createReader('Xlsx'); -$reader->setReadFilter(new MyReadFilter()); -$callStartTime = microtime(true); -$spreadsheet = $reader->load($filename); -$helper->logRead('Xlsx', $filename, $callStartTime); -$helper->log('Remove unnecessary rows'); -$spreadsheet->getActiveSheet()->removeRow(2, 18); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/25_In_memory_image.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/25_In_memory_image.php deleted file mode 100644 index a897486d..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/25_In_memory_image.php +++ /dev/null @@ -1,40 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Generate an image -$helper->log('Generate an image'); -$gdImage = @imagecreatetruecolor(120, 20) or die('Cannot Initialize new GD image stream'); -$textColor = imagecolorallocate($gdImage, 255, 255, 255); -imagestring($gdImage, 1, 5, 5, 'Created with PhpSpreadsheet', $textColor); - -// Add a drawing to the worksheet -$helper->log('Add a drawing to the worksheet'); -$drawing = new MemoryDrawing(); -$drawing->setName('Sample image'); -$drawing->setDescription('Sample image'); -$drawing->setImageResource($gdImage); -$drawing->setRenderingFunction(MemoryDrawing::RENDERING_JPEG); -$drawing->setMimeType(MemoryDrawing::MIMETYPE_DEFAULT); -$drawing->setHeight(36); -$drawing->setWorksheet($spreadsheet->getActiveSheet()); - -// Save -$helper->write($spreadsheet, __FILE__, ['Xlsx', 'Html']); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/26_Utf8.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/26_Utf8.php deleted file mode 100644 index af048246..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/26_Utf8.php +++ /dev/null @@ -1,39 +0,0 @@ -log('Load Xlsx template file'); -$reader = IOFactory::createReader('Xlsx'); -$spreadsheet = $reader->load(__DIR__ . '/../templates/26template.xlsx'); - -// at this point, we could do some manipulations with the template, but we skip this step -$helper->write($spreadsheet, __FILE__, ['Xlsx', 'Xls', 'Html']); - -// Export to PDF (.pdf) -$helper->log('Write to PDF format'); -IOFactory::registerWriter('Pdf', \PhpOffice\PhpSpreadsheet\Writer\Pdf\Dompdf::class); -$helper->write($spreadsheet, __FILE__, ['Pdf']); - -// Remove first two rows with field headers before exporting to CSV -$helper->log('Removing first two heading rows for CSV export'); -$worksheet = $spreadsheet->getActiveSheet(); -$worksheet->removeRow(1, 2); - -// Export to CSV (.csv) -$helper->log('Write to CSV format'); -$writer = IOFactory::createWriter($spreadsheet, 'Csv'); -$filename = $helper->getFilename(__FILE__, 'csv'); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); - -// Export to CSV with BOM (.csv) -$filename = str_replace('.csv', '-bom.csv', $filename); -$helper->log('Write to CSV format (with BOM)'); -$writer->setUseBOM(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/27_Images_Xls.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/27_Images_Xls.php deleted file mode 100644 index 4c20a9ac..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/27_Images_Xls.php +++ /dev/null @@ -1,13 +0,0 @@ -log('Load Xlsx template file'); -$reader = IOFactory::createReader('Xls'); -$spreadsheet = $reader->load(__DIR__ . '/../templates/27template.xls'); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/28_Iterator.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/28_Iterator.php deleted file mode 100644 index 4aec7a92..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/28_Iterator.php +++ /dev/null @@ -1,34 +0,0 @@ -getTemporaryFilename(); -$writer = new Xlsx($sampleSpreadsheet); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); - -$callStartTime = microtime(true); -$reader = IOFactory::createReader('Xlsx'); -$spreadsheet = $reader->load($filename); -$helper->logRead('Xlsx', $filename, $callStartTime); -$helper->log('Iterate worksheets'); -foreach ($spreadsheet->getWorksheetIterator() as $worksheet) { - $helper->log('Worksheet - ' . $worksheet->getTitle()); - - foreach ($worksheet->getRowIterator() as $row) { - $helper->log(' Row number - ' . $row->getRowIndex()); - - $cellIterator = $row->getCellIterator(); - $cellIterator->setIterateOnlyExistingCells(false); // Loop all cells, even if it is not set - foreach ($cellIterator as $cell) { - if ($cell !== null) { - $helper->log(' Cell - ' . $cell->getCoordinate() . ' - ' . $cell->getCalculatedValue()); - } - } - } -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/29_Advanced_value_binder.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/29_Advanced_value_binder.php deleted file mode 100644 index 74c16c21..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/29_Advanced_value_binder.php +++ /dev/null @@ -1,132 +0,0 @@ -log('Set timezone'); -date_default_timezone_set('UTC'); - -// Set value binder -$helper->log('Set value binder'); -Cell::setValueBinder(new AdvancedValueBinder()); - -// Create new Spreadsheet object -$helper->log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test document for Office 2007 XLSX, generated using PHP classes.') - ->setKeywords('office 2007 openxml php') - ->setCategory('Test result file'); - -// Set default font -$helper->log('Set default font'); -$spreadsheet->getDefaultStyle()->getFont()->setName('Arial'); -$spreadsheet->getDefaultStyle()->getFont()->setSize(10); - -// Set column widths -$helper->log('Set column widths'); -$spreadsheet->getActiveSheet()->getColumnDimension('A')->setAutoSize(true); -$spreadsheet->getActiveSheet()->getColumnDimension('B')->setWidth(14); - -// Add some data, resembling some different data types -$helper->log('Add some data'); -$spreadsheet->getActiveSheet()->setCellValue('A1', 'String value:') - ->setCellValue('B1', 'Mark Baker'); - -$spreadsheet->getActiveSheet()->setCellValue('A2', 'Numeric value #1:') - ->setCellValue('B2', 12345); - -$spreadsheet->getActiveSheet()->setCellValue('A3', 'Numeric value #2:') - ->setCellValue('B3', -12.345); - -$spreadsheet->getActiveSheet()->setCellValue('A4', 'Numeric value #3:') - ->setCellValue('B4', .12345); - -$spreadsheet->getActiveSheet()->setCellValue('A5', 'Numeric value #4:') - ->setCellValue('B5', '12345'); - -$spreadsheet->getActiveSheet()->setCellValue('A6', 'Numeric value #5:') - ->setCellValue('B6', '1.2345'); - -$spreadsheet->getActiveSheet()->setCellValue('A7', 'Numeric value #6:') - ->setCellValue('B7', '.12345'); - -$spreadsheet->getActiveSheet()->setCellValue('A8', 'Numeric value #7:') - ->setCellValue('B8', '1.234e-5'); - -$spreadsheet->getActiveSheet()->setCellValue('A9', 'Numeric value #8:') - ->setCellValue('B9', '-1.234e+5'); - -$spreadsheet->getActiveSheet()->setCellValue('A10', 'Boolean value:') - ->setCellValue('B10', 'TRUE'); - -$spreadsheet->getActiveSheet()->setCellValue('A11', 'Percentage value #1:') - ->setCellValue('B11', '10%'); - -$spreadsheet->getActiveSheet()->setCellValue('A12', 'Percentage value #2:') - ->setCellValue('B12', '12.5%'); - -$spreadsheet->getActiveSheet()->setCellValue('A13', 'Fraction value #1:') - ->setCellValue('B13', '-1/2'); - -$spreadsheet->getActiveSheet()->setCellValue('A14', 'Fraction value #2:') - ->setCellValue('B14', '3 1/2'); - -$spreadsheet->getActiveSheet()->setCellValue('A15', 'Fraction value #3:') - ->setCellValue('B15', '-12 3/4'); - -$spreadsheet->getActiveSheet()->setCellValue('A16', 'Fraction value #4:') - ->setCellValue('B16', '13/4'); - -$spreadsheet->getActiveSheet()->setCellValue('A17', 'Currency value #1:') - ->setCellValue('B17', '$12345'); - -$spreadsheet->getActiveSheet()->setCellValue('A18', 'Currency value #2:') - ->setCellValue('B18', '$12345.67'); - -$spreadsheet->getActiveSheet()->setCellValue('A19', 'Currency value #3:') - ->setCellValue('B19', '$12,345.67'); - -$spreadsheet->getActiveSheet()->setCellValue('A20', 'Date value #1:') - ->setCellValue('B20', '21 December 1983'); - -$spreadsheet->getActiveSheet()->setCellValue('A21', 'Date value #2:') - ->setCellValue('B21', '19-Dec-1960'); - -$spreadsheet->getActiveSheet()->setCellValue('A22', 'Date value #3:') - ->setCellValue('B22', '07/12/1982'); - -$spreadsheet->getActiveSheet()->setCellValue('A23', 'Date value #4:') - ->setCellValue('B23', '24-11-1950'); - -$spreadsheet->getActiveSheet()->setCellValue('A24', 'Date value #5:') - ->setCellValue('B24', '17-Mar'); - -$spreadsheet->getActiveSheet()->setCellValue('A25', 'Time value #1:') - ->setCellValue('B25', '01:30'); - -$spreadsheet->getActiveSheet()->setCellValue('A26', 'Time value #2:') - ->setCellValue('B26', '01:30:15'); - -$spreadsheet->getActiveSheet()->setCellValue('A27', 'Date/Time value:') - ->setCellValue('B27', '19-Dec-1960 01:30'); - -$spreadsheet->getActiveSheet()->setCellValue('A28', 'Formula:') - ->setCellValue('B28', '=SUM(B2:B9)'); - -// Rename worksheet -$helper->log('Rename worksheet'); -$spreadsheet->getActiveSheet()->setTitle('Advanced value binder'); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/30_Template.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/30_Template.php deleted file mode 100644 index b70c18b6..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/30_Template.php +++ /dev/null @@ -1,43 +0,0 @@ -log('Load from Xls template'); -$reader = IOFactory::createReader('Xls'); -$spreadsheet = $reader->load(__DIR__ . '/../templates/30template.xls'); - -$helper->log('Add new data to the template'); -$data = [['title' => 'Excel for dummies', - 'price' => 17.99, - 'quantity' => 2, - ], - ['title' => 'PHP for dummies', - 'price' => 15.99, - 'quantity' => 1, - ], - ['title' => 'Inside OOP', - 'price' => 12.95, - 'quantity' => 1, - ], -]; - -$spreadsheet->getActiveSheet()->setCellValue('D1', Date::PHPToExcel(time())); - -$baseRow = 5; -foreach ($data as $r => $dataRow) { - $row = $baseRow + $r; - $spreadsheet->getActiveSheet()->insertNewRowBefore($row, 1); - - $spreadsheet->getActiveSheet()->setCellValue('A' . $row, $r + 1) - ->setCellValue('B' . $row, $dataRow['title']) - ->setCellValue('C' . $row, $dataRow['price']) - ->setCellValue('D' . $row, $dataRow['quantity']) - ->setCellValue('E' . $row, '=C' . $row . '*D' . $row); -} -$spreadsheet->getActiveSheet()->removeRow($baseRow - 1, 1); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/31_Document_properties_write.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/31_Document_properties_write.php deleted file mode 100644 index dec3cc32..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/31_Document_properties_write.php +++ /dev/null @@ -1,68 +0,0 @@ -load($inputFileName); -$helper->logRead($inputFileType, $inputFileName, $callStartTime); - -$helper->log('Adjust properties'); -$spreadsheet->getProperties()->setTitle('Office 2007 XLSX Test Document') - ->setSubject('Office 2007 XLSX Test Document') - ->setDescription('Test XLSX document, generated using PhpSpreadsheet') - ->setKeywords('office 2007 openxml php'); - -// Save Excel 2007 file -$filename = $helper->getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); - -$helper->logEndingNotes(); - -// Reread File -$helper->log('Reread Xlsx file'); -$spreadsheetRead = IOFactory::load($filename); - -// Set properties -$helper->log('Get properties'); - -$helper->log('Core Properties:'); -$helper->log(' Created by - ' . $spreadsheet->getProperties()->getCreator()); -$helper->log(' Created on - ' . date('d-M-Y' . $spreadsheet->getProperties()->getCreated()) . ' at ' . date('H:i:s' . $spreadsheet->getProperties()->getCreated())); -$helper->log(' Last Modified by - ' . $spreadsheet->getProperties()->getLastModifiedBy()); -$helper->log(' Last Modified on - ' . date('d-M-Y' . $spreadsheet->getProperties()->getModified()) . ' at ' . date('H:i:s' . $spreadsheet->getProperties()->getModified())); -$helper->log(' Title - ' . $spreadsheet->getProperties()->getTitle()); -$helper->log(' Subject - ' . $spreadsheet->getProperties()->getSubject()); -$helper->log(' Description - ' . $spreadsheet->getProperties()->getDescription()); -$helper->log(' Keywords: - ' . $spreadsheet->getProperties()->getKeywords()); - -$helper->log('Extended (Application) Properties:'); -$helper->log(' Category - ' . $spreadsheet->getProperties()->getCategory()); -$helper->log(' Company - ' . $spreadsheet->getProperties()->getCompany()); -$helper->log(' Manager - ' . $spreadsheet->getProperties()->getManager()); - -$helper->log('Custom Properties:'); -$customProperties = $spreadsheet->getProperties()->getCustomProperties(); -foreach ($customProperties as $customProperty) { - $propertyValue = $spreadsheet->getProperties()->getCustomPropertyValue($customProperty); - $propertyType = $spreadsheet->getProperties()->getCustomPropertyType($customProperty); - if ($propertyType == Properties::PROPERTY_TYPE_DATE) { - $formattedValue = date('d-M-Y H:i:s', $propertyValue); - } elseif ($propertyType == Properties::PROPERTY_TYPE_BOOLEAN) { - $formattedValue = $propertyValue ? 'TRUE' : 'FALSE'; - } else { - $formattedValue = $propertyValue; - } - $helper->log(' ' . $customProperty . ' - (' . $propertyType . ') - ' . $formattedValue); -} - -$helper->logEndingNotes(); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/31_Document_properties_write_xls.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/31_Document_properties_write_xls.php deleted file mode 100644 index d58c3182..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/31_Document_properties_write_xls.php +++ /dev/null @@ -1,68 +0,0 @@ -load($inputFileName); -$helper->logRead($inputFileType, $inputFileName, $callStartTime); - -$helper->log('Adjust properties'); -$spreadsheet->getProperties()->setTitle('Office 95 XLS Test Document') - ->setSubject('Office 95 XLS Test Document') - ->setDescription('Test XLS document, generated using PhpSpreadsheet') - ->setKeywords('office 95 biff php'); - -// Save Excel 95 file -$filename = $helper->getFilename(__FILE__, 'xls'); -$writer = IOFactory::createWriter($spreadsheet, 'Xls'); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); - -$helper->logEndingNotes(); - -// Reread File -$helper->log('Reread Xls file'); -$spreadsheetRead = IOFactory::load($filename); - -// Set properties -$helper->log('Get properties'); - -$helper->log('Core Properties:'); -$helper->log(' Created by - ' . $spreadsheet->getProperties()->getCreator()); -$helper->log(' Created on - ' . date('d-M-Y' . $spreadsheet->getProperties()->getCreated()) . ' at ' . date('H:i:s' . $spreadsheet->getProperties()->getCreated())); -$helper->log(' Last Modified by - ' . $spreadsheet->getProperties()->getLastModifiedBy()); -$helper->log(' Last Modified on - ' . date('d-M-Y' . $spreadsheet->getProperties()->getModified()) . ' at ' . date('H:i:s' . $spreadsheet->getProperties()->getModified())); -$helper->log(' Title - ' . $spreadsheet->getProperties()->getTitle()); -$helper->log(' Subject - ' . $spreadsheet->getProperties()->getSubject()); -$helper->log(' Description - ' . $spreadsheet->getProperties()->getDescription()); -$helper->log(' Keywords: - ' . $spreadsheet->getProperties()->getKeywords()); - -$helper->log('Extended (Application) Properties:'); -$helper->log(' Category - ' . $spreadsheet->getProperties()->getCategory()); -$helper->log(' Company - ' . $spreadsheet->getProperties()->getCompany()); -$helper->log(' Manager - ' . $spreadsheet->getProperties()->getManager()); - -$helper->log('Custom Properties:'); -$customProperties = $spreadsheet->getProperties()->getCustomProperties(); -foreach ($customProperties as $customProperty) { - $propertyValue = $spreadsheet->getProperties()->getCustomPropertyValue($customProperty); - $propertyType = $spreadsheet->getProperties()->getCustomPropertyType($customProperty); - if ($propertyType == Properties::PROPERTY_TYPE_DATE) { - $formattedValue = date('d-M-Y H:i:s', $propertyValue); - } elseif ($propertyType == Properties::PROPERTY_TYPE_BOOLEAN) { - $formattedValue = $propertyValue ? 'TRUE' : 'FALSE'; - } else { - $formattedValue = $propertyValue; - } - $helper->log(' ' . $customProperty . ' - (' . $propertyType . ') - ' . $formattedValue); -} - -$helper->logEndingNotes(); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/37_Page_layout_view.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/37_Page_layout_view.php deleted file mode 100644 index d9bac80a..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/37_Page_layout_view.php +++ /dev/null @@ -1,32 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('PHPOffice') - ->setLastModifiedBy('PHPOffice') - ->setTitle('PhpSpreadsheet Test Document') - ->setSubject('PhpSpreadsheet Test Document') - ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') - ->setKeywords('Office PhpSpreadsheet php') - ->setCategory('Test result file'); - -// Add some data -$helper->log('Add some data'); -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!'); - -// Set the page layout view as page layout -$spreadsheet->getActiveSheet()->getSheetView()->setView(SheetView::SHEETVIEW_PAGE_LAYOUT); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/38_Clone_worksheet.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/38_Clone_worksheet.php deleted file mode 100644 index 83f2d9ce..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/38_Clone_worksheet.php +++ /dev/null @@ -1,57 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PhpSpreadsheet Test Document') - ->setSubject('PhpSpreadsheet Test Document') - ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') - ->setKeywords('office PhpSpreadsheet php') - ->setCategory('Test result file'); - -// Add some data -$helper->log('Add some data'); -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A1', 'Hello') - ->setCellValue('B2', 'world!') - ->setCellValue('C1', 'Hello') - ->setCellValue('D2', 'world!'); - -// Miscellaneous glyphs, UTF-8 -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A4', 'Miscellaneous glyphs') - ->setCellValue('A5', 'éàèùâêîôûëïüÿäöüç'); - -$spreadsheet->getActiveSheet()->setCellValue('A8', "Hello\nWorld"); -$spreadsheet->getActiveSheet()->getRowDimension(8)->setRowHeight(-1); -$spreadsheet->getActiveSheet()->getStyle('A8')->getAlignment()->setWrapText(true); - -// Rename worksheet -$helper->log('Rename worksheet'); -$spreadsheet->getActiveSheet()->setTitle('Simple'); - -// Clone worksheet -$helper->log('Clone worksheet'); -$clonedSheet = clone $spreadsheet->getActiveSheet(); -$clonedSheet - ->setCellValue('A1', 'Goodbye') - ->setCellValue('A2', 'cruel') - ->setCellValue('C1', 'Goodbye') - ->setCellValue('C2', 'cruel'); - -// Rename cloned worksheet -$helper->log('Rename cloned worksheet'); -$clonedSheet->setTitle('Simple Clone'); -$spreadsheet->addSheet($clonedSheet); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/39_Dropdown.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/39_Dropdown.php deleted file mode 100644 index e34d73e6..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/39_Dropdown.php +++ /dev/null @@ -1,129 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties() - ->setCreator('PHPOffice') - ->setLastModifiedBy('PHPOffice') - ->setTitle('PhpSpreadsheet Test Document') - ->setSubject('PhpSpreadsheet Test Document') - ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') - ->setKeywords('Office PhpSpreadsheet php') - ->setCategory('Test result file'); -function transpose($value) -{ - return [$value]; -} - -// Add some data -$continentColumn = 'D'; -$column = 'F'; - -// Set data for dropdowns -$continents = glob(__DIR__ . '/data/continents/*'); -foreach ($continents as $key => $filename) { - $continent = pathinfo($filename, PATHINFO_FILENAME); - $helper->log("Loading $continent"); - $continent = str_replace(' ', '_', $continent); - $countries = file($filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); - $countryCount = count($countries); - - // Transpose $countries from a row to a column array - $countries = array_map('transpose', $countries); - $spreadsheet->getActiveSheet() - ->fromArray($countries, null, $column . '1'); - $spreadsheet->addNamedRange( - new NamedRange( - $continent, - $spreadsheet->getActiveSheet(), - $column . '1:' . $column . $countryCount - ) - ); - $spreadsheet->getActiveSheet() - ->getColumnDimension($column) - ->setVisible(false); - - $spreadsheet->getActiveSheet() - ->setCellValue($continentColumn . ($key + 1), $continent); - - ++$column; -} - -// Hide the dropdown data -$spreadsheet->getActiveSheet() - ->getColumnDimension($continentColumn) - ->setVisible(false); - -$spreadsheet->addNamedRange( - new NamedRange( - 'Continents', - $spreadsheet->getActiveSheet(), - $continentColumn . '1:' . $continentColumn . count($continents) - ) -); - -// Set selection cells -$spreadsheet->getActiveSheet() - ->setCellValue('A1', 'Continent:'); -$spreadsheet->getActiveSheet() - ->setCellValue('B1', 'Select continent'); -$spreadsheet->getActiveSheet() - ->setCellValue('B3', '=' . $column . 1); -$spreadsheet->getActiveSheet() - ->setCellValue('B3', 'Select country'); -$spreadsheet->getActiveSheet() - ->getStyle('A1:A3') - ->getFont()->setBold(true); - -// Set linked validators -$validation = $spreadsheet->getActiveSheet() - ->getCell('B1') - ->getDataValidation(); -$validation->setType(DataValidation::TYPE_LIST) - ->setErrorStyle(DataValidation::STYLE_INFORMATION) - ->setAllowBlank(false) - ->setShowInputMessage(true) - ->setShowErrorMessage(true) - ->setShowDropDown(true) - ->setErrorTitle('Input error') - ->setError('Continent is not in the list.') - ->setPromptTitle('Pick from the list') - ->setPrompt('Please pick a continent from the drop-down list.') - ->setFormula1('=Continents'); - -$spreadsheet->getActiveSheet() - ->setCellValue('A3', 'Country:'); -$spreadsheet->getActiveSheet() - ->getStyle('A3') - ->getFont()->setBold(true); - -$validation = $spreadsheet->getActiveSheet() - ->getCell('B3') - ->getDataValidation(); -$validation->setType(DataValidation::TYPE_LIST) - ->setErrorStyle(DataValidation::STYLE_INFORMATION) - ->setAllowBlank(false) - ->setShowInputMessage(true) - ->setShowErrorMessage(true) - ->setShowDropDown(true) - ->setErrorTitle('Input error') - ->setError('Country is not in the list.') - ->setPromptTitle('Pick from the list') - ->setPrompt('Please pick a country from the drop-down list.') - ->setFormula1('=INDIRECT($B$1)'); - -$spreadsheet->getActiveSheet()->getColumnDimension('A')->setWidth(12); -$spreadsheet->getActiveSheet()->getColumnDimension('B')->setWidth(30); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/40_Duplicate_style.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/40_Duplicate_style.php deleted file mode 100644 index a2dc5f5f..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/40_Duplicate_style.php +++ /dev/null @@ -1,36 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -$helper->log('Create styles array'); -$styles = []; -for ($i = 0; $i < 10; ++$i) { - $style = new Style(); - $style->getFont()->setSize($i + 4); - $styles[] = $style; -} - -$helper->log('Add data (begin)'); -$t = microtime(true); -for ($col = 1; $col <= 50; ++$col) { - for ($row = 0; $row < 100; ++$row) { - $str = ($row + $col); - $style = $styles[$row % 10]; - $coord = Coordinate::stringFromColumnIndex($col) . ($row + 1); - $worksheet->setCellValue($coord, $str); - $worksheet->duplicateStyle($style, $coord); - } -} -$d = microtime(true) - $t; -$helper->log('Add data (end) . time: ' . round($d . 2) . ' s'); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/41_Password.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/41_Password.php deleted file mode 100644 index 9aa8e6db..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/41_Password.php +++ /dev/null @@ -1,12 +0,0 @@ -getSecurity()->setLockWindows(true); -$spreadsheet->getSecurity()->setLockStructure(true); -$spreadsheet->getSecurity()->setWorkbookPassword('secret'); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/42_RichText.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/42_RichText.php deleted file mode 100644 index 43b35a62..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/42_RichText.php +++ /dev/null @@ -1,98 +0,0 @@ -log('Create new Spreadsheet object'); -$spreadsheet = new Spreadsheet(); - -// Set document properties -$helper->log('Set document properties'); -$spreadsheet->getProperties()->setCreator('Maarten Balliauw') - ->setLastModifiedBy('Maarten Balliauw') - ->setTitle('PhpSpreadsheet Test Document') - ->setSubject('PhpSpreadsheet Test Document') - ->setDescription('Test document for PhpSpreadsheet, generated using PHP classes.') - ->setKeywords('office PhpSpreadsheet php') - ->setCategory('Test result file'); - -// Add some data -$helper->log('Add some data'); - -$html1 = ' -

    My very first example of rich text
    generated from html markup

    -

    - -This block contains an italicized word; -while this block uses an underline. - -

    -

    -I want to eat healthy food pizza. - -'; - -$html2 = '

    - - 100°C is a hot temperature - -
    - - 10°F is cold - -

    '; - -$html3 = '23 equals 8'; - -$html4 = 'H2SO4 is the chemical formula for Sulphuric acid'; - -$html5 = 'bold, italic, bold+italic'; - -$wizard = new HtmlHelper(); -$richText = $wizard->toRichTextObject($html1); - -$spreadsheet->getActiveSheet() - ->setCellValue('A1', $richText); - -$spreadsheet->getActiveSheet() - ->getColumnDimension('A') - ->setWidth(48); -$spreadsheet->getActiveSheet() - ->getRowDimension(1) - ->setRowHeight(-1); -$spreadsheet->getActiveSheet()->getStyle('A1') - ->getAlignment() - ->setWrapText(true); - -$richText = $wizard->toRichTextObject($html2); - -$spreadsheet->getActiveSheet() - ->setCellValue('A2', $richText); - -$spreadsheet->getActiveSheet() - ->getRowDimension(1) - ->setRowHeight(-1); -$spreadsheet->getActiveSheet() - ->getStyle('A2') - ->getAlignment() - ->setWrapText(true); - -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A3', $wizard->toRichTextObject($html3)); - -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A4', $wizard->toRichTextObject($html4)); - -$spreadsheet->setActiveSheetIndex(0) - ->setCellValue('A5', $wizard->toRichTextObject($html5)); - -// Rename worksheet -$helper->log('Rename worksheet'); -$spreadsheet->getActiveSheet() - ->setTitle('Rich Text Examples'); - -// Save -$helper->write($spreadsheet, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/43_Merge_workbooks.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/43_Merge_workbooks.php deleted file mode 100644 index 86314b3b..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/43_Merge_workbooks.php +++ /dev/null @@ -1,26 +0,0 @@ -log('Load MergeBook1 from Xlsx file'); -$filename1 = __DIR__ . '/../templates/43mergeBook1.xlsx'; -$callStartTime = microtime(true); -$spreadsheet1 = IOFactory::load($filename1); -$helper->logRead('Xlsx', $filename1, $callStartTime); - -$helper->log('Load MergeBook2 from Xlsx file'); -$filename2 = __DIR__ . '/../templates/43mergeBook2.xlsx'; -$callStartTime = microtime(true); -$spreadsheet2 = IOFactory::load($filename2); -$helper->logRead('Xlsx', $filename2, $callStartTime); - -foreach ($spreadsheet2->getSheetNames() as $sheetName) { - $sheet = $spreadsheet2->getSheetByName($sheetName); - $sheet->setTitle($sheet->getTitle() . ' copied'); - $spreadsheet1->addExternalSheet($sheet); -} - -// Save -$helper->write($spreadsheet1, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/44_Worksheet_info.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/44_Worksheet_info.php deleted file mode 100644 index 33c0cd05..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/44_Worksheet_info.php +++ /dev/null @@ -1,26 +0,0 @@ -getTemporaryFilename(); -$writer = new Xlsx($sampleSpreadsheet); -$writer->save($filename); - -$inputFileType = IOFactory::identify($filename); -$reader = IOFactory::createReader($inputFileType); -$sheetList = $reader->listWorksheetNames($filename); -$sheetInfo = $reader->listWorksheetInfo($filename); - -$helper->log('File Type:'); -var_dump($inputFileType); - -$helper->log('Worksheet Names:'); -var_dump($sheetList); - -$helper->log('Worksheet Names:'); -var_dump($sheetInfo); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/45_Quadratic_equation_solver.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/45_Quadratic_equation_solver.php deleted file mode 100644 index a59a0ceb..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/45_Quadratic_equation_solver.php +++ /dev/null @@ -1,43 +0,0 @@ - -
    - Enter the coefficients for the Ax2 + Bx + C = 0 - - - - - - - - - - -
    A 
    B 
    C 
    -
    - If A=0, the equation is not quadratic. -
    - -log('The equation is not quadratic'); - } else { - // Calculate and Display the results - $helper->log('
    Roots:
    '); - - $discriminantFormula = '=POWER(' . $_POST['B'] . ',2) - (4 * ' . $_POST['A'] . ' * ' . $_POST['C'] . ')'; - $discriminant = Calculation::getInstance()->calculateFormula($discriminantFormula); - - $r1Formula = '=IMDIV(IMSUM(-' . $_POST['B'] . ',IMSQRT(' . $discriminant . ')),2 * ' . $_POST['A'] . ')'; - $r2Formula = '=IF(' . $discriminant . '=0,"Only one root",IMDIV(IMSUB(-' . $_POST['B'] . ',IMSQRT(' . $discriminant . ')),2 * ' . $_POST['A'] . '))'; - - $helper->log(Calculation::getInstance()->calculateFormula($r1Formula)); - $helper->log(Calculation::getInstance()->calculateFormula($r2Formula)); - $callEndTime = microtime(true); - $helper->logEndingNotes(); - } -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/46_ReadHtml.php b/vendor/phpoffice/phpspreadsheet/samples/Basic/46_ReadHtml.php deleted file mode 100644 index bd37af9b..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/46_ReadHtml.php +++ /dev/null @@ -1,19 +0,0 @@ -load($html); - -$helper->logRead('Html', $html, $callStartTime); - -// Save -$helper->write($objPHPExcel, __FILE__); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/Africa.txt b/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/Africa.txt deleted file mode 100644 index 407fa769..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/Africa.txt +++ /dev/null @@ -1,54 +0,0 @@ -Algeria -Angola -Benin -Botswana -Burkina -Burundi -Cameroon -Cape Verde -Central African Republic -Chad -Comoros -Congo -Congo, Democratic Republic of -Djibouti -Egypt -Equatorial Guinea -Eritrea -Ethiopia -Gabon -Gambia -Ghana -Guinea -Guinea-Bissau -Ivory Coast -Kenya -Lesotho -Liberia -Libya -Madagascar -Malawi -Mali -Mauritania -Mauritius -Morocco -Mozambique -Namibia -Niger -Nigeria -Rwanda -Sao Tome and Principe -Senegal -Seychelles -Sierra Leone -Somalia -South Africa -South Sudan -Sudan -Swaziland -Tanzania -Togo -Tunisia -Uganda -Zambia -Zimbabwe diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/Asia.txt b/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/Asia.txt deleted file mode 100644 index 9ce006c5..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/Asia.txt +++ /dev/null @@ -1,44 +0,0 @@ -Afghanistan -Bahrain -Bangladesh -Bhutan -Brunei -Burma (Myanmar) -Cambodia -China -East Timor -India -Indonesia -Iran -Iraq -Israel -Japan -Jordan -Kazakhstan -Korea, North -Korea, South -Kuwait -Kyrgyzstan -Laos -Lebanon -Malaysia -Maldives -Mongolia -Nepal -Oman -Pakistan -Philippines -Qatar -Russian Federation -Saudi Arabia -Singapore -Sri Lanka -Syria -Tajikistan -Thailand -Turkey -Turkmenistan -United Arab Emirates -Uzbekistan -Vietnam -Yemen diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/Europe.txt b/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/Europe.txt deleted file mode 100644 index 70c11607..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/Europe.txt +++ /dev/null @@ -1,47 +0,0 @@ -Albania -Andorra -Armenia -Austria -Azerbaijan -Belarus -Belgium -Bosnia and Herzegovina -Bulgaria -Croatia -Cyprus -Czech Republic -Denmark -Estonia -Finland -France -Georgia -Germany -Greece -Hungary -Iceland -Ireland -Italy -Latvia -Liechtenstein -Lithuania -Luxembourg -Macedonia -Malta -Moldova -Monaco -Montenegro -Netherlands -Norway -Poland -Portugal -Romania -San Marino -Serbia -Slovakia -Slovenia -Spain -Sweden -Switzerland -Ukraine -United Kingdom -Vatican City diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/North America.txt b/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/North America.txt deleted file mode 100644 index 5881ae13..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/North America.txt +++ /dev/null @@ -1,23 +0,0 @@ -Antigua and Barbuda -Bahamas -Barbados -Belize -Canada -Costa Rica -Cuba -Dominica -Dominican Republic -El Salvador -Grenada -Guatemala -Haiti -Honduras -Jamaica -Mexico -Nicaragua -Panama -Saint Kitts and Nevis -Saint Lucia -Saint Vincent and the Grenadines -Trinidad and Tobago -United States diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/Oceania.txt b/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/Oceania.txt deleted file mode 100644 index cbdc896c..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/Oceania.txt +++ /dev/null @@ -1,14 +0,0 @@ -Australia -Fiji -Kiribati -Marshall Islands -Micronesia -Nauru -New Zealand -Palau -Papua New Guinea -Samoa -Solomon Islands -Tonga -Tuvalu -Vanuatu diff --git a/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/South America.txt b/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/South America.txt deleted file mode 100644 index 777ffbfb..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Basic/data/continents/South America.txt +++ /dev/null @@ -1,12 +0,0 @@ -Argentina -Bolivia -Brazil -Chile -Colombia -Ecuador -Guyana -Paraguay -Peru -Suriname -Uruguay -Venezuela diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DAVERAGE.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DAVERAGE.php deleted file mode 100644 index 92d84014..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DAVERAGE.php +++ /dev/null @@ -1,56 +0,0 @@ -log('Returns the average of selected database entries.'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'], - ['Apple', 18, 20, 14, 105.00], - ['Pear', 12, 12, 10, 96.00], - ['Cherry', 13, 14, 9, 105.00], - ['Apple', 14, 15, 10, 75.00], - ['Pear', 9, 8, 8, 76.80], - ['Apple', 8, 9, 6, 45.00], -]; -$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'], - ['="=Apple"', '>10', null, null, null, '<16'], - ['="=Pear"', null, null, null, null, null], -]; - -$worksheet->fromArray($criteria, null, 'A1'); -$worksheet->fromArray($database, null, 'A4'); - -$worksheet->setCellValue('A12', 'The Average yield of Apple trees over 10\' in height'); -$worksheet->setCellValue('B12', '=DAVERAGE(A4:E10,"Yield",A1:B2)'); - -$worksheet->setCellValue('A13', 'The Average age of all Apple and Pear trees in the orchard'); -$worksheet->setCellValue('B13', '=DAVERAGE(A4:E10,3,A1:A3)'); - -$helper->log('Database'); - -$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); -var_dump($databaseData); - -// Test the formulae -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:B2', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A12')->getValue()); -$helper->log('DAVERAGE() Result is ' . $worksheet->getCell('B12')->getCalculatedValue()); - -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A13')->getValue()); -$helper->log('DAVERAGE() Result is ' . $worksheet->getCell('B13')->getCalculatedValue()); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DCOUNT.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DCOUNT.php deleted file mode 100644 index d869a4bc..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DCOUNT.php +++ /dev/null @@ -1,55 +0,0 @@ -log('Counts the cells that contain numbers in a database.'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'], - ['Apple', 18, 20, 14, 105.00], - ['Pear', 12, 12, 10, 96.00], - ['Cherry', 13, 14, 9, 105.00], - ['Apple', 14, 15, 10, 75.00], - ['Pear', 9, 8, 8, 76.80], - ['Apple', 8, 9, 6, 45.00], -]; -$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'], - ['="=Apple"', '>10', null, null, null, '<16'], - ['="=Pear"', null, null, null, null, null], -]; - -$worksheet->fromArray($criteria, null, 'A1'); -$worksheet->fromArray($database, null, 'A4'); - -$worksheet->setCellValue('A12', 'The Number of Apple trees over 10\' in height'); -$worksheet->setCellValue('B12', '=DCOUNT(A4:E10,"Yield",A1:B2)'); - -$worksheet->setCellValue('A13', 'The Number of Apple and Pear trees in the orchard'); -$worksheet->setCellValue('B13', '=DCOUNT(A4:E10,3,A1:A3)'); - -$helper->log('Database'); - -$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); -var_dump($databaseData); - -// Test the formulae -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:B2', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A12')->getValue()); -$helper->log('DCOUNT() Result is ' . $worksheet->getCell('B12')->getCalculatedValue()); - -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A13')->getValue()); -$helper->log('DCOUNT() Result is ' . $worksheet->getCell('B13')->getCalculatedValue()); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DGET.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DGET.php deleted file mode 100644 index 9f543c91..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DGET.php +++ /dev/null @@ -1,52 +0,0 @@ -log('Extracts a single value from a column of a list or database that matches conditions that you specify.'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'], - ['Apple', 18, 20, 14, 105.00], - ['Pear', 12, 12, 10, 96.00], - ['Cherry', 13, 14, 9, 105.00], - ['Apple', 14, 15, 10, 75.00], - ['Pear', 9, 8, 8, 76.80], - ['Apple', 8, 9, 6, 45.00], -]; -$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'], - ['="=Apple"', '>10', null, null, null, '<16'], - ['="=Pear"', null, null, null, null, null], -]; - -$worksheet->fromArray($criteria, null, 'A1'); -$worksheet->fromArray($database, null, 'A4'); - -$worksheet->setCellValue('A12', 'The height of the Apple tree between 10\' and 16\' tall'); -$worksheet->setCellValue('B12', '=DGET(A4:E10,"Height",A1:F2)'); - -$helper->log('Database'); - -$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); -var_dump($databaseData); - -// Test the formulae -$helper->log('Criteria'); - -$helper->log('ALL'); - -$helper->log($worksheet->getCell('A12')->getValue()); -$helper->log('DMAX() Result is ' . $worksheet->getCell('B12')->getCalculatedValue()); - -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A13')->getValue()); -$helper->log('DMAX() Result is ' . $worksheet->getCell('B13')->getCalculatedValue()); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DMAX.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DMAX.php deleted file mode 100644 index c48928d4..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DMAX.php +++ /dev/null @@ -1,55 +0,0 @@ -log('Returns the maximum value from selected database entries.'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'], - ['Apple', 18, 20, 14, 105.00], - ['Pear', 12, 12, 10, 96.00], - ['Cherry', 13, 14, 9, 105.00], - ['Apple', 14, 15, 10, 75.00], - ['Pear', 9, 8, 8, 76.80], - ['Apple', 8, 9, 6, 45.00], -]; -$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'], - ['="=Apple"', '>10', null, null, null, '<16'], - ['="=Pear"', null, null, null, null, null], -]; - -$worksheet->fromArray($criteria, null, 'A1'); -$worksheet->fromArray($database, null, 'A4'); - -$worksheet->setCellValue('A12', 'The tallest tree in the orchard'); -$worksheet->setCellValue('B12', '=DMAX(A4:E10,"Height",A4:E10)'); - -$worksheet->setCellValue('A13', 'The Oldest apple tree in the orchard'); -$worksheet->setCellValue('B13', '=DMAX(A4:E10,3,A1:A2)'); - -$helper->log('Database'); - -$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); -var_dump($databaseData); - -// Test the formulae -$helper->log('Criteria'); - -$helper->log('ALL'); - -$helper->log($worksheet->getCell('A12')->getValue()); -$helper->log('DMAX() Result is ' . $worksheet->getCell('B12')->getCalculatedValue()); - -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A13')->getValue()); -$helper->log('DMAX() Result is ' . $worksheet->getCell('B13')->getCalculatedValue()); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DMIN.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DMIN.php deleted file mode 100644 index 7bcaa206..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DMIN.php +++ /dev/null @@ -1,55 +0,0 @@ -log('Returns the minimum value from selected database entries.'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'], - ['Apple', 18, 20, 14, 105.00], - ['Pear', 12, 12, 10, 96.00], - ['Cherry', 13, 14, 9, 105.00], - ['Apple', 14, 15, 10, 75.00], - ['Pear', 9, 8, 8, 76.80], - ['Apple', 8, 9, 6, 45.00], -]; -$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'], - ['="=Apple"', '>10', null, null, null, '<16'], - ['="=Pear"', null, null, null, null, null], -]; - -$worksheet->fromArray($criteria, null, 'A1'); -$worksheet->fromArray($database, null, 'A4'); - -$worksheet->setCellValue('A12', 'The shortest tree in the orchard'); -$worksheet->setCellValue('B12', '=DMIN(A4:E10,"Height",A4:E10)'); - -$worksheet->setCellValue('A13', 'The Youngest apple tree in the orchard'); -$worksheet->setCellValue('B13', '=DMIN(A4:E10,3,A1:A2)'); - -$helper->log('Database'); - -$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); -var_dump($databaseData); - -// Test the formulae -$helper->log('Criteria'); - -$helper->log('ALL'); - -$helper->log($worksheet->getCell('A12')->getValue()); -$helper->log('DMIN() Result is ' . $worksheet->getCell('B12')->getCalculatedValue()); - -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A13')->getValue()); -$helper->log('DMIN() Result is ' . $worksheet->getCell('B13')->getCalculatedValue()); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DPRODUCT.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DPRODUCT.php deleted file mode 100644 index 7c14ded6..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DPRODUCT.php +++ /dev/null @@ -1,52 +0,0 @@ -log('Multiplies the values in a column of a list or database that match conditions that you specify.'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'], - ['Apple', 18, 20, 14, 105.00], - ['Pear', 12, 12, 10, 96.00], - ['Cherry', 13, 14, 9, 105.00], - ['Apple', 14, 15, 10, 75.00], - ['Pear', 9, 8, 8, 76.80], - ['Apple', 8, 9, 6, 45.00], -]; -$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'], - ['="=Apple"', '>10', null, null, null, '<16'], - ['="=Pear"', null, null, null, null, null], -]; - -$worksheet->fromArray($criteria, null, 'A1'); -$worksheet->fromArray($database, null, 'A4'); - -$worksheet->setCellValue('A12', 'The product of the yields of all Apple trees over 10\' in the orchard'); -$worksheet->setCellValue('B12', '=DPRODUCT(A4:E10,"Yield",A1:B2)'); - -$helper->log('Database'); - -$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); -var_dump($databaseData); - -// Test the formulae -$helper->log('Criteria'); - -$helper->log('ALL'); - -$helper->log($worksheet->getCell('A12')->getValue()); -$helper->log('DMAX() Result is ' . $worksheet->getCell('B12')->getCalculatedValue()); - -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A2', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A13')->getValue()); -$helper->log('DMAX() Result is ' . $worksheet->getCell('B13')->getCalculatedValue()); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DSTDEV.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DSTDEV.php deleted file mode 100644 index 7f09fa59..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DSTDEV.php +++ /dev/null @@ -1,56 +0,0 @@ -log('Estimates the standard deviation based on a sample of selected database entries.'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'], - ['Apple', 18, 20, 14, 105.00], - ['Pear', 12, 12, 10, 96.00], - ['Cherry', 13, 14, 9, 105.00], - ['Apple', 14, 15, 10, 75.00], - ['Pear', 9, 8, 8, 76.80], - ['Apple', 8, 9, 6, 45.00], -]; -$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'], - ['="=Apple"', '>10', null, null, null, '<16'], - ['="=Pear"', null, null, null, null, null], -]; - -$worksheet->fromArray($criteria, null, 'A1'); -$worksheet->fromArray($database, null, 'A4'); - -$worksheet->setCellValue('A12', 'The estimated standard deviation in the yield of Apple and Pear trees'); -$worksheet->setCellValue('B12', '=DSTDEV(A4:E10,"Yield",A1:A3)'); - -$worksheet->setCellValue('A13', 'The estimated standard deviation in height of Apple and Pear trees'); -$worksheet->setCellValue('B13', '=DSTDEV(A4:E10,2,A1:A3)'); - -$helper->log('Database'); - -$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); -var_dump($databaseData); - -// Test the formulae -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A12')->getValue()); -$helper->log('DSTDEV() Result is ' . $worksheet->getCell('B12')->getCalculatedValue()); - -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A13')->getValue()); -$helper->log('DSTDEV() Result is ' . $worksheet->getCell('B13')->getCalculatedValue()); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DSTDEVP.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DSTDEVP.php deleted file mode 100644 index 9e999a80..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DSTDEVP.php +++ /dev/null @@ -1,55 +0,0 @@ -log('Calculates the standard deviation based on the entire population of selected database entries.'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'], - ['Apple', 18, 20, 14, 105.00], - ['Pear', 12, 12, 10, 96.00], - ['Cherry', 13, 14, 9, 105.00], - ['Apple', 14, 15, 10, 75.00], - ['Pear', 9, 8, 8, 76.80], - ['Apple', 8, 9, 6, 45.00], -]; -$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'], - ['="=Apple"', '>10', null, null, null, '<16'], - ['="=Pear"', null, null, null, null, null], -]; - -$worksheet->fromArray($criteria, null, 'A1'); -$worksheet->fromArray($database, null, 'A4'); - -$worksheet->setCellValue('A12', 'The standard deviation in the yield of Apple and Pear trees'); -$worksheet->setCellValue('B12', '=DSTDEVP(A4:E10,"Yield",A1:A3)'); - -$worksheet->setCellValue('A13', 'The standard deviation in height of Apple and Pear trees'); -$worksheet->setCellValue('B13', '=DSTDEVP(A4:E10,2,A1:A3)'); - -$helper->log('Database'); - -$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); -var_dump($databaseData); - -// Test the formulae -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A12')->getValue()); -$helper->log('DSTDEVP() Result is ' . $worksheet->getCell('B12')->getCalculatedValue()); - -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A13')->getValue()); -$helper->log('DSTDEVP() Result is ' . $worksheet->getCell('B13')->getCalculatedValue()); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DVAR.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DVAR.php deleted file mode 100644 index 2a5f8749..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DVAR.php +++ /dev/null @@ -1,55 +0,0 @@ -log('Estimates variance based on a sample from selected database entries.'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'], - ['Apple', 18, 20, 14, 105.00], - ['Pear', 12, 12, 10, 96.00], - ['Cherry', 13, 14, 9, 105.00], - ['Apple', 14, 15, 10, 75.00], - ['Pear', 9, 8, 8, 76.80], - ['Apple', 8, 9, 6, 45.00], -]; -$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'], - ['="=Apple"', '>10', null, null, null, '<16'], - ['="=Pear"', null, null, null, null, null], -]; - -$worksheet->fromArray($criteria, null, 'A1'); -$worksheet->fromArray($database, null, 'A4'); - -$worksheet->setCellValue('A12', 'The estimated variance in the yield of Apple and Pear trees'); -$worksheet->setCellValue('B12', '=DVAR(A4:E10,"Yield",A1:A3)'); - -$worksheet->setCellValue('A13', 'The estimated variance in height of Apple and Pear trees'); -$worksheet->setCellValue('B13', '=DVAR(A4:E10,2,A1:A3)'); - -$helper->log('Database'); - -$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); -var_dump($databaseData); - -// Test the formulae -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A12')->getValue()); -$helper->log('DVAR() Result is ' . $worksheet->getCell('B12')->getCalculatedValue()); - -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A13')->getValue()); -$helper->log('DVAR() Result is ' . $worksheet->getCell('B13')->getCalculatedValue()); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DVARP.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DVARP.php deleted file mode 100644 index 4f57113b..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/Database/DVARP.php +++ /dev/null @@ -1,56 +0,0 @@ -log('Calculates variance based on the entire population of selected database entries,'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$database = [['Tree', 'Height', 'Age', 'Yield', 'Profit'], - ['Apple', 18, 20, 14, 105.00], - ['Pear', 12, 12, 10, 96.00], - ['Cherry', 13, 14, 9, 105.00], - ['Apple', 14, 15, 10, 75.00], - ['Pear', 9, 8, 8, 76.80], - ['Apple', 8, 9, 6, 45.00], -]; -$criteria = [['Tree', 'Height', 'Age', 'Yield', 'Profit', 'Height'], - ['="=Apple"', '>10', null, null, null, '<16'], - ['="=Pear"', null, null, null, null, null], -]; - -$worksheet->fromArray($criteria, null, 'A1'); -$worksheet->fromArray($database, null, 'A4'); - -$worksheet->setCellValue('A12', 'The variance in the yield of Apple and Pear trees'); -$worksheet->setCellValue('B12', '=DVARP(A4:E10,"Yield",A1:A3)'); - -$worksheet->setCellValue('A13', 'The variance in height of Apple and Pear trees'); -$worksheet->setCellValue('B13', '=DVARP(A4:E10,2,A1:A3)'); - -$helper->log('Database'); - -$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true); -var_dump($databaseData); - -// Test the formulae -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A12')->getValue()); -$helper->log('DVARP() Result is ' . $worksheet->getCell('B12')->getCalculatedValue()); - -$helper->log('Criteria'); - -$criteriaData = $worksheet->rangeToArray('A1:A3', null, true, true, true); -var_dump($criteriaData); - -$helper->log($worksheet->getCell('A13')->getValue()); -$helper->log('DVARP() Result is ' . $worksheet->getCell('B13')->getCalculatedValue()); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/DateTime/DATE.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/DateTime/DATE.php deleted file mode 100644 index 5d758f76..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/DateTime/DATE.php +++ /dev/null @@ -1,41 +0,0 @@ -log('Returns the serial number of a particular date.'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$testDates = [[2012, 3, 26], [2012, 2, 29], [2012, 4, 1], [2012, 12, 25], - [2012, 10, 31], [2012, 11, 5], [2012, 1, 1], [2012, 3, 17], - [2011, 2, 29], [7, 5, 3], [2012, 13, 1], [2012, 11, 45], - [2012, 0, 0], [2012, 1, 0], [2012, 0, 1], - [2012, -2, 2], [2012, 2, -2], [2012, -2, -2], -]; -$testDateCount = count($testDates); - -$worksheet->fromArray($testDates, null, 'A1', true); - -for ($row = 1; $row <= $testDateCount; ++$row) { - $worksheet->setCellValue('D' . $row, '=DATE(A' . $row . ',B' . $row . ',C' . $row . ')'); - $worksheet->setCellValue('E' . $row, '=D' . $row); -} -$worksheet->getStyle('E1:E' . $testDateCount) - ->getNumberFormat() - ->setFormatCode('yyyy-mmm-dd'); - -// Test the formulae -for ($row = 1; $row <= $testDateCount; ++$row) { - $helper->log('Year: ' . $worksheet->getCell('A' . $row)->getFormattedValue()); - $helper->log('Month: ' . $worksheet->getCell('B' . $row)->getFormattedValue()); - $helper->log('Day: ' . $worksheet->getCell('C' . $row)->getFormattedValue()); - $helper->log('Formula: ' . $worksheet->getCell('D' . $row)->getValue()); - $helper->log('Excel DateStamp: ' . $worksheet->getCell('D' . $row)->getFormattedValue()); - $helper->log('Formatted DateStamp: ' . $worksheet->getCell('E' . $row)->getFormattedValue()); - $helper->log(''); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/DateTime/DATEVALUE.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/DateTime/DATEVALUE.php deleted file mode 100644 index 5cdb936d..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/DateTime/DATEVALUE.php +++ /dev/null @@ -1,39 +0,0 @@ -log('Converts a date in the form of text to a serial number.'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$testDates = ['26 March 2012', '29 Feb 2012', 'April 1, 2012', '25/12/2012', - '2012-Oct-31', '5th November', 'January 1st', 'April 2012', - '17-03', '03-2012', '29 Feb 2011', '03-05-07', - '03-MAY-07', '03-13-07', -]; -$testDateCount = count($testDates); - -for ($row = 1; $row <= $testDateCount; ++$row) { - $worksheet->setCellValue('A' . $row, $testDates[$row - 1]); - $worksheet->setCellValue('B' . $row, '=DATEVALUE(A' . $row . ')'); - $worksheet->setCellValue('C' . $row, '=B' . $row); -} - -$worksheet->getStyle('C1:C' . $testDateCount) - ->getNumberFormat() - ->setFormatCode('yyyy-mmm-dd'); - -// Test the formulae -$helper->log('Warning: The PhpSpreadsheet DATEVALUE() function accepts a wider range of date formats than MS Excel DATEFORMAT() function.'); -for ($row = 1; $row <= $testDateCount; ++$row) { - $helper->log('Date String: ' . $worksheet->getCell('A' . $row)->getFormattedValue()); - $helper->log('Formula: ' . $worksheet->getCell('B' . $row)->getValue()); - $helper->log('Excel DateStamp: ' . $worksheet->getCell('B' . $row)->getFormattedValue()); - $helper->log('Formatted DateStamp' . $worksheet->getCell('C' . $row)->getFormattedValue()); - $helper->log(''); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/DateTime/TIME.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/DateTime/TIME.php deleted file mode 100644 index 3d4208ad..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/DateTime/TIME.php +++ /dev/null @@ -1,39 +0,0 @@ -log('Returns the serial number of a particular time.'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$testDates = [[3, 15], [13, 15], [15, 15, 15], [3, 15, 30], - [15, 15, 15], [5], [9, 15, 0], [9, 15, -1], - [13, -14, -15], [0, 0, -1], -]; -$testDateCount = count($testDates); - -$worksheet->fromArray($testDates, null, 'A1', true); - -for ($row = 1; $row <= $testDateCount; ++$row) { - $worksheet->setCellValue('D' . $row, '=TIME(A' . $row . ',B' . $row . ',C' . $row . ')'); - $worksheet->setCellValue('E' . $row, '=D' . $row); -} -$worksheet->getStyle('E1:E' . $testDateCount) - ->getNumberFormat() - ->setFormatCode('hh:mm:ss'); - -// Test the formulae -for ($row = 1; $row <= $testDateCount; ++$row) { - $helper->log('Hour: ' . $worksheet->getCell('A' . $row)->getFormattedValue()); - $helper->log('Minute: ' . $worksheet->getCell('B' . $row)->getFormattedValue()); - $helper->log('Second: ' . $worksheet->getCell('C' . $row)->getFormattedValue()); - $helper->log('Formula: ' . $worksheet->getCell('D' . $row)->getValue()); - $helper->log('Excel TimeStamp: ' . $worksheet->getCell('D' . $row)->getFormattedValue()); - $helper->log('Formatted TimeStamp: ' . $worksheet->getCell('E' . $row)->getFormattedValue()); - $helper->log(''); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Calculations/DateTime/TIMEVALUE.php b/vendor/phpoffice/phpspreadsheet/samples/Calculations/DateTime/TIMEVALUE.php deleted file mode 100644 index f75393cd..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Calculations/DateTime/TIMEVALUE.php +++ /dev/null @@ -1,35 +0,0 @@ -log('Converts a time in the form of text to a serial number.'); - -// Create new PhpSpreadsheet object -$spreadsheet = new Spreadsheet(); -$worksheet = $spreadsheet->getActiveSheet(); - -// Add some data -$testDates = ['3:15', '13:15', '15:15:15', '3:15 AM', '3:15 PM', '5PM', '9:15AM', '13:15AM', -]; -$testDateCount = count($testDates); - -for ($row = 1; $row <= $testDateCount; ++$row) { - $worksheet->setCellValue('A' . $row, $testDates[$row - 1]); - $worksheet->setCellValue('B' . $row, '=TIMEVALUE(A' . $row . ')'); - $worksheet->setCellValue('C' . $row, '=B' . $row); -} - -$worksheet->getStyle('C1:C' . $testDateCount) - ->getNumberFormat() - ->setFormatCode('hh:mm:ss'); - -// Test the formulae -for ($row = 1; $row <= $testDateCount; ++$row) { - $helper->log('Time String: ' . $worksheet->getCell('A' . $row)->getFormattedValue()); - $helper->log('Formula: ' . $worksheet->getCell('B' . $row)->getValue()); - $helper->log('Excel TimeStamp: ' . $worksheet->getCell('B' . $row)->getFormattedValue()); - $helper->log('Formatted TimeStamp: ' . $worksheet->getCell('C' . $row)->getFormattedValue()); - $helper->log(''); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/32_Chart_read_write.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/32_Chart_read_write.php deleted file mode 100644 index ba711c06..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/32_Chart_read_write.php +++ /dev/null @@ -1,83 +0,0 @@ - 1)) { - $inputFileNames = []; - for ($i = 1; $i < $argc; ++$i) { - $inputFileNames[] = __DIR__ . '/../templates/' . $argv[$i]; - } -} else { - $inputFileNames = glob($inputFileNames); -} -foreach ($inputFileNames as $inputFileName) { - $inputFileNameShort = basename($inputFileName); - - if (!file_exists($inputFileName)) { - $helper->log('File ' . $inputFileNameShort . ' does not exist'); - - continue; - } - $reader = IOFactory::createReader($inputFileType); - $reader->setIncludeCharts(true); - $callStartTime = microtime(true); - $spreadsheet = $reader->load($inputFileName); - $helper->logRead($inputFileType, $inputFileName, $callStartTime); - - $helper->log('Iterate worksheets looking at the charts'); - foreach ($spreadsheet->getWorksheetIterator() as $worksheet) { - $sheetName = $worksheet->getTitle(); - $helper->log('Worksheet: ' . $sheetName); - - $chartNames = $worksheet->getChartNames(); - if (empty($chartNames)) { - $helper->log(' There are no charts in this worksheet'); - } else { - natsort($chartNames); - foreach ($chartNames as $i => $chartName) { - $chart = $worksheet->getChartByName($chartName); - if ($chart->getTitle() !== null) { - $caption = '"' . implode(' ', $chart->getTitle()->getCaption()) . '"'; - } else { - $caption = 'Untitled'; - } - $helper->log(' ' . $chartName . ' - ' . $caption); - $indentation = str_repeat(' ', strlen($chartName) + 3); - $groupCount = $chart->getPlotArea()->getPlotGroupCount(); - if ($groupCount == 1) { - $chartType = $chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType(); - $helper->log($indentation . ' ' . $chartType); - } else { - $chartTypes = []; - for ($i = 0; $i < $groupCount; ++$i) { - $chartTypes[] = $chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType(); - } - $chartTypes = array_unique($chartTypes); - if (count($chartTypes) == 1) { - $chartType = 'Multiple Plot ' . array_pop($chartTypes); - $helper->log($indentation . ' ' . $chartType); - } elseif (count($chartTypes) == 0) { - $helper->log($indentation . ' *** Type not yet implemented'); - } else { - $helper->log($indentation . ' Combination Chart'); - } - } - } - } - } - - $outputFileName = $helper->getFilename($inputFileName); - $writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); - $writer->setIncludeCharts(true); - $callStartTime = microtime(true); - $writer->save($outputFileName); - $helper->logWrite($writer, $outputFileName, $callStartTime); - - $spreadsheet->disconnectWorksheets(); - unset($spreadsheet); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/32_Chart_read_write_HTML.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/32_Chart_read_write_HTML.php deleted file mode 100644 index 5febbf93..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/32_Chart_read_write_HTML.php +++ /dev/null @@ -1,89 +0,0 @@ - 1)) { - $inputFileNames = []; - for ($i = 1; $i < $argc; ++$i) { - $inputFileNames[] = __DIR__ . '/../templates/' . $argv[$i]; - } -} else { - $inputFileNames = glob($inputFileNames); -} -foreach ($inputFileNames as $inputFileName) { - $inputFileNameShort = basename($inputFileName); - - if (!file_exists($inputFileName)) { - $helper->log('File ' . $inputFileNameShort . ' does not exist'); - - continue; - } - - $helper->log("Load Test from $inputFileType file " . $inputFileNameShort); - - $reader = IOFactory::createReader($inputFileType); - $reader->setIncludeCharts(true); - $spreadsheet = $reader->load($inputFileName); - - $helper->log('Iterate worksheets looking at the charts'); - foreach ($spreadsheet->getWorksheetIterator() as $worksheet) { - $sheetName = $worksheet->getTitle(); - $helper->log('Worksheet: ' . $sheetName); - - $chartNames = $worksheet->getChartNames(); - if (empty($chartNames)) { - $helper->log(' There are no charts in this worksheet'); - } else { - natsort($chartNames); - foreach ($chartNames as $i => $chartName) { - $chart = $worksheet->getChartByName($chartName); - if ($chart->getTitle() !== null) { - $caption = '"' . implode(' ', $chart->getTitle()->getCaption()) . '"'; - } else { - $caption = 'Untitled'; - } - $helper->log(' ' . $chartName . ' - ' . $caption); - $helper->log(str_repeat(' ', strlen($chartName) + 3)); - $groupCount = $chart->getPlotArea()->getPlotGroupCount(); - if ($groupCount == 1) { - $chartType = $chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType(); - $helper->log(' ' . $chartType); - } else { - $chartTypes = []; - for ($i = 0; $i < $groupCount; ++$i) { - $chartTypes[] = $chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType(); - } - $chartTypes = array_unique($chartTypes); - if (count($chartTypes) == 1) { - $chartType = 'Multiple Plot ' . array_pop($chartTypes); - $helper->log(' ' . $chartType); - } elseif (count($chartTypes) == 0) { - $helper->log(' *** Type not yet implemented'); - } else { - $helper->log(' Combination Chart'); - } - } - } - } - } - - // Save - $filename = $helper->getFilename($inputFileName, 'html'); - $writer = IOFactory::createWriter($spreadsheet, 'Html'); - $writer->setIncludeCharts(true); - $callStartTime = microtime(true); - $writer->save($filename); - $helper->logWrite($writer, $filename, $callStartTime); - - $spreadsheet->disconnectWorksheets(); - unset($spreadsheet); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/32_Chart_read_write_PDF.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/32_Chart_read_write_PDF.php deleted file mode 100644 index ee3ad0e0..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/32_Chart_read_write_PDF.php +++ /dev/null @@ -1,91 +0,0 @@ - 1)) { - $inputFileNames = []; - for ($i = 1; $i < $argc; ++$i) { - $inputFileNames[] = __DIR__ . '/../templates/' . $argv[$i]; - } -} else { - $inputFileNames = glob($inputFileNames); -} -foreach ($inputFileNames as $inputFileName) { - $inputFileNameShort = basename($inputFileName); - - if (!file_exists($inputFileName)) { - $helper->log('File ' . $inputFileNameShort . ' does not exist'); - - continue; - } - - $helper->log("Load Test from $inputFileType file " . $inputFileNameShort); - - $reader = IOFactory::createReader($inputFileType); - $reader->setIncludeCharts(true); - $spreadsheet = $reader->load($inputFileName); - - $helper->log('Iterate worksheets looking at the charts'); - foreach ($spreadsheet->getWorksheetIterator() as $worksheet) { - $sheetName = $worksheet->getTitle(); - $helper->log('Worksheet: ' . $sheetName); - - $chartNames = $worksheet->getChartNames(); - if (empty($chartNames)) { - $helper->log(' There are no charts in this worksheet'); - } else { - natsort($chartNames); - foreach ($chartNames as $i => $chartName) { - $chart = $worksheet->getChartByName($chartName); - if ($chart->getTitle() !== null) { - $caption = '"' . implode(' ', $chart->getTitle()->getCaption()) . '"'; - } else { - $caption = 'Untitled'; - } - $helper->log(' ' . $chartName . ' - ' . $caption); - $helper->log(str_repeat(' ', strlen($chartName) + 3)); - $groupCount = $chart->getPlotArea()->getPlotGroupCount(); - if ($groupCount == 1) { - $chartType = $chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType(); - $helper->log(' ' . $chartType); - } else { - $chartTypes = []; - for ($i = 0; $i < $groupCount; ++$i) { - $chartTypes[] = $chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType(); - } - $chartTypes = array_unique($chartTypes); - if (count($chartTypes) == 1) { - $chartType = 'Multiple Plot ' . array_pop($chartTypes); - $helper->log(' ' . $chartType); - } elseif (count($chartTypes) == 0) { - $helper->log(' *** Type not yet implemented'); - } else { - $helper->log(' Combination Chart'); - } - } - } - } - } - - // Save - $filename = $helper->getFilename($inputFileName, 'pdf'); - $writer = IOFactory::createWriter($spreadsheet, 'Pdf'); - $writer->setIncludeCharts(true); - $callStartTime = microtime(true); - $writer->save($filename); - $helper->logWrite($writer, $filename, $callStartTime); - - $spreadsheet->disconnectWorksheets(); - unset($spreadsheet); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_area.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_area.php deleted file mode 100644 index 4478d2dd..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_area.php +++ /dev/null @@ -1,104 +0,0 @@ -getActiveSheet(); -$worksheet->fromArray( - [ - ['', 2010, 2011, 2012], - ['Q1', 12, 15, 21], - ['Q2', 56, 73, 86], - ['Q3', 52, 61, 69], - ['Q4', 30, 32, 0], - ] -); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1), // 2010 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // 2012 -]; -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4 -]; -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$5', null, 4), -]; - -// Build the dataseries -$series = new DataSeries( - DataSeries::TYPE_AREACHART, // plotType - DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping - range(0, count($dataSeriesValues) - 1), // plotOrder - $dataSeriesLabels, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues // plotValues -); - -// Set the series in the plot area -$plotArea = new PlotArea(null, [$series]); -// Set the chart legend -$legend = new Legend(Legend::POSITION_TOPRIGHT, null, false); - -$title = new Title('Test %age-Stacked Area Chart'); -$yAxisLabel = new Title('Value ($k)'); - -// Create the chart -$chart = new Chart( - 'chart1', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - null, // xAxisLabel - $yAxisLabel // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('A7'); -$chart->setBottomRightPosition('H20'); - -// Add the chart to the worksheet -$worksheet->addChart($chart); - -// Save Excel 2007 file -$filename = $helper->getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->setIncludeCharts(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_bar.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_bar.php deleted file mode 100644 index a05cf927..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_bar.php +++ /dev/null @@ -1,15 +0,0 @@ -getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->setIncludeCharts(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_bar_stacked.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_bar_stacked.php deleted file mode 100644 index 7ba4d8de..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_bar_stacked.php +++ /dev/null @@ -1,107 +0,0 @@ -getActiveSheet(); -$worksheet->fromArray( - [ - ['', 2010, 2011, 2012], - ['Q1', 12, 15, 21], - ['Q2', 56, 73, 86], - ['Q3', 52, 61, 69], - ['Q4', 30, 32, 0], - ] -); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1), // 2010 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // 2012 -]; -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4 -]; -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$5', null, 4), -]; - -// Build the dataseries -$series = new DataSeries( - DataSeries::TYPE_BARCHART, // plotType - DataSeries::GROUPING_STACKED, // plotGrouping - range(0, count($dataSeriesValues) - 1), // plotOrder - $dataSeriesLabels, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues // plotValues -); -// Set additional dataseries parameters -// Make it a horizontal bar rather than a vertical column graph -$series->setPlotDirection(DataSeries::DIRECTION_BAR); - -// Set the series in the plot area -$plotArea = new PlotArea(null, [$series]); -// Set the chart legend -$legend = new Legend(Legend::POSITION_RIGHT, null, false); - -$title = new Title('Test Chart'); -$yAxisLabel = new Title('Value ($k)'); - -// Create the chart -$chart = new Chart( - 'chart1', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - null, // xAxisLabel - $yAxisLabel // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('A7'); -$chart->setBottomRightPosition('H20'); - -// Add the chart to the worksheet -$worksheet->addChart($chart); - -// Save Excel 2007 file -$filename = $helper->getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->setIncludeCharts(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_column.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_column.php deleted file mode 100644 index 9ffe9d3f..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_column.php +++ /dev/null @@ -1,107 +0,0 @@ -getActiveSheet(); -$worksheet->fromArray( - [ - ['', 2010, 2011, 2012], - ['Q1', 12, 15, 21], - ['Q2', 56, 73, 86], - ['Q3', 52, 61, 69], - ['Q4', 30, 32, 0], - ] -); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1), // 2010 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // 2012 -]; -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4 -]; -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$5', null, 4), -]; - -// Build the dataseries -$series = new DataSeries( - DataSeries::TYPE_BARCHART, // plotType - DataSeries::GROUPING_STANDARD, // plotGrouping - range(0, count($dataSeriesValues) - 1), // plotOrder - $dataSeriesLabels, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues // plotValues -); -// Set additional dataseries parameters -// Make it a vertical column rather than a horizontal bar graph -$series->setPlotDirection(DataSeries::DIRECTION_COL); - -// Set the series in the plot area -$plotArea = new PlotArea(null, [$series]); -// Set the chart legend -$legend = new Legend(Legend::POSITION_RIGHT, null, false); - -$title = new Title('Test Column Chart'); -$yAxisLabel = new Title('Value ($k)'); - -// Create the chart -$chart = new Chart( - 'chart1', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - null, // xAxisLabel - $yAxisLabel // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('A7'); -$chart->setBottomRightPosition('H20'); - -// Add the chart to the worksheet -$worksheet->addChart($chart); - -// Save Excel 2007 file -$filename = $helper->getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->setIncludeCharts(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_column_2.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_column_2.php deleted file mode 100644 index bba9210a..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_column_2.php +++ /dev/null @@ -1,116 +0,0 @@ -getActiveSheet(); -$worksheet->fromArray( - [ - ['', '', 'Budget', 'Forecast', 'Actual'], - ['2010', 'Q1', 47, 44, 43], - ['', 'Q2', 56, 53, 50], - ['', 'Q3', 52, 46, 45], - ['', 'Q4', 45, 40, 40], - ['2011', 'Q1', 51, 42, 46], - ['', 'Q2', 53, 58, 56], - ['', 'Q3', 64, 66, 69], - ['', 'Q4', 54, 55, 56], - ['2012', 'Q1', 49, 52, 58], - ['', 'Q2', 68, 73, 86], - ['', 'Q3', 72, 78, 0], - ['', 'Q4', 50, 60, 0], - ] -); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 'Budget' - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // 'Forecast' - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$E$1', null, 1), // 'Actual' -]; -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$B$13', null, 12), // Q1 to Q4 for 2010 to 2012 -]; -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$13', null, 12), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$13', null, 12), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$E$2:$E$13', null, 12), -]; - -// Build the dataseries -$series = new DataSeries( - DataSeries::TYPE_BARCHART, // plotType - DataSeries::GROUPING_CLUSTERED, // plotGrouping - range(0, count($dataSeriesValues) - 1), // plotOrder - $dataSeriesLabels, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues // plotValues -); -// Set additional dataseries parameters -// Make it a vertical column rather than a horizontal bar graph -$series->setPlotDirection(DataSeries::DIRECTION_COL); - -// Set the series in the plot area -$plotArea = new PlotArea(null, [$series]); -// Set the chart legend -$legend = new Legend(Legend::POSITION_BOTTOM, null, false); - -$title = new Title('Test Grouped Column Chart'); -$xAxisLabel = new Title('Financial Period'); -$yAxisLabel = new Title('Value ($k)'); - -// Create the chart -$chart = new Chart( - 'chart1', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - $xAxisLabel, // xAxisLabel - $yAxisLabel // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('G2'); -$chart->setBottomRightPosition('P20'); - -// Add the chart to the worksheet -$worksheet->addChart($chart); - -// Save Excel 2007 file -$filename = $helper->getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->setIncludeCharts(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_composite.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_composite.php deleted file mode 100644 index 83dc34a9..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_composite.php +++ /dev/null @@ -1,160 +0,0 @@ -getActiveSheet(); -$worksheet->fromArray( - [ - ['', 'Rainfall (mm)', 'Temperature (°F)', 'Humidity (%)'], - ['Jan', 78, 52, 61], - ['Feb', 64, 54, 62], - ['Mar', 62, 57, 63], - ['Apr', 21, 62, 59], - ['May', 11, 75, 60], - ['Jun', 1, 75, 57], - ['Jul', 1, 79, 56], - ['Aug', 1, 79, 59], - ['Sep', 10, 75, 60], - ['Oct', 40, 68, 63], - ['Nov', 69, 62, 64], - ['Dec', 89, 57, 66], - ] -); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels1 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1), // Temperature -]; -$dataSeriesLabels2 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // Rainfall -]; -$dataSeriesLabels3 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // Humidity -]; - -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$13', null, 12), // Jan to Dec -]; - -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues1 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$13', null, 12), -]; - -// Build the dataseries -$series1 = new DataSeries( - DataSeries::TYPE_BARCHART, // plotType - DataSeries::GROUPING_CLUSTERED, // plotGrouping - range(0, count($dataSeriesValues1) - 1), // plotOrder - $dataSeriesLabels1, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues1 // plotValues -); -// Set additional dataseries parameters -// Make it a vertical column rather than a horizontal bar graph -$series1->setPlotDirection(DataSeries::DIRECTION_COL); - -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues2 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$13', null, 12), -]; - -// Build the dataseries -$series2 = new DataSeries( - DataSeries::TYPE_LINECHART, // plotType - DataSeries::GROUPING_STANDARD, // plotGrouping - range(0, count($dataSeriesValues2) - 1), // plotOrder - $dataSeriesLabels2, // plotLabel - [], // plotCategory - $dataSeriesValues2 // plotValues -); - -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues3 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$13', null, 12), -]; - -// Build the dataseries -$series3 = new DataSeries( - DataSeries::TYPE_AREACHART, // plotType - DataSeries::GROUPING_STANDARD, // plotGrouping - range(0, count($dataSeriesValues2) - 1), // plotOrder - $dataSeriesLabels3, // plotLabel - [], // plotCategory - $dataSeriesValues3 // plotValues -); - -// Set the series in the plot area -$plotArea = new PlotArea(null, [$series1, $series2, $series3]); -// Set the chart legend -$legend = new Legend(Legend::POSITION_RIGHT, null, false); - -$title = new Title('Average Weather Chart for Crete'); - -// Create the chart -$chart = new Chart( - 'chart1', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - null, // xAxisLabel - null // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('F2'); -$chart->setBottomRightPosition('O16'); - -// Add the chart to the worksheet -$worksheet->addChart($chart); - -// Save Excel 2007 file -$filename = $helper->getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->setIncludeCharts(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_line.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_line.php deleted file mode 100644 index bdaf0111..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_line.php +++ /dev/null @@ -1,105 +0,0 @@ -getActiveSheet(); -$worksheet->fromArray( - [ - ['', 2010, 2011, 2012], - ['Q1', 12, 15, 21], - ['Q2', 56, 73, 86], - ['Q3', 52, 61, 69], - ['Q4', 30, 32, 0], - ] -); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1), // 2010 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // 2012 -]; -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4 -]; -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$5', null, 4), -]; -$dataSeriesValues[2]->setLineWidth(60000); - -// Build the dataseries -$series = new DataSeries( - DataSeries::TYPE_LINECHART, // plotType - DataSeries::GROUPING_STACKED, // plotGrouping - range(0, count($dataSeriesValues) - 1), // plotOrder - $dataSeriesLabels, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues // plotValues -); - -// Set the series in the plot area -$plotArea = new PlotArea(null, [$series]); -// Set the chart legend -$legend = new Legend(Legend::POSITION_TOPRIGHT, null, false); - -$title = new Title('Test Stacked Line Chart'); -$yAxisLabel = new Title('Value ($k)'); - -// Create the chart -$chart = new Chart( - 'chart1', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - null, // xAxisLabel - $yAxisLabel // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('A7'); -$chart->setBottomRightPosition('H20'); - -// Add the chart to the worksheet -$worksheet->addChart($chart); - -// Save Excel 2007 file -$filename = $helper->getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->setIncludeCharts(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_multiple_charts.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_multiple_charts.php deleted file mode 100644 index 10a11e13..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_multiple_charts.php +++ /dev/null @@ -1,179 +0,0 @@ -getActiveSheet(); -$worksheet->fromArray( - [ - ['', 2010, 2011, 2012], - ['Q1', 12, 15, 21], - ['Q2', 56, 73, 86], - ['Q3', 52, 61, 69], - ['Q4', 30, 32, 0], - ] -); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels1 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1), // 2010 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // 2012 -]; -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues1 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4 -]; -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues1 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$5', null, 4), -]; - -// Build the dataseries -$series1 = new DataSeries( - DataSeries::TYPE_AREACHART, // plotType - DataSeries::GROUPING_PERCENT_STACKED, // plotGrouping - range(0, count($dataSeriesValues1) - 1), // plotOrder - $dataSeriesLabels1, // plotLabel - $xAxisTickValues1, // plotCategory - $dataSeriesValues1 // plotValues -); - -// Set the series in the plot area -$plotArea1 = new PlotArea(null, [$series1]); -// Set the chart legend -$legend1 = new Legend(Legend::POSITION_TOPRIGHT, null, false); - -$title1 = new Title('Test %age-Stacked Area Chart'); -$yAxisLabel1 = new Title('Value ($k)'); - -// Create the chart -$chart1 = new Chart( - 'chart1', // name - $title1, // title - $legend1, // legend - $plotArea1, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - null, // xAxisLabel - $yAxisLabel1 // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart1->setTopLeftPosition('A7'); -$chart1->setBottomRightPosition('H20'); - -// Add the chart to the worksheet -$worksheet->addChart($chart1); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels2 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1), // 2010 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // 2012 -]; -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues2 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4 -]; -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues2 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$5', null, 4), -]; - -// Build the dataseries -$series2 = new DataSeries( - DataSeries::TYPE_BARCHART, // plotType - DataSeries::GROUPING_STANDARD, // plotGrouping - range(0, count($dataSeriesValues2) - 1), // plotOrder - $dataSeriesLabels2, // plotLabel - $xAxisTickValues2, // plotCategory - $dataSeriesValues2 // plotValues -); -// Set additional dataseries parameters -// Make it a vertical column rather than a horizontal bar graph -$series2->setPlotDirection(DataSeries::DIRECTION_COL); - -// Set the series in the plot area -$plotArea2 = new PlotArea(null, [$series2]); -// Set the chart legend -$legend2 = new Legend(Legend::POSITION_RIGHT, null, false); - -$title2 = new Title('Test Column Chart'); -$yAxisLabel2 = new Title('Value ($k)'); - -// Create the chart -$chart2 = new Chart( - 'chart2', // name - $title2, // title - $legend2, // legend - $plotArea2, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - null, // xAxisLabel - $yAxisLabel2 // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart2->setTopLeftPosition('I7'); -$chart2->setBottomRightPosition('P20'); - -// Add the chart to the worksheet -$worksheet->addChart($chart2); - -// Save Excel 2007 file -$filename = $helper->getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->setIncludeCharts(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_pie.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_pie.php deleted file mode 100644 index d4ec0752..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_pie.php +++ /dev/null @@ -1,175 +0,0 @@ -getActiveSheet(); -$worksheet->fromArray( - [ - ['', 2010, 2011, 2012], - ['Q1', 12, 15, 21], - ['Q2', 56, 73, 86], - ['Q3', 52, 61, 69], - ['Q4', 30, 32, 0], - ] -); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels1 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011 -]; -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues1 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4 -]; -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues1 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4), -]; - -// Build the dataseries -$series1 = new DataSeries( - DataSeries::TYPE_PIECHART, // plotType - null, // plotGrouping (Pie charts don't have any grouping) - range(0, count($dataSeriesValues1) - 1), // plotOrder - $dataSeriesLabels1, // plotLabel - $xAxisTickValues1, // plotCategory - $dataSeriesValues1 // plotValues -); - -// Set up a layout object for the Pie chart -$layout1 = new Layout(); -$layout1->setShowVal(true); -$layout1->setShowPercent(true); - -// Set the series in the plot area -$plotArea1 = new PlotArea($layout1, [$series1]); -// Set the chart legend -$legend1 = new Legend(Legend::POSITION_RIGHT, null, false); - -$title1 = new Title('Test Pie Chart'); - -// Create the chart -$chart1 = new Chart( - 'chart1', // name - $title1, // title - $legend1, // legend - $plotArea1, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - null, // xAxisLabel - null // yAxisLabel - Pie charts don't have a Y-Axis -); - -// Set the position where the chart should appear in the worksheet -$chart1->setTopLeftPosition('A7'); -$chart1->setBottomRightPosition('H20'); - -// Add the chart to the worksheet -$worksheet->addChart($chart1); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels2 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011 -]; -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues2 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4 -]; -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues2 = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4), -]; - -// Build the dataseries -$series2 = new DataSeries( - DataSeries::TYPE_DONUTCHART, // plotType - null, // plotGrouping (Donut charts don't have any grouping) - range(0, count($dataSeriesValues2) - 1), // plotOrder - $dataSeriesLabels2, // plotLabel - $xAxisTickValues2, // plotCategory - $dataSeriesValues2 // plotValues -); - -// Set up a layout object for the Pie chart -$layout2 = new Layout(); -$layout2->setShowVal(true); -$layout2->setShowCatName(true); - -// Set the series in the plot area -$plotArea2 = new PlotArea($layout2, [$series2]); - -$title2 = new Title('Test Donut Chart'); - -// Create the chart -$chart2 = new Chart( - 'chart2', // name - $title2, // title - null, // legend - $plotArea2, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - null, // xAxisLabel - null // yAxisLabel - Like Pie charts, Donut charts don't have a Y-Axis -); - -// Set the position where the chart should appear in the worksheet -$chart2->setTopLeftPosition('I7'); -$chart2->setBottomRightPosition('P20'); - -// Add the chart to the worksheet -$worksheet->addChart($chart2); - -// Save Excel 2007 file -$filename = $helper->getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->setIncludeCharts(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_radar.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_radar.php deleted file mode 100644 index e57914ab..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_radar.php +++ /dev/null @@ -1,117 +0,0 @@ -getActiveSheet(); -$worksheet->fromArray( - [ - ['', 2010, 2011, 2012], - ['Jan', 47, 45, 71], - ['Feb', 56, 73, 86], - ['Mar', 52, 61, 69], - ['Apr', 40, 52, 60], - ['May', 42, 55, 71], - ['Jun', 58, 63, 76], - ['Jul', 53, 61, 89], - ['Aug', 46, 69, 85], - ['Sep', 62, 75, 81], - ['Oct', 51, 70, 96], - ['Nov', 55, 66, 89], - ['Dec', 68, 62, 0], - ] -); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // 2012 -]; -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$13', null, 12), // Jan to Dec - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$13', null, 12), // Jan to Dec -]; -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$13', null, 12), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$13', null, 12), -]; - -// Build the dataseries -$series = new DataSeries( - DataSeries::TYPE_RADARCHART, // plotType - null, // plotGrouping (Radar charts don't have any grouping) - range(0, count($dataSeriesValues) - 1), // plotOrder - $dataSeriesLabels, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues, // plotValues - null, // plotDirection - null, // smooth line - DataSeries::STYLE_MARKER // plotStyle -); - -// Set up a layout object for the Pie chart -$layout = new Layout(); - -// Set the series in the plot area -$plotArea = new PlotArea($layout, [$series]); -// Set the chart legend -$legend = new Legend(Legend::POSITION_RIGHT, null, false); - -$title = new Title('Test Radar Chart'); - -// Create the chart -$chart = new Chart( - 'chart1', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - null, // xAxisLabel - null // yAxisLabel - Radar charts don't have a Y-Axis -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('F2'); -$chart->setBottomRightPosition('M15'); - -// Add the chart to the worksheet -$worksheet->addChart($chart); - -// Save Excel 2007 file -$filename = $helper->getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->setIncludeCharts(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_scatter.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_scatter.php deleted file mode 100644 index 12fc2bdc..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_scatter.php +++ /dev/null @@ -1,101 +0,0 @@ -getActiveSheet(); -$worksheet->fromArray( - [ - ['', 2010, 2011, 2012], - ['Q1', 12, 15, 21], - ['Q2', 56, 73, 86], - ['Q3', 52, 61, 69], - ['Q4', 30, 32, 0], - ] -); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1), // 2010 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), // 2011 - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), // 2012 -]; -// Set the X-Axis Labels -$xAxisTickValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$5', null, 4), // Q1 to Q4 -]; -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$5', null, 4), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$5', null, 4), -]; - -// Build the dataseries -$series = new DataSeries( - DataSeries::TYPE_SCATTERCHART, // plotType - null, // plotGrouping (Scatter charts don't have any grouping) - range(0, count($dataSeriesValues) - 1), // plotOrder - $dataSeriesLabels, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues, // plotValues - null, // plotDirection - null, // smooth line - DataSeries::STYLE_LINEMARKER // plotStyle -); - -// Set the series in the plot area -$plotArea = new PlotArea(null, [$series]); -// Set the chart legend -$legend = new Legend(Legend::POSITION_TOPRIGHT, null, false); - -$title = new Title('Test Scatter Chart'); -$yAxisLabel = new Title('Value ($k)'); - -// Create the chart -$chart = new Chart( - 'chart1', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - null, // xAxisLabel - $yAxisLabel // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('A7'); -$chart->setBottomRightPosition('H20'); - -// Add the chart to the worksheet -$worksheet->addChart($chart); - -// Save Excel 2007 file -$filename = $helper->getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->setIncludeCharts(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_stock.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_stock.php deleted file mode 100644 index 7a9f7274..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/33_Chart_create_stock.php +++ /dev/null @@ -1,113 +0,0 @@ -getActiveSheet(); -$worksheet->fromArray( - [ - ['Counts', 'Max', 'Min', 'Min Threshold', 'Max Threshold'], - [10, 10, 5, 0, 50], - [30, 20, 10, 0, 50], - [20, 30, 15, 0, 50], - [40, 10, 0, 0, 50], - [100, 40, 5, 0, 50], - ], - null, - 'A1', - true -); -$worksheet->getStyle('B2:E6')->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_NUMBER_00); - -// Set the Labels for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesLabels = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$B$1', null, 1), //Max / Open - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$C$1', null, 1), //Min / Close - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$D$1', null, 1), //Min Threshold / Min - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$E$1', null, 1), //Max Threshold / Max -]; -// Set the X-Axis Labels -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$xAxisTickValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_STRING, 'Worksheet!$A$2:$A$6', null, 5), // Counts -]; -// Set the Data values for each data series we want to plot -// Datatype -// Cell reference for data -// Format Code -// Number of datapoints in series -// Data values -// Data Marker -$dataSeriesValues = [ - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$B$2:$B$6', null, 5), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$C$2:$C$6', null, 5), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$D$2:$D$6', null, 5), - new DataSeriesValues(DataSeriesValues::DATASERIES_TYPE_NUMBER, 'Worksheet!$E$2:$E$6', null, 5), -]; - -// Build the dataseries -$series = new DataSeries( - DataSeries::TYPE_STOCKCHART, // plotType - null, // plotGrouping - if we set this to not null, then xlsx throws error - range(0, count($dataSeriesValues) - 1), // plotOrder - $dataSeriesLabels, // plotLabel - $xAxisTickValues, // plotCategory - $dataSeriesValues // plotValues -); - -// Set the series in the plot area -$plotArea = new PlotArea(null, [$series]); -// Set the chart legend -$legend = new Legend(Legend::POSITION_RIGHT, null, false); - -$title = new Title('Test Stock Chart'); -$xAxisLabel = new Title('Counts'); -$yAxisLabel = new Title('Values'); - -// Create the chart -$chart = new Chart( - 'stock-chart', // name - $title, // title - $legend, // legend - $plotArea, // plotArea - true, // plotVisibleOnly - 0, // displayBlanksAs - $xAxisLabel, // xAxisLabel - $yAxisLabel // yAxisLabel -); - -// Set the position where the chart should appear in the worksheet -$chart->setTopLeftPosition('A7'); -$chart->setBottomRightPosition('H20'); - -// Add the chart to the worksheet -$worksheet->addChart($chart); - -// Save Excel 2007 file -$filename = $helper->getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->setIncludeCharts(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/34_Chart_update.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/34_Chart_update.php deleted file mode 100644 index 638d2e0a..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/34_Chart_update.php +++ /dev/null @@ -1,38 +0,0 @@ -getTemporaryFilename(); -$writer = new Xlsx($sampleSpreadsheet); -$writer->save($filename); - -$helper->log('Load from Xlsx file'); -$reader = IOFactory::createReader('Xlsx'); -$reader->setIncludeCharts(true); -$spreadsheet = $reader->load($filename); - -$helper->log('Update cell data values that are displayed in the chart'); -$worksheet = $spreadsheet->getActiveSheet(); -$worksheet->fromArray( - [ - [50 - 12, 50 - 15, 50 - 21], - [50 - 56, 50 - 73, 50 - 86], - [50 - 52, 50 - 61, 50 - 69], - [50 - 30, 50 - 32, 50], - ], - null, - 'B2' -); - -// Save Excel 2007 file -$filename = $helper->getFilename(__FILE__); -$writer = IOFactory::createWriter($spreadsheet, 'Xlsx'); -$writer->setIncludeCharts(true); -$callStartTime = microtime(true); -$writer->save($filename); -$helper->logWrite($writer, $filename, $callStartTime); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Chart/35_Chart_render.php b/vendor/phpoffice/phpspreadsheet/samples/Chart/35_Chart_render.php deleted file mode 100644 index 9638c679..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Chart/35_Chart_render.php +++ /dev/null @@ -1,75 +0,0 @@ - 1)) { - $inputFileNames = []; - for ($i = 1; $i < $argc; ++$i) { - $inputFileNames[] = __DIR__ . '/../templates/' . $argv[$i]; - } -} else { - $inputFileNames = glob($inputFileNames); -} -foreach ($inputFileNames as $inputFileName) { - $inputFileNameShort = basename($inputFileName); - - if (!file_exists($inputFileName)) { - $helper->log('File ' . $inputFileNameShort . ' does not exist'); - - continue; - } - - $helper->log("Load Test from $inputFileType file " . $inputFileNameShort); - - $reader = IOFactory::createReader($inputFileType); - $reader->setIncludeCharts(true); - $spreadsheet = $reader->load($inputFileName); - - $helper->log('Iterate worksheets looking at the charts'); - foreach ($spreadsheet->getWorksheetIterator() as $worksheet) { - $sheetName = $worksheet->getTitle(); - $helper->log('Worksheet: ' . $sheetName); - - $chartNames = $worksheet->getChartNames(); - if (empty($chartNames)) { - $helper->log(' There are no charts in this worksheet'); - } else { - natsort($chartNames); - foreach ($chartNames as $i => $chartName) { - $chart = $worksheet->getChartByName($chartName); - if ($chart->getTitle() !== null) { - $caption = '"' . implode(' ', $chart->getTitle()->getCaption()) . '"'; - } else { - $caption = 'Untitled'; - } - $helper->log(' ' . $chartName . ' - ' . $caption); - - $jpegFile = $helper->getFilename('35-' . $inputFileNameShort, 'png'); - if (file_exists($jpegFile)) { - unlink($jpegFile); - } - - try { - $chart->render($jpegFile); - $helper->log('Rendered image: ' . $jpegFile); - } catch (Exception $e) { - $helper->log('Error rendering chart: ' . $e->getMessage()); - } - } - } - } - - $spreadsheet->disconnectWorksheets(); - unset($spreadsheet); -} - -$helper->log('Done rendering charts as images'); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Header.php b/vendor/phpoffice/phpspreadsheet/samples/Header.php deleted file mode 100644 index fb8bd986..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Header.php +++ /dev/null @@ -1,64 +0,0 @@ -isCli()) { - return; -} -?> - - - <?php echo $helper->getPageTitle(); ?> - - - - - - - - - - -
    - - getPageHeading(); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Pdf/21_Pdf_Domdf.php b/vendor/phpoffice/phpspreadsheet/samples/Pdf/21_Pdf_Domdf.php deleted file mode 100644 index aea4c96d..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Pdf/21_Pdf_Domdf.php +++ /dev/null @@ -1,20 +0,0 @@ -log('Hide grid lines'); -$spreadsheet->getActiveSheet()->setShowGridLines(false); - -$helper->log('Set orientation to landscape'); -$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(PageSetup::ORIENTATION_LANDSCAPE); - -$className = \PhpOffice\PhpSpreadsheet\Writer\Pdf\Dompdf::class; -$helper->log("Write to PDF format using {$className}"); -IOFactory::registerWriter('Pdf', $className); - -// Save -$helper->write($spreadsheet, __FILE__, ['Pdf']); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Pdf/21_Pdf_TCPDF.php b/vendor/phpoffice/phpspreadsheet/samples/Pdf/21_Pdf_TCPDF.php deleted file mode 100644 index 9a8593e1..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Pdf/21_Pdf_TCPDF.php +++ /dev/null @@ -1,20 +0,0 @@ -log('Hide grid lines'); -$spreadsheet->getActiveSheet()->setShowGridLines(false); - -$helper->log('Set orientation to landscape'); -$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(PageSetup::ORIENTATION_LANDSCAPE); - -$className = \PhpOffice\PhpSpreadsheet\Writer\Pdf\Tcpdf::class; -$helper->log("Write to PDF format using {$className}"); -IOFactory::registerWriter('Pdf', $className); - -// Save -$helper->write($spreadsheet, __FILE__, ['Pdf']); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Pdf/21_Pdf_mPDF.php b/vendor/phpoffice/phpspreadsheet/samples/Pdf/21_Pdf_mPDF.php deleted file mode 100644 index b99c2250..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Pdf/21_Pdf_mPDF.php +++ /dev/null @@ -1,20 +0,0 @@ -log('Hide grid lines'); -$spreadsheet->getActiveSheet()->setShowGridLines(false); - -$helper->log('Set orientation to landscape'); -$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(PageSetup::ORIENTATION_LANDSCAPE); - -$className = \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf::class; -$helper->log("Write to PDF format using {$className}"); -IOFactory::registerWriter('Pdf', $className); - -// Save -$helper->write($spreadsheet, __FILE__, ['Pdf']); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/01_Simple_file_reader_using_IOFactory.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/01_Simple_file_reader_using_IOFactory.php deleted file mode 100644 index 584fd5be..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/01_Simple_file_reader_using_IOFactory.php +++ /dev/null @@ -1,11 +0,0 @@ -log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory to identify the format'); -$spreadsheet = IOFactory::load($inputFileName); -$sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true); -var_dump($sheetData); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/02_Simple_file_reader_using_a_specified_reader.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/02_Simple_file_reader_using_a_specified_reader.php deleted file mode 100644 index 9a705123..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/02_Simple_file_reader_using_a_specified_reader.php +++ /dev/null @@ -1,13 +0,0 @@ -log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using ' . Xls::class); -$reader = new Xls(); -$spreadsheet = $reader->load($inputFileName); - -$sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true); -var_dump($sheetData); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/03_Simple_file_reader_using_the_IOFactory_to_return_a_reader.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/03_Simple_file_reader_using_the_IOFactory_to_return_a_reader.php deleted file mode 100644 index 305651de..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/03_Simple_file_reader_using_the_IOFactory_to_return_a_reader.php +++ /dev/null @@ -1,15 +0,0 @@ -log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory with a defined reader type of ' . $inputFileType); -$reader = IOFactory::createReader($inputFileType); -$spreadsheet = $reader->load($inputFileName); - -$sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true); -var_dump($sheetData); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/04_Simple_file_reader_using_the_IOFactory_to_identify_a_reader_to_use.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/04_Simple_file_reader_using_the_IOFactory_to_identify_a_reader_to_use.php deleted file mode 100644 index 98aabfc6..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/04_Simple_file_reader_using_the_IOFactory_to_identify_a_reader_to_use.php +++ /dev/null @@ -1,17 +0,0 @@ -log('File ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' has been identified as an ' . $inputFileType . ' file'); - -$helper->log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory with the identified reader type'); -$reader = IOFactory::createReader($inputFileType); -$spreadsheet = $reader->load($inputFileName); - -$sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true); -var_dump($sheetData); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/05_Simple_file_reader_using_the_read_data_only_option.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/05_Simple_file_reader_using_the_read_data_only_option.php deleted file mode 100644 index d3ce9d82..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/05_Simple_file_reader_using_the_read_data_only_option.php +++ /dev/null @@ -1,17 +0,0 @@ -log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory with a defined reader type of ' . $inputFileType); -$reader = IOFactory::createReader($inputFileType); -$helper->log('Turning Formatting off for Load'); -$reader->setReadDataOnly(true); -$spreadsheet = $reader->load($inputFileName); - -$sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true); -var_dump($sheetData); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/06_Simple_file_reader_loading_all_worksheets.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/06_Simple_file_reader_loading_all_worksheets.php deleted file mode 100644 index 5507c52b..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/06_Simple_file_reader_loading_all_worksheets.php +++ /dev/null @@ -1,20 +0,0 @@ -log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory with a defined reader type of ' . $inputFileType); -$reader = IOFactory::createReader($inputFileType); -$helper->log('Loading all WorkSheets'); -$reader->setLoadAllSheets(); -$spreadsheet = $reader->load($inputFileName); - -$helper->log($spreadsheet->getSheetCount() . ' worksheet' . (($spreadsheet->getSheetCount() == 1) ? '' : 's') . ' loaded'); -$loadedSheetNames = $spreadsheet->getSheetNames(); -foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) { - $helper->log($sheetIndex . ' -> ' . $loadedSheetName); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/07_Simple_file_reader_loading_a_single_named_worksheet.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/07_Simple_file_reader_loading_a_single_named_worksheet.php deleted file mode 100644 index 142a17f8..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/07_Simple_file_reader_loading_a_single_named_worksheet.php +++ /dev/null @@ -1,21 +0,0 @@ -log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory with a defined reader type of ' . $inputFileType); -$reader = IOFactory::createReader($inputFileType); -$helper->log('Loading Sheet "' . $sheetname . '" only'); -$reader->setLoadSheetsOnly($sheetname); -$spreadsheet = $reader->load($inputFileName); - -$helper->log($spreadsheet->getSheetCount() . ' worksheet' . (($spreadsheet->getSheetCount() == 1) ? '' : 's') . ' loaded'); -$loadedSheetNames = $spreadsheet->getSheetNames(); -foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) { - $helper->log($sheetIndex . ' -> ' . $loadedSheetName); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/08_Simple_file_reader_loading_several_named_worksheets.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/08_Simple_file_reader_loading_several_named_worksheets.php deleted file mode 100644 index 66efc3e0..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/08_Simple_file_reader_loading_several_named_worksheets.php +++ /dev/null @@ -1,21 +0,0 @@ -log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory with a defined reader type of ' . $inputFileType); -$reader = IOFactory::createReader($inputFileType); -$helper->log('Loading Sheet' . ((count($sheetnames) == 1) ? '' : 's') . ' "' . implode('" and "', $sheetnames) . '" only'); -$reader->setLoadSheetsOnly($sheetnames); -$spreadsheet = $reader->load($inputFileName); - -$helper->log($spreadsheet->getSheetCount() . ' worksheet' . (($spreadsheet->getSheetCount() == 1) ? '' : 's') . ' loaded'); -$loadedSheetNames = $spreadsheet->getSheetNames(); -foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) { - $helper->log($sheetIndex . ' -> ' . $loadedSheetName); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/09_Simple_file_reader_using_a_read_filter.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/09_Simple_file_reader_using_a_read_filter.php deleted file mode 100644 index 6e0eda14..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/09_Simple_file_reader_using_a_read_filter.php +++ /dev/null @@ -1,40 +0,0 @@ -= 1 && $row <= 7) { - if (in_array($column, range('A', 'E'))) { - return true; - } - } - - return false; - } -} - -$filterSubset = new MyReadFilter(); - -$helper->log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory with a defined reader type of ' . $inputFileType); -$reader = IOFactory::createReader($inputFileType); -$helper->log('Loading Sheet "' . $sheetname . '" only'); -$reader->setLoadSheetsOnly($sheetname); -$helper->log('Loading Sheet using filter'); -$reader->setReadFilter($filterSubset); -$spreadsheet = $reader->load($inputFileName); - -$sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true); -var_dump($sheetData); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/10_Simple_file_reader_using_a_configurable_read_filter.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/10_Simple_file_reader_using_a_configurable_read_filter.php deleted file mode 100644 index 7b3fc440..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/10_Simple_file_reader_using_a_configurable_read_filter.php +++ /dev/null @@ -1,52 +0,0 @@ -startRow = $startRow; - $this->endRow = $endRow; - $this->columns = $columns; - } - - public function readCell($column, $row, $worksheetName = '') - { - if ($row >= $this->startRow && $row <= $this->endRow) { - if (in_array($column, $this->columns)) { - return true; - } - } - - return false; - } -} - -$filterSubset = new MyReadFilter(9, 15, range('G', 'K')); - -$helper->log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory with a defined reader type of ' . $inputFileType); -$reader = IOFactory::createReader($inputFileType); -$helper->log('Loading Sheet "' . $sheetname . '" only'); -$reader->setLoadSheetsOnly($sheetname); -$helper->log('Loading Sheet using configurable filter'); -$reader->setReadFilter($filterSubset); -$spreadsheet = $reader->load($inputFileName); - -$sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true); -var_dump($sheetData); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/11_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_1).php b/vendor/phpoffice/phpspreadsheet/samples/Reader/11_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_1).php deleted file mode 100644 index 18562217..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/11_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_1).php +++ /dev/null @@ -1,64 +0,0 @@ -startRow = $startRow; - $this->endRow = $startRow + $chunkSize; - } - - public function readCell($column, $row, $worksheetName = '') - { - // Only read the heading row, and the rows that were configured in the constructor - if (($row == 1) || ($row >= $this->startRow && $row < $this->endRow)) { - return true; - } - - return false; - } -} - -$helper->log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory with a defined reader type of ' . $inputFileType); -// Create a new Reader of the type defined in $inputFileType -$reader = IOFactory::createReader($inputFileType); - -// Define how many rows we want for each "chunk" -$chunkSize = 20; - -// Loop to read our worksheet in "chunk size" blocks -for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) { - $helper->log('Loading WorkSheet using configurable filter for headings row 1 and for rows ' . $startRow . ' to ' . ($startRow + $chunkSize - 1)); - // Create a new Instance of our Read Filter, passing in the limits on which rows we want to read - $chunkFilter = new ChunkReadFilter($startRow, $chunkSize); - // Tell the Reader that we want to use the new Read Filter that we've just Instantiated - $reader->setReadFilter($chunkFilter); - // Load only the rows that match our filter from $inputFileName to a PhpSpreadsheet Object - $spreadsheet = $reader->load($inputFileName); - - // Do some processing here - - $sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true); - var_dump($sheetData); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/12_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_2).php b/vendor/phpoffice/phpspreadsheet/samples/Reader/12_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_2).php deleted file mode 100644 index 1f39ec4d..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/12_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_2).php +++ /dev/null @@ -1,67 +0,0 @@ -startRow = $startRow; - $this->endRow = $startRow + $chunkSize; - } - - public function readCell($column, $row, $worksheetName = '') - { - // Only read the heading row, and the rows that are configured in $this->_startRow and $this->_endRow - if (($row == 1) || ($row >= $this->startRow && $row < $this->endRow)) { - return true; - } - - return false; - } -} - -$helper->log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory with a defined reader type of ' . $inputFileType); -// Create a new Reader of the type defined in $inputFileType -$reader = IOFactory::createReader($inputFileType); - -// Define how many rows we want to read for each "chunk" -$chunkSize = 20; -// Create a new Instance of our Read Filter -$chunkFilter = new ChunkReadFilter(); - -// Tell the Reader that we want to use the Read Filter that we've Instantiated -$reader->setReadFilter($chunkFilter); - -// Loop to read our worksheet in "chunk size" blocks -for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) { - $helper->log('Loading WorkSheet using configurable filter for headings row 1 and for rows ' . $startRow . ' to ' . ($startRow + $chunkSize - 1)); - // Tell the Read Filter, the limits on which rows we want to read this iteration - $chunkFilter->setRows($startRow, $chunkSize); - // Load only the rows that match our filter from $inputFileName to a PhpSpreadsheet Object - $spreadsheet = $reader->load($inputFileName); - - // Do some processing here - - $sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true); - var_dump($sheetData); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/13_Simple_file_reader_for_multiple_CSV_files.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/13_Simple_file_reader_for_multiple_CSV_files.php deleted file mode 100644 index d4817e30..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/13_Simple_file_reader_for_multiple_CSV_files.php +++ /dev/null @@ -1,29 +0,0 @@ -log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' into WorkSheet #1 using IOFactory with a defined reader type of ' . $inputFileType); -$spreadsheet = $reader->load($inputFileName); -$spreadsheet->getActiveSheet()->setTitle(pathinfo($inputFileName, PATHINFO_BASENAME)); -foreach ($inputFileNames as $sheet => $inputFileName) { - $helper->log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' into WorkSheet #' . ($sheet + 2) . ' using IOFactory with a defined reader type of ' . $inputFileType); - $reader->setSheetIndex($sheet + 1); - $reader->loadIntoExisting($inputFileName, $spreadsheet); - $spreadsheet->getActiveSheet()->setTitle(pathinfo($inputFileName, PATHINFO_BASENAME)); -} - -$helper->log($spreadsheet->getSheetCount() . ' worksheet' . (($spreadsheet->getSheetCount() == 1) ? '' : 's') . ' loaded'); -$loadedSheetNames = $spreadsheet->getSheetNames(); -foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) { - $helper->log('Worksheet #' . $sheetIndex . ' -> ' . $loadedSheetName . ''); - $spreadsheet->setActiveSheetIndexByName($loadedSheetName); - $sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true); - var_dump($sheetData); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/14_Reading_a_large_CSV_file_in_chunks_to_split_across_multiple_worksheets.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/14_Reading_a_large_CSV_file_in_chunks_to_split_across_multiple_worksheets.php deleted file mode 100644 index efe68582..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/14_Reading_a_large_CSV_file_in_chunks_to_split_across_multiple_worksheets.php +++ /dev/null @@ -1,86 +0,0 @@ -startRow = $startRow; - $this->endRow = $startRow + $chunkSize; - } - - public function readCell($column, $row, $worksheetName = '') - { - // Only read the heading row, and the rows that are configured in $this->_startRow and $this->_endRow - if (($row == 1) || ($row >= $this->startRow && $row < $this->endRow)) { - return true; - } - - return false; - } -} - -$helper->log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory with a defined reader type of ' . $inputFileType); -// Create a new Reader of the type defined in $inputFileType -$reader = IOFactory::createReader($inputFileType); - -// Define how many rows we want to read for each "chunk" -$chunkSize = 100; -// Create a new Instance of our Read Filter -$chunkFilter = new ChunkReadFilter(); - -// Tell the Reader that we want to use the Read Filter that we've Instantiated -// and that we want to store it in contiguous rows/columns -$reader->setReadFilter($chunkFilter) - ->setContiguous(true); - -// Instantiate a new PhpSpreadsheet object manually -$spreadsheet = new Spreadsheet(); - -// Set a sheet index -$sheet = 0; -// Loop to read our worksheet in "chunk size" blocks -/** $startRow is set to 2 initially because we always read the headings in row #1 * */ -for ($startRow = 2; $startRow <= 240; $startRow += $chunkSize) { - $helper->log('Loading WorkSheet #' . ($sheet + 1) . ' using configurable filter for headings row 1 and for rows ' . $startRow . ' to ' . ($startRow + $chunkSize - 1)); - // Tell the Read Filter, the limits on which rows we want to read this iteration - $chunkFilter->setRows($startRow, $chunkSize); - - // Increment the worksheet index pointer for the Reader - $reader->setSheetIndex($sheet); - // Load only the rows that match our filter into a new worksheet in the PhpSpreadsheet Object - $reader->loadIntoExisting($inputFileName, $spreadsheet); - // Set the worksheet title (to reference the "sheet" of data that we've loaded) - // and increment the sheet index as well - $spreadsheet->getActiveSheet()->setTitle('Country Data #' . (++$sheet)); -} - -$helper->log($spreadsheet->getSheetCount() . ' worksheet' . (($spreadsheet->getSheetCount() == 1) ? '' : 's') . ' loaded'); -$loadedSheetNames = $spreadsheet->getSheetNames(); -foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) { - $helper->log('Worksheet #' . $sheetIndex . ' -> ' . $loadedSheetName . ''); - $spreadsheet->setActiveSheetIndexByName($loadedSheetName); - $sheetData = $spreadsheet->getActiveSheet()->toArray(null, false, false, true); - var_dump($sheetData); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/15_Simple_file_reader_for_tab_separated_value_file_using_the_Advanced_Value_Binder.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/15_Simple_file_reader_for_tab_separated_value_file_using_the_Advanced_Value_Binder.php deleted file mode 100644 index 8213678a..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/15_Simple_file_reader_for_tab_separated_value_file_using_the_Advanced_Value_Binder.php +++ /dev/null @@ -1,41 +0,0 @@ -log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' into WorkSheet #1 using IOFactory with a defined reader type of ' . $inputFileType); -$reader->setDelimiter("\t"); -$spreadsheet = $reader->load($inputFileName); -$spreadsheet->getActiveSheet()->setTitle(pathinfo($inputFileName, PATHINFO_BASENAME)); - -$helper->log($spreadsheet->getSheetCount() . ' worksheet' . (($spreadsheet->getSheetCount() == 1) ? '' : 's') . ' loaded'); -$loadedSheetNames = $spreadsheet->getSheetNames(); -foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) { - $helper->log('Worksheet #' . $sheetIndex . ' -> ' . $loadedSheetName . ' (Formatted)'); - $spreadsheet->setActiveSheetIndexByName($loadedSheetName); - $sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true); - var_dump($sheetData); -} - -foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) { - $helper->log('Worksheet #' . $sheetIndex . ' -> ' . $loadedSheetName . ' (Unformatted)'); - $spreadsheet->setActiveSheetIndexByName($loadedSheetName); - $sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, false, true); - var_dump($sheetData); -} - -foreach ($loadedSheetNames as $sheetIndex => $loadedSheetName) { - $helper->log('Worksheet #' . $sheetIndex . ' -> ' . $loadedSheetName . ' (Raw)'); - $spreadsheet->setActiveSheetIndexByName($loadedSheetName); - $sheetData = $spreadsheet->getActiveSheet()->toArray(null, false, false, true); - var_dump($sheetData); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/16_Handling_loader_exceptions_using_TryCatch.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/16_Handling_loader_exceptions_using_TryCatch.php deleted file mode 100644 index 80bb371d..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/16_Handling_loader_exceptions_using_TryCatch.php +++ /dev/null @@ -1,14 +0,0 @@ -log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory to identify the format'); - -try { - $spreadsheet = IOFactory::load($inputFileName); -} catch (InvalidArgumentException $e) { - $helper->log('Error loading file "' . pathinfo($inputFileName, PATHINFO_BASENAME) . '": ' . $e->getMessage()); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/17_Simple_file_reader_loading_several_named_worksheets.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/17_Simple_file_reader_loading_several_named_worksheets.php deleted file mode 100644 index db30bff8..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/17_Simple_file_reader_loading_several_named_worksheets.php +++ /dev/null @@ -1,20 +0,0 @@ -log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' using IOFactory with a defined reader type of ' . $inputFileType); -$reader = IOFactory::createReader($inputFileType); - -// Read the list of Worksheet Names from the Workbook file -$helper->log('Read the list of Worksheets in the WorkBook'); -$worksheetNames = $reader->listWorksheetNames($inputFileName); - -$helper->log('There are ' . count($worksheetNames) . ' worksheet' . ((count($worksheetNames) == 1) ? '' : 's') . ' in the workbook'); -foreach ($worksheetNames as $worksheetName) { - $helper->log($worksheetName); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/18_Reading_list_of_worksheets_without_loading_entire_file.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/18_Reading_list_of_worksheets_without_loading_entire_file.php deleted file mode 100644 index bb58a2d5..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/18_Reading_list_of_worksheets_without_loading_entire_file.php +++ /dev/null @@ -1,20 +0,0 @@ -log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' information using IOFactory with a defined reader type of ' . $inputFileType); - -$reader = IOFactory::createReader($inputFileType); -$worksheetNames = $reader->listWorksheetNames($inputFileName); - -$helper->log('

    Worksheet Names

    '); -$helper->log('
      '); -foreach ($worksheetNames as $worksheetName) { - $helper->log('
    1. ' . $worksheetName . '
    2. '); -} -$helper->log('
    '); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/19_Reading_worksheet_information_without_loading_entire_file.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/19_Reading_worksheet_information_without_loading_entire_file.php deleted file mode 100644 index 5cdc4988..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/19_Reading_worksheet_information_without_loading_entire_file.php +++ /dev/null @@ -1,23 +0,0 @@ -log('Loading file ' . pathinfo($inputFileName, PATHINFO_BASENAME) . ' information using IOFactory with a defined reader type of ' . $inputFileType); - -$reader = IOFactory::createReader($inputFileType); -$worksheetData = $reader->listWorksheetInfo($inputFileName); - -$helper->log('

    Worksheet Information

    '); -$helper->log('
      '); -foreach ($worksheetData as $worksheet) { - $helper->log('
    1. ' . $worksheet['worksheetName']); - $helper->log('Rows: ' . $worksheet['totalRows'] . ' Columns: ' . $worksheet['totalColumns']); - $helper->log('Cell Range: A1:' . $worksheet['lastColumnLetter'] . $worksheet['totalRows']); - $helper->log('
    2. '); -} -$helper->log('
    '); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/20_Reader_worksheet_hyperlink_image.php b/vendor/phpoffice/phpspreadsheet/samples/Reader/20_Reader_worksheet_hyperlink_image.php deleted file mode 100644 index 0636e467..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/20_Reader_worksheet_hyperlink_image.php +++ /dev/null @@ -1,54 +0,0 @@ -log('Start'); - -$spreadsheet = new Spreadsheet(); - -$aSheet = $spreadsheet->getActiveSheet(); - -$gdImage = @imagecreatetruecolor(120, 20); -$textColor = imagecolorallocate($gdImage, 255, 255, 255); -imagestring($gdImage, 1, 5, 5, 'Created with PhpSpreadsheet', $textColor); - -$baseUrl = 'https://phpspreadsheet.readthedocs.io/'; - -$drawing = new \PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing(); -$drawing->setName('In-Memory image 1'); -$drawing->setDescription('In-Memory image 1'); -$drawing->setCoordinates('A1'); -$drawing->setImageResource($gdImage); -$drawing->setRenderingFunction( - \PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::RENDERING_JPEG -); -$drawing->setMimeType(\PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::MIMETYPE_DEFAULT); -$drawing->setHeight(36); -$helper->log('Write image'); - -$hyperLink = new \PhpOffice\PhpSpreadsheet\Cell\Hyperlink($baseUrl, 'test image'); -$drawing->setHyperlink($hyperLink); -$helper->log('Write link: ' . $baseUrl); - -$drawing->setWorksheet($aSheet); - -$filename = tempnam(\PhpOffice\PhpSpreadsheet\Shared\File::sysGetTempDir(), 'phpspreadsheet-test'); - -$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, $inputFileType); -$writer->save($filename); - -$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType); - -$reloadedSpreadsheet = $reader->load($filename); -unlink($filename); - -$helper->log('reloaded Spreadsheet'); - -foreach ($reloadedSpreadsheet->getActiveSheet()->getDrawingCollection() as $pDrawing) { - $helper->log('Read link: ' . $pDrawing->getHyperlink()->getUrl()); -} - -$helper->log('end'); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example1.csv b/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example1.csv deleted file mode 100644 index b8cdf182..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example1.csv +++ /dev/null @@ -1,4 +0,0 @@ -First Name,Last Name,Nationality,Gender,Date of Birth,Time of Birth,Date/Time,PHP Coder,Sanity %Age -Mark,Baker,British,M,19-Dec-1960,01:30,=E2+F2,TRUE,32% -Toni,Baker,British,F,24-Nov-1950,20:00,=E3+F3,FALSE,95% -Rachel,Baker,British,F,7-Dec-1982,00:15,=E4+F4,FALSE,100% \ No newline at end of file diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example1.tsv b/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example1.tsv deleted file mode 100644 index 29c9297c..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example1.tsv +++ /dev/null @@ -1,4 +0,0 @@ -First Name Last Name Nationality Gender Date of Birth Time of Birth Date/Time PHP Coder Sanity %Age -Mark Baker British M 19-Dec-1960 01:30 =E2+F2 TRUE 32% -Toni Baker British F 24-Nov-1950 20:00 =E3+F3 FALSE 95% -Rachel Baker British F 7-Dec-1982 00:15 =E4+F4 FALSE 100% \ No newline at end of file diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example1.xls b/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example1.xls deleted file mode 100644 index bd9bb110..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example1.xls and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example2.csv b/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example2.csv deleted file mode 100644 index 1750f1b6..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example2.csv +++ /dev/null @@ -1,223 +0,0 @@ -"City","Country","Latitude","Longitude" -"Kabul","Afghanistan",34.528455,69.171703 -"Tirane","Albania",41.33,19.82 -"Algiers","Algeria",36.752887,3.042048 -"Pago Pago","American Samoa",-14.27933,-170.700897 -"Andorra la Vella","Andorra",42.507531,1.521816 -"Luanda","Angola",-8.838333,13.234444 -"Buenos Aires","Argentina",-34.608417,-58.373161 -"Yerevan","Armenia",40.183333,44.516667 -"Oranjestad","Aruba",12.52458,-70.026459 -"Canberra","Australia",-35.3075,149.124417 -"Vienna","Austria",48.208333,16.373056 -"Baku","Azerbaijan",40.379571,49.891233 -"Nassau","Bahamas",25.06,-77.345 -"Manama","Bahrain",26.216667,50.583333 -"Dhaka","Bangladesh",23.709921,90.407143 -"Bridgetown","Barbados",13.096111,-59.608333 -"Minsk","Belarus",53.9,27.566667 -"Brussels","Belgium",50.846281,4.354727 -"Belmopan","Belize",17.251389,-88.766944 -"Thimphu","Bhutan",27.466667,89.641667 -"La Paz","Bolivia",-16.49901,-68.146248 -"Sarajevo","Bosnia and Herzegovina",43.8476,18.3564 -"Gaborone","Botswana",-24.65411,25.908739 -"Brasilia","Brazil",-15.780148,-47.92917 -"Road Town","British Virgin Islands",18.433333,-64.616667 -"Bandar Seri Begawan","Brunei Darussalam",4.9431,114.9425 -"Sofia","Bulgaria",42.697626,23.322284 -"Ouagadougou","Burkina Faso",12.364637,-1.533864 -"Bujumbura","Burundi",-3.361378,29.359878 -"Phnom Penh","Cambodia",11.55,104.916667 -"Yaounde","Cameroon",3.866667,11.516667 -"Ottawa","Canada",45.423494,-75.697933 -"Praia","Cape Verde",14.920833,-23.508333 -"George Town","Cayman Islands",19.286932,-81.367439 -"Bangui","Central African Republic",4.361698,18.555975 -"N'Djamena","Chad",12.104797,15.044506 -"Santiago","Chile",-33.42536,-70.566466 -"Beijing","China",39.904667,116.408198 -"Bogota","Colombia",4.647302,-74.096268 -"Moroni","Comoros",-11.717216,43.247315 -"Brazzaville","Congo",-4.266667,15.283333 -"San Jose","Costa Rica",9.933333,-84.083333 -"Yamoussoukro","Cote d'Ivoire",6.816667,-5.283333 -"Zagreb","Croatia",45.814912,15.978515 -"Havana","Cuba",23.133333,-82.366667 -"Nicosia","Cyprus",35.166667,33.366667 -"Prague","Czech Republic",50.087811,14.42046 -"Kinshasa","Congo",-4.325,15.322222 -"Copenhagen","Denmark",55.676294,12.568116 -"Djibouti","Djibouti",11.588,43.145 -"Roseau","Dominica",15.301389,-61.388333 -"Santo Domingo","Dominican Republic",18.5,-69.983333 -"Dili","East Timor",-8.566667,125.566667 -"Quito","Ecuador",-0.229498,-78.524277 -"Cairo","Egypt",30.064742,31.249509 -"San Salvador","El Salvador",13.69,-89.190003 -"Malabo","Equatorial Guinea",3.75,8.783333 -"Asmara","Eritrea",15.33236,38.92617 -"Tallinn","Estonia",59.438862,24.754472 -"Addis Ababa","Ethiopia",9.022736,38.746799 -"Stanley","Falkland Islands",-51.700981,-57.84919 -"Torshavn","Faroe Islands",62.017707,-6.771879 -"Suva","Fiji",-18.1416,178.4419 -"Helsinki","Finland",60.169813,24.93824 -"Paris","France",48.856667,2.350987 -"Cayenne","French Guiana",4.9227,-52.3269 -"Papeete","French Polynesia",-17.535021,-149.569595 -"Libreville","Gabon",0.390841,9.453644 -"Banjul","Gambia",13.453056,-16.5775 -"T'bilisi","Georgia",41.716667,44.783333 -"Berlin","Germany",52.523405,13.4114 -"Accra","Ghana",5.555717,-0.196306 -"Athens","Greece",37.97918,23.716647 -"Nuuk","Greenland",64.18362,-51.721407 -"Basse-Terre","Guadeloupe",15.998503,-61.72202 -"Guatemala","Guatemala",14.641389,-90.513056 -"St. Peter Port","Guernsey",49.458858,-2.534752 -"Conakry","Guinea",9.537029,-13.67847 -"Bissau","Guinea-Bissau",11.866667,-15.6 -"Georgetown","Guyana",6.804611,-58.154831 -"Port-au-Prince","Haiti",18.539269,-72.336408 -"Tegucigalpa","Honduras",14.082054,-87.206285 -"Budapest","Hungary",47.498406,19.040758 -"Reykjavik","Iceland",64.135338,-21.89521 -"New Delhi","India",28.635308,77.22496 -"Jakarta","Indonesia",-6.211544,106.845172 -"Tehran","Iran",35.696216,51.422945 -"Baghdad","Iraq",33.3157,44.3922 -"Dublin","Ireland",53.344104,-6.267494 -"Jerusalem","Israel",31.7857,35.2007 -"Rome","Italy",41.895466,12.482324 -"Kingston","Jamaica",17.992731,-76.792009 -"St. Helier","Jersey",49.190278,-2.108611 -"Amman","Jordan",31.956578,35.945695 -"Astana","Kazakhstan",51.10,71.30 -"Nairobi","Kenya",-01.17,36.48 -"Tarawa","Kiribati",01.30,173.00 -"Seoul","South Korea",37.31,126.58 -"Kuwait City","Kuwait",29.30,48.00 -"Bishkek","Kyrgyzstan",42.54,74.46 -"Riga","Latvia",56.53,24.08 -"Beirut","Lebanon",33.53,35.31 -"Maseru","Lesotho",-29.18,27.30 -"Monrovia","Liberia",06.18,-10.47 -"Vaduz","Liechtenstein",47.08,09.31 -"Vilnius","Lithuania",54.38,25.19 -"Luxembourg","Luxembourg",49.37,06.09 -"Antananarivo","Madagascar",-18.55,47.31 -"Lilongwe","Malawi",-14.00,33.48 -"Kuala Lumpur","Malaysia",03.09,101.41 -"Male","Maldives",04.00,73.28 -"Bamako","Mali",12.34,-07.55 -"Valletta","Malta",35.54,14.31 -"Fort-de-France","Martinique",14.36,-61.02 -"Nouakchott","Mauritania",-20.10,57.30 -"Mamoudzou","Mayotte",-12.48,45.14 -"Mexico City","Mexico",19.20,-99.10 -"Palikir","Micronesia",06.55,158.09 -"Chisinau","Moldova",47.02,28.50 -"Maputo","Mozambique",-25.58,32.32 -"Yangon","Myanmar",16.45,96.20 -"Windhoek","Namibia",-22.35,17.04 -"Kathmandu","Nepal",27.45,85.20 -"Amsterdam","Netherlands",52.23,04.54 -"Willemstad","Netherlands Antilles",12.05,-69.00 -"Noumea","New Caledonia",-22.17,166.30 -"Wellington","New Zealand",-41.19,174.46 -"Managua","Nicaragua",12.06,-86.20 -"Niamey","Niger",13.27,02.06 -"Abuja","Nigeria",09.05,07.32 -"Kingston","Norfolk Island",-45.20,168.43 -"Saipan","Northern Mariana Islands",15.12,145.45 -"Oslo","Norway",59.55,10.45 -"Masqat","Oman",23.37,58.36 -"Islamabad","Pakistan",33.40,73.10 -"Koror","Palau",07.20,134.28 -"Panama City","Panama",09.00,-79.25 -"Port Moresby","Papua New Guinea",-09.24,147.08 -"Asuncion","Paraguay",-25.10,-57.30 -"Lima","Peru",-12.00,-77.00 -"Manila","Philippines",14.40,121.03 -"Warsaw","Poland",52.13,21.00 -"Lisbon","Portugal",38.42,-09.10 -"San Juan","Puerto Rico",18.28,-66.07 -"Doha","Qatar",25.15,51.35 -"Bucuresti","Romania",44.27,26.10 -"Moskva","Russian Federation",55.45,37.35 -"Kigali","Rawanda",-01.59,30.04 -"Basseterre","Saint Kitts and Nevis",17.17,-62.43 -"Castries","Saint Lucia",14.02,-60.58 -"Saint-Pierre","Saint Pierre and Miquelon",46.46,-56.12 -"Apia","Samoa",-13.50,-171.50 -"San Marino","San Marino",43.55,12.30 -"Sao Tome","Sao Tome and Principe",00.10,06.39 -"Riyadh","Saudi Arabia",24.41,46.42 -"Dakar","Senegal",14.34,-17.29 -"Freetown","Sierra Leone",08.30,-13.17 -"Bratislava","Slovakia",48.10,17.07 -"Ljubljana","Slovenia",46.04,14.33 -"Honiara","Solomon Islands",-09.27,159.57 -"Mogadishu","Somalia",02.02,45.25 -"Pretoria","South Africa",-25.44,28.12 -"Madrid","Spain",40.25,-03.45 -"Khartoum","Sudan",15.31,32.35 -"Paramaribo","Suriname",05.50,-55.10 -"Mbabane","Swaziland",-26.18,31.06 -"Stockholm","Sweden",59.20,18.03 -"Bern","Switzerland",46.57,07.28 -"Damascus","Syrian Arab Republic",33.30,36.18 -"Dushanbe","Tajikistan",38.33,68.48 -"Bangkok","Thailand",13.45,100.35 -"Lome","Togo",06.09,01.20 -"Nuku'alofa","Tonga",-21.10,-174.00 -"Tunis","Tunisia",36.50,10.11 -"Ankara","Turkey",39.57,32.54 -"Ashgabat","Turkmenistan",38.00,57.50 -"Funafuti","Tuvalu",-08.31,179.13 -"Kampala","Uganda",00.20,32.30 -"Kiev","Ukraine",50.30,30.28 -"Abu Dhabi","United Arab Emirates",24.28,54.22 -"London","United Kingdom",51.36,-00.05 -"Dodoma","Tanzania",-06.08,35.45 -"Washington DC","United States of America",39.91,-77.02 -"Montevideo","Uruguay",-34.50,-56.11 -"Tashkent","Uzbekistan",41.20,69.10 -"Port-Vila","Vanuatu",-17.45,168.18 -"Caracas","Venezuela",10.30,-66.55 -"Hanoi","Viet Nam",21.05,105.55 -"Belgrade","Yugoslavia",44.50,20.37 -"Lusaka","Zambia",-15.28,28.16 -"Harare","Zimbabwe",-17.43,31.02 -"St. John's","Antigua and Barbuda",17.08,-61.50 -"Porto Novo","Benin",06.30,02.47 -"Hamilton","Bermuda"","32.18,-64.48 -"Avarua","Cook Islands",-21.12,-159.46 -"St. George's","Grenada",12.04,-61.44 -"Agaña","Guam",13.28,144.45 -"Victoria","Hong Kong",22.16,114.13 -"Tokyo","Japan",35.40,139.45 -"Pyongyang","North Korea",39.00,125.47 -"Vientiane","Laos",17.59,102.38 -"Tripoli","Libya",32.54,013.11 -"Skopje","Macedonia",42.00,021.28 -"Majuro","Marshall Islands",07.05,171.08 -"Port Louis","Mauritius",-20.10,57.30 -"Monaco","Monaco",43.44,007.25 -"Ulan Bator","Mongolia",47.54,106.52 -"Plymouth","Montserrat",16.44,-62.14 -"Rabat","Morocco",34.02,-06.51 -"Alofi","Niue",-14.27,-178.05 -"Saint-Denis","Réunion",-20.52,55.27 -"Victoria","Seychelles",-04.38,55.28 -"Singapore","Singapore",01.18,103.50 -"Colombo","Sri Lanka",06.55,79.52 -"Kingstown","St Vincent and the Grenadines",13.12,-61.14 -"Taipei","Taiwan",25.50,121.32 -"Port-of-Spain","Trinidad and Tobago",10.38,-61.31 -"Cockburn Harbour","Turks and Caicos Islands",21.30,-71.30 -"Charlotte Amalie","US Virgin Islands",18.22,-64.56 -"Vatican City","Vatican State",41.54,12.27 -"Laàyoune","Western Sahara",27.10,-13.11 -"San'a","Yemen",15.24,44.14 diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example2.xls b/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example2.xls deleted file mode 100644 index dd213ab9..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/samples/Reader/sampleData/example2.xls and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/Custom_properties.php b/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/Custom_properties.php deleted file mode 100644 index 1c222b50..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/Custom_properties.php +++ /dev/null @@ -1,53 +0,0 @@ -load($inputFileName); - -// Read an array list of any custom properties for this document -$customPropertyList = $spreadsheet->getProperties()->getCustomProperties(); - -// Loop through the list of custom properties -foreach ($customPropertyList as $customPropertyName) { - $helper->log('' . $customPropertyName . ': '); - // Retrieve the property value - $propertyValue = $spreadsheet->getProperties()->getCustomPropertyValue($customPropertyName); - // Retrieve the property type - $propertyType = $spreadsheet->getProperties()->getCustomPropertyType($customPropertyName); - - // Manipulate properties as appropriate for display purposes - switch ($propertyType) { - case 'i': // integer - $propertyType = 'integer number'; - - break; - case 'f': // float - $propertyType = 'floating point number'; - - break; - case 's': // string - $propertyType = 'string'; - - break; - case 'd': // date - $propertyValue = date('l, d<\s\up>S F Y g:i A', $propertyValue); - $propertyType = 'date'; - - break; - case 'b': // boolean - $propertyValue = ($propertyValue) ? 'TRUE' : 'FALSE'; - $propertyType = 'boolean'; - - break; - } - - $helper->log($propertyValue . ' (' . $propertyType . ')'); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/Custom_property_names.php b/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/Custom_property_names.php deleted file mode 100644 index 0f287f04..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/Custom_property_names.php +++ /dev/null @@ -1,20 +0,0 @@ -load($inputFileName); - -// Read an array list of any custom properties for this document -$customPropertyList = $spreadsheet->getProperties()->getCustomProperties(); - -foreach ($customPropertyList as $customPropertyName) { - $helper->log($customPropertyName); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/Properties.php b/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/Properties.php deleted file mode 100644 index 5bf25b8e..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/Properties.php +++ /dev/null @@ -1,64 +0,0 @@ -load($inputFileName); - -// Read the document's creator property -$creator = $spreadsheet->getProperties()->getCreator(); -$helper->log('Document Creator: ' . $creator); - -// Read the Date when the workbook was created (as a PHP timestamp value) -$creationDatestamp = $spreadsheet->getProperties()->getCreated(); -// Format the date and time using the standard PHP date() function -$creationDate = date('l, d<\s\up>S F Y', $creationDatestamp); -$creationTime = date('g:i A', $creationDatestamp); -$helper->log('Created On: ' . $creationDate . ' at ' . $creationTime); - -// Read the name of the last person to modify this workbook -$modifiedBy = $spreadsheet->getProperties()->getLastModifiedBy(); -$helper->log('Last Modified By: ' . $modifiedBy); - -// Read the Date when the workbook was last modified (as a PHP timestamp value) -$modifiedDatestamp = $spreadsheet->getProperties()->getModified(); -// Format the date and time using the standard PHP date() function -$modifiedDate = date('l, d<\s\up>S F Y', $modifiedDatestamp); -$modifiedTime = date('g:i A', $modifiedDatestamp); -$helper->log('Last Modified On: ' . $modifiedDate . ' at ' . $modifiedTime); - -// Read the workbook title property -$workbookTitle = $spreadsheet->getProperties()->getTitle(); -$helper->log('Title: ' . $workbookTitle); - -// Read the workbook description property -$description = $spreadsheet->getProperties()->getDescription(); -$helper->log('Description: ' . $description); - -// Read the workbook subject property -$subject = $spreadsheet->getProperties()->getSubject(); -$helper->log('Subject: ' . $subject); - -// Read the workbook keywords property -$keywords = $spreadsheet->getProperties()->getKeywords(); -$helper->log('Keywords: ' . $keywords); - -// Read the workbook category property -$category = $spreadsheet->getProperties()->getCategory(); -$helper->log('Category: ' . $category); - -// Read the workbook company property -$company = $spreadsheet->getProperties()->getCompany(); -$helper->log('Company: ' . $company); - -// Read the workbook manager property -$manager = $spreadsheet->getProperties()->getManager(); -$helper->log('Manager: ' . $manager); -$s = new \PhpOffice\PhpSpreadsheet\Helper\Sample(); diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/Worksheet_count_and_names.php b/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/Worksheet_count_and_names.php deleted file mode 100644 index 630312b7..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/Worksheet_count_and_names.php +++ /dev/null @@ -1,24 +0,0 @@ -load($inputFileName); - -// Use the PhpSpreadsheet object's getSheetCount() method to get a count of the number of WorkSheets in the WorkBook -$sheetCount = $spreadsheet->getSheetCount(); -$helper->log('There ' . (($sheetCount == 1) ? 'is' : 'are') . ' ' . $sheetCount . ' WorkSheet' . (($sheetCount == 1) ? '' : 's') . ' in the WorkBook'); - -$helper->log('Reading the names of Worksheets in the WorkBook'); -// Use the PhpSpreadsheet object's getSheetNames() method to get an array listing the names/titles of the WorkSheets in the WorkBook -$sheetNames = $spreadsheet->getSheetNames(); -foreach ($sheetNames as $sheetIndex => $sheetName) { - $helper->log('WorkSheet #' . $sheetIndex . ' is named "' . $sheetName . '"'); -} diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/sampleData/example1.xls b/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/sampleData/example1.xls deleted file mode 100644 index 0db0efdc..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/sampleData/example1.xls and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/sampleData/example1.xlsx b/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/sampleData/example1.xlsx deleted file mode 100644 index 2224dd4f..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/sampleData/example1.xlsx and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/sampleData/example2.xls b/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/sampleData/example2.xls deleted file mode 100644 index 18bfcf47..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/samples/Reading_workbook_data/sampleData/example2.xls and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/css/bootstrap.min.css b/vendor/phpoffice/phpspreadsheet/samples/bootstrap/css/bootstrap.min.css deleted file mode 100644 index ed3905e0..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/css/bootstrap.min.css +++ /dev/null @@ -1,6 +0,0 @@ -/*! - * Bootstrap v3.3.7 (http://getbootstrap.com) - * Copyright 2011-2016 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - *//*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{margin:.67em 0;font-size:2em}mark{color:#000;background:#ff0}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{height:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{margin:0;font:inherit;color:inherit}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}input{line-height:normal}input[type=checkbox],input[type=radio]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{padding:.35em .625em .75em;margin:0 2px;border:1px solid silver}legend{padding:0;border:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-spacing:0;border-collapse:collapse}td,th{padding:0}/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */@media print{*,:after,:before{color:#000!important;text-shadow:none!important;background:0 0!important;-webkit-box-shadow:none!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="javascript:"]:after,a[href^="#"]:after{content:""}blockquote,pre{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}img,tr{page-break-inside:avoid}img{max-width:100%!important}h2,h3,p{orphans:3;widows:3}h2,h3{page-break-after:avoid}.navbar{display:none}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table td,.table th{background-color:#fff!important}.table-bordered td,.table-bordered th{border:1px solid #ddd!important}}@font-face{font-family:'Glyphicons Halflings';src:url(../fonts/glyphicons-halflings-regular.eot);src:url(../fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'),url(../fonts/glyphicons-halflings-regular.woff2) format('woff2'),url(../fonts/glyphicons-halflings-regular.woff) format('woff'),url(../fonts/glyphicons-halflings-regular.ttf) format('truetype'),url(../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glyphicon-asterisk:before{content:"\002a"}.glyphicon-plus:before{content:"\002b"}.glyphicon-eur:before,.glyphicon-euro:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}.glyphicon-cd:before{content:"\e201"}.glyphicon-save-file:before{content:"\e202"}.glyphicon-open-file:before{content:"\e203"}.glyphicon-level-up:before{content:"\e204"}.glyphicon-copy:before{content:"\e205"}.glyphicon-paste:before{content:"\e206"}.glyphicon-alert:before{content:"\e209"}.glyphicon-equalizer:before{content:"\e210"}.glyphicon-king:before{content:"\e211"}.glyphicon-queen:before{content:"\e212"}.glyphicon-pawn:before{content:"\e213"}.glyphicon-bishop:before{content:"\e214"}.glyphicon-knight:before{content:"\e215"}.glyphicon-baby-formula:before{content:"\e216"}.glyphicon-tent:before{content:"\26fa"}.glyphicon-blackboard:before{content:"\e218"}.glyphicon-bed:before{content:"\e219"}.glyphicon-apple:before{content:"\f8ff"}.glyphicon-erase:before{content:"\e221"}.glyphicon-hourglass:before{content:"\231b"}.glyphicon-lamp:before{content:"\e223"}.glyphicon-duplicate:before{content:"\e224"}.glyphicon-piggy-bank:before{content:"\e225"}.glyphicon-scissors:before{content:"\e226"}.glyphicon-bitcoin:before{content:"\e227"}.glyphicon-btc:before{content:"\e227"}.glyphicon-xbt:before{content:"\e227"}.glyphicon-yen:before{content:"\00a5"}.glyphicon-jpy:before{content:"\00a5"}.glyphicon-ruble:before{content:"\20bd"}.glyphicon-rub:before{content:"\20bd"}.glyphicon-scale:before{content:"\e230"}.glyphicon-ice-lolly:before{content:"\e231"}.glyphicon-ice-lolly-tasted:before{content:"\e232"}.glyphicon-education:before{content:"\e233"}.glyphicon-option-horizontal:before{content:"\e234"}.glyphicon-option-vertical:before{content:"\e235"}.glyphicon-menu-hamburger:before{content:"\e236"}.glyphicon-modal-window:before{content:"\e237"}.glyphicon-oil:before{content:"\e238"}.glyphicon-grain:before{content:"\e239"}.glyphicon-sunglasses:before{content:"\e240"}.glyphicon-text-size:before{content:"\e241"}.glyphicon-text-color:before{content:"\e242"}.glyphicon-text-background:before{content:"\e243"}.glyphicon-object-align-top:before{content:"\e244"}.glyphicon-object-align-bottom:before{content:"\e245"}.glyphicon-object-align-horizontal:before{content:"\e246"}.glyphicon-object-align-left:before{content:"\e247"}.glyphicon-object-align-vertical:before{content:"\e248"}.glyphicon-object-align-right:before{content:"\e249"}.glyphicon-triangle-right:before{content:"\e250"}.glyphicon-triangle-left:before{content:"\e251"}.glyphicon-triangle-bottom:before{content:"\e252"}.glyphicon-triangle-top:before{content:"\e253"}.glyphicon-console:before{content:"\e254"}.glyphicon-superscript:before{content:"\e255"}.glyphicon-subscript:before{content:"\e256"}.glyphicon-menu-left:before{content:"\e257"}.glyphicon-menu-right:before{content:"\e258"}.glyphicon-menu-down:before{content:"\e259"}.glyphicon-menu-up:before{content:"\e260"}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}:after,:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:10px;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.42857143;color:#333;background-color:#fff}button,input,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#337ab7;text-decoration:none}a:focus,a:hover{color:#23527c;text-decoration:underline}a:focus{outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}figure{margin:0}img{vertical-align:middle}.carousel-inner>.item>a>img,.carousel-inner>.item>img,.img-responsive,.thumbnail a>img,.thumbnail>img{display:block;max-width:100%;height:auto}.img-rounded{border-radius:6px}.img-thumbnail{display:inline-block;max-width:100%;height:auto;padding:4px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}[role=button]{cursor:pointer}.h1,.h2,.h3,.h4,.h5,.h6,h1,h2,h3,h4,h5,h6{font-family:inherit;font-weight:500;line-height:1.1;color:inherit}.h1 .small,.h1 small,.h2 .small,.h2 small,.h3 .small,.h3 small,.h4 .small,.h4 small,.h5 .small,.h5 small,.h6 .small,.h6 small,h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small,h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-weight:400;line-height:1;color:#777}.h1,.h2,.h3,h1,h2,h3{margin-top:20px;margin-bottom:10px}.h1 .small,.h1 small,.h2 .small,.h2 small,.h3 .small,.h3 small,h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small{font-size:65%}.h4,.h5,.h6,h4,h5,h6{margin-top:10px;margin-bottom:10px}.h4 .small,.h4 small,.h5 .small,.h5 small,.h6 .small,.h6 small,h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-size:75%}.h1,h1{font-size:36px}.h2,h2{font-size:30px}.h3,h3{font-size:24px}.h4,h4{font-size:18px}.h5,h5{font-size:14px}.h6,h6{font-size:12px}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:16px;font-weight:300;line-height:1.4}@media (min-width:768px){.lead{font-size:21px}}.small,small{font-size:85%}.mark,mark{padding:.2em;background-color:#fcf8e3}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.text-justify{text-align:justify}.text-nowrap{white-space:nowrap}.text-lowercase{text-transform:lowercase}.text-uppercase{text-transform:uppercase}.text-capitalize{text-transform:capitalize}.text-muted{color:#777}.text-primary{color:#337ab7}a.text-primary:focus,a.text-primary:hover{color:#286090}.text-success{color:#3c763d}a.text-success:focus,a.text-success:hover{color:#2b542c}.text-info{color:#31708f}a.text-info:focus,a.text-info:hover{color:#245269}.text-warning{color:#8a6d3b}a.text-warning:focus,a.text-warning:hover{color:#66512c}.text-danger{color:#a94442}a.text-danger:focus,a.text-danger:hover{color:#843534}.bg-primary{color:#fff;background-color:#337ab7}a.bg-primary:focus,a.bg-primary:hover{background-color:#286090}.bg-success{background-color:#dff0d8}a.bg-success:focus,a.bg-success:hover{background-color:#c1e2b3}.bg-info{background-color:#d9edf7}a.bg-info:focus,a.bg-info:hover{background-color:#afd9ee}.bg-warning{background-color:#fcf8e3}a.bg-warning:focus,a.bg-warning:hover{background-color:#f7ecb5}.bg-danger{background-color:#f2dede}a.bg-danger:focus,a.bg-danger:hover{background-color:#e4b9b9}.page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}ol,ul{margin-top:0;margin-bottom:10px}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;margin-left:-5px;list-style:none}.list-inline>li{display:inline-block;padding-right:5px;padding-left:5px}dl{margin-top:0;margin-bottom:20px}dd,dt{line-height:1.42857143}dt{font-weight:700}dd{margin-left:0}@media (min-width:768px){.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}}abbr[data-original-title],abbr[title]{cursor:help;border-bottom:1px dotted #777}.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:10px 20px;margin:0 0 20px;font-size:17.5px;border-left:5px solid #eee}blockquote ol:last-child,blockquote p:last-child,blockquote ul:last-child{margin-bottom:0}blockquote .small,blockquote footer,blockquote small{display:block;font-size:80%;line-height:1.42857143;color:#777}blockquote .small:before,blockquote footer:before,blockquote small:before{content:'\2014 \00A0'}.blockquote-reverse,blockquote.pull-right{padding-right:15px;padding-left:0;text-align:right;border-right:5px solid #eee;border-left:0}.blockquote-reverse .small:before,.blockquote-reverse footer:before,.blockquote-reverse small:before,blockquote.pull-right .small:before,blockquote.pull-right footer:before,blockquote.pull-right small:before{content:''}.blockquote-reverse .small:after,.blockquote-reverse footer:after,.blockquote-reverse small:after,blockquote.pull-right .small:after,blockquote.pull-right footer:after,blockquote.pull-right small:after{content:'\00A0 \2014'}address{margin-bottom:20px;font-style:normal;line-height:1.42857143}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}code{padding:2px 4px;font-size:90%;color:#c7254e;background-color:#f9f2f4;border-radius:4px}kbd{padding:2px 4px;font-size:90%;color:#fff;background-color:#333;border-radius:3px;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.25);box-shadow:inset 0 -1px 0 rgba(0,0,0,.25)}kbd kbd{padding:0;font-size:100%;font-weight:700;-webkit-box-shadow:none;box-shadow:none}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.42857143;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}@media (min-width:768px){.container{width:750px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}.container-fluid{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.row{margin-right:-15px;margin-left:-15px}.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{position:relative;min-height:1px;padding-right:15px;padding-left:15px}.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666667%}.col-xs-10{width:83.33333333%}.col-xs-9{width:75%}.col-xs-8{width:66.66666667%}.col-xs-7{width:58.33333333%}.col-xs-6{width:50%}.col-xs-5{width:41.66666667%}.col-xs-4{width:33.33333333%}.col-xs-3{width:25%}.col-xs-2{width:16.66666667%}.col-xs-1{width:8.33333333%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666667%}.col-xs-pull-10{right:83.33333333%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666667%}.col-xs-pull-7{right:58.33333333%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666667%}.col-xs-pull-4{right:33.33333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.66666667%}.col-xs-pull-1{right:8.33333333%}.col-xs-pull-0{right:auto}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666667%}.col-xs-push-10{left:83.33333333%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666667%}.col-xs-push-7{left:58.33333333%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666667%}.col-xs-push-4{left:33.33333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.66666667%}.col-xs-push-1{left:8.33333333%}.col-xs-push-0{left:auto}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666667%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-0{margin-left:0}@media (min-width:768px){.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666667%}.col-sm-10{width:83.33333333%}.col-sm-9{width:75%}.col-sm-8{width:66.66666667%}.col-sm-7{width:58.33333333%}.col-sm-6{width:50%}.col-sm-5{width:41.66666667%}.col-sm-4{width:33.33333333%}.col-sm-3{width:25%}.col-sm-2{width:16.66666667%}.col-sm-1{width:8.33333333%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666667%}.col-sm-pull-10{right:83.33333333%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666667%}.col-sm-pull-7{right:58.33333333%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666667%}.col-sm-pull-4{right:33.33333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.66666667%}.col-sm-pull-1{right:8.33333333%}.col-sm-pull-0{right:auto}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666667%}.col-sm-push-10{left:83.33333333%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666667%}.col-sm-push-7{left:58.33333333%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666667%}.col-sm-push-4{left:33.33333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.66666667%}.col-sm-push-1{left:8.33333333%}.col-sm-push-0{left:auto}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666667%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-0{margin-left:0}}@media (min-width:992px){.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666667%}.col-md-10{width:83.33333333%}.col-md-9{width:75%}.col-md-8{width:66.66666667%}.col-md-7{width:58.33333333%}.col-md-6{width:50%}.col-md-5{width:41.66666667%}.col-md-4{width:33.33333333%}.col-md-3{width:25%}.col-md-2{width:16.66666667%}.col-md-1{width:8.33333333%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666667%}.col-md-pull-10{right:83.33333333%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666667%}.col-md-pull-7{right:58.33333333%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666667%}.col-md-pull-4{right:33.33333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.66666667%}.col-md-pull-1{right:8.33333333%}.col-md-pull-0{right:auto}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666667%}.col-md-push-10{left:83.33333333%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666667%}.col-md-push-7{left:58.33333333%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666667%}.col-md-push-4{left:33.33333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.66666667%}.col-md-push-1{left:8.33333333%}.col-md-push-0{left:auto}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666667%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-0{margin-left:0}}@media (min-width:1200px){.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666667%}.col-lg-10{width:83.33333333%}.col-lg-9{width:75%}.col-lg-8{width:66.66666667%}.col-lg-7{width:58.33333333%}.col-lg-6{width:50%}.col-lg-5{width:41.66666667%}.col-lg-4{width:33.33333333%}.col-lg-3{width:25%}.col-lg-2{width:16.66666667%}.col-lg-1{width:8.33333333%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666667%}.col-lg-pull-10{right:83.33333333%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666667%}.col-lg-pull-7{right:58.33333333%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666667%}.col-lg-pull-4{right:33.33333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.66666667%}.col-lg-pull-1{right:8.33333333%}.col-lg-pull-0{right:auto}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666667%}.col-lg-push-10{left:83.33333333%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666667%}.col-lg-push-7{left:58.33333333%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666667%}.col-lg-push-4{left:33.33333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.66666667%}.col-lg-push-1{left:8.33333333%}.col-lg-push-0{left:auto}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666667%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-0{margin-left:0}}table{background-color:transparent}caption{padding-top:8px;padding-bottom:8px;color:#777;text-align:left}th{text-align:left}.table{width:100%;max-width:100%;margin-bottom:20px}.table>tbody>tr>td,.table>tbody>tr>th,.table>tfoot>tr>td,.table>tfoot>tr>th,.table>thead>tr>td,.table>thead>tr>th{padding:8px;line-height:1.42857143;vertical-align:top;border-top:1px solid #ddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.table>caption+thead>tr:first-child>td,.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>td,.table>thead:first-child>tr:first-child>th{border-top:0}.table>tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed>tbody>tr>td,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>td,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>thead>tr>th{padding:5px}.table-bordered{border:1px solid #ddd}.table-bordered>tbody>tr>td,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>td,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border:1px solid #ddd}.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border-bottom-width:2px}.table-striped>tbody>tr:nth-of-type(odd){background-color:#f9f9f9}.table-hover>tbody>tr:hover{background-color:#f5f5f5}table col[class*=col-]{position:static;display:table-column;float:none}table td[class*=col-],table th[class*=col-]{position:static;display:table-cell;float:none}.table>tbody>tr.active>td,.table>tbody>tr.active>th,.table>tbody>tr>td.active,.table>tbody>tr>th.active,.table>tfoot>tr.active>td,.table>tfoot>tr.active>th,.table>tfoot>tr>td.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>thead>tr.active>th,.table>thead>tr>td.active,.table>thead>tr>th.active{background-color:#f5f5f5}.table-hover>tbody>tr.active:hover>td,.table-hover>tbody>tr.active:hover>th,.table-hover>tbody>tr:hover>.active,.table-hover>tbody>tr>td.active:hover,.table-hover>tbody>tr>th.active:hover{background-color:#e8e8e8}.table>tbody>tr.success>td,.table>tbody>tr.success>th,.table>tbody>tr>td.success,.table>tbody>tr>th.success,.table>tfoot>tr.success>td,.table>tfoot>tr.success>th,.table>tfoot>tr>td.success,.table>tfoot>tr>th.success,.table>thead>tr.success>td,.table>thead>tr.success>th,.table>thead>tr>td.success,.table>thead>tr>th.success{background-color:#dff0d8}.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr.success:hover>th,.table-hover>tbody>tr:hover>.success,.table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover{background-color:#d0e9c6}.table>tbody>tr.info>td,.table>tbody>tr.info>th,.table>tbody>tr>td.info,.table>tbody>tr>th.info,.table>tfoot>tr.info>td,.table>tfoot>tr.info>th,.table>tfoot>tr>td.info,.table>tfoot>tr>th.info,.table>thead>tr.info>td,.table>thead>tr.info>th,.table>thead>tr>td.info,.table>thead>tr>th.info{background-color:#d9edf7}.table-hover>tbody>tr.info:hover>td,.table-hover>tbody>tr.info:hover>th,.table-hover>tbody>tr:hover>.info,.table-hover>tbody>tr>td.info:hover,.table-hover>tbody>tr>th.info:hover{background-color:#c4e3f3}.table>tbody>tr.warning>td,.table>tbody>tr.warning>th,.table>tbody>tr>td.warning,.table>tbody>tr>th.warning,.table>tfoot>tr.warning>td,.table>tfoot>tr.warning>th,.table>tfoot>tr>td.warning,.table>tfoot>tr>th.warning,.table>thead>tr.warning>td,.table>thead>tr.warning>th,.table>thead>tr>td.warning,.table>thead>tr>th.warning{background-color:#fcf8e3}.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr.warning:hover>th,.table-hover>tbody>tr:hover>.warning,.table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover{background-color:#faf2cc}.table>tbody>tr.danger>td,.table>tbody>tr.danger>th,.table>tbody>tr>td.danger,.table>tbody>tr>th.danger,.table>tfoot>tr.danger>td,.table>tfoot>tr.danger>th,.table>tfoot>tr>td.danger,.table>tfoot>tr>th.danger,.table>thead>tr.danger>td,.table>thead>tr.danger>th,.table>thead>tr>td.danger,.table>thead>tr>th.danger{background-color:#f2dede}.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr.danger:hover>th,.table-hover>tbody>tr:hover>.danger,.table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover{background-color:#ebcccc}.table-responsive{min-height:.01%;overflow-x:auto}@media screen and (max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-y:hidden;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #ddd}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>td,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>thead>tr>th{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type=checkbox],input[type=radio]{margin:4px 0 0;margin-top:1px\9;line-height:normal}input[type=file]{display:block}input[type=range]{display:block;width:100%}select[multiple],select[size]{height:auto}input[type=file]:focus,input[type=checkbox]:focus,input[type=radio]:focus{outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}output{display:block;padding-top:7px;font-size:14px;line-height:1.42857143;color:#555}.form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.42857143;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition:border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.form-control::-moz-placeholder{color:#999;opacity:1}.form-control:-ms-input-placeholder{color:#999}.form-control::-webkit-input-placeholder{color:#999}.form-control::-ms-expand{background-color:transparent;border:0}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{background-color:#eee;opacity:1}.form-control[disabled],fieldset[disabled] .form-control{cursor:not-allowed}textarea.form-control{height:auto}input[type=search]{-webkit-appearance:none}@media screen and (-webkit-min-device-pixel-ratio:0){input[type=date].form-control,input[type=time].form-control,input[type=datetime-local].form-control,input[type=month].form-control{line-height:34px}.input-group-sm input[type=date],.input-group-sm input[type=time],.input-group-sm input[type=datetime-local],.input-group-sm input[type=month],input[type=date].input-sm,input[type=time].input-sm,input[type=datetime-local].input-sm,input[type=month].input-sm{line-height:30px}.input-group-lg input[type=date],.input-group-lg input[type=time],.input-group-lg input[type=datetime-local],.input-group-lg input[type=month],input[type=date].input-lg,input[type=time].input-lg,input[type=datetime-local].input-lg,input[type=month].input-lg{line-height:46px}}.form-group{margin-bottom:15px}.checkbox,.radio{position:relative;display:block;margin-top:10px;margin-bottom:10px}.checkbox label,.radio label{min-height:20px;padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer}.checkbox input[type=checkbox],.checkbox-inline input[type=checkbox],.radio input[type=radio],.radio-inline input[type=radio]{position:absolute;margin-top:4px\9;margin-left:-20px}.checkbox+.checkbox,.radio+.radio{margin-top:-5px}.checkbox-inline,.radio-inline{position:relative;display:inline-block;padding-left:20px;margin-bottom:0;font-weight:400;vertical-align:middle;cursor:pointer}.checkbox-inline+.checkbox-inline,.radio-inline+.radio-inline{margin-top:0;margin-left:10px}fieldset[disabled] input[type=checkbox],fieldset[disabled] input[type=radio],input[type=checkbox].disabled,input[type=checkbox][disabled],input[type=radio].disabled,input[type=radio][disabled]{cursor:not-allowed}.checkbox-inline.disabled,.radio-inline.disabled,fieldset[disabled] .checkbox-inline,fieldset[disabled] .radio-inline{cursor:not-allowed}.checkbox.disabled label,.radio.disabled label,fieldset[disabled] .checkbox label,fieldset[disabled] .radio label{cursor:not-allowed}.form-control-static{min-height:34px;padding-top:7px;padding-bottom:7px;margin-bottom:0}.form-control-static.input-lg,.form-control-static.input-sm{padding-right:0;padding-left:0}.input-sm{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-sm{height:30px;line-height:30px}select[multiple].input-sm,textarea.input-sm{height:auto}.form-group-sm .form-control{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.form-group-sm select.form-control{height:30px;line-height:30px}.form-group-sm select[multiple].form-control,.form-group-sm textarea.form-control{height:auto}.form-group-sm .form-control-static{height:30px;min-height:32px;padding:6px 10px;font-size:12px;line-height:1.5}.input-lg{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}select.input-lg{height:46px;line-height:46px}select[multiple].input-lg,textarea.input-lg{height:auto}.form-group-lg .form-control{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}.form-group-lg select.form-control{height:46px;line-height:46px}.form-group-lg select[multiple].form-control,.form-group-lg textarea.form-control{height:auto}.form-group-lg .form-control-static{height:46px;min-height:38px;padding:11px 16px;font-size:18px;line-height:1.3333333}.has-feedback{position:relative}.has-feedback .form-control{padding-right:42.5px}.form-control-feedback{position:absolute;top:0;right:0;z-index:2;display:block;width:34px;height:34px;line-height:34px;text-align:center;pointer-events:none}.form-group-lg .form-control+.form-control-feedback,.input-group-lg+.form-control-feedback,.input-lg+.form-control-feedback{width:46px;height:46px;line-height:46px}.form-group-sm .form-control+.form-control-feedback,.input-group-sm+.form-control-feedback,.input-sm+.form-control-feedback{width:30px;height:30px;line-height:30px}.has-success .checkbox,.has-success .checkbox-inline,.has-success .control-label,.has-success .help-block,.has-success .radio,.has-success .radio-inline,.has-success.checkbox label,.has-success.checkbox-inline label,.has-success.radio label,.has-success.radio-inline label{color:#3c763d}.has-success .form-control{border-color:#3c763d;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-success .form-control:focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168}.has-success .input-group-addon{color:#3c763d;background-color:#dff0d8;border-color:#3c763d}.has-success .form-control-feedback{color:#3c763d}.has-warning .checkbox,.has-warning .checkbox-inline,.has-warning .control-label,.has-warning .help-block,.has-warning .radio,.has-warning .radio-inline,.has-warning.checkbox label,.has-warning.checkbox-inline label,.has-warning.radio label,.has-warning.radio-inline label{color:#8a6d3b}.has-warning .form-control{border-color:#8a6d3b;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-warning .form-control:focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b}.has-warning .input-group-addon{color:#8a6d3b;background-color:#fcf8e3;border-color:#8a6d3b}.has-warning .form-control-feedback{color:#8a6d3b}.has-error .checkbox,.has-error .checkbox-inline,.has-error .control-label,.has-error .help-block,.has-error .radio,.has-error .radio-inline,.has-error.checkbox label,.has-error.checkbox-inline label,.has-error.radio label,.has-error.radio-inline label{color:#a94442}.has-error .form-control{border-color:#a94442;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-error .form-control:focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.has-error .input-group-addon{color:#a94442;background-color:#f2dede;border-color:#a94442}.has-error .form-control-feedback{color:#a94442}.has-feedback label~.form-control-feedback{top:25px}.has-feedback label.sr-only~.form-control-feedback{top:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media (min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .form-control-static{display:inline-block}.form-inline .input-group{display:inline-table;vertical-align:middle}.form-inline .input-group .form-control,.form-inline .input-group .input-group-addon,.form-inline .input-group .input-group-btn{width:auto}.form-inline .input-group>.form-control{width:100%}.form-inline .control-label{margin-bottom:0;vertical-align:middle}.form-inline .checkbox,.form-inline .radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.form-inline .checkbox label,.form-inline .radio label{padding-left:0}.form-inline .checkbox input[type=checkbox],.form-inline .radio input[type=radio]{position:relative;margin-left:0}.form-inline .has-feedback .form-control-feedback{top:0}}.form-horizontal .checkbox,.form-horizontal .checkbox-inline,.form-horizontal .radio,.form-horizontal .radio-inline{padding-top:7px;margin-top:0;margin-bottom:0}.form-horizontal .checkbox,.form-horizontal .radio{min-height:27px}.form-horizontal .form-group{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.form-horizontal .control-label{padding-top:7px;margin-bottom:0;text-align:right}}.form-horizontal .has-feedback .form-control-feedback{right:15px}@media (min-width:768px){.form-horizontal .form-group-lg .control-label{padding-top:11px;font-size:18px}}@media (min-width:768px){.form-horizontal .form-group-sm .control-label{padding-top:6px;font-size:12px}}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent;border-radius:4px}.btn.active.focus,.btn.active:focus,.btn.focus,.btn:active.focus,.btn:active:focus,.btn:focus{outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn.focus,.btn:focus,.btn:hover{color:#333;text-decoration:none}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{cursor:not-allowed;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none;opacity:.65}a.btn.disabled,fieldset[disabled] a.btn{pointer-events:none}.btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default.focus,.btn-default:focus{color:#333;background-color:#e6e6e6;border-color:#8c8c8c}.btn-default:hover{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default.active,.btn-default:active,.open>.dropdown-toggle.btn-default{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default.active.focus,.btn-default.active:focus,.btn-default.active:hover,.btn-default:active.focus,.btn-default:active:focus,.btn-default:active:hover,.open>.dropdown-toggle.btn-default.focus,.open>.dropdown-toggle.btn-default:focus,.open>.dropdown-toggle.btn-default:hover{color:#333;background-color:#d4d4d4;border-color:#8c8c8c}.btn-default.active,.btn-default:active,.open>.dropdown-toggle.btn-default{background-image:none}.btn-default.disabled.focus,.btn-default.disabled:focus,.btn-default.disabled:hover,.btn-default[disabled].focus,.btn-default[disabled]:focus,.btn-default[disabled]:hover,fieldset[disabled] .btn-default.focus,fieldset[disabled] .btn-default:focus,fieldset[disabled] .btn-default:hover{background-color:#fff;border-color:#ccc}.btn-default .badge{color:#fff;background-color:#333}.btn-primary{color:#fff;background-color:#337ab7;border-color:#2e6da4}.btn-primary.focus,.btn-primary:focus{color:#fff;background-color:#286090;border-color:#122b40}.btn-primary:hover{color:#fff;background-color:#286090;border-color:#204d74}.btn-primary.active,.btn-primary:active,.open>.dropdown-toggle.btn-primary{color:#fff;background-color:#286090;border-color:#204d74}.btn-primary.active.focus,.btn-primary.active:focus,.btn-primary.active:hover,.btn-primary:active.focus,.btn-primary:active:focus,.btn-primary:active:hover,.open>.dropdown-toggle.btn-primary.focus,.open>.dropdown-toggle.btn-primary:focus,.open>.dropdown-toggle.btn-primary:hover{color:#fff;background-color:#204d74;border-color:#122b40}.btn-primary.active,.btn-primary:active,.open>.dropdown-toggle.btn-primary{background-image:none}.btn-primary.disabled.focus,.btn-primary.disabled:focus,.btn-primary.disabled:hover,.btn-primary[disabled].focus,.btn-primary[disabled]:focus,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary.focus,fieldset[disabled] .btn-primary:focus,fieldset[disabled] .btn-primary:hover{background-color:#337ab7;border-color:#2e6da4}.btn-primary .badge{color:#337ab7;background-color:#fff}.btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.btn-success.focus,.btn-success:focus{color:#fff;background-color:#449d44;border-color:#255625}.btn-success:hover{color:#fff;background-color:#449d44;border-color:#398439}.btn-success.active,.btn-success:active,.open>.dropdown-toggle.btn-success{color:#fff;background-color:#449d44;border-color:#398439}.btn-success.active.focus,.btn-success.active:focus,.btn-success.active:hover,.btn-success:active.focus,.btn-success:active:focus,.btn-success:active:hover,.open>.dropdown-toggle.btn-success.focus,.open>.dropdown-toggle.btn-success:focus,.open>.dropdown-toggle.btn-success:hover{color:#fff;background-color:#398439;border-color:#255625}.btn-success.active,.btn-success:active,.open>.dropdown-toggle.btn-success{background-image:none}.btn-success.disabled.focus,.btn-success.disabled:focus,.btn-success.disabled:hover,.btn-success[disabled].focus,.btn-success[disabled]:focus,.btn-success[disabled]:hover,fieldset[disabled] .btn-success.focus,fieldset[disabled] .btn-success:focus,fieldset[disabled] .btn-success:hover{background-color:#5cb85c;border-color:#4cae4c}.btn-success .badge{color:#5cb85c;background-color:#fff}.btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.btn-info.focus,.btn-info:focus{color:#fff;background-color:#31b0d5;border-color:#1b6d85}.btn-info:hover{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info.active,.btn-info:active,.open>.dropdown-toggle.btn-info{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info.active.focus,.btn-info.active:focus,.btn-info.active:hover,.btn-info:active.focus,.btn-info:active:focus,.btn-info:active:hover,.open>.dropdown-toggle.btn-info.focus,.open>.dropdown-toggle.btn-info:focus,.open>.dropdown-toggle.btn-info:hover{color:#fff;background-color:#269abc;border-color:#1b6d85}.btn-info.active,.btn-info:active,.open>.dropdown-toggle.btn-info{background-image:none}.btn-info.disabled.focus,.btn-info.disabled:focus,.btn-info.disabled:hover,.btn-info[disabled].focus,.btn-info[disabled]:focus,.btn-info[disabled]:hover,fieldset[disabled] .btn-info.focus,fieldset[disabled] .btn-info:focus,fieldset[disabled] .btn-info:hover{background-color:#5bc0de;border-color:#46b8da}.btn-info .badge{color:#5bc0de;background-color:#fff}.btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.btn-warning.focus,.btn-warning:focus{color:#fff;background-color:#ec971f;border-color:#985f0d}.btn-warning:hover{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning.active,.btn-warning:active,.open>.dropdown-toggle.btn-warning{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning.active.focus,.btn-warning.active:focus,.btn-warning.active:hover,.btn-warning:active.focus,.btn-warning:active:focus,.btn-warning:active:hover,.open>.dropdown-toggle.btn-warning.focus,.open>.dropdown-toggle.btn-warning:focus,.open>.dropdown-toggle.btn-warning:hover{color:#fff;background-color:#d58512;border-color:#985f0d}.btn-warning.active,.btn-warning:active,.open>.dropdown-toggle.btn-warning{background-image:none}.btn-warning.disabled.focus,.btn-warning.disabled:focus,.btn-warning.disabled:hover,.btn-warning[disabled].focus,.btn-warning[disabled]:focus,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning.focus,fieldset[disabled] .btn-warning:focus,fieldset[disabled] .btn-warning:hover{background-color:#f0ad4e;border-color:#eea236}.btn-warning .badge{color:#f0ad4e;background-color:#fff}.btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.btn-danger.focus,.btn-danger:focus{color:#fff;background-color:#c9302c;border-color:#761c19}.btn-danger:hover{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger.active,.btn-danger:active,.open>.dropdown-toggle.btn-danger{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger.active.focus,.btn-danger.active:focus,.btn-danger.active:hover,.btn-danger:active.focus,.btn-danger:active:focus,.btn-danger:active:hover,.open>.dropdown-toggle.btn-danger.focus,.open>.dropdown-toggle.btn-danger:focus,.open>.dropdown-toggle.btn-danger:hover{color:#fff;background-color:#ac2925;border-color:#761c19}.btn-danger.active,.btn-danger:active,.open>.dropdown-toggle.btn-danger{background-image:none}.btn-danger.disabled.focus,.btn-danger.disabled:focus,.btn-danger.disabled:hover,.btn-danger[disabled].focus,.btn-danger[disabled]:focus,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger.focus,fieldset[disabled] .btn-danger:focus,fieldset[disabled] .btn-danger:hover{background-color:#d9534f;border-color:#d43f3a}.btn-danger .badge{color:#d9534f;background-color:#fff}.btn-link{font-weight:400;color:#337ab7;border-radius:0}.btn-link,.btn-link.active,.btn-link:active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:active,.btn-link:focus,.btn-link:hover{border-color:transparent}.btn-link:focus,.btn-link:hover{color:#23527c;text-decoration:underline;background-color:transparent}.btn-link[disabled]:focus,.btn-link[disabled]:hover,fieldset[disabled] .btn-link:focus,fieldset[disabled] .btn-link:hover{color:#777;text-decoration:none}.btn-group-lg>.btn,.btn-lg{padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}.btn-group-sm>.btn,.btn-sm{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-group-xs>.btn,.btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:5px}input[type=button].btn-block,input[type=reset].btn-block,input[type=submit].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{display:none}.collapse.in{display:block}tr.collapse.in{display:table-row}tbody.collapse.in{display:table-row-group}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition-timing-function:ease;-o-transition-timing-function:ease;transition-timing-function:ease;-webkit-transition-duration:.35s;-o-transition-duration:.35s;transition-duration:.35s;-webkit-transition-property:height,visibility;-o-transition-property:height,visibility;transition-property:height,visibility}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px dashed;border-top:4px solid\9;border-right:4px solid transparent;border-left:4px solid transparent}.dropdown,.dropup{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175)}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{color:#262626;text-decoration:none;background-color:#f5f5f5}.dropdown-menu>.active>a,.dropdown-menu>.active>a:focus,.dropdown-menu>.active>a:hover{color:#fff;text-decoration:none;background-color:#337ab7;outline:0}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{color:#777}.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{text-decoration:none;cursor:not-allowed;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-menu-right{right:0;left:auto}.dropdown-menu-left{right:auto;left:0}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.42857143;color:#777;white-space:nowrap}.dropdown-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{content:"";border-top:0;border-bottom:4px dashed;border-bottom:4px solid\9}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:2px}@media (min-width:768px){.navbar-right .dropdown-menu{right:0;left:auto}.navbar-right .dropdown-menu-left{right:auto;left:0}}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group-vertical>.btn,.btn-group>.btn{position:relative;float:left}.btn-group-vertical>.btn.active,.btn-group-vertical>.btn:active,.btn-group-vertical>.btn:focus,.btn-group-vertical>.btn:hover,.btn-group>.btn.active,.btn-group>.btn:active,.btn-group>.btn:focus,.btn-group>.btn:hover{z-index:2}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{margin-left:-5px}.btn-toolbar .btn,.btn-toolbar .btn-group,.btn-toolbar .input-group{float:left}.btn-toolbar>.btn,.btn-toolbar>.btn-group,.btn-toolbar>.input-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-bottom-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{padding-right:8px;padding-left:8px}.btn-group>.btn-lg+.dropdown-toggle{padding-right:12px;padding-left:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group,.btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-top-left-radius:0;border-top-right-radius:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-top-right-radius:0}.btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate}.btn-group-justified>.btn,.btn-group-justified>.btn-group{display:table-cell;float:none;width:1%}.btn-group-justified>.btn-group .btn{width:100%}.btn-group-justified>.btn-group .dropdown-menu{left:auto}[data-toggle=buttons]>.btn input[type=checkbox],[data-toggle=buttons]>.btn input[type=radio],[data-toggle=buttons]>.btn-group>.btn input[type=checkbox],[data-toggle=buttons]>.btn-group>.btn input[type=radio]{position:absolute;clip:rect(0,0,0,0);pointer-events:none}.input-group{position:relative;display:table;border-collapse:separate}.input-group[class*=col-]{float:none;padding-right:0;padding-left:0}.input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.input-group .form-control:focus{z-index:3}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:46px;line-height:46px}select[multiple].input-group-lg>.form-control,select[multiple].input-group-lg>.input-group-addon,select[multiple].input-group-lg>.input-group-btn>.btn,textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn{height:auto}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px}select[multiple].input-group-sm>.form-control,select[multiple].input-group-sm>.input-group-addon,select[multiple].input-group-sm>.input-group-btn>.btn,textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn{height:auto}.input-group .form-control,.input-group-addon,.input-group-btn{display:table-cell}.input-group .form-control:not(:first-child):not(:last-child),.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:6px 12px;font-size:14px;font-weight:400;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg{padding:10px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type=checkbox],.input-group-addon input[type=radio]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn-group:not(:last-child)>.btn,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:first-child>.btn-group:not(:first-child)>.btn,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group>.btn,.input-group-btn:last-child>.dropdown-toggle{border-top-left-radius:0;border-bottom-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;font-size:0;white-space:nowrap}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-1px}.input-group-btn>.btn:active,.input-group-btn>.btn:focus,.input-group-btn>.btn:hover{z-index:2}.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group{margin-right:-1px}.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group{z-index:2;margin-left:-1px}.nav{padding-left:0;margin-bottom:0;list-style:none}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:focus,.nav>li>a:hover{text-decoration:none;background-color:#eee}.nav>li.disabled>a{color:#777}.nav>li.disabled>a:focus,.nav>li.disabled>a:hover{color:#777;text-decoration:none;cursor:not-allowed;background-color:transparent}.nav .open>a,.nav .open>a:focus,.nav .open>a:hover{background-color:#eee;border-color:#337ab7}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.42857143;border:1px solid transparent;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:focus,.nav-tabs>li.active>a:hover{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-tabs.nav-justified{width:100%;border-bottom:0}.nav-tabs.nav-justified>li{float:none}.nav-tabs.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-tabs.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-tabs.nav-justified>li>a{margin-bottom:0}}.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border:1px solid #ddd}@media (min-width:768px){.nav-tabs.nav-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border-bottom-color:#fff}}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:focus,.nav-pills>li.active>a:hover{color:#fff;background-color:#337ab7}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified{width:100%}.nav-justified>li{float:none}.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a{margin-bottom:0}}.nav-tabs-justified{border-bottom:0}.nav-tabs-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover{border:1px solid #ddd}@media (min-width:768px){.nav-tabs-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover{border-bottom-color:#fff}}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-left-radius:0;border-top-right-radius:0}.navbar{position:relative;min-height:50px;margin-bottom:20px;border:1px solid transparent}@media (min-width:768px){.navbar{border-radius:4px}}@media (min-width:768px){.navbar-header{float:left}}.navbar-collapse{padding-right:15px;padding-left:15px;overflow-x:visible;-webkit-overflow-scrolling:touch;border-top:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1)}.navbar-collapse.in{overflow-y:auto}@media (min-width:768px){.navbar-collapse{width:auto;border-top:0;-webkit-box-shadow:none;box-shadow:none}.navbar-collapse.collapse{display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important}.navbar-collapse.in{overflow-y:visible}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse,.navbar-static-top .navbar-collapse{padding-right:0;padding-left:0}}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse{max-height:340px}@media (max-device-width:480px) and (orientation:landscape){.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse{max-height:200px}}.container-fluid>.navbar-collapse,.container-fluid>.navbar-header,.container>.navbar-collapse,.container>.navbar-header{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.container-fluid>.navbar-collapse,.container-fluid>.navbar-header,.container>.navbar-collapse,.container>.navbar-header{margin-right:0;margin-left:0}}.navbar-static-top{z-index:1000;border-width:0 0 1px}@media (min-width:768px){.navbar-static-top{border-radius:0}}.navbar-fixed-bottom,.navbar-fixed-top{position:fixed;right:0;left:0;z-index:1030}@media (min-width:768px){.navbar-fixed-bottom,.navbar-fixed-top{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;height:50px;padding:15px 15px;font-size:18px;line-height:20px}.navbar-brand:focus,.navbar-brand:hover{text-decoration:none}.navbar-brand>img{display:block}@media (min-width:768px){.navbar>.container .navbar-brand,.navbar>.container-fluid .navbar-brand{margin-left:-15px}}.navbar-toggle{position:relative;float:right;padding:9px 10px;margin-top:8px;margin-right:15px;margin-bottom:8px;background-color:transparent;background-image:none;border:1px solid transparent;border-radius:4px}.navbar-toggle:focus{outline:0}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media (min-width:768px){.navbar-toggle{display:none}}.navbar-nav{margin:7.5px -15px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:20px}@media (max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;-webkit-box-shadow:none;box-shadow:none}.navbar-nav .open .dropdown-menu .dropdown-header,.navbar-nav .open .dropdown-menu>li>a{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:20px}.navbar-nav .open .dropdown-menu>li>a:focus,.navbar-nav .open .dropdown-menu>li>a:hover{background-image:none}}@media (min-width:768px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:15px;padding-bottom:15px}}.navbar-form{padding:10px 15px;margin-top:8px;margin-right:-15px;margin-bottom:8px;margin-left:-15px;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1)}@media (min-width:768px){.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block;width:auto;vertical-align:middle}.navbar-form .form-control-static{display:inline-block}.navbar-form .input-group{display:inline-table;vertical-align:middle}.navbar-form .input-group .form-control,.navbar-form .input-group .input-group-addon,.navbar-form .input-group .input-group-btn{width:auto}.navbar-form .input-group>.form-control{width:100%}.navbar-form .control-label{margin-bottom:0;vertical-align:middle}.navbar-form .checkbox,.navbar-form .radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.navbar-form .checkbox label,.navbar-form .radio label{padding-left:0}.navbar-form .checkbox input[type=checkbox],.navbar-form .radio input[type=radio]{position:relative;margin-left:0}.navbar-form .has-feedback .form-control-feedback{top:0}}@media (max-width:767px){.navbar-form .form-group{margin-bottom:5px}.navbar-form .form-group:last-child{margin-bottom:0}}@media (min-width:768px){.navbar-form{width:auto;padding-top:0;padding-bottom:0;margin-right:0;margin-left:0;border:0;-webkit-box-shadow:none;box-shadow:none}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-left-radius:0;border-top-right-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{margin-bottom:0;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.navbar-btn{margin-top:8px;margin-bottom:8px}.navbar-btn.btn-sm{margin-top:10px;margin-bottom:10px}.navbar-btn.btn-xs{margin-top:14px;margin-bottom:14px}.navbar-text{margin-top:15px;margin-bottom:15px}@media (min-width:768px){.navbar-text{float:left;margin-right:15px;margin-left:15px}}@media (min-width:768px){.navbar-left{float:left!important}.navbar-right{float:right!important;margin-right:-15px}.navbar-right~.navbar-right{margin-right:0}}.navbar-default{background-color:#f8f8f8;border-color:#e7e7e7}.navbar-default .navbar-brand{color:#777}.navbar-default .navbar-brand:focus,.navbar-default .navbar-brand:hover{color:#5e5e5e;background-color:transparent}.navbar-default .navbar-text{color:#777}.navbar-default .navbar-nav>li>a{color:#777}.navbar-default .navbar-nav>li>a:focus,.navbar-default .navbar-nav>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:focus,.navbar-default .navbar-nav>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:focus,.navbar-default .navbar-nav>.disabled>a:hover{color:#ccc;background-color:transparent}.navbar-default .navbar-toggle{border-color:#ddd}.navbar-default .navbar-toggle:focus,.navbar-default .navbar-toggle:hover{background-color:#ddd}.navbar-default .navbar-toggle .icon-bar{background-color:#888}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#e7e7e7}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:focus,.navbar-default .navbar-nav>.open>a:hover{color:#555;background-color:#e7e7e7}@media (max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#ccc;background-color:transparent}}.navbar-default .navbar-link{color:#777}.navbar-default .navbar-link:hover{color:#333}.navbar-default .btn-link{color:#777}.navbar-default .btn-link:focus,.navbar-default .btn-link:hover{color:#333}.navbar-default .btn-link[disabled]:focus,.navbar-default .btn-link[disabled]:hover,fieldset[disabled] .navbar-default .btn-link:focus,fieldset[disabled] .navbar-default .btn-link:hover{color:#ccc}.navbar-inverse{background-color:#222;border-color:#080808}.navbar-inverse .navbar-brand{color:#9d9d9d}.navbar-inverse .navbar-brand:focus,.navbar-inverse .navbar-brand:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-text{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a:focus,.navbar-inverse .navbar-nav>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:focus,.navbar-inverse .navbar-nav>.active>a:hover{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:focus,.navbar-inverse .navbar-nav>.disabled>a:hover{color:#444;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#333}.navbar-inverse .navbar-toggle:focus,.navbar-inverse .navbar-toggle:hover{background-color:#333}.navbar-inverse .navbar-toggle .icon-bar{background-color:#fff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#101010}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:focus,.navbar-inverse .navbar-nav>.open>a:hover{color:#fff;background-color:#080808}@media (max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu .divider{background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#444;background-color:transparent}}.navbar-inverse .navbar-link{color:#9d9d9d}.navbar-inverse .navbar-link:hover{color:#fff}.navbar-inverse .btn-link{color:#9d9d9d}.navbar-inverse .btn-link:focus,.navbar-inverse .btn-link:hover{color:#fff}.navbar-inverse .btn-link[disabled]:focus,.navbar-inverse .btn-link[disabled]:hover,fieldset[disabled] .navbar-inverse .btn-link:focus,fieldset[disabled] .navbar-inverse .btn-link:hover{color:#444}.breadcrumb{padding:8px 15px;margin-bottom:20px;list-style:none;background-color:#f5f5f5;border-radius:4px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{padding:0 5px;color:#ccc;content:"/\00a0"}.breadcrumb>.active{color:#777}.pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:4px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;margin-left:-1px;line-height:1.42857143;color:#337ab7;text-decoration:none;background-color:#fff;border:1px solid #ddd}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-top-left-radius:4px;border-bottom-left-radius:4px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-top-right-radius:4px;border-bottom-right-radius:4px}.pagination>li>a:focus,.pagination>li>a:hover,.pagination>li>span:focus,.pagination>li>span:hover{z-index:2;color:#23527c;background-color:#eee;border-color:#ddd}.pagination>.active>a,.pagination>.active>a:focus,.pagination>.active>a:hover,.pagination>.active>span,.pagination>.active>span:focus,.pagination>.active>span:hover{z-index:3;color:#fff;cursor:default;background-color:#337ab7;border-color:#337ab7}.pagination>.disabled>a,.pagination>.disabled>a:focus,.pagination>.disabled>a:hover,.pagination>.disabled>span,.pagination>.disabled>span:focus,.pagination>.disabled>span:hover{color:#777;cursor:not-allowed;background-color:#fff;border-color:#ddd}.pagination-lg>li>a,.pagination-lg>li>span{padding:10px 16px;font-size:18px;line-height:1.3333333}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-top-left-radius:6px;border-bottom-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-top-right-radius:6px;border-bottom-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px;line-height:1.5}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-top-left-radius:3px;border-bottom-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-top-right-radius:3px;border-bottom-right-radius:3px}.pager{padding-left:0;margin:20px 0;text-align:center;list-style:none}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;border-radius:15px}.pager li>a:focus,.pager li>a:hover{text-decoration:none;background-color:#eee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:focus,.pager .disabled>a:hover,.pager .disabled>span{color:#777;cursor:not-allowed;background-color:#fff}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}a.label:focus,a.label:hover{color:#fff;text-decoration:none;cursor:pointer}.label:empty{display:none}.btn .label{position:relative;top:-1px}.label-default{background-color:#777}.label-default[href]:focus,.label-default[href]:hover{background-color:#5e5e5e}.label-primary{background-color:#337ab7}.label-primary[href]:focus,.label-primary[href]:hover{background-color:#286090}.label-success{background-color:#5cb85c}.label-success[href]:focus,.label-success[href]:hover{background-color:#449d44}.label-info{background-color:#5bc0de}.label-info[href]:focus,.label-info[href]:hover{background-color:#31b0d5}.label-warning{background-color:#f0ad4e}.label-warning[href]:focus,.label-warning[href]:hover{background-color:#ec971f}.label-danger{background-color:#d9534f}.label-danger[href]:focus,.label-danger[href]:hover{background-color:#c9302c}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:middle;background-color:#777;border-radius:10px}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.btn-group-xs>.btn .badge,.btn-xs .badge{top:0;padding:1px 5px}a.badge:focus,a.badge:hover{color:#fff;text-decoration:none;cursor:pointer}.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#337ab7;background-color:#fff}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding-top:30px;padding-bottom:30px;margin-bottom:30px;color:inherit;background-color:#eee}.jumbotron .h1,.jumbotron h1{color:inherit}.jumbotron p{margin-bottom:15px;font-size:21px;font-weight:200}.jumbotron>hr{border-top-color:#d5d5d5}.container .jumbotron,.container-fluid .jumbotron{padding-right:15px;padding-left:15px;border-radius:6px}.jumbotron .container{max-width:100%}@media screen and (min-width:768px){.jumbotron{padding-top:48px;padding-bottom:48px}.container .jumbotron,.container-fluid .jumbotron{padding-right:60px;padding-left:60px}.jumbotron .h1,.jumbotron h1{font-size:63px}}.thumbnail{display:block;padding:4px;margin-bottom:20px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:border .2s ease-in-out;-o-transition:border .2s ease-in-out;transition:border .2s ease-in-out}.thumbnail a>img,.thumbnail>img{margin-right:auto;margin-left:auto}a.thumbnail.active,a.thumbnail:focus,a.thumbnail:hover{border-color:#337ab7}.thumbnail .caption{padding:9px;color:#333}.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:700}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable,.alert-dismissible{padding-right:35px}.alert-dismissable .close,.alert-dismissible .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#2b542c}.alert-info{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#245269}.alert-warning{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.alert-warning hr{border-top-color:#f7e1b5}.alert-warning .alert-link{color:#66512c}.alert-danger{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.alert-danger hr{border-top-color:#e4b9c0}.alert-danger .alert-link{color:#843534}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{height:20px;margin-bottom:20px;overflow:hidden;background-color:#f5f5f5;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1)}.progress-bar{float:left;width:0;height:100%;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#337ab7;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);-webkit-transition:width .6s ease;-o-transition:width .6s ease;transition:width .6s ease}.progress-bar-striped,.progress-striped .progress-bar{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);-webkit-background-size:40px 40px;background-size:40px 40px}.progress-bar.active,.progress.active .progress-bar{-webkit-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar-success{background-color:#5cb85c}.progress-striped .progress-bar-success{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#5bc0de}.progress-striped .progress-bar-info{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#f0ad4e}.progress-striped .progress-bar-warning{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-danger{background-color:#d9534f}.progress-striped .progress-bar-danger{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.media{margin-top:15px}.media:first-child{margin-top:0}.media,.media-body{overflow:hidden;zoom:1}.media-body{width:10000px}.media-object{display:block}.media-object.img-thumbnail{max-width:none}.media-right,.media>.pull-right{padding-left:10px}.media-left,.media>.pull-left{padding-right:10px}.media-body,.media-left,.media-right{display:table-cell;vertical-align:top}.media-middle{vertical-align:middle}.media-bottom{vertical-align:bottom}.media-heading{margin-top:0;margin-bottom:5px}.media-list{padding-left:0;list-style:none}.list-group{padding-left:0;margin-bottom:20px}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}.list-group-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}a.list-group-item,button.list-group-item{color:#555}a.list-group-item .list-group-item-heading,button.list-group-item .list-group-item-heading{color:#333}a.list-group-item:focus,a.list-group-item:hover,button.list-group-item:focus,button.list-group-item:hover{color:#555;text-decoration:none;background-color:#f5f5f5}button.list-group-item{width:100%;text-align:left}.list-group-item.disabled,.list-group-item.disabled:focus,.list-group-item.disabled:hover{color:#777;cursor:not-allowed;background-color:#eee}.list-group-item.disabled .list-group-item-heading,.list-group-item.disabled:focus .list-group-item-heading,.list-group-item.disabled:hover .list-group-item-heading{color:inherit}.list-group-item.disabled .list-group-item-text,.list-group-item.disabled:focus .list-group-item-text,.list-group-item.disabled:hover .list-group-item-text{color:#777}.list-group-item.active,.list-group-item.active:focus,.list-group-item.active:hover{z-index:2;color:#fff;background-color:#337ab7;border-color:#337ab7}.list-group-item.active .list-group-item-heading,.list-group-item.active .list-group-item-heading>.small,.list-group-item.active .list-group-item-heading>small,.list-group-item.active:focus .list-group-item-heading,.list-group-item.active:focus .list-group-item-heading>.small,.list-group-item.active:focus .list-group-item-heading>small,.list-group-item.active:hover .list-group-item-heading,.list-group-item.active:hover .list-group-item-heading>.small,.list-group-item.active:hover .list-group-item-heading>small{color:inherit}.list-group-item.active .list-group-item-text,.list-group-item.active:focus .list-group-item-text,.list-group-item.active:hover .list-group-item-text{color:#c7ddef}.list-group-item-success{color:#3c763d;background-color:#dff0d8}a.list-group-item-success,button.list-group-item-success{color:#3c763d}a.list-group-item-success .list-group-item-heading,button.list-group-item-success .list-group-item-heading{color:inherit}a.list-group-item-success:focus,a.list-group-item-success:hover,button.list-group-item-success:focus,button.list-group-item-success:hover{color:#3c763d;background-color:#d0e9c6}a.list-group-item-success.active,a.list-group-item-success.active:focus,a.list-group-item-success.active:hover,button.list-group-item-success.active,button.list-group-item-success.active:focus,button.list-group-item-success.active:hover{color:#fff;background-color:#3c763d;border-color:#3c763d}.list-group-item-info{color:#31708f;background-color:#d9edf7}a.list-group-item-info,button.list-group-item-info{color:#31708f}a.list-group-item-info .list-group-item-heading,button.list-group-item-info .list-group-item-heading{color:inherit}a.list-group-item-info:focus,a.list-group-item-info:hover,button.list-group-item-info:focus,button.list-group-item-info:hover{color:#31708f;background-color:#c4e3f3}a.list-group-item-info.active,a.list-group-item-info.active:focus,a.list-group-item-info.active:hover,button.list-group-item-info.active,button.list-group-item-info.active:focus,button.list-group-item-info.active:hover{color:#fff;background-color:#31708f;border-color:#31708f}.list-group-item-warning{color:#8a6d3b;background-color:#fcf8e3}a.list-group-item-warning,button.list-group-item-warning{color:#8a6d3b}a.list-group-item-warning .list-group-item-heading,button.list-group-item-warning .list-group-item-heading{color:inherit}a.list-group-item-warning:focus,a.list-group-item-warning:hover,button.list-group-item-warning:focus,button.list-group-item-warning:hover{color:#8a6d3b;background-color:#faf2cc}a.list-group-item-warning.active,a.list-group-item-warning.active:focus,a.list-group-item-warning.active:hover,button.list-group-item-warning.active,button.list-group-item-warning.active:focus,button.list-group-item-warning.active:hover{color:#fff;background-color:#8a6d3b;border-color:#8a6d3b}.list-group-item-danger{color:#a94442;background-color:#f2dede}a.list-group-item-danger,button.list-group-item-danger{color:#a94442}a.list-group-item-danger .list-group-item-heading,button.list-group-item-danger .list-group-item-heading{color:inherit}a.list-group-item-danger:focus,a.list-group-item-danger:hover,button.list-group-item-danger:focus,button.list-group-item-danger:hover{color:#a94442;background-color:#ebcccc}a.list-group-item-danger.active,a.list-group-item-danger.active:focus,a.list-group-item-danger.active:hover,button.list-group-item-danger.active,button.list-group-item-danger.active:focus,button.list-group-item-danger.active:hover{color:#fff;background-color:#a94442;border-color:#a94442}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:20px;background-color:#fff;border:1px solid transparent;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}.panel-body{padding:15px}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-left-radius:3px;border-top-right-radius:3px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:16px;color:inherit}.panel-title>.small,.panel-title>.small>a,.panel-title>a,.panel-title>small,.panel-title>small>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.list-group,.panel>.panel-collapse>.list-group{margin-bottom:0}.panel>.list-group .list-group-item,.panel>.panel-collapse>.list-group .list-group-item{border-width:1px 0;border-radius:0}.panel>.list-group:first-child .list-group-item:first-child,.panel>.panel-collapse>.list-group:first-child .list-group-item:first-child{border-top:0;border-top-left-radius:3px;border-top-right-radius:3px}.panel>.list-group:last-child .list-group-item:last-child,.panel>.panel-collapse>.list-group:last-child .list-group-item:last-child{border-bottom:0;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.panel-heading+.panel-collapse>.list-group .list-group-item:first-child{border-top-left-radius:0;border-top-right-radius:0}.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.list-group+.panel-footer{border-top-width:0}.panel>.panel-collapse>.table,.panel>.table,.panel>.table-responsive>.table{margin-bottom:0}.panel>.panel-collapse>.table caption,.panel>.table caption,.panel>.table-responsive>.table caption{padding-right:15px;padding-left:15px}.panel>.table-responsive:first-child>.table:first-child,.panel>.table:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child,.panel>.table:first-child>thead:first-child>tr:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table:first-child>thead:first-child>tr:first-child th:first-child{border-top-left-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table:first-child>thead:first-child>tr:first-child th:last-child{border-top-right-radius:3px}.panel>.table-responsive:last-child>.table:last-child,.panel>.table:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:first-child{border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:last-child{border-bottom-right-radius:3px}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive,.panel>.table+.panel-body,.panel>.table-responsive+.panel-body{border-top:1px solid #ddd}.panel>.table>tbody:first-child>tr:first-child td,.panel>.table>tbody:first-child>tr:first-child th{border-top:0}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.panel>.table-bordered>tbody>tr:first-child>td,.panel>.table-bordered>tbody>tr:first-child>th,.panel>.table-bordered>thead>tr:first-child>td,.panel>.table-bordered>thead>tr:first-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>th,.panel>.table-responsive>.table-bordered>thead>tr:first-child>td,.panel>.table-responsive>.table-bordered>thead>tr:first-child>th{border-bottom:0}.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}.panel>.table-responsive{margin-bottom:0;border:0}.panel-group{margin-bottom:20px}.panel-group .panel{margin-bottom:0;border-radius:4px}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse>.list-group,.panel-group .panel-heading+.panel-collapse>.panel-body{border-top:1px solid #ddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #ddd}.panel-default{border-color:#ddd}.panel-default>.panel-heading{color:#333;background-color:#f5f5f5;border-color:#ddd}.panel-default>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ddd}.panel-default>.panel-heading .badge{color:#f5f5f5;background-color:#333}.panel-default>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ddd}.panel-primary{border-color:#337ab7}.panel-primary>.panel-heading{color:#fff;background-color:#337ab7;border-color:#337ab7}.panel-primary>.panel-heading+.panel-collapse>.panel-body{border-top-color:#337ab7}.panel-primary>.panel-heading .badge{color:#337ab7;background-color:#fff}.panel-primary>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#337ab7}.panel-success{border-color:#d6e9c6}.panel-success>.panel-heading{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.panel-success>.panel-heading+.panel-collapse>.panel-body{border-top-color:#d6e9c6}.panel-success>.panel-heading .badge{color:#dff0d8;background-color:#3c763d}.panel-success>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#d6e9c6}.panel-info{border-color:#bce8f1}.panel-info>.panel-heading{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.panel-info>.panel-heading+.panel-collapse>.panel-body{border-top-color:#bce8f1}.panel-info>.panel-heading .badge{color:#d9edf7;background-color:#31708f}.panel-info>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#bce8f1}.panel-warning{border-color:#faebcc}.panel-warning>.panel-heading{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.panel-warning>.panel-heading+.panel-collapse>.panel-body{border-top-color:#faebcc}.panel-warning>.panel-heading .badge{color:#fcf8e3;background-color:#8a6d3b}.panel-warning>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#faebcc}.panel-danger{border-color:#ebccd1}.panel-danger>.panel-heading{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.panel-danger>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ebccd1}.panel-danger>.panel-heading .badge{color:#f2dede;background-color:#a94442}.panel-danger>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ebccd1}.embed-responsive{position:relative;display:block;height:0;padding:0;overflow:hidden}.embed-responsive .embed-responsive-item,.embed-responsive embed,.embed-responsive iframe,.embed-responsive object,.embed-responsive video{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;border:0}.embed-responsive-16by9{padding-bottom:56.25%}.embed-responsive-4by3{padding-bottom:75%}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:21px;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;filter:alpha(opacity=20);opacity:.2}.close:focus,.close:hover{color:#000;text-decoration:none;cursor:pointer;filter:alpha(opacity=50);opacity:.5}button.close{-webkit-appearance:none;padding:0;cursor:pointer;background:0 0;border:0}.modal-open{overflow:hidden}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;display:none;overflow:hidden;-webkit-overflow-scrolling:touch;outline:0}.modal.fade .modal-dialog{-webkit-transition:-webkit-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out;-webkit-transform:translate(0,-25%);-ms-transform:translate(0,-25%);-o-transform:translate(0,-25%);transform:translate(0,-25%)}.modal.in .modal-dialog{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);-o-transform:translate(0,0);transform:translate(0,0)}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal-dialog{position:relative;width:auto;margin:10px}.modal-content{position:relative;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #999;border:1px solid rgba(0,0,0,.2);border-radius:6px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{filter:alpha(opacity=0);opacity:0}.modal-backdrop.in{filter:alpha(opacity=50);opacity:.5}.modal-header{padding:15px;border-bottom:1px solid #e5e5e5}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.42857143}.modal-body{position:relative;padding:15px}.modal-footer{padding:15px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:768px){.modal-dialog{width:600px;margin:30px auto}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,.5);box-shadow:0 5px 15px rgba(0,0,0,.5)}.modal-sm{width:300px}}@media (min-width:992px){.modal-lg{width:900px}}.tooltip{position:absolute;z-index:1070;display:block;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:12px;font-style:normal;font-weight:400;line-height:1.42857143;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;filter:alpha(opacity=0);opacity:0;line-break:auto}.tooltip.in{filter:alpha(opacity=90);opacity:.9}.tooltip.top{padding:5px 0;margin-top:-3px}.tooltip.right{padding:0 5px;margin-left:3px}.tooltip.bottom{padding:5px 0;margin-top:3px}.tooltip.left{padding:0 5px;margin-left:-3px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;background-color:#000;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-left .tooltip-arrow{right:5px;bottom:0;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-right .tooltip-arrow{bottom:0;left:5px;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-left .tooltip-arrow{top:0;right:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-right .tooltip-arrow{top:0;left:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000}.popover{position:absolute;top:0;left:0;z-index:1060;display:none;max-width:276px;padding:1px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;font-style:normal;font-weight:400;line-height:1.42857143;text-align:left;text-align:start;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-break:normal;word-spacing:normal;word-wrap:normal;white-space:normal;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2);line-break:auto}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{padding:8px 14px;margin:0;font-size:14px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover>.arrow,.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover>.arrow{border-width:11px}.popover>.arrow:after{content:"";border-width:10px}.popover.top>.arrow{bottom:-11px;left:50%;margin-left:-11px;border-top-color:#999;border-top-color:rgba(0,0,0,.25);border-bottom-width:0}.popover.top>.arrow:after{bottom:1px;margin-left:-10px;content:" ";border-top-color:#fff;border-bottom-width:0}.popover.right>.arrow{top:50%;left:-11px;margin-top:-11px;border-right-color:#999;border-right-color:rgba(0,0,0,.25);border-left-width:0}.popover.right>.arrow:after{bottom:-10px;left:1px;content:" ";border-right-color:#fff;border-left-width:0}.popover.bottom>.arrow{top:-11px;left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,.25)}.popover.bottom>.arrow:after{top:1px;margin-left:-10px;content:" ";border-top-width:0;border-bottom-color:#fff}.popover.left>.arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0,0,0,.25)}.popover.left>.arrow:after{right:1px;bottom:-10px;content:" ";border-right-width:0;border-left-color:#fff}.carousel{position:relative}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner>.item{position:relative;display:none;-webkit-transition:.6s ease-in-out left;-o-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>a>img,.carousel-inner>.item>img{line-height:1}@media all and (transform-3d),(-webkit-transform-3d){.carousel-inner>.item{-webkit-transition:-webkit-transform .6s ease-in-out;-o-transition:-o-transform .6s ease-in-out;transition:transform .6s ease-in-out;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-perspective:1000px;perspective:1000px}.carousel-inner>.item.active.right,.carousel-inner>.item.next{left:0;-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}.carousel-inner>.item.active.left,.carousel-inner>.item.prev{left:0;-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}.carousel-inner>.item.active,.carousel-inner>.item.next.left,.carousel-inner>.item.prev.right{left:0;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;bottom:0;left:0;width:15%;font-size:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6);background-color:rgba(0,0,0,0);filter:alpha(opacity=50);opacity:.5}.carousel-control.left{background-image:-webkit-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.5)),to(rgba(0,0,0,.0001)));background-image:linear-gradient(to right,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);background-repeat:repeat-x}.carousel-control.right{right:0;left:auto;background-image:-webkit-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.0001)),to(rgba(0,0,0,.5)));background-image:linear-gradient(to right,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);background-repeat:repeat-x}.carousel-control:focus,.carousel-control:hover{color:#fff;text-decoration:none;filter:alpha(opacity=90);outline:0;opacity:.9}.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{position:absolute;top:50%;z-index:5;display:inline-block;margin-top:-10px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{left:50%;margin-left:-10px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{right:50%;margin-right:-10px}.carousel-control .icon-next,.carousel-control .icon-prev{width:20px;height:20px;font-family:serif;line-height:1}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;padding-left:0;margin-left:-30%;text-align:center;list-style:none}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;cursor:pointer;background-color:#000\9;background-color:rgba(0,0,0,0);border:1px solid #fff;border-radius:10px}.carousel-indicators .active{width:12px;height:12px;margin:0;background-color:#fff}.carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{width:30px;height:30px;margin-top:-10px;font-size:30px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{margin-left:-10px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{margin-right:-10px}.carousel-caption{right:20%;left:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.btn-group-vertical>.btn-group:after,.btn-group-vertical>.btn-group:before,.btn-toolbar:after,.btn-toolbar:before,.clearfix:after,.clearfix:before,.container-fluid:after,.container-fluid:before,.container:after,.container:before,.dl-horizontal dd:after,.dl-horizontal dd:before,.form-horizontal .form-group:after,.form-horizontal .form-group:before,.modal-footer:after,.modal-footer:before,.modal-header:after,.modal-header:before,.nav:after,.nav:before,.navbar-collapse:after,.navbar-collapse:before,.navbar-header:after,.navbar-header:before,.navbar:after,.navbar:before,.pager:after,.pager:before,.panel-body:after,.panel-body:before,.row:after,.row:before{display:table;content:" "}.btn-group-vertical>.btn-group:after,.btn-toolbar:after,.clearfix:after,.container-fluid:after,.container:after,.dl-horizontal dd:after,.form-horizontal .form-group:after,.modal-footer:after,.modal-header:after,.nav:after,.navbar-collapse:after,.navbar-header:after,.navbar:after,.pager:after,.panel-body:after,.row:after{clear:both}.center-block{display:block;margin-right:auto;margin-left:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none!important}.affix{position:fixed}@-ms-viewport{width:device-width}.visible-lg,.visible-md,.visible-sm,.visible-xs{display:none!important}.visible-lg-block,.visible-lg-inline,.visible-lg-inline-block,.visible-md-block,.visible-md-inline,.visible-md-inline-block,.visible-sm-block,.visible-sm-inline,.visible-sm-inline-block,.visible-xs-block,.visible-xs-inline,.visible-xs-inline-block{display:none!important}@media (max-width:767px){.visible-xs{display:block!important}table.visible-xs{display:table!important}tr.visible-xs{display:table-row!important}td.visible-xs,th.visible-xs{display:table-cell!important}}@media (max-width:767px){.visible-xs-block{display:block!important}}@media (max-width:767px){.visible-xs-inline{display:inline!important}}@media (max-width:767px){.visible-xs-inline-block{display:inline-block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm{display:block!important}table.visible-sm{display:table!important}tr.visible-sm{display:table-row!important}td.visible-sm,th.visible-sm{display:table-cell!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-block{display:block!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline{display:inline!important}}@media (min-width:768px) and (max-width:991px){.visible-sm-inline-block{display:inline-block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md{display:block!important}table.visible-md{display:table!important}tr.visible-md{display:table-row!important}td.visible-md,th.visible-md{display:table-cell!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-block{display:block!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline{display:inline!important}}@media (min-width:992px) and (max-width:1199px){.visible-md-inline-block{display:inline-block!important}}@media (min-width:1200px){.visible-lg{display:block!important}table.visible-lg{display:table!important}tr.visible-lg{display:table-row!important}td.visible-lg,th.visible-lg{display:table-cell!important}}@media (min-width:1200px){.visible-lg-block{display:block!important}}@media (min-width:1200px){.visible-lg-inline{display:inline!important}}@media (min-width:1200px){.visible-lg-inline-block{display:inline-block!important}}@media (max-width:767px){.hidden-xs{display:none!important}}@media (min-width:768px) and (max-width:991px){.hidden-sm{display:none!important}}@media (min-width:992px) and (max-width:1199px){.hidden-md{display:none!important}}@media (min-width:1200px){.hidden-lg{display:none!important}}.visible-print{display:none!important}@media print{.visible-print{display:block!important}table.visible-print{display:table!important}tr.visible-print{display:table-row!important}td.visible-print,th.visible-print{display:table-cell!important}}.visible-print-block{display:none!important}@media print{.visible-print-block{display:block!important}}.visible-print-inline{display:none!important}@media print{.visible-print-inline{display:inline!important}}.visible-print-inline-block{display:none!important}@media print{.visible-print-inline-block{display:inline-block!important}}@media print{.hidden-print{display:none!important}} -/*# sourceMappingURL=bootstrap.min.css.map */ \ No newline at end of file diff --git a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/css/font-awesome.min.css b/vendor/phpoffice/phpspreadsheet/samples/bootstrap/css/font-awesome.min.css deleted file mode 100644 index 4ec92235..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/css/font-awesome.min.css +++ /dev/null @@ -1,4 +0,0 @@ -/*! - * Font Awesome 4.6.3 by @davegandy - http://fontawesome.io - @fontawesome - * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) - */@font-face{font-family:'FontAwesome';src:url('../fonts/fontawesome-webfont.eot?v=4.6.3');src:url('../fonts/fontawesome-webfont.eot?#iefix&v=4.6.3') format('embedded-opentype'),url('../fonts/fontawesome-webfont.woff2?v=4.6.3') format('woff2'),url('../fonts/fontawesome-webfont.woff?v=4.6.3') format('woff'),url('../fonts/fontawesome-webfont.ttf?v=4.6.3') format('truetype'),url('../fonts/fontawesome-webfont.svg?v=4.6.3#fontawesomeregular') format('svg');font-weight:normal;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left{margin-right:.3em}.fa.fa-pull-right{margin-left:.3em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";-webkit-transform:scale(-1, 1);-ms-transform:scale(-1, 1);transform:scale(-1, 1)}.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";-webkit-transform:scale(1, -1);-ms-transform:scale(1, -1);transform:scale(1, -1)}:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-flip-horizontal,:root .fa-flip-vertical{filter:none}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-remove:before,.fa-close:before,.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-gear:before,.fa-cog:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-rotate-right:before,.fa-repeat:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-photo:before,.fa-image:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-warning:before,.fa-exclamation-triangle:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before,.fa-bar-chart:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-gears:before,.fa-cogs:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-feed:before,.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-save:before,.fa-floppy-o:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-navicon:before,.fa-reorder:before,.fa-bars:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-unsorted:before,.fa-sort:before{content:"\f0dc"}.fa-sort-down:before,.fa-sort-desc:before{content:"\f0dd"}.fa-sort-up:before,.fa-sort-asc:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-legal:before,.fa-gavel:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-flash:before,.fa-bolt:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-paste:before,.fa-clipboard:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-unlink:before,.fa-chain-broken:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-toggle-down:before,.fa-caret-square-o-down:before{content:"\f150"}.fa-toggle-up:before,.fa-caret-square-o-up:before{content:"\f151"}.fa-toggle-right:before,.fa-caret-square-o-right:before{content:"\f152"}.fa-euro:before,.fa-eur:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-rupee:before,.fa-inr:before{content:"\f156"}.fa-cny:before,.fa-rmb:before,.fa-yen:before,.fa-jpy:before{content:"\f157"}.fa-ruble:before,.fa-rouble:before,.fa-rub:before{content:"\f158"}.fa-won:before,.fa-krw:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before,.fa-gratipay:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-toggle-left:before,.fa-caret-square-o-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-turkish-lira:before,.fa-try:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-institution:before,.fa-bank:before,.fa-university:before{content:"\f19c"}.fa-mortar-board:before,.fa-graduation-cap:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper-pp:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-photo-o:before,.fa-file-picture-o:before,.fa-file-image-o:before{content:"\f1c5"}.fa-file-zip-o:before,.fa-file-archive-o:before{content:"\f1c6"}.fa-file-sound-o:before,.fa-file-audio-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-saver:before,.fa-support:before,.fa-life-ring:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-resistance:before,.fa-rebel:before{content:"\f1d0"}.fa-ge:before,.fa-empire:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-y-combinator-square:before,.fa-yc-square:before,.fa-hacker-news:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-send:before,.fa-paper-plane:before{content:"\f1d8"}.fa-send-o:before,.fa-paper-plane-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-circle-thin:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"}.fa-soccer-ball-o:before,.fa-futbol-o:before{content:"\f1e3"}.fa-tty:before{content:"\f1e4"}.fa-binoculars:before{content:"\f1e5"}.fa-plug:before{content:"\f1e6"}.fa-slideshare:before{content:"\f1e7"}.fa-twitch:before{content:"\f1e8"}.fa-yelp:before{content:"\f1e9"}.fa-newspaper-o:before{content:"\f1ea"}.fa-wifi:before{content:"\f1eb"}.fa-calculator:before{content:"\f1ec"}.fa-paypal:before{content:"\f1ed"}.fa-google-wallet:before{content:"\f1ee"}.fa-cc-visa:before{content:"\f1f0"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-bell-slash:before{content:"\f1f6"}.fa-bell-slash-o:before{content:"\f1f7"}.fa-trash:before{content:"\f1f8"}.fa-copyright:before{content:"\f1f9"}.fa-at:before{content:"\f1fa"}.fa-eyedropper:before{content:"\f1fb"}.fa-paint-brush:before{content:"\f1fc"}.fa-birthday-cake:before{content:"\f1fd"}.fa-area-chart:before{content:"\f1fe"}.fa-pie-chart:before{content:"\f200"}.fa-line-chart:before{content:"\f201"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-bicycle:before{content:"\f206"}.fa-bus:before{content:"\f207"}.fa-ioxhost:before{content:"\f208"}.fa-angellist:before{content:"\f209"}.fa-cc:before{content:"\f20a"}.fa-shekel:before,.fa-sheqel:before,.fa-ils:before{content:"\f20b"}.fa-meanpath:before{content:"\f20c"}.fa-buysellads:before{content:"\f20d"}.fa-connectdevelop:before{content:"\f20e"}.fa-dashcube:before{content:"\f210"}.fa-forumbee:before{content:"\f211"}.fa-leanpub:before{content:"\f212"}.fa-sellsy:before{content:"\f213"}.fa-shirtsinbulk:before{content:"\f214"}.fa-simplybuilt:before{content:"\f215"}.fa-skyatlas:before{content:"\f216"}.fa-cart-plus:before{content:"\f217"}.fa-cart-arrow-down:before{content:"\f218"}.fa-diamond:before{content:"\f219"}.fa-ship:before{content:"\f21a"}.fa-user-secret:before{content:"\f21b"}.fa-motorcycle:before{content:"\f21c"}.fa-street-view:before{content:"\f21d"}.fa-heartbeat:before{content:"\f21e"}.fa-venus:before{content:"\f221"}.fa-mars:before{content:"\f222"}.fa-mercury:before{content:"\f223"}.fa-intersex:before,.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-venus-double:before{content:"\f226"}.fa-mars-double:before{content:"\f227"}.fa-venus-mars:before{content:"\f228"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-neuter:before{content:"\f22c"}.fa-genderless:before{content:"\f22d"}.fa-facebook-official:before{content:"\f230"}.fa-pinterest-p:before{content:"\f231"}.fa-whatsapp:before{content:"\f232"}.fa-server:before{content:"\f233"}.fa-user-plus:before{content:"\f234"}.fa-user-times:before{content:"\f235"}.fa-hotel:before,.fa-bed:before{content:"\f236"}.fa-viacoin:before{content:"\f237"}.fa-train:before{content:"\f238"}.fa-subway:before{content:"\f239"}.fa-medium:before{content:"\f23a"}.fa-yc:before,.fa-y-combinator:before{content:"\f23b"}.fa-optin-monster:before{content:"\f23c"}.fa-opencart:before{content:"\f23d"}.fa-expeditedssl:before{content:"\f23e"}.fa-battery-4:before,.fa-battery-full:before{content:"\f240"}.fa-battery-3:before,.fa-battery-three-quarters:before{content:"\f241"}.fa-battery-2:before,.fa-battery-half:before{content:"\f242"}.fa-battery-1:before,.fa-battery-quarter:before{content:"\f243"}.fa-battery-0:before,.fa-battery-empty:before{content:"\f244"}.fa-mouse-pointer:before{content:"\f245"}.fa-i-cursor:before{content:"\f246"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-sticky-note:before{content:"\f249"}.fa-sticky-note-o:before{content:"\f24a"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-diners-club:before{content:"\f24c"}.fa-clone:before{content:"\f24d"}.fa-balance-scale:before{content:"\f24e"}.fa-hourglass-o:before{content:"\f250"}.fa-hourglass-1:before,.fa-hourglass-start:before{content:"\f251"}.fa-hourglass-2:before,.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-3:before,.fa-hourglass-end:before{content:"\f253"}.fa-hourglass:before{content:"\f254"}.fa-hand-grab-o:before,.fa-hand-rock-o:before{content:"\f255"}.fa-hand-stop-o:before,.fa-hand-paper-o:before{content:"\f256"}.fa-hand-scissors-o:before{content:"\f257"}.fa-hand-lizard-o:before{content:"\f258"}.fa-hand-spock-o:before{content:"\f259"}.fa-hand-pointer-o:before{content:"\f25a"}.fa-hand-peace-o:before{content:"\f25b"}.fa-trademark:before{content:"\f25c"}.fa-registered:before{content:"\f25d"}.fa-creative-commons:before{content:"\f25e"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-tripadvisor:before{content:"\f262"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-get-pocket:before{content:"\f265"}.fa-wikipedia-w:before{content:"\f266"}.fa-safari:before{content:"\f267"}.fa-chrome:before{content:"\f268"}.fa-firefox:before{content:"\f269"}.fa-opera:before{content:"\f26a"}.fa-internet-explorer:before{content:"\f26b"}.fa-tv:before,.fa-television:before{content:"\f26c"}.fa-contao:before{content:"\f26d"}.fa-500px:before{content:"\f26e"}.fa-amazon:before{content:"\f270"}.fa-calendar-plus-o:before{content:"\f271"}.fa-calendar-minus-o:before{content:"\f272"}.fa-calendar-times-o:before{content:"\f273"}.fa-calendar-check-o:before{content:"\f274"}.fa-industry:before{content:"\f275"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-map-o:before{content:"\f278"}.fa-map:before{content:"\f279"}.fa-commenting:before{content:"\f27a"}.fa-commenting-o:before{content:"\f27b"}.fa-houzz:before{content:"\f27c"}.fa-vimeo:before{content:"\f27d"}.fa-black-tie:before{content:"\f27e"}.fa-fonticons:before{content:"\f280"}.fa-reddit-alien:before{content:"\f281"}.fa-edge:before{content:"\f282"}.fa-credit-card-alt:before{content:"\f283"}.fa-codiepie:before{content:"\f284"}.fa-modx:before{content:"\f285"}.fa-fort-awesome:before{content:"\f286"}.fa-usb:before{content:"\f287"}.fa-product-hunt:before{content:"\f288"}.fa-mixcloud:before{content:"\f289"}.fa-scribd:before{content:"\f28a"}.fa-pause-circle:before{content:"\f28b"}.fa-pause-circle-o:before{content:"\f28c"}.fa-stop-circle:before{content:"\f28d"}.fa-stop-circle-o:before{content:"\f28e"}.fa-shopping-bag:before{content:"\f290"}.fa-shopping-basket:before{content:"\f291"}.fa-hashtag:before{content:"\f292"}.fa-bluetooth:before{content:"\f293"}.fa-bluetooth-b:before{content:"\f294"}.fa-percent:before{content:"\f295"}.fa-gitlab:before{content:"\f296"}.fa-wpbeginner:before{content:"\f297"}.fa-wpforms:before{content:"\f298"}.fa-envira:before{content:"\f299"}.fa-universal-access:before{content:"\f29a"}.fa-wheelchair-alt:before{content:"\f29b"}.fa-question-circle-o:before{content:"\f29c"}.fa-blind:before{content:"\f29d"}.fa-audio-description:before{content:"\f29e"}.fa-volume-control-phone:before{content:"\f2a0"}.fa-braille:before{content:"\f2a1"}.fa-assistive-listening-systems:before{content:"\f2a2"}.fa-asl-interpreting:before,.fa-american-sign-language-interpreting:before{content:"\f2a3"}.fa-deafness:before,.fa-hard-of-hearing:before,.fa-deaf:before{content:"\f2a4"}.fa-glide:before{content:"\f2a5"}.fa-glide-g:before{content:"\f2a6"}.fa-signing:before,.fa-sign-language:before{content:"\f2a7"}.fa-low-vision:before{content:"\f2a8"}.fa-viadeo:before{content:"\f2a9"}.fa-viadeo-square:before{content:"\f2aa"}.fa-snapchat:before{content:"\f2ab"}.fa-snapchat-ghost:before{content:"\f2ac"}.fa-snapchat-square:before{content:"\f2ad"}.fa-pied-piper:before{content:"\f2ae"}.fa-first-order:before{content:"\f2b0"}.fa-yoast:before{content:"\f2b1"}.fa-themeisle:before{content:"\f2b2"}.fa-google-plus-circle:before,.fa-google-plus-official:before{content:"\f2b3"}.fa-fa:before,.fa-font-awesome:before{content:"\f2b4"}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto} \ No newline at end of file diff --git a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/css/phpspreadsheet.css b/vendor/phpoffice/phpspreadsheet/samples/bootstrap/css/phpspreadsheet.css deleted file mode 100644 index 5ea37342..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/css/phpspreadsheet.css +++ /dev/null @@ -1,13 +0,0 @@ -body { - padding-top: 20px; - padding-bottom: 20px; -} -.navbar { - margin-bottom: 20px; -} -.passed { - color: #339900; -} -.failed { - color: #ff0000; -} \ No newline at end of file diff --git a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/FontAwesome.otf b/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/FontAwesome.otf deleted file mode 100644 index d4de13e8..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/FontAwesome.otf and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.eot b/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.eot deleted file mode 100644 index c7b00d2b..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.eot and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.svg b/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.svg deleted file mode 100644 index 8b66187f..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.svg +++ /dev/null @@ -1,685 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.ttf b/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.ttf deleted file mode 100644 index f221e50a..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.ttf and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.woff b/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.woff deleted file mode 100644 index 6e7483cf..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.woff and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.woff2 b/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.woff2 deleted file mode 100644 index 7eb74fd1..00000000 Binary files a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/fonts/fontawesome-webfont.woff2 and /dev/null differ diff --git a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/js/bootstrap.min.js b/vendor/phpoffice/phpspreadsheet/samples/bootstrap/js/bootstrap.min.js deleted file mode 100644 index 9bcd2fcc..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/js/bootstrap.min.js +++ /dev/null @@ -1,7 +0,0 @@ -/*! - * Bootstrap v3.3.7 (http://getbootstrap.com) - * Copyright 2011-2016 Twitter, Inc. - * Licensed under the MIT license - */ -if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1||b[0]>3)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){if(a(b.target).is(this))return b.handleObj.handler.apply(this,arguments)}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.7",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a("#"===f?[]:f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.7",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c).prop(c,!0)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c).prop(c,!1))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")?(c.prop("checked")&&(a=!1),b.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==c.prop("type")&&(c.prop("checked")!==this.$element.hasClass("active")&&(a=!1),this.$element.toggleClass("active")),c.prop("checked",this.$element.hasClass("active")),a&&c.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target).closest(".btn");b.call(d,"toggle"),a(c.target).is('input[type="radio"], input[type="checkbox"]')||(c.preventDefault(),d.is("input,button")?d.trigger("focus"):d.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.7",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(a>this.$items.length-1||a<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){if(!this.sliding)return this.slide("next")},c.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.7",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function c(c){c&&3===c.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=b(d),f={relatedTarget:this};e.hasClass("open")&&(c&&"click"==c.type&&/input|textarea/i.test(c.target.tagName)&&a.contains(e[0],c.target)||(e.trigger(c=a.Event("hide.bs.dropdown",f)),c.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",f)))))}))}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.7",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=b(e),g=f.hasClass("open");if(c(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",c);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger(a.Event("shown.bs.dropdown",h))}return!1}},g.prototype.keydown=function(c){if(/(38|40|27|32)/.test(c.which)&&!/input|textarea/i.test(c.target.tagName)){var d=a(this);if(c.preventDefault(),c.stopPropagation(),!d.is(".disabled, :disabled")){var e=b(d),g=e.hasClass("open");if(!g&&27!=c.which||g&&27==c.which)return 27==c.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find(".dropdown-menu"+h);if(i.length){var j=i.index(c.target);38==c.which&&j>0&&j--,40==c.which&&jdocument.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth
    ',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusin"==b.type?"focus":"hover"]=!0),c.tip().hasClass("in")||"in"==c.hoverState?void(c.hoverState="in"):(clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.isInStateTrue=function(){for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);if(c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusout"==b.type?"focus":"hover"]=!1),!c.isInStateTrue())return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h="bottom"==h&&k.bottom+m>o.bottom?"top":"top"==h&&k.top-mo.width?"left":"left"==h&&k.left-lg.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;jg.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=a(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue()?c.enter(c):c.leave(c)):c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type),a.$tip&&a.$tip.detach(),a.$tip=null,a.$arrow=null,a.$viewport=null,a.$element=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.7",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:''}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.7",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b=e[a]&&(void 0===e[a+1]||b .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.7",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return e=a-d&&"bottom"},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery); \ No newline at end of file diff --git a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/js/jquery.min.js b/vendor/phpoffice/phpspreadsheet/samples/bootstrap/js/jquery.min.js deleted file mode 100644 index f6a6a99e..00000000 --- a/vendor/phpoffice/phpspreadsheet/samples/bootstrap/js/jquery.min.js +++ /dev/null @@ -1,4 +0,0 @@ -/*! jQuery v3.1.0 | (c) jQuery Foundation | jquery.org/license */ -!function(a,b){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.1.0",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null!=a?a<0?this[a+this.length]:this[a]:f.call(this)},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(a<0?b:0);return this.pushStack(c>=0&&c0&&b-1 in a)}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;c+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:d<0?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,ca=function(a,b){return b?"\0"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"label"in b&&b.disabled===a||"form"in b&&b.disabled===a||"form"in b&&b.disabled===!1&&(b.isDisabled===a||b.isDisabled!==!a&&("label"in b||!ea(b))!==a)}}function pa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return!!b&&"HTML"!==b.nodeName},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}},d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){if("undefined"!=typeof b.getElementsByClassName&&p)return b.getElementsByClassName(a)},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(_,aa).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:!b||(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(O," ")+" ").indexOf(c)>-1:"|="===b&&(e===c||e.slice(0,c.length+1)===c+"-"))}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:oa(!1),disabled:oa(!0),checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return X.test(a.nodeName)},input:function(a){return W.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[c<0?c+b:c]}),even:pa(function(a,b){for(var c=0;c=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=c<0?c+b:c;++d1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function va(a,b,c){for(var d=0,e=b.length;d-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];i1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,i0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(_,aa),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=V.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(_,aa),$.test(j[0].type)&&qa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&sa(j),!a)return G.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||$.test(a)&&qa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){if(!c)return a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){if(!c&&"input"===a.nodeName.toLowerCase())return a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;if(!c)return a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext,B=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,C=/^.[^:#\[\.,]*$/;function D(a,b,c){if(r.isFunction(b))return r.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return r.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(C.test(b))return r.filter(b,a,c);b=r.filter(b,a)}return r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType})}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;b1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(D(this,a||[],!1))},not:function(a){return this.pushStack(D(this,a||[],!0))},is:function(a){return!!D(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var E,F=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,G=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||E,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:F.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),B.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};G.prototype=r.fn,E=r(d);var H=/^(?:parents|prev(?:Until|All))/,I={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;a-1:1===c.nodeType&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function J(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return J(a,"nextSibling")},prev:function(a){return J(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return a.contentDocument||r.merge([],a.childNodes)}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(I[a]||r.uniqueSort(e),H.test(a)&&e.reverse()),this.pushStack(e)}});var K=/\S+/g;function L(a){var b={};return r.each(a.match(K)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?L(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h-1)f.splice(c,1),c<=h&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function M(a){return a}function N(a){throw a}function O(a,b,c){var d;try{a&&r.isFunction(d=a.promise)?d.call(a).done(b).fail(c):a&&r.isFunction(d=a.then)?d.call(a,b,c):b.call(void 0,a)}catch(a){c.call(void 0,a)}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(b=f&&(d!==N&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:M,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:M)),c[2][3].add(g(0,a,r.isFunction(d)?d:N))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(b<=1&&(O(a,g.done(h(c)).resolve,g.reject),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)O(e[c],h(c),g.reject);return g.promise()}});var P=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&P.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)},r.readyException=function(b){a.setTimeout(function(){throw b})};var Q=r.Deferred();r.fn.ready=function(a){return Q.then(a)["catch"](function(a){r.readyException(a)}),this},r.extend({isReady:!1,readyWait:1,holdReady:function(a){a?r.readyWait++:r.ready(!0)},ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||Q.resolveWith(d,[r]))}}),r.ready.then=Q.then;function R(){d.removeEventListener("DOMContentLoaded",R),a.removeEventListener("load",R),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",R),a.addEventListener("load",R));var S=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)S(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0, -r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(a),c)})),b))for(;h1,null,!0)},removeData:function(a){return this.each(function(){W.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=V.get(a,b),c&&(!d||r.isArray(c)?d=V.access(a,b,r.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return V.get(a,c)||V.access(a,c,{empty:r.Callbacks("once memory").add(function(){V.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length\x20\t\r\n\f]+)/i,ja=/^$|\/(?:java|ecma)script/i,ka={option:[1,""],thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};ka.optgroup=ka.option,ka.tbody=ka.tfoot=ka.colgroup=ka.caption=ka.thead,ka.th=ka.td;function la(a,b){var c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&r.nodeName(a,b)?r.merge([a],c):c}function ma(a,b){for(var c=0,d=a.length;c-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=la(l.appendChild(f),"script"),j&&ma(g),c){k=0;while(f=g[k++])ja.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var pa=d.documentElement,qa=/^key/,ra=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,sa=/^([^.]*)(?:\.(.+)|)/;function ta(){return!0}function ua(){return!1}function va(){try{return d.activeElement}catch(a){}}function wa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)wa(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=ua;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(pa,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(K)||[""],j=b.length;while(j--)h=sa.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.hasData(a)&&V.get(a);if(q&&(i=q.events)){b=(b||"").match(K)||[""],j=b.length;while(j--)if(h=sa.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&V.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(V.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;c-1:r.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h\x20\t\r\n\f]*)[^>]*)\/>/gi,ya=/\s*$/g;function Ca(a,b){return r.nodeName(a,"table")&&r.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a:a}function Da(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Ea(a){var b=Aa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Fa(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(V.hasData(a)&&(f=V.access(a),g=V.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;c1&&"string"==typeof q&&!o.checkClone&&za.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ha(f,b,c,d)});if(m&&(e=oa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(la(e,"script"),Da),i=h.length;l")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=la(h),f=la(a),d=0,e=f.length;d0&&ma(g,!i&&la(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(T(c)){if(b=c[V.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[V.expando]=void 0}c[W.expando]&&(c[W.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ia(this,a,!0)},remove:function(a){return Ia(this,a)},text:function(a){return S(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.appendChild(a)}})},prepend:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(la(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null!=a&&a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return S(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!ya.test(a)&&!ka[(ia.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;c1)}});function Xa(a,b,c,d,e){return new Xa.prototype.init(a,b,c,d,e)}r.Tween=Xa,Xa.prototype={constructor:Xa,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||r.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(r.cssNumber[c]?"":"px")},cur:function(){var a=Xa.propHooks[this.prop];return a&&a.get?a.get(this):Xa.propHooks._default.get(this)},run:function(a){var b,c=Xa.propHooks[this.prop];return this.options.duration?this.pos=b=r.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Xa.propHooks._default.set(this),this}},Xa.prototype.init.prototype=Xa.prototype,Xa.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=r.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){r.fx.step[a.prop]?r.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[r.cssProps[a.prop]]&&!r.cssHooks[a.prop]?a.elem[a.prop]=a.now:r.style(a.elem,a.prop,a.now+a.unit)}}},Xa.propHooks.scrollTop=Xa.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},r.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2},_default:"swing"},r.fx=Xa.prototype.init,r.fx.step={};var Ya,Za,$a=/^(?:toggle|show|hide)$/,_a=/queueHooks$/;function ab(){Za&&(a.requestAnimationFrame(ab),r.fx.tick())}function bb(){return a.setTimeout(function(){Ya=void 0}),Ya=r.now()}function cb(a,b){var c,d=0,e={height:a};for(b=b?1:0;d<4;d+=2-b)c=aa[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function db(a,b,c){for(var d,e=(gb.tweeners[b]||[]).concat(gb.tweeners["*"]),f=0,g=e.length;f1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?hb:void 0)),void 0!==c?null===c?void r.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&r.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(K); -if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),hb={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=ib[b]||r.find.attr;ib[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=ib[g],ib[g]=e,e=null!=c(a,b,d)?g:null,ib[g]=f),e}});var jb=/^(?:input|select|textarea|button)$/i,kb=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return S(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=r.find.attr(a,"tabindex");return b?parseInt(b,10):jb.test(a.nodeName)||kb.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});var lb=/[\t\r\n\f]/g;function mb(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,mb(this)))});if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=mb(c),d=1===c.nodeType&&(" "+e+" ").replace(lb," ")){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=r.trim(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,mb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=mb(c),d=1===c.nodeType&&(" "+e+" ").replace(lb," ")){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=r.trim(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,mb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(K)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=mb(this),b&&V.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":V.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+mb(c)+" ").replace(lb," ").indexOf(b)>-1)return!0;return!1}});var nb=/\r/g,ob=/[\x20\t\r\n\f]+/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":r.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(nb,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:r.trim(r.text(a)).replace(ob," ")}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type,g=f?null:[],h=f?e+1:d.length,i=e<0?h:f?e:0;i-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){if(r.isArray(b))return a.checked=r.inArray(r(a).val(),b)>-1}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var pb=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!pb.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,pb.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(V.get(h,"events")||{})[b.type]&&V.get(h,"handle"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&T(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!T(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];if(c)return r.event.trigger(a,b,c,!0)}}),r.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=V.access(d,b);e||d.addEventListener(a,c,!0),V.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=V.access(d,b)-1;e?V.access(d,b,e):(d.removeEventListener(a,c,!0),V.remove(d,b))}}});var qb=a.location,rb=r.now(),sb=/\?/;r.parseXML=function(b){var c;if(!b||"string"!=typeof b)return null;try{c=(new a.DOMParser).parseFromString(b,"text/xml")}catch(d){c=void 0}return c&&!c.getElementsByTagName("parsererror").length||r.error("Invalid XML: "+b),c};var tb=/\[\]$/,ub=/\r?\n/g,vb=/^(?:submit|button|image|reset|file)$/i,wb=/^(?:input|select|textarea|keygen)/i;function xb(a,b,c,d){var e;if(r.isArray(b))r.each(b,function(b,e){c||tb.test(a)?d(a,e):xb(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(e in b)xb(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(r.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)xb(c,a[c],b,e);return d.join("&")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(":disabled")&&wb.test(this.nodeName)&&!vb.test(a)&&(this.checked||!ha.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:r.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(ub,"\r\n")}}):{name:b.name,value:c.replace(ub,"\r\n")}}).get()}});var yb=/%20/g,zb=/#.*$/,Ab=/([?&])_=[^&]*/,Bb=/^(.*?):[ \t]*([^\r\n]*)$/gm,Cb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Db=/^(?:GET|HEAD)$/,Eb=/^\/\//,Fb={},Gb={},Hb="*/".concat("*"),Ib=d.createElement("a");Ib.href=qb.href;function Jb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(K)||[];if(r.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Kb(a,b,c,d){var e={},f=a===Gb;function g(h){var i;return e[h]=!0,r.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Lb(a,b){var c,d,e=r.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&r.extend(!0,a,d),a}function Mb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}if(f)return f!==i[0]&&i.unshift(f),c[f]}function Nb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}r.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:qb.href,type:"GET",isLocal:Cb.test(qb.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Hb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":r.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Lb(Lb(a,r.ajaxSettings),b):Lb(r.ajaxSettings,a)},ajaxPrefilter:Jb(Fb),ajaxTransport:Jb(Gb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var e,f,g,h,i,j,k,l,m,n,o=r.ajaxSetup({},c),p=o.context||o,q=o.context&&(p.nodeType||p.jquery)?r(p):r.event,s=r.Deferred(),t=r.Callbacks("once memory"),u=o.statusCode||{},v={},w={},x="canceled",y={readyState:0,getResponseHeader:function(a){var b;if(k){if(!h){h={};while(b=Bb.exec(g))h[b[1].toLowerCase()]=b[2]}b=h[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return k?g:null},setRequestHeader:function(a,b){return null==k&&(a=w[a.toLowerCase()]=w[a.toLowerCase()]||a,v[a]=b),this},overrideMimeType:function(a){return null==k&&(o.mimeType=a),this},statusCode:function(a){var b;if(a)if(k)y.always(a[y.status]);else for(b in a)u[b]=[u[b],a[b]];return this},abort:function(a){var b=a||x;return e&&e.abort(b),A(0,b),this}};if(s.promise(y),o.url=((b||o.url||qb.href)+"").replace(Eb,qb.protocol+"//"),o.type=c.method||c.type||o.method||o.type,o.dataTypes=(o.dataType||"*").toLowerCase().match(K)||[""],null==o.crossDomain){j=d.createElement("a");try{j.href=o.url,j.href=j.href,o.crossDomain=Ib.protocol+"//"+Ib.host!=j.protocol+"//"+j.host}catch(z){o.crossDomain=!0}}if(o.data&&o.processData&&"string"!=typeof o.data&&(o.data=r.param(o.data,o.traditional)),Kb(Fb,o,c,y),k)return y;l=r.event&&o.global,l&&0===r.active++&&r.event.trigger("ajaxStart"),o.type=o.type.toUpperCase(),o.hasContent=!Db.test(o.type),f=o.url.replace(zb,""),o.hasContent?o.data&&o.processData&&0===(o.contentType||"").indexOf("application/x-www-form-urlencoded")&&(o.data=o.data.replace(yb,"+")):(n=o.url.slice(f.length),o.data&&(f+=(sb.test(f)?"&":"?")+o.data,delete o.data),o.cache===!1&&(f=f.replace(Ab,""),n=(sb.test(f)?"&":"?")+"_="+rb++ +n),o.url=f+n),o.ifModified&&(r.lastModified[f]&&y.setRequestHeader("If-Modified-Since",r.lastModified[f]),r.etag[f]&&y.setRequestHeader("If-None-Match",r.etag[f])),(o.data&&o.hasContent&&o.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",o.contentType),y.setRequestHeader("Accept",o.dataTypes[0]&&o.accepts[o.dataTypes[0]]?o.accepts[o.dataTypes[0]]+("*"!==o.dataTypes[0]?", "+Hb+"; q=0.01":""):o.accepts["*"]);for(m in o.headers)y.setRequestHeader(m,o.headers[m]);if(o.beforeSend&&(o.beforeSend.call(p,y,o)===!1||k))return y.abort();if(x="abort",t.add(o.complete),y.done(o.success),y.fail(o.error),e=Kb(Gb,o,c,y)){if(y.readyState=1,l&&q.trigger("ajaxSend",[y,o]),k)return y;o.async&&o.timeout>0&&(i=a.setTimeout(function(){y.abort("timeout")},o.timeout));try{k=!1,e.send(v,A)}catch(z){if(k)throw z;A(-1,z)}}else A(-1,"No Transport");function A(b,c,d,h){var j,m,n,v,w,x=c;k||(k=!0,i&&a.clearTimeout(i),e=void 0,g=h||"",y.readyState=b>0?4:0,j=b>=200&&b<300||304===b,d&&(v=Mb(o,y,d)),v=Nb(o,v,y,j),j?(o.ifModified&&(w=y.getResponseHeader("Last-Modified"),w&&(r.lastModified[f]=w),w=y.getResponseHeader("etag"),w&&(r.etag[f]=w)),204===b||"HEAD"===o.type?x="nocontent":304===b?x="notmodified":(x=v.state,m=v.data,n=v.error,j=!n)):(n=x,!b&&x||(x="error",b<0&&(b=0))),y.status=b,y.statusText=(c||x)+"",j?s.resolveWith(p,[m,x,y]):s.rejectWith(p,[y,x,n]),y.statusCode(u),u=void 0,l&&q.trigger(j?"ajaxSuccess":"ajaxError",[y,o,j?m:n]),t.fireWith(p,[y,x]),l&&(q.trigger("ajaxComplete",[y,o]),--r.active||r.event.trigger("ajaxStop")))}return y},getJSON:function(a,b,c){return r.get(a,b,c,"json")},getScript:function(a,b){return r.get(a,void 0,b,"script")}}),r.each(["get","post"],function(a,b){r[b]=function(a,c,d,e){return r.isFunction(c)&&(e=e||d,d=c,c=void 0),r.ajax(r.extend({url:a,type:b,dataType:e,data:c,success:d},r.isPlainObject(a)&&a))}}),r._evalUrl=function(a){return r.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},r.ajaxSettings.xhr=function(){try{return new a.XMLHttpRequest}catch(b){}};var Ob={0:200,1223:204},Pb=r.ajaxSettings.xhr();o.cors=!!Pb&&"withCredentials"in Pb,o.ajax=Pb=!!Pb,r.ajaxTransport(function(b){var c,d;if(o.cors||Pb&&!b.crossDomain)return{send:function(e,f){var g,h=b.xhr();if(h.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields)for(g in b.xhrFields)h[g]=b.xhrFields[g];b.mimeType&&h.overrideMimeType&&h.overrideMimeType(b.mimeType),b.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest");for(g in e)h.setRequestHeader(g,e[g]);c=function(a){return function(){c&&(c=d=h.onload=h.onerror=h.onabort=h.onreadystatechange=null,"abort"===a?h.abort():"error"===a?"number"!=typeof h.status?f(0,"error"):f(h.status,h.statusText):f(Ob[h.status]||h.status,h.statusText,"text"!==(h.responseType||"text")||"string"!=typeof h.responseText?{binary:h.response}:{text:h.responseText},h.getAllResponseHeaders()))}},h.onload=c(),d=h.onerror=c("error"),void 0!==h.onabort?h.onabort=d:h.onreadystatechange=function(){4===h.readyState&&a.setTimeout(function(){c&&d()})},c=c("abort");try{h.send(b.hasContent&&b.data||null)}catch(i){if(c)throw i}},abort:function(){c&&c()}}}),r.ajaxPrefilter(function(a){a.crossDomain&&(a.contents.script=!1)}),r.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return r.globalEval(a),a}}}),r.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),r.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(e,f){b=r("