//
//  GMFacePointViewController.m
//  Gengmei
//
//  Created by 刘鹿杰 on 2019/6/26.
//  Copyright © 2019 更美互动信息科技有限公司. All rights reserved.
//

#import "GMFacePointViewController.h"
//#import "GMFaceInfoShareViewController.h"
//#import "Gengmei-Swift.h"
#import "UIView+GMExtension.h"
#import "UIImage+GMExtension.h"
#import "GMImageView+GMFace.h"
#import "GMDrawDottedView.h"
#import "GMMarkView.h"
#import "GMTitleView.h"
#import "ALFacePointsModel.h"
#import "GMFaceV3Model.h"
#import "ALTransFormFaceUtil.h"
#import "GMFaceV3Util.h"
//#import "GMGeneMemoryResultViewController.h"
#import "NSString+jsonData.h"
//#import "Lottie.h"
//#import "UIImage+WebP.h"
@import GMCache;
@import SDWebImage;
@import GMRouter;
#define AnimationDuration 0.75  // 动画执行时间
#define AnimationDuration1 1.0  // 动画执行时间为1.0 秒
#define Blue_line [UIColor colorWithHexString:@"0x4EC4CD" alpha:0.6]
#define TitleToTopHight [OCNavigationBar barHeight] + 101

@interface UIView (Transform)

@end

@implementation UIView (Transform)
- (void)setAnchorPoint:(CGPoint)anchorPoint {
    CGFloat x = anchorPoint.x/self.bounds.size.width;
    CGFloat y = anchorPoint.y/self.bounds.size.height;
    
    CGPoint oldOrigin = self.frame.origin;
    self.layer.anchorPoint = CGPointMake(x, y);
    CGPoint newOrigin = self.frame.origin;
    
    CGPoint transition;
    transition.x = newOrigin.x - oldOrigin.x;
    transition.y = newOrigin.y - oldOrigin.y;
    
    self.center = CGPointMake (self.center.x - transition.x, self.center.y - transition.y);
}
@end

@interface GMFacePointViewController ()
@property (nonatomic, strong) GMButton *backBtn;            //  返回按钮
@property (nonatomic, strong) GMButton *ignoreBtn;          //  跳过按钮
@property (nonatomic, strong) GMImageView *titleImageView;  //  页面标题imageView
@property (nonatomic, strong) GMImageView *picImageView;    //  当前页面图片
@property (nonatomic, assign) BOOL stopGCD;                 //  是否停用GCD， 结束当前页面动画

@property (nonatomic, strong) GMFaceV3Model *faceModel;

@property (nonatomic, strong) NSMutableArray *allViewLine;   // 页面需要消失的线
@property (nonatomic, strong) NSMutableArray *viewshowTime;   // 每个页面需要延时的时间

@property (nonatomic, strong) UIImageView *placeholderImage;
//@property (nonatomic, strong) UIImageView *finallyImageView;
@property (nonatomic, assign) BOOL isShowAnimate;

@property (nonatomic, strong) SDAnimatedImageView *geneEndImageView;    //  面孔起源动画结尾
@property (nonatomic, strong) GMImageView *geneEndBgImageView;    //  面孔起源动画结尾

@end

@implementation GMFacePointViewController

- (instancetype)initWithModel:(GMFaceV3Model *)faceModel {
    if (self = [super init]) {
        self.faceModel = [ALTransFormFaceUtil zoomFaceImagelScreenWidth:faceModel];
    }
    return self;
}

- (void)initController {
    [super initController];
    self.pageName = @"face_scan_loading";
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationBar.hidden = YES;
    self.fd_interactivePopDisabled = YES;
    self.view.backgroundColor = [UIColor colorWithHexString:@"666666"];
    [self setupPlaceHoldImageV];
    [self animateFaceImageToDesignatedLocation];
    self.extraParam = [NSString jsonStringWithObject:@{@"land_tab_name" : self.isGene ? @"AI面孔" : @"AI测脸"}];
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:YES];
    if (self.geneEndImageView) {
        [self.geneEndImageView stopAnimating];
        [self.geneEndBgImageView removeFromSuperview];
    }
}

- (void)animateFaceImageToDesignatedLocation {
    // 1 standardPoint：标准点。同时画一个standardView作为参考
    CGPoint standardPoint = CGPointMake(MAINSCREEN_WIDTH / 2, MAINSCREEN_HEIGHT * templeTopScale);
    
    // 2 faceCenterPoint：人脸中心点。同时画一个绿色faceCenterView作为参考。
    // faceCenterView 是被添加到图片上的，以便验证后续的平移、旋转、缩放是正确的
    CGPoint faceCenterPoint = CGPointMake((self.faceModel.templeInfo.leftX + self.faceModel.templeInfo.rightX)/2, (self.faceModel.templeInfo.leftY + self.faceModel.templeInfo.rightY)/2);
    
    // 3、将人脸中心点移动到标准点，所以要先计算平移的 x和y
    CGFloat translateX = standardPoint.x - faceCenterPoint.x;
    CGFloat translateY = standardPoint.y - faceCenterPoint.y;
    
    // 3.1 计算平移后的 frame
    CGRect newRect = _placeholderImage.frame;
    newRect.origin.x += translateX;
    newRect.origin.y += translateY;
    // 5 接下来要旋转、缩放，所以要保证图片此时的 anchorPoint、人脸中心点、标准参考点，三点重叠
    [_placeholderImage setAnchorPoint:faceCenterPoint];
    // 6 旋转transform
    CGAffineTransform roateTransform = [ALTransFormFaceUtil rollTransformImageV:self.faceModel];
    // 7 缩放transform
    // 7.1 由两个太阳穴的点可以得到脸的宽度
    CGFloat betweenX = self.faceModel.templeInfo.leftX - self.faceModel.templeInfo.rightX;
    CGFloat betweenY = self.faceModel.templeInfo.leftY - self.faceModel.templeInfo.rightY;
    CGFloat faceWidth = sqrt(betweenX*betweenX + betweenY*betweenY);
    // 7.2 标准宽度与脸宽度对比得到缩放因子，进而得到transform
    CGFloat standardWidth = MAINSCREEN_WIDTH * templeWidthScale;
    CGFloat imageScale = standardWidth / faceWidth;
    CGAffineTransform lastTransform = CGAffineTransformScale(roateTransform, imageScale, imageScale);
    
    [UIView animateWithDuration:0.5 animations:^{
        // 4 开始平移
        _placeholderImage.frame = newRect;
    }];
    
    [UIView animateWithDuration:0.5 delay:0.5 options:UIViewAnimationOptionCurveEaseInOut animations:^{
        // 8 应用最终的 transform
        _placeholderImage.transform = lastTransform;
    } completion:^(BOOL finished) {
        dispatch_async(dispatch_get_main_queue(), ^{
            self.faceModel = [ALTransFormFaceUtil mapFaceModelToScreencCoordinates:self.faceModel aroundPoint:standardPoint roate:roateTransform  scale:imageScale translate:CGPointMake(translateX, translateY)];
            self.faceModel.image = nil; // 存储模型到沙盒前， 需要清空image对象
            [GMCache storeObjectAtDocumentPathWithkey:@"GMFaceV3Model" object:self.faceModel.toDictionary];
            self.faceModel.image = [self snapScreenImageMethod];
            NSData *imageData = UIImagePNGRepresentation(self.faceModel.image);
            [GMCache storeObjectAtDocumentPathWithkey:@"GMFaceV3ModelImage" object:imageData];
            // 控制动画效果
            [self setupSubView];
            [self setNavigationBarUI];
        });
    }];
}

- (void)snapFaceMethod {
    CGRect r1 = CGRectMake(self.faceModel.rect.left, self.faceModel.rect.top, self.faceModel.rect.right - self.faceModel.rect.left, self.faceModel.rect.bottom - self.faceModel.rect.top);
    //对r1 放大1.8倍 取出来传给 h5 显示头像使用
    CGFloat scale = 1.6;
    CGFloat newRectX = r1.origin.x - ((scale - 1) / 2 * r1.size.width);
    CGFloat newRectY = r1.origin.y - ((scale - 1) * r1.size.height);
    CGRect newRect = CGRectMake(newRectX, newRectY, r1.size.width*scale, r1.size.height*scale);
    UIImage *h5Image = [self imageFromView:self.view atFrame:newRect];
    if (self.isGene) { // 面孔起源
        [self uploadImageToQiniu:h5Image key:@"researchUserImg"];
    } else {
        [self uploadImageToQiniu:h5Image key:@"scanUserImg"];
    }
}

// 存取base64 给h5
- (void)uploadImageToQiniu:(UIImage *)image key:(NSString *)key {
    [GMFaceV3Util uploadImageToQiNiu:image successBlock:^(id responseObject) {
        NSString *path = (NSString *)responseObject;
        //由于是一个段路径 所以要拼接上域名 https://pic.igengmei.com/ 以及后缀给h5 -aspectscale800
        NSString *urlStr = [NSString stringWithFormat:@"https://pic.igengmei.com/%@-aspectscale800", path];
        [GMCache storeObjectAtDocumentPathWithkey:key object:urlStr];
    }];
}

