import * as commonModule from './common';
export class RadRadialGauge extends commonModule.RadRadialGauge {
    constructor() {
        super();
        this._ios = TKRadialGauge.alloc().init();
    }
    createNativeView() {
        return this._nativeView;
    }
    get _nativeView() {
        return this._ios;
    }
    get nativeObject() {
        return this._ios;
    }
}
////////////// TITLE STYLE
export class TitleStyle extends commonModule.TitleStyle {
    _onTextSizePropertyChanged(oldValue, newValue) {
        if (this.shouldUpdateNativeObject()) {
            this.owner._nativeView.labelTitle.font = UIFont.systemFontOfSize(newValue);
        }
    }
    _onTextColorPropertyChanged(oldValue, newValue) {
        if (this.shouldUpdateNativeObject() && newValue) {
            this.owner._nativeView.labelTitle.textColor = newValue.ios;
        }
    }
    _onHorizontalOffsetPropertyChanged(oldValue, newValue) {
        if (this.shouldUpdateNativeObject()) {
            this.owner._nativeView.labelTitleOffset = CGPointMake(newValue, this.owner._nativeView.labelTitleOffset.y);
        }
    }
    _onVerticalOffsetPropertyChanged(oldValue, newValue) {
        if (this.shouldUpdateNativeObject()) {
            this.owner._nativeView.labelTitleOffset = CGPointMake(this.owner._nativeView.labelTitleOffset.x, newValue);
        }
    }
}
/////////////// SUBTITLE STYLE
export class SubtitleStyle extends commonModule.SubtitleStyle {
    _onTextSizePropertyChanged(oldValue, newValue) {
        if (this.shouldUpdateNativeObject()) {
            this.owner._nativeView.labelSubtitle.font = UIFont.systemFontOfSize(newValue);
        }
    }
    _onTextColorPropertyChanged(oldValue, newValue) {
        if (this.shouldUpdateNativeObject() && newValue) {
            this.owner._nativeView.labelSubtitle.textColor = newValue.ios;
        }
    }
    _onHorizontalOffsetPropertyChanged(oldValue, newValue) {
        if (this.shouldUpdateNativeObject()) {
            this.owner._nativeView.labelSubtitleOffset = CGPointMake(newValue, this.owner._nativeView.labelSubtitleOffset.y);
        }
    }
    _onVerticalOffsetPropertyChanged(oldValue, newValue) {
        if (this.shouldUpdateNativeObject()) {
            this.owner._nativeView.labelSubtitleOffset = CGPointMake(this.owner._nativeView.labelSubtitleOffset.x, newValue);
        }
    }
}
////////////////// SCALES
export class RadialScale extends commonModule.RadialScale {
    constructor() {
        super();
        this._ios = TKGaugeRadialScale.alloc().init();
    }
    get ios() {
        return this._ios;
    }
    get _nativeView() {
        return this._ios;
    }
    get nativeObject() {
        return this._ios;
    }
    _onStartAnglePropertyChanged(oldValue, newValue) {
        if (!this.ios) {
            return;
        }
        this.ios.startAngle = this.degreesToRadians(newValue);
        if (this.sweepAngle) {
            this.ios.endAngle = this.degreesToRadians(newValue + this.sweepAngle);
        }
    }
    _onSweepAnglePropertyChanged(oldValue, newValue) {
        if (!this.ios) {
            return;
        }
        this.ios.endAngle = this.degreesToRadians(newValue + this.startAngle);
    }
    _onRadiusPropertyChanged(oldValue, newValue) {
        if (!this.ios) {
            return;
        }
        this.ios.radius = newValue;
    }
    degreesToRadians(degrees) {
        return (degrees * Math.PI) / 180;
    }
}
/////////////////////// SCALE STYLES
export class ScaleStyle extends commonModule.ScaleStyle {
    _onLineColorPropertyChanged(oldValue, newValue) {
        if (!this.owner || !newValue) {
            return;
        }
        this.owner.ios.stroke = TKStroke.strokeWithColorWidth(newValue.ios, this.owner.ios.stroke.width);
        this.owner.ios.setNeedsDisplay();
    }
    _onLineThicknessPropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        this.owner.ios.stroke = TKStroke.strokeWithColorWidth(this.owner.ios.stroke.color, newValue);
        this.owner.ios.setNeedsDisplay();
    }
    _onTicksVisiblePropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        this.owner.ios.ticks.hidden = !newValue;
        this.owner.ios.setNeedsDisplay();
    }
    _onMajorTicksCountPropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        this.owner.ios.ticks.majorTicksCount = newValue;
        this.owner.ios.setNeedsDisplay();
    }
    _onMinorTicksCountPropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        this.owner.ios.ticks.minorTicksCount = newValue;
        this.owner.ios.setNeedsDisplay();
    }
    _onТicksOffsetPropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        this.owner.ios.ticks.offset = newValue;
        this.owner.ios.setNeedsDisplay();
    }
    _onTicksLayoutModePropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        if (newValue === commonModule.GaugeScaleLayoutMode.Inner) {
            this.owner.ios.ticks.position = 0 /* TKGaugeTicksPosition.Inner */;
        }
        else if (newValue === commonModule.GaugeScaleLayoutMode.Outer) {
            this.owner.ios.ticks.position = 1 /* TKGaugeTicksPosition.Outer */;
        }
        this.owner.ios.setNeedsDisplay();
    }
    _onMajorTicksWidthPropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        this.owner.ios.ticks.majorTicksWidth = newValue;
        this.owner.ios.setNeedsDisplay();
    }
    _onMinorTicksWidthPropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        this.owner.ios.ticks.minorTicksWidth = newValue;
        this.owner.ios.setNeedsDisplay();
    }
    _onMajorTicksLengthPropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        this.owner.ios.ticks.majorTicksLength = newValue;
        this.owner.ios.setNeedsDisplay();
    }
    _onMinorTicksLengthPropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        this.owner.ios.ticks.minorTicksLength = newValue;
        this.owner.ios.setNeedsDisplay();
    }
    _onMajorTicksStrokeColorPropertyChanged(oldValue, newValue) {
        if (!this.owner || !newValue) {
            return;
        }
        let strokeWidth = this.owner.ios.ticks.majorTicksStroke.width ? this.owner.ios.ticks.majorTicksStroke.width : 0;
        this.owner.ios.ticks.majorTicksStroke = TKStroke.strokeWithColorWidth(newValue.ios, strokeWidth);
        this.owner.ios.setNeedsDisplay();
    }
    _onМinorTicksStrokeColorPropertyChanged(oldValue, newValue) {
        if (!this.owner || !newValue) {
            return;
        }
        let strokeWidth = this.owner.ios.ticks.minorTicksStroke.width ? this.owner.ios.ticks.minorTicksStroke.width : 0;
        this.owner.ios.ticks.minorTicksStroke = TKStroke.strokeWithColorWidth(newValue.ios, strokeWidth);
        this.owner.ios.setNeedsDisplay();
    }
    _onMajorTicksFillColorPropertyChanged(oldValue, newValue) {
        if (!this.owner || !newValue) {
            return;
        }
        this.owner.ios.ticks.majorTicksFill = TKSolidFill.solidFillWithColor(newValue.ios);
        this.owner.ios.setNeedsDisplay();
    }
    _onMinorTicksFillColorPropertyChanged(oldValue, newValue) {
        if (!this.owner || !newValue) {
            return;
        }
        this.owner.ios.ticks.minorTicksFill = TKSolidFill.solidFillWithColor(newValue.ios);
        this.owner.ios.setNeedsDisplay();
    }
    _onМajorTicksStrokeWidthPropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        if (this.majorTicksStrokeColor) {
            this.owner.ios.ticks.majorTicksStroke = TKStroke.strokeWithColorWidth(this.majorTicksStrokeColor.ios, newValue);
        }
        else {
            this.owner.ios.ticks.majorTicksStroke = TKStroke.alloc().init();
            this.owner.ios.ticks.majorTicksStroke.width = newValue;
        }
        this.owner.ios.setNeedsDisplay();
    }
    _onМinorTicksStrokeWidthPropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        if (this.minorTicksStrokeColor) {
            this.owner.ios.ticks.minorTicksStroke = TKStroke.strokeWithColorWidth(this.minorTicksStrokeColor.ios, newValue);
        }
        else {
            this.owner.ios.ticks.minorTicksStroke = TKStroke.alloc().init();
            this.owner.ios.ticks.minorTicksStroke.width = newValue;
        }
        this.owner.ios.setNeedsDisplay();
    }
    _onLabelsVisiblePropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        this.owner.ios.labels.hidden = !newValue;
        this.owner.ios.setNeedsDisplay();
    }
    _onLabelsCountPropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        this.owner.ios.labels.count = newValue;
        this.owner.ios.setNeedsDisplay();
    }
    _onLabelsLayoutModePropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        if (newValue === commonModule.GaugeScaleLayoutMode.Inner) {
            this.owner.ios.labels.position = 0 /* TKGaugeLabelsPosition.TKGaugeLabelsPositionInner */;
        }
        else if (newValue === commonModule.GaugeScaleLayoutMode.Outer) {
            this.owner.ios.labels.position = 1 /* TKGaugeLabelsPosition.TKGaugeLabelsPositionOuter */;
        }
        this.owner.ios.setNeedsDisplay();
    }
    _onLabelsOffsetPropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        this.owner.ios.labels.offset = newValue;
        this.owner.ios.setNeedsDisplay();
    }
    _onLabelsSizePropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        this.owner.ios.labels.font = UIFont.systemFontOfSize(newValue);
        this.owner.ios.setNeedsDisplay();
    }
    _onLabelsColorPropertyChanged(oldValue, newValue) {
        if (!this.owner || !newValue) {
            return;
        }
        this.owner.ios.labels.color = newValue.ios;
        this.owner.ios.setNeedsDisplay();
    }
}
//////////////////////////// NEEDLE STYLES
export class NeedleStyle extends commonModule.NeedleStyle {
    _onLengthPropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        this.owner.ios.length = newValue;
        this.owner.ios.setNeedsDisplay();
    }
    _onBottomWidthPropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        this.owner.ios.width = newValue;
        this.owner.ios.setNeedsDisplay();
    }
    _onTopWidthPropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        this.owner.ios.topWidth = newValue;
        this.owner.ios.setNeedsDisplay();
    }
    _onCircleRadiusPropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        this.owner.ios.circleRadius = newValue;
        this.owner.ios.setNeedsDisplay();
    }
    _onCircleInnerRadiusPropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        this.owner.ios.circleInnerRadius = newValue;
        this.owner.ios.setNeedsDisplay();
    }
    _onOffsetPropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        this.owner.ios.offset = newValue;
        this.owner.ios.setNeedsDisplay();
    }
    _onCircleFillColorPropertyChanged(oldValue, newValue) {
        if (!this.owner || !newValue) {
            return;
        }
        this.owner.ios.circleFill = TKSolidFill.solidFillWithColor(newValue.ios);
        this.owner.ios.setNeedsDisplay();
    }
    _onCircleStrokeColorPropertyChanged(oldValue, newValue) {
        if (!this.owner || !newValue) {
            return;
        }
        let strokeWidth = this.circleStrokeWidth ? this.circleStrokeWidth : 0;
        this.owner.ios.circleStroke = TKStroke.strokeWithColorWidth(newValue.ios, strokeWidth);
        this.owner.ios.setNeedsDisplay();
    }
    _onCircleStrokeWidthPropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        if (this.circleStrokeColor) {
            this.owner.ios.circleStroke = TKStroke.strokeWithColorWidth(this.circleStrokeColor.ios, newValue);
        }
        else {
            this.owner.ios.circleStroke = TKStroke.alloc().init();
            this.owner.ios.circleStroke.width = newValue;
        }
        this.owner.ios.setNeedsDisplay();
    }
    _onFillColorPropertyChanged(oldValue, newValue) {
        if (!this.owner || !newValue) {
            return;
        }
        this.owner.ios.fill = TKSolidFill.solidFillWithColor(newValue.ios);
        this.owner.ios.setNeedsDisplay();
    }
    _onStrokeColorPropertyChanged(oldValue, newValue) {
        if (!this.owner || !newValue) {
            return;
        }
        let strokeWidth = this.strokeWidth ? this.strokeWidth : 0;
        this.owner.ios.stroke = TKStroke.strokeWithColorWidth(newValue.ios, strokeWidth);
        this.owner.ios.setNeedsDisplay();
    }
    _onStrokeWidthPropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        if (this.strokeColor) {
            this.owner.ios.stroke = TKStroke.strokeWithColorWidth(this.strokeColor.ios, newValue);
        }
        else {
            this.owner.ios.stroke = TKStroke.alloc().init();
            this.owner.ios.stroke.width = newValue;
        }
        this.owner.ios.setNeedsDisplay();
    }
}
/////////////////////////// BAR INDICATOR STYLE
export class BarIndicatorStyle extends commonModule.BarIndicatorStyle {
    _onCapPropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        if (newValue === commonModule.GaugeIndicatorCapMode.Edge) {
            this.owner.ios.cap = 1 /* TKGaugeSegmentCap.Edge */;
        }
        else if (newValue === commonModule.GaugeIndicatorCapMode.Round) {
            this.owner.ios.cap = 0 /* TKGaugeSegmentCap.Round */;
        }
        this.owner.ios.setNeedsDisplay();
    }
    _onBarWidthPropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        this.owner.ios.width = newValue;
        this.owner.ios.width2 = newValue;
        this.owner.ios.setNeedsDisplay();
    }
    _onFillColorPropertyChanged(oldValue, newValue) {
        if (!this.owner || !newValue) {
            return;
        }
        this.owner.ios.fill = TKSolidFill.solidFillWithColor(newValue.ios);
        this.owner.ios.setNeedsDisplay();
    }
    _onStrokeColorPropertyChanged(oldValue, newValue) {
        if (!this.owner || !newValue) {
            return;
        }
        let strokeWidth = this.strokeWidth ? this.strokeWidth : 0;
        this.owner.ios.stroke = TKStroke.strokeWithColorWidth(newValue.ios, strokeWidth);
        this.owner.ios.setNeedsDisplay();
    }
    _onStrokeWidthPropertyChanged(oldValue, newValue) {
        if (!this.owner) {
            return;
        }
        if (this.strokeColor) {
            this.owner.ios.stroke = TKStroke.strokeWithColorWidth(this.strokeColor.ios, newValue);
        }
        else {
            this.owner.ios.stroke = TKStroke.alloc().init();
            this.owner.ios.stroke.width = newValue;
        }
        this.owner.ios.setNeedsDisplay();
    }
}
/////////////////////////// INDICATORS
export class RadialNeedle extends commonModule.RadialNeedle {
    constructor() {
        super();
        this._ios = TKGaugeNeedle.alloc().init();
    }
    get ios() {
        return this._ios;
    }
    get nativeObject() {
        return this._ios;
    }
    get _nativeView() {
        return this._ios;
    }
    _onValuePropertyChanged(oldValue, newValue) {
        if (!this._ios) {
            return;
        }
        if (this.isAnimated) {
            let duration = this.animationDuration ? this.animationDuration / 1000 : 1;
            this._ios.setValueAnimatedWithDurationMediaTimingFunction(newValue, duration, undefined);
        }
        else {
            this._ios.value = newValue;
        }
    }
}
export class RadialBarIndicator extends commonModule.RadialBarIndicator {
    constructor() {
        super();
        this._ios = TKGaugeSegment.alloc().init();
    }
    get ios() {
        return this._ios;
    }
    get nativeObject() {
        return this._ios;
    }
    get _nativeView() {
        return this._ios;
    }
}
//# sourceMappingURL=index.ios.js.map