Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge gsoc2022 jatin jain to develop #1599

Merged
merged 7 commits into from
Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/testing-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ on:
push:
branches:
- develop
- GSOC2022-JatinJain
pull_request:
branches:
- develop
- GSOC2022-JatinJain
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

muss das nicht raus?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, in a further step. There is also some wording in the docs, I don't wanted to change more than flake8 in the merge. There will be follow up PR.


jobs:
test-develop:
Expand All @@ -29,4 +31,3 @@ jobs:
secrets:
PAT: ${{ secrets.PAT }}


21 changes: 21 additions & 0 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,27 @@ Close the software with ease of mind. Next time you open your software, all your
you left it! KML Overlay supports **Saving Open files** so that you can jump back in, anytime!


Multiple Flightpath Dockwidget
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


The topview has a dockwidget allowing to plot multiple flighttracks/operations on top of map.

New flightpaths can be added or removed without crashing, and a clear visualization on map, with
relevant geometries and styles.

The multiple flightpath dockwidget interface supports display of multiple flighttracks on map simultaneously,
with a check box to display/hide individual plots on map.

Activated flighttrack/operation is shown in bold letters and can't be unchecked.

"Change Linewidth" and "Change Color" button improves the User experience by allowing user to customize
color & linewidth of each of flightpath displayed, realtime. This allows for better understanding of map and
flightpath.

For Activated Flightpath, use "options" menu on topview interface.


Test Samples
------------

Expand Down
10 changes: 7 additions & 3 deletions mslib/mscolab/file_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
See the License for the specific language governing permissions and
limitations under the License.
"""
import datetime
import fs
import difflib
import logging
Expand All @@ -39,7 +40,7 @@ class FileManager(object):
def __init__(self, data_dir):
self.data_dir = data_dir

def create_operation(self, path, description, user, content=None, category="default"):
def create_operation(self, path, description, user, last_used=None, content=None, category="default"):
"""
path: path to the operation
description: description of the operation
Expand All @@ -51,7 +52,9 @@ def create_operation(self, path, description, user, content=None, category="defa
proj_available = Operation.query.filter_by(path=path).first()
if proj_available is not None:
return False
operation = Operation(path, description, category)
if last_used is None:
last_used = datetime.datetime.utcnow()
operation = Operation(path, description, last_used, category)
db.session.add(operation)
db.session.flush()
operation_id = operation.id
Expand Down Expand Up @@ -100,7 +103,8 @@ def list_operations(self, user):
"access_level": permission.access_level,
"path": operation.path,
"description": operation.description,
"category": operation.category
"category": operation.category,
"active": operation.active
})
return operations

Expand Down
13 changes: 11 additions & 2 deletions mslib/mscolab/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,10 @@ class Operation(db.Model):
path = db.Column(db.String(255), unique=True)
category = db.Column(db.String(255))
description = db.Column(db.String(255))
active = db.Column(db.Boolean)
last_used = db.Column(db.DateTime)