#pragma mark -- 获得某个范围内的屏幕图像(截图)
- (UIImage *)imageFromView:(UIView *)theView atFrame:(CGRect)atFrame {
    // 下面方法，第一个参数表示区域大小。第二个参数表示是否是非透明的。如果需要显示半透明效果，需要传NO，否则传YES。第三个参数就是屏幕密度了，关键就是第三个参数 [UIScreen mainScreen].scale。
    UIGraphicsBeginImageContextWithOptions(theView.frame.size, NO, 1.0);
    [theView.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    CGRect myImageRect = atFrame;
    CGImageRef imageRef = image.CGImage;
    CGImageRef subImageRef = CGImageCreateWithImageInRect(imageRef,myImageRect );
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextDrawImage(context, myImageRect, subImageRef);
    UIImage* smallImage = [UIImage imageWithCGImage:subImageRef];
    CGImageRelease(subImageRef);
    UIGraphicsEndImageContext();
    return smallImage;
}

- (void)setupPlaceHoldImageV {
    _placeholderImage = [[UIImageView alloc] initWithFrame:CGRectMake(self.faceModel.imageX, self.faceModel.imageY, self.faceModel.imageW, self.faceModel.imageH)];
    _placeholderImage.contentMode = UIViewContentModeScaleAspectFit;
    _placeholderImage.image = self.faceModel.image;
    [self.view addSubview:_placeholderImage];
    [self snapFaceMethod];
}

- (void)setAnchorPoint:(CGPoint)anchorPoint forView:(UIView *)view {
    CGPoint oldOrigin = view.frame.origin;
    view.layer.anchorPoint = anchorPoint;
    CGPoint newOrigin = view.frame.origin;
    CGPoint transition;
    transition.x = newOrigin.x - oldOrigin.x;
    transition.y = newOrigin.y - oldOrigin.y;
    view.center = CGPointMake (view.center.x - transition.x, view.center.y - transition.y);
}

- (void)drawCircleAtPoint:(CGPoint)point color:(UIColor *)color {
    CAShapeLayer *solidLine =  [CAShapeLayer layer];
    CGMutablePathRef solidPath =  CGPathCreateMutable();
    solidLine.lineWidth = 2.0f ;
    solidLine.strokeColor = color.CGColor;
    solidLine.fillColor = [UIColor clearColor].CGColor;
    
    CGPathAddEllipseInRect(solidPath, nil, CGRectMake(point.x,  point.y, 4, 4));
    solidLine.path = solidPath;
    CGPathRelease(solidPath);
    [self.view.layer addSublayer:solidLine];
}

#pragma mark - 获得屏幕截图
- (UIImage *)snapScreenImageMethod {
    UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, YES, [[UIScreen mainScreen] scale]);
    if ([self respondsToSelector:@selector(drawViewHierarchyInRect:afterScreenUpdates:)]) {
        [self.view drawViewHierarchyInRect:self.view.bounds afterScreenUpdates:NO];
    } else {
        CGContextRef context = UIGraphicsGetCurrentContext();
        [self.view.layer renderInContext:context];
    }
    UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return viewImage;
}

- (void)setupSubView {
    [self addImageView];                        // 设置ImageView
    [self addMaskView];                         // 添加遮罩层
    [self addTitleImageView:@"facev3_analyse"]; // 添加面部分析图片
    [self controlAnimation];                    // 控制动画
}

- (void)setNavigationBarUI {
    [self.view addSubview:self.backBtn];
    [self.backBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(20);
        make.centerY.equalTo(self.view.mas_top).offset([OCNavigationBar navigationItemCenterY]);
    }];
    [self.view addSubview:self.ignoreBtn];
    [self.ignoreBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-20);
        make.centerY.equalTo(self.backBtn.mas_centerY);
    }];
}

// 添加picImageView
- (void)addImageView {
    self.picImageView = [[GMImageView alloc] initWithImage:self.faceModel.image];
    _picImageView.contentMode = UIViewContentModeScaleAspectFill;
    _picImageView.frame = self.view.frame;
    [_placeholderImage removeFromSuperview];
    [self.view addSubview:_picImageView];
}

// 添加遮罩层
- (void)addMaskView {
    GMMarkView * markView = [[GMMarkView alloc] init];
    markView.backgroundColor = [UIColor colorWithHexString:@"000000" alpha:0.25];
    markView.alpha = 0;
    markView.frame = CGRectMake(0, 0, MAINSCREEN_WIDTH, MAINSCREEN_HEIGHT);
    [self.view addSubview:markView];
    [UIView animateWithDuration:1.0 animations:^{
        markView.alpha = 1;
    }];
}

#pragma mark 使用递归方法 - 串行控制动画效果

// 控制动画效果
- (void)controlAnimation  {
    self.viewshowTime = [NSMutableArray arrayWithArray:@[@(2.25),@(2.25),@(3),@(3.25)]];
    __weak typeof(self) weakSelf = self; // 展示面部分析动画后， 停留0.75s，动画耗时0.75s 共用 1.5s
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        if (weakSelf.stopGCD) { return ;}
        [weakSelf drawOneViewAnimation];  // 共耗时 1.25s
        [weakSelf controlVcAnimationWithIndex:2 Delay:2.25];
    });
}

- (void)controlVcAnimationWithIndex:(NSInteger)index Delay:(CGFloat)delayTime{
    __weak typeof(self) weakSelf = self;
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayTime * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        if (weakSelf.stopGCD) { return ;}
        [weakSelf clearFristViewLineView];  // 耗时0.75s, 等待0.75s
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            if (weakSelf.stopGCD) { return ;}
            if (index == 2) {                      // 开启第二个页面的动画
                [weakSelf drawSectionViewAnimation];
            }else if (index == 3){                // 开启第三页面的动画
                [weakSelf drawThirdViewAnimation];
            }else if (index == 4){                // 开启第四页面的动画
                [weakSelf drawFourViewAnimation];
                [weakSelf controlVcAnimationFive]; // 开启第五页面的动画
            }
            if (index < 4) {
                [weakSelf controlVcAnimationWithIndex:index + 1 Delay:[weakSelf.viewshowTime[index - 1] floatValue]];
            }
        });
    });
}

// 控制第五个页面的动画
- (void)controlVcAnimationFive {
    __weak typeof(self) weakSelf = self;
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        if (weakSelf.stopGCD) { return ;}
        [weakSelf clearFristViewLineView];  // 耗时0.75s
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(AnimationDuration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            if (weakSelf.stopGCD) { return ;}
            [weakSelf addTitleImageView:@"facev3_eye_analyse"]; // 0.75s
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(AnimationDuration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                if (weakSelf.stopGCD) { return ;}
                [weakSelf drawFiveViewAnimation]; // 3.75s
                dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4.75 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                    if (weakSelf.stopGCD) { return ;}
                    [weakSelf controlVcAnimationSix];
                });
            });
        });
    });
}

// 控制第六个页面的动画
- (void)controlVcAnimationSix {
    __weak typeof(self) weakSelf = self;
    [weakSelf clearFristViewLineView]; // 清除页面线条
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.75 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        if (weakSelf.stopGCD) { return ;}
        [weakSelf updatePicImageViewframeP]; // 0.75s
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.75 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            if (weakSelf.stopGCD) { return ;}
            // 在这里开启新的动画
            [weakSelf drawAddNewAnimation];
            [weakSelf.allViewLine addObject:weakSelf.titleImageView];
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.75 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                if (weakSelf.stopGCD) { return ;}
                [weakSelf clearFristViewLineView]; // 清除页面线条
                dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.75 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                    if (weakSelf.stopGCD) { return ;}
                    [weakSelf addTitleImageView:@"facev3_mouth_analyse"]; // 0.75s
                    [weakSelf.allViewLine addObject:weakSelf.titleImageView];
                    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.75 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                        if (weakSelf.stopGCD) { return ;}
                        [weakSelf drawSixViewAnimation]; // 1.75s
                        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.75 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                            if (weakSelf.stopGCD) { return ;}
                            if (weakSelf.isGene) {
                                [weakSelf drawGeneMemoryEndAnimation]; // 0.23s
                            } else {
                                [weakSelf ignoreMethod];   // 跳转页面
                            }
                        });
                    });
                });
            });
        });
    });
}

#pragma mark 第一个页面所有动画

