Commit d3f26585 authored by Heiko Etzold's avatar Heiko Etzold

Initial commit

parents
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:/Users/etzold/Documents/Uni/60-69 Programmierung/61 iOS-Apps/61.03 Winkel/iOS-App/Winkel 3.0/Math Angle.xcodeproj">
</FileRef>
</Workspace>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1130"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B3499A3E20154641007E1CAB"
BuildableName = "Angle.app"
BlueprintName = "Math Angle"
ReferencedContainer = "container:Math Angle.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B3499A3E20154641007E1CAB"
BuildableName = "Angle.app"
BlueprintName = "Math Angle"
ReferencedContainer = "container:Math Angle.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B3499A3E20154641007E1CAB"
BuildableName = "Angle.app"
BlueprintName = "Math Angle"
ReferencedContainer = "container:Math Angle.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "B3499A3E20154641007E1CAB"
BuildableName = "Angle.app"
BlueprintName = "Math Angle"
ReferencedContainer = "container:Math Angle.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>Winkel.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>B3499A3E20154641007E1CAB</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
//
// AngleView.swift
// Winkel
//
// Created by Heiko Etzold on 22.01.18.
// Copyright © 2018 Heiko Etzold. All rights reserved.
//
import UIKit
class AngleView: UIView {
var offsetAngle = CGFloat(0)
var sizeOfAngle = CGFloat(30)
var sizeOfCompareAngle = CGFloat(30)
var lengthOfLine = CGFloat(200)
var touchPoint : TouchPointForAngleView!
var colorOfLines = labelColor
var colorOfComparableLines = labelColor
override func draw(_ rect: CGRect) {
let arcDistance = lengthOfLine/2
let arrowAngle = min(8,sizeOfAngle)
let arrowLength = CGFloat(5)*arrowAngle/8
//angle
let center = self.convert(self.center, from: self.superview)
let angleLines = UIGraphicsGetCurrentContext()!
angleLines.move(to: center+CGPoint(x: lengthOfLine*cos(offsetAngle*(.pi)/180), y: -lengthOfLine*sin(offsetAngle*(.pi)/180)))
angleLines.addLine(to: center)
angleLines.addLine(to: center+CGPoint(x: lengthOfLine*cos((offsetAngle+sizeOfAngle)*(.pi)/180), y: -lengthOfLine*sin((offsetAngle+sizeOfAngle)*(.pi)/180)))
//arc
angleLines.move(to: center+CGPoint(x: arcDistance*cos(offsetAngle*(.pi)/180), y: -arcDistance*sin(offsetAngle*(.pi)/180)))
if(arrowAngle != sizeOfAngle){
angleLines.addArc(center: center, radius: arcDistance, startAngle: -offsetAngle*(.pi)/180, endAngle: (-offsetAngle-sizeOfAngle+arrowAngle)*(.pi)/180, clockwise: true)
}
//draw
angleLines.setLineWidth(3)
angleLines.setLineCap(.round)
angleLines.setLineJoin(.round)
angleLines.setStrokeColor(colorOfLines.cgColor)
angleLines.strokePath()
//arrow
let angleArrow = UIGraphicsGetCurrentContext()!
angleArrow.move(to: center+CGPoint(x: (arcDistance-arrowLength)*cos((offsetAngle+sizeOfAngle-arrowAngle)*(.pi)/180), y: -(arcDistance-arrowLength)*sin((offsetAngle+sizeOfAngle-arrowAngle)*(.pi)/180)))
angleArrow.addLine(to: center+CGPoint(x: (arcDistance+arrowLength)*cos((offsetAngle+sizeOfAngle-arrowAngle)*(.pi)/180), y: -(arcDistance+arrowLength)*sin((offsetAngle+sizeOfAngle-arrowAngle)*(.pi)/180)))
angleArrow.addLine(to: center+CGPoint(x: (arcDistance)*cos((offsetAngle+sizeOfAngle)*(.pi)/180), y: -(arcDistance)*sin((offsetAngle+sizeOfAngle)*(.pi)/180)))
angleArrow.closePath()
angleArrow.setLineJoin(.round)
angleArrow.setFillColor(colorOfLines.cgColor)
angleArrow.fillPath()
//draw comparable angle
if(compareAngleIsDrawn == true){
let compareArcDistance = lengthOfLine/3
let compareArrowAngle = min(8,sizeOfCompareAngle)
let compareArrowLength = CGFloat(4)*compareArrowAngle/8
//angle
let compareAngleLines = UIGraphicsGetCurrentContext()!
compareAngleLines.move(to: center+CGPoint(x: lengthOfLine*cos(offsetAngle*(.pi)/180), y: -lengthOfLine*sin(offsetAngle*(.pi)/180)))
compareAngleLines.addLine(to: center)
compareAngleLines.addLine(to: center+CGPoint(x: lengthOfLine*cos((offsetAngle+sizeOfCompareAngle)*(.pi)/180), y: -lengthOfLine*sin((offsetAngle+sizeOfCompareAngle)*(.pi)/180)))
//arc
compareAngleLines.move(to: center+CGPoint(x: lengthOfLine/2*cos(offsetAngle*(.pi)/180), y: -lengthOfLine/2*sin(offsetAngle*(.pi)/180)))
if(compareArrowAngle != sizeOfCompareAngle){
compareAngleLines.addArc(center: center, radius: compareArcDistance, startAngle: -offsetAngle*(.pi)/180, endAngle: (-offsetAngle-sizeOfCompareAngle+compareArrowAngle)*(.pi)/180, clockwise: true)
}
compareAngleLines.setLineWidth(2)
compareAngleLines.setStrokeColor(colorOfComparableLines.cgColor)
compareAngleLines.strokePath()
//arrow
let compareAngleArrow = UIGraphicsGetCurrentContext()!
compareAngleArrow.move(to: center+CGPoint(x: (compareArcDistance-compareArrowLength)*cos((offsetAngle+sizeOfCompareAngle-compareArrowAngle)*(.pi)/180), y: -(compareArcDistance-compareArrowLength)*sin((offsetAngle+sizeOfCompareAngle-compareArrowAngle)*(.pi)/180)))
compareAngleArrow.addLine(to: center+CGPoint(x: (compareArcDistance+compareArrowLength)*cos((offsetAngle+sizeOfCompareAngle-compareArrowAngle)*(.pi)/180), y: -(compareArcDistance+compareArrowLength)*sin((offsetAngle+sizeOfCompareAngle-compareArrowAngle)*(.pi)/180)))
compareAngleArrow.addLine(to: center+CGPoint(x: (compareArcDistance)*cos((offsetAngle+sizeOfCompareAngle)*(.pi)/180), y: -(compareArcDistance)*sin((offsetAngle+sizeOfCompareAngle)*(.pi)/180)))
compareAngleArrow.closePath()
compareAngleArrow.setLineJoin(.round)
compareAngleArrow.setFillColor(colorOfComparableLines.cgColor)
compareAngleArrow.fillPath()
compareAngleIsDrawn = false
}
}
func redrawAngle(offset: CGFloat, size: CGFloat){
offsetAngle = offset
sizeOfAngle = size
touchPoint.center = self.convert(self.center, from: self.superview)+CGPoint(x: lengthOfLine*cos((-offsetAngle-sizeOfAngle)*(.pi)/180), y: lengthOfLine*sin((-offsetAngle-sizeOfAngle)*(.pi)/180))
self.setNeedsDisplay()
}
var compareAngleIsDrawn = Bool(false)
func drawCompareAngle(size: CGFloat){
compareAngleIsDrawn = true
sizeOfCompareAngle = size
self.setNeedsDisplay()
}
func disableTouchPoint(){
touchPoint.alpha = 0
}
func enableTouchPoint(){
touchPoint.alpha = 1
}
func disableInteraction(){
self.isUserInteractionEnabled = false
touchPoint.alpha = 0.5
}
func enableInteration(){
self.isUserInteractionEnabled = true
touchPoint.alpha = 1
}
}
//
// AngleViewController.swift
// Winkel
//
// Created by Heiko Etzold on 31.03.20.
// Copyright © 2020 Heiko Etzold. All rights reserved.
//
import UIKit
class AngleViewController: UIViewController {
var angleView = AngleView()
var currentStateOfTask = Int(0)
var stateOfCheckButton = "check"
var score = Double(0)
override func viewDidLoad() {
super.viewDidLoad()
angleView.colorOfLines = labelColor
}
override func viewDidAppear(_ animated: Bool) {
//change line length for iPhone
if(UIDevice.current.userInterfaceIdiom == .phone){
angleView.lengthOfLine = min(angleView.bounds.width,angleView.bounds.height)/2-1.25*angleView.touchPoint.touchPointRadius-10
}
//redraw the angle
angleView.redrawAngle(offset: angleView.offsetAngle, size: angleView.sizeOfAngle)
}
//change between identify an adjust
@IBAction func changeReadAndDraw(_ sender: UISegmentedControl) {
currentStateOfTask = sender.selectedSegmentIndex
newTask()
}
func newTask() {
}
//create touch points
func initTouchPoint(){
angleView.touchPoint = TouchPointForAngleView(connectedAngleViewController: self)
angleView.touchPoint.alpha = 0
angleView.addSubview(angleView.touchPoint)
//set task to adjust when using iPhone
if(UIDevice.current.userInterfaceIdiom == .phone){
currentStateOfTask = 1
}
}
//update view, when Mac-window is resized
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
if(angleView.touchPoint != nil){
angleView.redrawAngle(offset: angleView.offsetAngle, size: angleView.sizeOfAngle)
}
}
}
//
// AppDelegate.swift
// Winkel
//
// Created by Heiko Etzold on 21.01.18.
// Copyright © 2018 Heiko Etzold. All rights reserved.
//
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}
{
"images" : [
{
"filename" : "AppIcon40.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"filename" : "AppIcon60.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"filename" : "AppIcon58.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"filename" : "AppIcon87.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"filename" : "AppIcon80.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"filename" : "AppIcon120.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"filename" : "AppIcon120-1.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"filename" : "AppIcon180.png",
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"filename" : "AppIcon20.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "20x20"
},
{
"filename" : "AppIcon40-1.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"filename" : "AppIcon29.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"filename" : "AppIcon58-1.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"filename" : "AppIcon40-2.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"filename" : "AppIcon80-1.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"filename" : "AppIcon76.png",
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"filename" : "AppIcon152.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"filename" : "AppIcon167.png",
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"filename" : "AppIcon1024.png",
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"filename" : "Launch.pdf",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "LaunchDark.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true
}
}
{
"images" : [
{
"filename" : "Tab:Estimate.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true
}
}
{
"images" : [
{
"filename" : "Tab:Explore.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true
}
}