def __init__(self, path, description, category="default"):
def __init__(self, path, description, last_used=None, category="default", active=True):
"""
path: path to the operation
description: small description of operation
Expand All @@ -135,9 +137,16 @@ def __init__(self, path, description, category="default"):
self.path = path
self.description = description
self.category = category
self.active = active
if self.last_used is None:
self.last_used = datetime.datetime.utcnow()
else:
self.last_used = last_used

def __repr__(self):
return f'<Operation path: {self.path}, desc: {self.description}, cat: {self.category}>'
return f'<Operation path: {self.path}, desc: {self.description},' \
f' cat: {self.category}, active: {self.active}, ' \
f'last_used: {self.last_used}> '


class MessageType(enum.IntEnum):
Expand Down
41 changes: 36 additions & 5 deletions mslib/mscolab/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from werkzeug.utils import secure_filename

from mslib.mscolab.conf import mscolab_settings
from mslib.mscolab.models import Change, MessageType, User, db
from mslib.mscolab.models import Change, MessageType, User, Operation, db
from mslib.mscolab.sockets_manager import setup_managers
from mslib.mscolab.utils import create_files, get_message_dict
from mslib.utils import conditional_decorator
Expand All @@ -54,7 +54,6 @@
mail = Mail(APP)
CORS(APP, origins=mscolab_settings.CORS_ORIGINS if hasattr(mscolab_settings, "CORS_ORIGINS") else ["*"])


# set the operation root directory as the static folder
# ToDo needs refactoring on a route without using of static folder

Expand Down Expand Up @@ -235,8 +234,8 @@ def get_auth_token():
if user.confirmed:
token = user.generate_auth_token()
return json.dumps({
'token': token.decode('ascii'),
'user': {'username': user.username, 'id': user.id}})
'token': token.decode('ascii'),
'user': {'username': user.username, 'id': user.id}})
else:
return "False"
else:
Expand Down Expand Up @@ -394,8 +393,9 @@ def create_operation():
content = request.form.get('content', None)
description = request.form.get('description', None)
category = request.form.get('category', "default")
last_used = datetime.datetime.utcnow()
user = g.user
r = str(fm.create_operation(path, description, user, content=content, category=category))
r = str(fm.create_operation(path, description, user, last_used, content=content, category=category))
if r == "True":
token = request.args.get('token', request.form.get('token', False))
json_config = {"token": token}
Expand Down Expand Up @@ -500,6 +500,37 @@ def get_operation_details():
return json.dumps(fm.get_operation_details(int(op_id), user))


@APP.route('/set_last_used', methods=["POST"])
@verify_user
def set_last_used():
op_id = request.form.get('op_id', None)
operation = Operation.query.filter_by(id=int(op_id)).first()
operation.last_used = datetime.datetime.utcnow()
temp_operation_active = operation.active
operation.active = True
db.session.commit()
# Reload Operation List
if not temp_operation_active:
token = request.args.get('token', request.form.get('token', False))
json_config = {"token": token}
sockio.sm.update_operation_list(json_config)
return jsonify({"success": True}), 200


@APP.route('/update_last_used', methods=["POST"])
@verify_user
def update_last_used():
operations = Operation.query.filter().all()
for operation in operations:
a = (datetime.datetime.utcnow() - operation.last_used).days
if a > 30:
operation.active = False
else:
operation.active = True
db.session.commit()
return jsonify({"success": True}), 200


@APP.route('/undo', methods=["POST"])
@verify_user
def undo_ftml():
Expand Down
2 changes: 1 addition & 1 deletion mslib/msui/kmloverlay_dockwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def load_file(self):
Loads multiple KML Files simultaneously and constructs the
corresponding patches.
"""
for entry in self.dict_files.values(): # removes all patches from map, but not from dict_files
for entry in self.dict_files.values(): # removes all patches from map, but not from dict_flighttrack
if entry["patch"] is not None: # since newly initialized files will have patch:None
entry["patch"].remove()

Expand Down
9 changes: 9 additions & 0 deletions mslib/msui/mpl_qtwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -1163,6 +1163,7 @@ def __init__(self, settings=None):
self.waypoints_interactor = None
self.satoverpasspatch = []
self.kmloverlay = None
self.multiple_flightpath = None
self.map = None
self.basename = "topview"

Expand Down Expand Up @@ -1280,6 +1281,9 @@ def redraw_map(self, kwargs_update=None):
if self.kmloverlay:
self.kmloverlay.update()

if self.multiple_flightpath:
self.multiple_flightpath.update()

# self.draw_metadata() ; It is not needed here, since below here already plot title is being set.

# Setting fontsize for topview plot title when map is redrawn.
Expand Down Expand Up @@ -1417,6 +1421,11 @@ def plot_kml(self, kmloverlay):
"""
self.kmloverlay = kmloverlay

def plot_multiple_flightpath(self, multipleflightpath):
"""Plots a multiple flightpaths on topview of the map
"""
self.multiple_flightpath = multipleflightpath

def set_map_appearance(self, settings_dict):
"""Apply settings from dictionary 'settings_dict' to the view.

Expand Down
Loading