- (void)drawOneViewAnimation {
    NSArray *keyPointModelArray = self.faceModel.analysis.santingInfo.realLinePoints;
    NSArray *subTitle = self.faceModel.analysis.santingInfo.subTitle;
    // 线宽
    NSArray *array1 = @[@(0.75), @(0.6), @(0.45)];
    if (keyPointModelArray.count != 3) {return;}
    // 画三条横线
    [keyPointModelArray enumerateObjectsUsingBlock:^(NSArray * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        GMFaceCommonPositionModel *pointModel = (GMFaceCommonPositionModel *)obj;
        GMImageView *lineImage = [GMImageView creatHorizontalPathWithY:pointModel.y];
        lineImage.centerX = self.view.centerX;
        [self.view addSubview:lineImage];
        [UIView animateWithDuration:AnimationDuration animations:^{
            lineImage.width = [array1[idx] floatValue] * MAINSCREEN_WIDTH;
            lineImage.centerX = self.view.centerX;
        }];
        [self.allViewLine addObject:lineImage];
    }];
    
    // 画中间两条描述竖线
    NSArray *contentModelArray = [self.faceModel.analysis.santingInfo.content copy];
    for (int i = 1; i < keyPointModelArray.count; i++) {
        GMFaceCommonContentModel *contentModel = contentModelArray[i - 1];
        NSString *dect = [NSString stringWithFormat:@"%@\n%@",contentModel.title, contentModel.value];
        CGSize dectSize = [dect sizeWithAttributes:@{NSFontAttributeName:[UIFont gmFont:9]}];
        CGPointModel *pointModel0 = keyPointModelArray[i - 1];
        CGPointModel *pointModel = keyPointModelArray[i];
        GMDrawDottedView *drawHView = [[GMDrawDottedView alloc] initWithLineType:drawViewTypeVerticalDotted addlabel:wordPlaceCenter addDect:dect];
        drawHView.backgroundColor = [UIColor clearColor];
        drawHView.frame = CGRectMake(MAINSCREEN_WIDTH -  (60 + i * dectSize.width), pointModel0.y + 1, dectSize.width, pointModel.y - pointModel0.y - 2);
        drawHView.alpha = 0;
        [self.view addSubview:drawHView];
        [self.allViewLine addObject:drawHView];
        [UIView animateWithDuration:AnimationDuration1 animations:^{
            drawHView.alpha = 1;
        }];
    }
    // 添加描述文字
    [self leftPopTitleWith:self.allViewLine AddSubtitle:subTitle Animation:0.5];
}


#pragma mark 第二个页面所有动画

- (void)drawSectionViewAnimation {
    NSArray *wuyanPointArray = self.faceModel.analysis.wuyanInfo.realLinePoints;
    NSArray *santingArray = self.faceModel.analysis.santingInfo.realLinePoints; // 从三庭页面获取P点
    NSArray *subTitle = self.faceModel.analysis.wuyanInfo.subTitle;
    GMFaceCommonPositionModel *pModel = santingArray[1];
    if (wuyanPointArray.count != 6) {return;}
    [wuyanPointArray enumerateObjectsUsingBlock:^(NSArray * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        CGPointModel *pointModel = (CGPointModel *)obj;
        GMImageView *lineImage = [GMImageView creatVerticalPathWithX:pointModel.x];
        lineImage.centerY = pModel.y;
        [self.view addSubview:lineImage];
        [UIView animateWithDuration:AnimationDuration animations:^{
            lineImage.height = 300;
            lineImage.centerY = pModel.y;
        }];
        // 保存数据
        [self.allViewLine addObject:lineImage];
    }];
    
    // 计算横着的带箭头的虚线
    NSArray *triangleSubTitle = self.faceModel.analysis.goldTriangleInfo.pointsTriangle;
    GMFaceCommonPositionModel *pModel1 = triangleSubTitle[0];
    NSArray *yArray = @[@(pModel1.y + 90), @(pModel1.y + 30), @(pModel1.y + 60), @(pModel1.y + 30),@(pModel1.y + 90)];
    NSArray *contentModelArray = self.faceModel.analysis.wuyanInfo.content;
    for (int i = 1; i < wuyanPointArray.count; i++) {
        GMFaceCommonContentModel *contentModel = contentModelArray[i - 1];
        NSString *dect = [NSString stringWithFormat:@"%@\n%@",contentModel.title, contentModel.value];
        CGSize dectSize = [dect sizeWithAttributes:@{NSFontAttributeName:[UIFont gmFont:9]}];
        CGPointModel *pointModel0 = wuyanPointArray[i - 1];
        CGPointModel *pointModel = wuyanPointArray[i];
        // 文字在下面
        GMDrawDottedView *drawHView = [[GMDrawDottedView alloc] initWithLineType:drawViewTypeHorizontalDotted addlabel:wordPlaceBottom addDect:dect];
        drawHView.backgroundColor = [UIColor clearColor];
        drawHView.frame = CGRectMake(pointModel0.x, [yArray[i - 1] floatValue], pointModel.x - pointModel0.x, dectSize.height + 10);
        drawHView.alpha = 0;
        [UIView animateWithDuration:AnimationDuration animations:^{
            drawHView.alpha = 1;
        }];
        [self.view addSubview:drawHView];
        [self.allViewLine addObject:drawHView];
    }
    
    // 添加中间两条横线
    NSArray *dottedPointArray = [self.faceModel.analysis.wuyanInfo.dottedPoints copy];
    for (int i = 0; i< 2; i++) {
        GMFaceCommonPositionModel *contentModel = dottedPointArray[i];
        GMImageView *lineImage1 = [GMImageView creatHorizontalDottedWithY:contentModel.y];
        lineImage1.centerX = self.view.centerX;
        lineImage1.alpha = 0;
        [UIView animateWithDuration:AnimationDuration1 animations:^{
            lineImage1.width = MAINSCREEN_WIDTH;
            lineImage1.alpha = 1;
            lineImage1.centerX = self.view.centerX;
        }];
        [self.view addSubview:lineImage1];
        [self.allViewLine addObject:lineImage1];
    }
    
    // 添加描述文字
    [self leftPopTitleWith:self.allViewLine AddSubtitle:subTitle Animation:0.5];
}


#pragma mark 第三个页面所有动画

- (void)drawThirdViewAnimation {
    NSArray *pointsLeft = self.faceModel.analysis.featureInfo.pointsLeft;    // 添加画脸的线
    NSArray *pointsRight = self.faceModel.analysis.featureInfo.pointsRight;
    NSArray *subTitle = self.faceModel.analysis.featureInfo.subTitle;       // 添加描述文字
    
    NSArray *subTitle1 = self.faceModel.analysis.niebuquankuanInfo.subTitle;
    NSArray *niebuPoints = self.faceModel.analysis.niebuquankuanInfo.niebuPoints;    // 添加画脸的线
    NSArray *quankuanPoints = self.faceModel.analysis.niebuquankuanInfo.quankuanPoints;
    NSArray *nbqkContentArray = self.faceModel.analysis.niebuquankuanInfo.content;
    
    // 画脸型折线条
    CALayer *layer = [self drawLineMethod:pointsLeft Color:Blue_line];
    [self.allViewLine addObject:layer];
    CALayer *layer1 = [self drawLineMethod:pointsRight Color:Blue_line];
    [self.allViewLine addObject:layer1];
    // 画竖线
    __weak typeof (self) weakSelf = self;
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(AnimationDuration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        if (weakSelf.stopGCD) { return ;}
        NSMutableArray *verticalLineArray = [NSMutableArray arrayWithObjects:pointsLeft[0],pointsLeft[1], nil];
        [verticalLineArray addObject:pointsRight.firstObject];
        [verticalLineArray addObject:pointsRight[1]];
        [verticalLineArray enumerateObjectsUsingBlock:^(NSArray * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
            GMFaceCommonPositionModel *pointModel = (GMFaceCommonPositionModel *)obj;
            GMImageView *lineImage = [GMImageView creatVerticalPathWithX:pointModel.x];
            lineImage.centerY = pointModel.y;
            [weakSelf.view addSubview:lineImage];
            [UIView animateWithDuration:AnimationDuration animations:^{
                lineImage.height = 70;
                lineImage.centerY = pointModel.y;
            }];
            // 保存数据
            [weakSelf.allViewLine addObject:lineImage];
        }];
        // 获取中心点坐标
        GMFaceCommonPositionModel *niebuCenterModel = [self calculateCenterModelWithArray:niebuPoints];
        GMFaceCommonPositionModel *quankuanCenterModel = [self calculateCenterModelWithArray:quankuanPoints];
        // 添加颞部新增横线
        NSArray<GMFaceCommonPositionModel *> *hArrry = @[niebuCenterModel,quankuanCenterModel];
        NSArray *widthArray = @[@(284),@(284)];
        [self drawSixhLine:hArrry widthArray:widthArray];
        // 展示比例
        GMFaceCommonContentModel *nbqkModel = nbqkContentArray[0];
        [self creatVerticalDottedLineWith:nbqkModel addArray:@[niebuCenterModel,quankuanCenterModel] offset:30];
    });
    // 颧弓宽度
    NSArray *contentArray = self.faceModel.analysis.featureInfo.content;
    GMFaceCommonPositionModel* leftPointModel0 = pointsLeft[0];
    GMFaceCommonPositionModel* leftPointModel1 = pointsLeft[1];
    GMFaceCommonPositionModel* rightPointModel0 = pointsRight[0];
    GMFaceCommonPositionModel* rightPointModel1 = pointsRight[1];
    GMFaceCommonContentModel *qgModel = contentArray[0];
    NSString *qgString = [NSString stringWithFormat:@"%@%@",qgModel.title,qgModel.value];
    CGSize qgSize = [qgString sizeWithAttributes:@{NSFontAttributeName:[UIFont gmFont:9]}];
    GMDrawDottedView *racDottedLine = [[GMDrawDottedView alloc] initWithLineType:drawViewTypeHorizontalDotted addlabel:wordPlaceCenter addDect:qgString];
    racDottedLine.alpha = 0.0;
    racDottedLine.backgroundColor = UIColor.clearColor;
    racDottedLine.frame = CGRectMake(leftPointModel0.x, leftPointModel0.y + 10, rightPointModel0.x - leftPointModel0.x, qgSize.height + 5);
    [self.view addSubview:racDottedLine];
    [self.allViewLine addObject:racDottedLine];
    
    // 下颌角宽度
    GMFaceCommonContentModel *xhjModel = contentArray[1];
    NSString *xhjString = [NSString stringWithFormat:@"%@%@",xhjModel.title,xhjModel.value];
    CGSize xhjSize = [xhjString sizeWithAttributes:@{NSFontAttributeName:[UIFont gmFont:9]}];
    GMDrawDottedView *xhjDottedLine = [[GMDrawDottedView alloc] initWithLineType:drawViewTypeHorizontalDotted addlabel:wordPlaceCenter addDect:xhjString];
    xhjDottedLine.alpha = 0.0;
    xhjDottedLine.backgroundColor = UIColor.clearColor;
    xhjDottedLine.frame = CGRectMake(leftPointModel1.x, leftPointModel1.y, rightPointModel1.x - leftPointModel1.x, xhjSize.height + 5);
    [self.view addSubview:xhjDottedLine];
    [self.allViewLine addObject:xhjDottedLine];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(AnimationDuration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        if (weakSelf.stopGCD) { return ;}
        [UIView animateWithDuration:AnimationDuration1 animations:^{
            racDottedLine.alpha = 1;
            xhjDottedLine.alpha = 1;
        }];
    });
    // 添加描述文字
    NSMutableArray *allsubTitle = [NSMutableArray arrayWithArray:subTitle];
    [allsubTitle addObjectsFromArray:subTitle1];
    [self leftPopTitleWith:self.allViewLine AddSubtitle:allsubTitle Animation:1.25];
}

