Skip to content

Commit 6d25bd9

Browse files
committed
wip
0 parents  commit 6d25bd9

9 files changed

Lines changed: 312 additions & 0 deletions

File tree

.gitignore

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# Virtual environment
7+
.venv/
8+
env/
9+
venv/
10+
ENV/
11+
12+
# Flask cache / instance folder
13+
instance/
14+
*.db
15+
*.sqlite3
16+
17+
# PyInstaller
18+
*.manifest
19+
*.spec
20+
21+
# Distribution / packaging
22+
.Python
23+
build/
24+
develop-eggs/
25+
dist/
26+
downloads/
27+
eggs/
28+
.eggs/
29+
lib/
30+
lib64/
31+
parts/
32+
sdist/
33+
var/
34+
wheels/
35+
share/python-wheels/
36+
*.egg-info/
37+
.installed.cfg
38+
*.egg
39+
MANIFEST
40+
41+
# Unit test / coverage reports
42+
htmlcov/
43+
.tox/
44+
.nox/
45+
.coverage
46+
.coverage.*
47+
.cache
48+
nosetests.xml
49+
coverage.xml
50+
*.cover
51+
*.py,cover
52+
.hypothesis/
53+
.pytest_cache/
54+
55+
# IDE files
56+
.vscode/
57+
.idea/
58+
59+
# Logs
60+
*.log
61+
62+
# OS generated files
63+
.DS_Store
64+
Thumbs.db
65+
66+
# Environment variables
67+
.env
68+
.env.*

.idea/fyp-api.iml

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/profiles_settings.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/workspace.xml

Lines changed: 99 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from flask import Flask
2+
3+
app = Flask(__name__)
4+
app.config["SECRET_KEY"] = "secret"
5+
6+
7+
@app.get("/")
8+
def home():
9+
return "<h1>Hello, Flask 👋</h1><p>You're up and running!</p>"
10+
11+
@app.route("/plans", methods=["POST"])
12+
def auto_plan():
13+
return ""
14+
15+
if __name__ == '__main__':
16+
app.run()

models/plan.py

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
from enum import Enum
2+
from typing import List, Optional, Union
3+
from datetime import datetime
4+
from pydantic import BaseModel
5+
6+
# ---------- Enums ----------
7+
class PlanType(str, Enum):
8+
CADASTRAL = "cadastral"
9+
LAYOUT = "layout"
10+
TOPOGRAPHIC = "topographic"
11+
ROUTE = "route"
12+
13+
class PlanOrigin(str, Enum):
14+
UTM_ZONE_31 = "utm_zone_31"
15+
16+
class BeaconType(str, Enum):
17+
DOT = "dot"
18+
CIRCLE = "circle"
19+
BOX = "box"
20+
NONE = "none"
21+
22+
23+
# ---------- Supporting models ----------
24+
class ParcelProps(BaseModel):
25+
name: str
26+
ids: List[str]
27+
28+
class CoordinateProps(BaseModel):
29+
x: float
30+
y: float
31+
z: Optional[float] = None
32+
33+
class TraverseLegProps(BaseModel):
34+
from_: str # `from` is reserved in Python
35+
to: str
36+
bearing: Optional[float] = None
37+
observed_angle: Optional[float] = None
38+
distance: float
39+
40+
41+
# ---------- Computation models ----------
42+
class ForwardComputationData(BaseModel):
43+
coordinates: Optional[List[CoordinateProps]] = None
44+
start: CoordinateProps
45+
legs: List[TraverseLegProps]
46+
misclosure_correction: Optional[bool] = False
47+
48+
class TraverseComputationData(BaseModel):
49+
coordinates: List[CoordinateProps]
50+
legs: List[TraverseLegProps]
51+
misclosure_correction: Optional[bool] = False
52+
53+
54+
# ---------- Main Plan Model ----------
55+
class PlanProps(BaseModel):
56+
id: str
57+
created_at: datetime
58+
updated_at: Optional[datetime] = None
59+
user: Union[str, dict]
60+
project: Union[str, dict]
61+
name: str
62+
type: PlanType = PlanType.CADASTRAL
63+
font: str = "Arial"
64+
font_size: int = 12
65+
coordinates: List[CoordinateProps] = []
66+
parcels: List[ParcelProps] = []
67+
title: str = "Untitled Plan"
68+
address: str = ""
69+
local_govt: str = ""
70+
state: str = ""
71+
plan_number: str = ""
72+
origin: PlanOrigin = PlanOrigin.UTM_ZONE_31
73+
scale: float = 1
74+
beacon_type: BeaconType = BeaconType.NONE
75+
personel_name: str = ""
76+
surveyor_name: str = ""
77+
forward_computation_data: Optional[ForwardComputationData] = None
78+
traverse_computation_data: Optional[TraverseComputationData] = None

requirements.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
blinker==1.9.0
2+
click==8.2.1
3+
colorama==0.4.6
4+
comtypes==1.4.12
5+
Flask==3.1.2
6+
itsdangerous==2.2.0
7+
Jinja2==3.1.6
8+
MarkupSafe==3.0.2
9+
pyautocad==0.2.0
10+
Werkzeug==3.1.3

0 commit comments

Comments
 (0)