// 计算两点之间的水平宽度
-(CGFloat)calculateWidthWithArray:(NSArray*)array{
    GMFaceCommonPositionModel *model0 = array[0];
    GMFaceCommonPositionModel *model1 = array[1];
    return model1.x  -  model0.x;
}

// 返回中心点model
-(GMFaceCommonPositionModel *)calculateCenterModelWithArray:(NSArray*)array{
    GMFaceCommonPositionModel *centerModel = [GMFaceCommonPositionModel new];
    GMFaceCommonPositionModel *model0 = array[0];
    GMFaceCommonPositionModel *model1 = array[1];
    centerModel.x = (model0.x + model1.x) / 2;
    centerModel.y = (model0.y + model1.y) / 2;
    return centerModel;
}


#pragma mark 第四个页面所有动画

- (void)drawFourViewAnimation {
    NSArray *triangleArray = self.faceModel.analysis.goldTriangleInfo.pointsTriangle;  // 获取黄金三角三个点
    NSArray *mouthArray = self.faceModel.analysis.goldTriangleInfo.pointsMouth;        // 获取嘴角两个点
    NSArray *subTitle = self.faceModel.analysis.goldTriangleInfo.subTitle;             // 添加描述文字
    NSArray *chinArray = self.faceModel.analysis.goldTriangleInfo.pointsChin;          // 获取下巴的三个点
    NSArray *contentArray = self.faceModel.analysis.goldTriangleInfo.content;          // 获取所有角度
    // 画下巴线条
    GMFaceCommonPositionModel *point0 = chinArray[1];           // 中心点
    GMFaceCommonPositionModel *point1 = chinArray.firstObject;  // 左侧点
    GMFaceCommonPositionModel *point2 = chinArray.lastObject;   // 右侧点
    // 延长线条
    CGPoint leftEndPoint = CGPointMake(point0.x - 2*(point0.x - point1.x), point0.y - 2*( point0.y - point1.y));
    CGPoint rightEndPoint = CGPointMake(point0.x + 2*(point2.x-point0.x), point0.y - 2*( point0.y - point2.y));
    GMFaceCommonPositionModel *leftModel = [GMFaceCommonPositionModel creatFaceCommonModelWithCGPoint:leftEndPoint];
    GMFaceCommonPositionModel *rightModel = [GMFaceCommonPositionModel creatFaceCommonModelWithCGPoint:rightEndPoint];
    // 添加下巴两天线
    CALayer *layer1 = [self drawLineMethod:@[point0,leftModel] Color:Blue_line];
    CALayer *layer2 = [self drawLineMethod:@[point0,rightModel] Color:Blue_line];
    [self.allViewLine addObject:layer1];
    [self.allViewLine addObject:layer2];
    // 添加下巴角度
    GMFaceCommonContentModel *lastContentModel = contentArray.lastObject;
    GMLabel *dectLabel1 = [self creatLabelWithText:lastContentModel.value Font:9 Color:UIColor.whiteColor Size:CGRectMake(point0.x - 30, point0.y - 20, 60, 15)];
    [self.allViewLine addObject:dectLabel1];
    //画黄金三角
    NSMutableArray *sanjiaoArray = [NSMutableArray arrayWithArray:triangleArray];
    [sanjiaoArray addObject:triangleArray.firstObject];
    CALayer *layer = [self drawLineMethod:sanjiaoArray Color:[UIColor whiteColor]];
    [self.allViewLine addObject:layer];
    // 画黄金三角文字
    [self creatFourWord:triangleArray addModel:contentArray.firstObject];
    
    __weak typeof (self) weakSelf = self;
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(AnimationDuration1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        if (weakSelf.stopGCD) { return ;}
        // 画四条横线
        NSMutableArray<GMFaceCommonPositionModel *> *lineArrayPoint = [NSMutableArray arrayWithObject:triangleArray[2]];
        [lineArrayPoint addObjectsFromArray:mouthArray];
        [lineArrayPoint addObject:chinArray[1]];
        NSArray *lineWidth = @[@(82),@(82),@(175),@(175)];
        [lineArrayPoint enumerateObjectsUsingBlock:^(GMFaceCommonPositionModel * _Nonnull point, NSUInteger idx, BOOL * _Nonnull stop) {
            GMImageView *lineImage = [GMImageView creatHorizontalPathWithY:point.y];
            lineImage.centerX = point.x;
            [weakSelf.view addSubview:lineImage];
            [UIView animateWithDuration:AnimationDuration animations:^{
                lineImage.width = [lineWidth[idx] floatValue];
                lineImage.centerX = point.x;
            }];
            [weakSelf.allViewLine addObject:lineImage];
        }];
        // 添加带箭头的文字描述
        GMFaceCommonPositionModel* linePointModel0 = lineArrayPoint[0];
        GMFaceCommonPositionModel* linePointModel1 = lineArrayPoint[1];
        GMFaceCommonPositionModel* linePointModel2 = lineArrayPoint[2];
        GMFaceCommonPositionModel* linePointModel3 = lineArrayPoint[3];
        // 人中长
        GMFaceCommonContentModel *rzcModel = contentArray[1];
        NSString *rzcString = [NSString stringWithFormat:@"%@%@",rzcModel.title,rzcModel.value];
        CGSize rzcStringSize = [rzcString sizeWithAttributes:@{NSFontAttributeName:[UIFont gmFont:9]}];
        GMDrawDottedView *racDottedLine = [[GMDrawDottedView alloc] initWithLineType:drawViewTypeVerticalDotted addlabel:wordPlaceRight addDect:rzcString];
        racDottedLine.backgroundColor = UIColor.clearColor;
        racDottedLine.alpha = 0;
        racDottedLine.frame = CGRectMake(linePointModel0.x + 30, linePointModel0.y, rzcStringSize.width + 10, linePointModel1.y - linePointModel0.y);
        [weakSelf.view addSubview:racDottedLine];
        [weakSelf.allViewLine addObject:racDottedLine];
        // 下巴长
        GMFaceCommonContentModel *xbcModel = contentArray[2];
        NSString *xbcString = [NSString stringWithFormat:@"%@%@",xbcModel.title,xbcModel.value];
        CGSize xbcStringSize = [xbcString sizeWithAttributes:@{NSFontAttributeName:[UIFont gmFont:9]}];
        
        GMDrawDottedView *xbcDottedLine = [[GMDrawDottedView alloc] initWithLineType:drawViewTypeVerticalDotted addlabel:wordPlaceRight addDect:xbcString];
        xbcDottedLine.backgroundColor = UIColor.clearColor;
        xbcDottedLine.alpha = 0;
        xbcDottedLine.frame = CGRectMake(linePointModel2.x + 45, linePointModel2.y, xbcStringSize.width + 10, linePointModel3.y - linePointModel2.y);
        [weakSelf.view addSubview:xbcDottedLine];
        [weakSelf.allViewLine addObject:xbcDottedLine];
        [UIView animateWithDuration:AnimationDuration1 animations:^{
            racDottedLine.alpha = 1.0;
            xbcDottedLine.alpha = 1.0;
        }];
    });
    // 添加描述文字
    [self leftPopTitleWith:self.allViewLine AddSubtitle:subTitle Animation:1.25];
    [self.allViewLine addObject:self.titleImageView];
}

// 处理第四个页面 面部分析黄金三角文字展示
-(void)creatFourWord:(NSArray *)triangleArray addModel:(GMFaceCommonContentModel *)model{
    GMFaceCommonPositionModel *triangleL = triangleArray[0];                   // 获取黄金三角最后一个点
    GMFaceCommonPositionModel *triangleR = triangleArray[1];                   // 获取黄金三角最后一个点
    GMFaceCommonPositionModel *triangleP = triangleArray[2];                   // 获取黄金三角最后一个点
    // 添加黄金三角文字
    NSString *title = [NSString stringWithFormat:@"%@\n%@",model.title,model.value];
    CGRect titleSize = CGRectMake(triangleP.x - 40, triangleP.y - 60, 80, 35);
    GMLabel *dectLabel0 = [self creatLabelWithText:title Font:9 Color:UIColor.whiteColor Size:titleSize];
    dectLabel0.numberOfLines = 2;
    dectLabel0.alpha = 0.0;
    [self.allViewLine addObject:dectLabel0];
    // 添加 L 文字
    CGRect LSize = CGRectMake(triangleL.x - 15, triangleL.y - 6, 12, 12);
    GMLabel *dectLabelL = [self creatLabelWithText:@"L" Font:12 Color:UIColor.whiteColor Size:LSize];
    dectLabelL.alpha = 0.0;
    [self.allViewLine addObject:dectLabelL];
    // 添加 R 文字
    CGRect RSize = CGRectMake(triangleR.x + 3, triangleR.y - 6, 12, 12);
    GMLabel *dectLabelR = [self creatLabelWithText:@"R" Font:12 Color:UIColor.whiteColor Size:RSize];
    dectLabelR.alpha = 0.0;
    [self.allViewLine addObject:dectLabelR];
    // 添加 P 文字
    CGRect PSize = CGRectMake(triangleP.x - 6, triangleP.y + 3, 12, 12);
    GMLabel *dectLabelP = [self creatLabelWithText:@"P" Font:12 Color:UIColor.whiteColor Size:PSize];
    dectLabelP.alpha = 0.0;
    [self.allViewLine addObject:dectLabelP];
    [UIView animateWithDuration:AnimationDuration1 animations:^{
        dectLabel0.alpha = 1.0;
        dectLabelL.alpha = 1.0;
        dectLabelR.alpha = 1.0;
        dectLabelP.alpha = 1.0;
    }];
}

#pragma mark 第五个页面 眉眼分析动画
// 第五个页面 眉眼分析界面
- (void)drawFiveViewAnimation {
    // 获取数据， 方便之后使用
    NSArray *contnetArray = self.faceModel.analysis.eyeEyebrowInfo.content;            // 描述文字数组
    NSArray *pointsEye = self.faceModel.analysis.eyeEyebrowInfo.pointsEye;             // 眼睛的点坐标
    NSArray *pointsEyeBrow = self.faceModel.analysis.eyeEyebrowInfo.pointsEyeBrow;     // 眉毛的点坐标
    NSArray *subTitle = self.faceModel.analysis.eyeEyebrowInfo.subTitle;               // 描述文字
    ALFaceRectModel *eyebrowRect = self.faceModel.analysis.eyeEyebrowInfo.eyebrowRect; // 眉毛矩形框
    ALFaceRectModel *eyeRect = self.faceModel.analysis.eyeEyebrowInfo.eyeRect;         // 眼睛矩形框
    GMFaceCommonPositionModel *ptriangle = self.faceModel.analysis.goldTriangleInfo.pointsTriangle[2]; // 获取P点坐标
    // 定义缩放比例
    CGFloat scale = 1.6;
    // 计算P点的新坐标
    GMFaceCommonPositionModel *newPoint = [GMFaceCommonPositionModel creatFaceCommonModelWithX:ptriangle.x *scale addY:ptriangle.y *scale];
    // 要平移到的最终位置
    GMFaceCommonPositionModel *finalPoint = [GMFaceCommonPositionModel creatFaceCommonModelWithX:MAINSCREEN_WIDTH addY:MAINSCREEN_HEIGHT * 0.70];
    // 计算便宜量
    CGFloat x = finalPoint.x  - newPoint.x;
    CGFloat y = finalPoint.y - newPoint.y;
    // 更改现在的位置
    [UIView animateWithDuration:AnimationDuration animations:^{
        self.picImageView.frame = CGRectMake(x, y, self.picImageView.frame.size.width * scale, self.picImageView.frame.size.height * scale);
    }];
    // 计算新的坐标点 并且多加了一个起始点
    __weak typeof (self) weakSelf = self;
    NSMutableArray *newPointsEyeBrow = [self bigImagePointWithScale:scale offsetX:x offsetY:y poinyArray:pointsEyeBrow];
    NSMutableArray *newPointsEye = [self bigImagePointWithScale:scale offsetX:x offsetY:y poinyArray:pointsEye];
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(AnimationDuration * 2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        if (weakSelf.stopGCD) { return ;}
        // 画眉毛
        [newPointsEyeBrow addObject:newPointsEyeBrow.firstObject];
        CALayer *eyeBrowlayer = [weakSelf drawLineMethod:[newPointsEyeBrow copy] Color:Blue_line];
        [weakSelf.allViewLine addObject:eyeBrowlayer];
        // 画眼睛
        [newPointsEye addObject:newPointsEye.firstObject];
        CALayer *eyelayer = [weakSelf drawLineMethod:[newPointsEye copy] Color:Blue_line];
        [weakSelf.allViewLine addObject:eyelayer];
    });
    //  原始坐标点
    NSArray *eyebrowMidlePoint = [self midlePointWithModel:eyebrowRect];
    NSArray *eyeMidlePoint = [self midlePointWithModel:eyeRect];          //  点坐标
    // 计算新点的坐标
    NSArray *eyebrowNewPoint = [self bigImagePointWithScale:scale offsetX:x offsetY:y poinyArray:eyebrowMidlePoint];
    NSArray *eyeNewPoint = [self bigImagePointWithScale:scale offsetX:x offsetY:y poinyArray:eyeMidlePoint];
    // 画竖线
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(AnimationDuration * 3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        if (weakSelf.stopGCD) { return ;}
        [weakSelf fiveViewdrawlineWithEye:eyeNewPoint eyebrow:eyebrowNewPoint];
    });
    // 画虚线
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(AnimationDuration * 4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        if (weakSelf.stopGCD) { return ;}
        [weakSelf fiveViewdrawDottodlineWithEye:eyeNewPoint eyebrow:eyebrowNewPoint modelAry:contnetArray];
    });
    // 添加描述文字
    [self leftPopTitleWith:self.allViewLine AddSubtitle:subTitle Animation:2.5];
}

- (void)fiveViewdrawlineWithEye:(NSArray<GMFaceCommonPositionModel *> *)eyeNewPoint eyebrow:(NSArray<GMFaceCommonPositionModel *> *)eyebrowNewPoint {
    NSArray *HLinePointArray = @[eyebrowNewPoint[1],eyebrowNewPoint[3],eyeNewPoint[1],eyeNewPoint[3]];
    NSArray *VLinePointArray = @[eyebrowNewPoint[0],eyebrowNewPoint[2],eyeNewPoint[0],eyeNewPoint[2]];
    // 获取矩形框的宽和高
    CGSize eyebrowSize = [self getWidthAddHightWithRect:eyebrowNewPoint];
    CGSize eyeSize = [self getWidthAddHightWithRect:eyeNewPoint];
    // 画四条横线
    NSArray *widthArray = @[@(eyebrowSize.width),@(eyebrowSize.width),@(eyeSize.width),@(eyeSize.width)];
    [HLinePointArray enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        GMFaceCommonPositionModel *model = (GMFaceCommonPositionModel *)obj;
        GMImageView *himageView = [GMImageView creatHorizontalPathWithY:model.y];
        himageView.centerX = model.x;
        himageView.alpha = 0;
        [UIView animateWithDuration:AnimationDuration animations:^{
            himageView.width = [widthArray[idx] floatValue] + 30;
            himageView.alpha = 1;
            himageView.centerX = model.x;
        }];
        [self.view addSubview:himageView];
        [self.allViewLine addObject:himageView];
    }];
    // 画四条竖线
    NSArray *hightArray = @[@(eyebrowSize.height),@(eyebrowSize.height),@(eyeSize.height),@(eyeSize.height)];
    [VLinePointArray enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        GMFaceCommonPositionModel *model = (GMFaceCommonPositionModel *)obj;
        GMImageView *vimageView = [GMImageView creatVerticalPathWithX:model.x];
        vimageView.centerY = model.y;
        [self.view addSubview:vimageView];
        [UIView animateWithDuration:AnimationDuration animations:^{
            vimageView.height = [hightArray[idx] floatValue] + 30;;
            vimageView.centerY =  model.y;
        }];
        [self.allViewLine addObject:vimageView];
    }];
}

// 画五个页面的四条虚线
-(void)fiveViewdrawDottodlineWithEye:(NSArray<GMFaceCommonPositionModel *> *)eyeArray eyebrow:(NSArray<GMFaceCommonPositionModel *> *)eyebroArray modelAry:(NSArray *)modelAry {
    ALFaceRectModel *eye = [ALFaceRectModel creatRectModelWithTop:eyeArray[1].y right:eyeArray[2].x left:eyeArray[0].x bottom:eyeArray[3].y];
    ALFaceRectModel *eyebrow = [ALFaceRectModel creatRectModelWithTop:eyebroArray[1].y right:eyebroArray[2].x left:eyebroArray[0].x bottom:eyebroArray[3].y];
    // 画虚线框
    NSArray *type = @[@(0),@(1),@(0),@(1)];
    NSArray *pleac = @[@(wordPlaceLeft),@(wordPlaceTop),@(wordPlaceRight),@(wordPlaceBottom)];
    for (int i = 0; i < modelAry.count; i++ ) {
        GMFaceCommonContentModel *model = modelAry[i];
        NSString *dect = [NSString stringWithFormat:@"%@\n%@",model.title,model.value];
        CGSize dectSize = [dect sizeWithAttributes:@{NSFontAttributeName:[UIFont gmFont:9]}];
        // 文字在中间
        GMDrawDottedView *drawHView = [[GMDrawDottedView alloc] initWithLineType:[type[i] intValue]  addlabel:[pleac[i] intValue] addDect:dect];
        drawHView.backgroundColor = [UIColor clearColor];
        CGRect frame;
        if (i == 0) {
            frame = CGRectMake(eyebrow.left - dectSize.width - 15, eyebrow.top, dectSize.width + 10, eyebrow.bottom - eyebrow.top);
        }else if (i == 1) {
            frame = CGRectMake(eyebrow.left, eyebrow.top - dectSize.height - 15, eyebrow.right - eyebrow.left, dectSize.height + 10);
        }else if (i == 2){
            frame = CGRectMake(eye.right + 5, eye.top, dectSize.width + 10, eye.bottom -eye.top);
        }else{
            frame = CGRectMake(eye.left, eye.bottom + 5, eye.right - eye.left, dectSize.height + 10);
        }
        drawHView.frame = frame;
        drawHView.alpha = 0;
        [self.view addSubview:drawHView];
        [UIView animateWithDuration:AnimationDuration animations:^{
            drawHView.alpha = 1;
        }];
        [self.allViewLine addObject:drawHView];
    }
}

#pragma mark  新添加页面动画
- (void)drawAddNewAnimation {
    // 人中、嘴唇
    NSArray *contnetArray = self.faceModel.analysis.renzhongzuichunkediInfo.content;
    NSArray *subTitle = self.faceModel.analysis.renzhongzuichunkediInfo.subTitle;
    NSArray *renzhongPoints = self.faceModel.analysis.renzhongzuichunkediInfo.renzhongPoints;
    NSArray *zuichunPoints = self.faceModel.analysis.renzhongzuichunkediInfo.zuichunPoints;
    NSArray *kediPoints = self.faceModel.analysis.renzhongzuichunkediInfo.kediPoints;
    // 瞳距鼻翼宽比
    NSArray *tjbContnetArray = self.faceModel.analysis.tongjubiyiInfo.content;
    NSArray *tjbSubTitle = self.faceModel.analysis.tongjubiyiInfo.subTitle;
    NSArray *tongjuPoints = self.faceModel.analysis.tongjubiyiInfo.tongjuPoints;
    NSArray *biyiPoints = self.faceModel.analysis.tongjubiyiInfo.biyiPoints;
    // 获取中心点
    GMFaceCommonPositionModel *tongjuCenterPoints = [self calculateCenterModelWithArray:tongjuPoints];
    GMFaceCommonPositionModel *biyiCenterModel = [self calculateCenterModelWithArray:biyiPoints];
    // 鼻翼宽度
    CGFloat tongjuWidth = [self calculateWidthWithArray:tongjuPoints];
    CGFloat biyiWidth = [self calculateWidthWithArray:biyiPoints];
    // 添加横线
    NSArray<GMFaceCommonPositionModel *> *hArrry = @[tongjuCenterPoints,biyiCenterModel,renzhongPoints[0],renzhongPoints[1],zuichunPoints[1],kediPoints[1]];
    NSArray *widthArray = @[@(tongjuWidth),@(biyiWidth),@(100),@(100),@(100),@(100)];
    [self drawSixhLine:hArrry widthArray:widthArray];
    // 画中间的描述文字
    [self creatVerticalDottedLineWith:tjbContnetArray[0] addArray:@[tongjuCenterPoints,biyiCenterModel]offset:0];
    [self creatVerticalDottedLineWith:contnetArray[0] addArray:renzhongPoints offset:0];
    [self creatVerticalDottedLineWith:contnetArray[1] addArray:zuichunPoints offset:30];
    [self creatVerticalDottedLineWith:contnetArray[2] addArray:kediPoints offset:-20];
    // 添加描述文字
    NSMutableArray *allsubTitle = [NSMutableArray arrayWithArray:tjbSubTitle];
    [allsubTitle addObjectsFromArray:subTitle];
    // 添加描述文字
    [self leftPopTitleWith:self.allViewLine AddSubtitle:allsubTitle Animation:1.25];
}

// 面孔起源 结束动画
- (void)drawGeneMemoryEndAnimation {
    self.stopGCD = YES;
    [self.geneEndBgImageView addSubview:self.geneEndImageView];
    [self.view addSubview:self.geneEndBgImageView];
    NSString *path = [[NSBundle mainBundle] pathForResource:@"gene_end_webp_loading" ofType:@"webp"];
    NSData *data = [[NSData alloc] initWithContentsOfFile:path];
    UIImage *img = [UIImage sd_imageWithData:data];
    self.geneEndImageView.image = img;
    [self performSelector:@selector(ignoreMethod) withObject:nil afterDelay:2.1];
}

/**
 // 创建竖线 文字在右侧

 @param contentModel 描述文字
 @param pointArray 画线的点位传两个点过来
 */
-(void)creatVerticalDottedLineWith:(GMFaceCommonContentModel *)contentModel addArray:(NSArray *)pointArray offset:(CGFloat)offset{
    GMFaceCommonPositionModel *model0 = pointArray[0];
    GMFaceCommonPositionModel *model1 = pointArray[1];
    NSString *nbqkString = [NSString stringWithFormat:@"%@%@",contentModel.title,contentModel.value];
    CGSize nbqkStringSize = [nbqkString sizeWithAttributes:@{NSFontAttributeName:[UIFont gmFont:9]}];
    GMDrawDottedView *nbqkDottedLine = [[GMDrawDottedView alloc] initWithLineType:drawViewTypeVerticalDotted addlabel:wordPlaceRight addDect:nbqkString];
    nbqkDottedLine.backgroundColor = UIColor.clearColor;
    nbqkDottedLine.alpha = 0;
    nbqkDottedLine.frame = CGRectMake(model0.x + offset, model0.y, nbqkStringSize.width + 10, model1.y - model0.y);
    [self.view addSubview:nbqkDottedLine];
    [self.allViewLine addObject:nbqkDottedLine];
    [UIView animateWithDuration:AnimationDuration animations:^{
        nbqkDottedLine.alpha = 1;
    }];
}

#pragma mark 第六个页面 眉眼分析动画

- (void)drawSixViewAnimation {
    NSArray *contnetArray = self.faceModel.analysis.mouthNoseInfo.content;
    NSArray *subTitle = self.faceModel.analysis.mouthNoseInfo.subTitle;
    NSArray *pointsNose = self.faceModel.analysis.mouthNoseInfo.pointsNose;
    NSArray *pointsMouth = self.faceModel.analysis.mouthNoseInfo.pointsMouth;
    ALFaceRectModel *mouthRect = self.faceModel.analysis.mouthNoseInfo.mouthRect;
    NSArray *contentCxian = self.faceModel.analysis.shuangCxianInfo.content;
    NSArray *subTitleCxian = self.faceModel.analysis.shuangCxianInfo.subTitle;
    NSArray *pointListCxian = self.faceModel.analysis.shuangCxianInfo.pointList;
    // 画嘴角线条
    for (GMFacePointsMouthInfoModel *mouthModel in pointsMouth) {
        CALayer *eyeBrowlayer = [self drawLineMethod:mouthModel.points Color:Blue_line];
        [self.allViewLine addObject:eyeBrowlayer];
    }
    // 画双C线
    CALayer *cxianlayer = [self drawLineMethod:pointListCxian Color:Blue_line];
    [self.allViewLine addObject:cxianlayer];
    
    NSArray<GMFaceCommonPositionModel *> *rectArray = [self midlePointWithModel:mouthRect];
    GMFaceCommonPositionModel* model0 = rectArray[0];
    GMFaceCommonPositionModel* model1 = rectArray[1];
    GMFaceCommonPositionModel* model2 = rectArray[2];
    GMFaceCommonPositionModel* model3 = rectArray[3];
    __weak typeof (self) weakSelf = self;
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(AnimationDuration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        if (weakSelf.stopGCD) { return ;}
        // 添加Cxian文字
        GMFaceCommonPositionModel *positionModel = pointListCxian[1];
        CGRect cxianSize = CGRectMake(positionModel.x + 10, positionModel.y - 15, 100, 45);
        GMFaceCommonContentModel *cxianContentModel = contentCxian[0];
        GMLabel *dectLabelCxian = [self creatLabelWithText:[NSString stringWithFormat:@"%@\n%@",cxianContentModel.title,cxianContentModel.value] Font:9 Color:UIColor.whiteColor Size:cxianSize];
        dectLabelCxian.alpha = 0.0;
        dectLabelCxian.numberOfLines = 2;
        dectLabelCxian.textAlignment = NSTextAlignmentLeft;
        [self.allViewLine addObject:dectLabelCxian];
        [UIView animateWithDuration:AnimationDuration1 animations:^{
            dectLabelCxian.alpha = 1.0;
        }];
        
        // 获取矩形框宽高
        CGSize rectSize = [weakSelf getWidthAddHightWithRect:rectArray];
        // 画四条竖线
        NSArray<GMFaceCommonPositionModel *> *verticalArrry = @[pointsNose[0],pointsNose[1],rectArray[0],rectArray[2]];
        NSArray *hightArray = @[@(77),@(77),@(rectSize.height + 30),@(rectSize.height + 30)];
        [weakSelf drawSixVerticalLine:verticalArrry hightArray:hightArray];
        
        // 画三条横线
        NSArray *realLine = weakSelf.faceModel.analysis.santingInfo.realLinePoints;
        NSArray<GMFaceCommonPositionModel *> *hArrry = @[realLine[1],rectArray[1],rectArray[3]];
        NSArray *widthArray = @[@(115),@(rectSize.width + 30),@(rectSize.width + 30)];
        [weakSelf drawSixhLine:hArrry widthArray:widthArray];
        
        // 画带箭头的线条
        [weakSelf drawDottodLineWithPointArray:pointsNose content:contnetArray[0] type:drawViewTypeHorizontalDotted place:wordPlaceTop];
        
        GMFaceCommonPositionModel* newModel0 = model1;
        newModel0.x = model2.x;
        NSArray *rightArray = @[newModel0, model3];
        [weakSelf drawDottodLineWithPointArray:rightArray content:contnetArray[1] type:drawViewTypeVerticalDotted place:wordPlaceRight];
        
        GMFaceCommonPositionModel* newModel1 = model0;
        newModel1.y = model3.y + 15;
        NSArray *bootmArray = @[newModel1, model2];
        [weakSelf drawDottodLineWithPointArray:bootmArray content:contnetArray[2] type:drawViewTypeHorizontalDotted place:wordPlaceBottom];
    });
    // 添加描述文字
    NSMutableArray *allsubTitle = [NSMutableArray arrayWithArray:subTitle];
    [allsubTitle addObjectsFromArray:subTitleCxian];
    // 添加描述文字
    [self leftPopTitleWith:self.allViewLine AddSubtitle:allsubTitle Animation:1.25];
}

- (void)drawDottodLineWithPointArray:(NSArray<GMFaceCommonPositionModel *> *)pointArray content:(GMFaceCommonContentModel *)contentModel type:(GMLineType)lineType place:(GMWordPlace)place {
    NSString *dect = [NSString stringWithFormat:@"%@\n%@",contentModel.title,contentModel.value];
    CGSize dectSize = [dect sizeWithAttributes:@{NSFontAttributeName:[UIFont gmFont:9]}];
    GMDrawDottedView *drawHView = [[GMDrawDottedView alloc] initWithLineType:lineType addlabel:place addDect:dect];
    drawHView.backgroundColor = [UIColor clearColor];
    CGRect frame;
    if (lineType == drawViewTypeHorizontalDotted) {
        if (place == wordPlaceTop) {
            frame = CGRectMake(pointArray[0].x, (pointArray[0].y - dectSize.height - 10),pointArray[1].x - pointArray[0].x, dectSize.height + 10);
        }else{
            frame = CGRectMake(pointArray[0].x, (pointArray[0].y - 10),pointArray[1].x - pointArray[0].x, dectSize.height + 10);
        }
    }else{
        frame = CGRectMake(pointArray[0].x + 5, pointArray[0].y, dectSize.width + 10, pointArray[1].y - pointArray[0].y);
    }
    drawHView.frame = frame;
    drawHView.alpha = 0;
    [self.view addSubview:drawHView];
    [UIView animateWithDuration:AnimationDuration1 animations:^{
        drawHView.alpha = 1;
    }];
    [self.allViewLine addObject:drawHView];
}

// 画横线
- (void)drawSixhLine:(NSArray<GMFaceCommonPositionModel *> *)pointXArray widthArray:(NSArray<NSNumber *> *)widthArray{
    for (int i = 0; i < pointXArray.count; i++) {
        GMFaceCommonPositionModel *model = pointXArray[i];
        GMImageView *vimageView = [GMImageView creatHorizontalPathWithY:model.y];
        vimageView.centerX = model.x;
        [self.view addSubview:vimageView];
        [UIView animateWithDuration:AnimationDuration animations:^{
            vimageView.width = [widthArray[i] floatValue];
            vimageView.centerX = model.x;
        }];
        [self.allViewLine addObject:vimageView];
    }
}

- (void)drawSixVerticalLine:(NSArray<GMFaceCommonPositionModel *> *)pointXArray hightArray:(NSArray<NSNumber *> *)hightArray{
    for (int i = 0; i < pointXArray.count; i++) {
        GMFaceCommonPositionModel *model = pointXArray[i];
        GMImageView *vimageView = [GMImageView creatVerticalPathWithX:model.x];
        vimageView.centerY = model.y;
        [self.view addSubview:vimageView];
        [UIView animateWithDuration:AnimationDuration animations:^{
            vimageView.height = [hightArray[i] floatValue];
            vimageView.centerY =  model.y;
        }];
        [self.allViewLine addObject:vimageView];
    }
}

#pragma mark 辅助方法

// 展示分析图片
- (void)addTitleImageView:(NSString *)imageName {
    self.titleImageView = [[GMImageView alloc] initWithImage:[UIImage imageNamed:imageName]];
    _titleImageView.contentMode = UIViewContentModeScaleAspectFit;
    _titleImageView.frame = CGRectMake(15, -55, 248, 55);
    [UIView animateWithDuration:AnimationDuration animations:^{
        _titleImageView.transform = CGAffineTransformMakeTranslation(0, [OCNavigationBar barHeight] + 71);
    }];
    [self.view addSubview:_titleImageView];
}

// 计算中心点坐标
-(NSArray *)midlePointWithModel:(ALFaceRectModel *)model{
    GMFaceCommonPositionModel *midleLeft = [GMFaceCommonPositionModel creatFaceCommonModelWithX:model.left addY:(model.bottom - model.top) / 2 + model.top];
    GMFaceCommonPositionModel *midleTop = [GMFaceCommonPositionModel creatFaceCommonModelWithX:(model.right - model.left) / 2 + model.left addY:model.top];
    GMFaceCommonPositionModel *midleRight = [GMFaceCommonPositionModel creatFaceCommonModelWithX:model.right addY:(model.bottom - model.top) / 2 + model.top];
    GMFaceCommonPositionModel *midleBottom = [GMFaceCommonPositionModel creatFaceCommonModelWithX:(model.right - model.left) / 2 + model.left addY:model.bottom];
    return [NSArray arrayWithObjects:midleLeft,midleTop,midleRight,midleBottom, nil];
}

// 计算放大后的点位置
-(NSMutableArray *)bigImagePointWithScale:(CGFloat)scale offsetX:(CGFloat)offsetX offsetY:(CGFloat)offsetY poinyArray:(NSArray *)pointArray{
    NSMutableArray *newPointArray = [NSMutableArray array];
    [pointArray enumerateObjectsUsingBlock:^(id  _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
        GMFaceCommonPositionModel *point = (GMFaceCommonPositionModel *)obj;
        GMFaceCommonPositionModel *newPoint = [GMFaceCommonPositionModel new];
        newPoint.x = point.x * scale + offsetX;
        newPoint.y = point.y * scale + offsetY;
        [newPointArray addObject:newPoint];
    }];
    return newPointArray;
}

// 更新背景图片的尺寸
- (void)updatePicImageViewframeP {
    [UIView animateWithDuration:AnimationDuration animations:^{
        self.picImageView.frame = self.view.frame;
    }];
}

// 创建描述文字
- (GMLabel *)creatLabelWithText:(NSString *)text Font:(CGFloat)font Color:(UIColor *)color Size:(CGRect)frame {
    GMLabel *label = [GMLabel labelWithTextAlignment:NSTextAlignmentCenter backgroundColor:UIColor.clearColor textColor:color fontSize:font];
    label.shadowColor = [UIColor colorWithHexString:@"000000" alpha:0.3];
    label.shadowOffset = CGSizeMake(0, 1);
    label.layer.shadowRadius = 0.5;
    label.frame = frame;
    label.text = text;
    [self.view addSubview:label];
    return label;
}

// 给一个矩形框，返回一个宽和高
- (CGSize)getWidthAddHightWithRect:(NSArray<GMFaceCommonPositionModel *> *)rectArray{
    NSAssert(rectArray.count == 4, @"这个数组必须传过来四个点");
    CGFloat rectWidth = rectArray[2].x - rectArray[0].x;
    CGFloat recthight = rectArray[3].y - rectArray[1].y;
    return CGSizeMake(rectWidth, recthight);
}

// 清除页面上的线条
- (void)clearFristViewLineView {
    for (id viewOrLayer in self.allViewLine) {
        if ([viewOrLayer isKindOfClass:[UIView class]]) {
            UIView *view = (UIView *)viewOrLayer;
            [UIView animateWithDuration:AnimationDuration animations:^{
                view.alpha = 0;
            } completion:^(BOOL finished) {
                [view removeAllSubviews];
            }];
        }else if([viewOrLayer isKindOfClass:[CALayer class]]){
            CALayer *layer = (CALayer *)viewOrLayer;
            [CATransaction begin];
            [CATransaction setAnimationDuration:AnimationDuration];
            layer.opacity = 0.0;
            [CATransaction commit];
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(AnimationDuration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                [layer removeFromSuperlayer];
            });
        }
    }
}

// 画线
- (CAShapeLayer *)drawLineMethod:(NSArray<GMFaceCommonPositionModel *>*)positionModelArray Color:(UIColor *)color{
    UIBezierPath *path = [UIBezierPath bezierPath];
    [positionModelArray enumerateObjectsUsingBlock:^(GMFaceCommonPositionModel *value, NSUInteger idx, BOOL * _Nonnull stop) {
        GMFaceCommonPositionModel *pointModel = value;
        if (idx == 0) {
            [path moveToPoint:CGPointMake(pointModel.x, pointModel.y)];
        }else {
            [path addLineToPoint:CGPointMake(pointModel.x, pointModel.y)];
        }
    }];
    // 创建CAShapeLayer
    CAShapeLayer *layer = [CAShapeLayer layer];
    layer.lineWidth = 1.0f;
    layer.fillColor = [UIColor clearColor].CGColor;
    layer.strokeColor = color.CGColor;
    [self.view.layer addSublayer:layer];
    layer.path = path.CGPath;
    // 创建Animation
    CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
    animation.fromValue = @(0.0);
    animation.toValue = @(1.0);
    layer.autoreverses = NO;
    animation.duration = 0.75f;
    //     设置layer的animation
    [layer addAnimation:animation forKey:nil];
    return layer;
}


#pragma mark 左侧弹出的描述-方法封装

- (void)leftPopTitleWith:(NSMutableArray *)viewLineArray AddSubtitle:(NSArray *)subTitle Animation:(CGFloat)duration{
    __weak typeof (self) weakSelf = self;
    for (int i = 0; i < subTitle.count; i++) {
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)((duration + 0.25 * i) *  NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            if (weakSelf.stopGCD) { return ;}
            GMFaceCommonSubtitleModel *subTitleModel = subTitle[i];
            CGFloat sumHight = TitleToTopHight;
            for (int j = 0; j < i; j ++) {
                GMFaceCommonSubtitleModel *titleModel = subTitle[j];
                sumHight += titleModel.hight + 20;
            }
            GMTitleView *tView = [weakSelf addDectTitleNameWithModel:subTitleModel viewFrame:CGRectMake(-120, sumHight, 120, subTitleModel.hight)];
            [viewLineArray addObject:tView];
        });
    }
}

// 添加描述文字
- (GMTitleView *)addDectTitleNameWithModel:(GMFaceCommonSubtitleModel *)tempModel viewFrame:(CGRect)frame {
    GMTitleView *tView = [[GMTitleView alloc] initWithModel:tempModel];
    tView.alpha = 0;
    tView.backgroundColor = [UIColor clearColor];
    tView.frame = frame;
    [self.view addSubview:tView];
    [UIView animateWithDuration:AnimationDuration animations:^{
        tView.transform = CGAffineTransformMakeTranslation(135, 0);
        tView.alpha = 1;
    }];
    return tView;
}


#pragma mark 创建返回和跳过按钮， 及处理逻辑。

- (GMButton *)backBtn {
    if (!_backBtn) {
        _backBtn = [GMButton buttonWithType:(UIButtonTypeCustom)];
        _backBtn.enableAdaptive = YES;
        _backBtn.alpha = 1.0;
        [_backBtn setImage:[UIImage imageNamed:@"NewFaceBack"] forState:UIControlStateNormal];
        [_backBtn addTarget:self action:@selector(backMethod) forControlEvents:(UIControlEventTouchUpInside)];
    }
    return _backBtn;
}

- (GMButton *)ignoreBtn {
    if (!_ignoreBtn) {
        _ignoreBtn = [GMButton buttonWithType:(UIButtonTypeCustom)];
        _ignoreBtn.enableAdaptive = YES;
        _ignoreBtn.alpha = 1.0;
        [_ignoreBtn setTitle:@"跳过" forState:(UIControlStateNormal)];
        [_ignoreBtn.titleLabel setFont:[UIFont gmFont:14]];
        [_ignoreBtn setTitleColor:UIColor.whiteColor forState:(UIControlStateNormal)];
        [_ignoreBtn addTarget:self action:@selector(ignoreMethod) forControlEvents:(UIControlEventTouchUpInside)];
    }
    return _ignoreBtn;
}

- (GMImageView *)geneEndBgImageView {
    if (!_geneEndBgImageView) {
        _geneEndBgImageView = [[GMImageView alloc] initWithImage:[UIImage imageNamed:@"gene_end_bj_webp_loading@3x"]];
        _geneEndBgImageView.contentMode = UIViewContentModeScaleToFill;
        _geneEndBgImageView.frame = CGRectMake(0, 0, MAINSCREEN_WIDTH, MAINSCREEN_HEIGHT);
    }
    return _geneEndBgImageView;
}

- (SDAnimatedImageView *)geneEndImageView {
    if (!_geneEndImageView) {
        _geneEndImageView = [[SDAnimatedImageView alloc] init];
        _geneEndImageView.contentMode = UIViewContentModeScaleAspectFit;
        _geneEndImageView.runLoopMode = NSDefaultRunLoopMode;
        _geneEndImageView.frame = CGRectMake(0, 0, MAINSCREEN_WIDTH, MAINSCREEN_HEIGHT);
    }
    return _geneEndImageView;
}

- (void)backMethod {
    // 返回到具体页面
    self.stopGCD = YES;
    BOOL isPop = YES;
//    for (UIViewController *vc in AppDelegate.navigation.childViewControllers) {
//        if ([vc isKindOfClass:[NewFaceShotController class]]){
//            isPop = NO;
//            [AppDelegate.navigation popToViewController:vc animated:YES];
//            return;
//        }
//    }
//    if (isPop) {
//        [AppDelegate.navigation popToRootViewControllerAnimated:YES];
//    }
}

- (void)ignoreMethod {
    self.stopGCD = YES;
    [Phobos track:@"on_click_button" attributes:@{@"page_name":SafeString(self.pageName),
                                                  @"button_name":SafeString(@"skip")}];
    if (self.isGene) { // 面孔起源
        [[GMRouter sharedInstance] pushScheme:@"gengmei://gene_memory_result"];
//        GMGeneMemoryResultViewController *vc = [[GMGeneMemoryResultViewController alloc] init];
//        [AppDelegate.navigation pushViewController:vc animated:YES];
    } else {
//        GMFaceInfoShareViewController *vc = [[GMFaceInfoShareViewController alloc] init];
//        vc.faceModel = self.faceModel;
//        [AppDelegate.navigation pushViewController:vc animated:YES];
//        [[GMRouter sharedInstance] pushScheme:[NSString stringWithFormat:@"gengmei://?face_model"]];
        [[GMRouter sharedInstance] pushScheme:@"gengmei://face_info_share"];

    }
}

-(NSMutableArray *)allViewLine{
    if (!_allViewLine) {
        _allViewLine = [NSMutableArray array];
    }
    return _allViewLine;
}

-(void)dealloc{
    NSLog(@"%s", __func__);
}

@end
