Skip to content

Commit

Permalink
Vers. 0.4.2 RC 1
Browse files Browse the repository at this point in the history
  • Loading branch information
mauroalberti committed Aug 19, 2018
1 parent f61aabd commit 5dec062
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 2 deletions.
3 changes: 3 additions & 0 deletions config/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@


pt_num_threshold = 10000
1 change: 1 addition & 0 deletions gis_utils/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ def topoline_from_dem(resampled_trace2d, bOnTheFlyProjection, project_crs, dem,

def topoprofiles_from_dems(canvas, source_profile_line, sample_distance, selected_dems, selected_dem_parameters,
invert_profile):

# get project CRS information
on_the_fly_projection, project_crs = get_on_the_fly_projection(canvas)

Expand Down
23 changes: 21 additions & 2 deletions qProf_QWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

from .string_utils.utils_string import clean_string

from .config.settings import *
from .config.output import dem_header_common, dem_single_dem_header, gpx_header

from .qProf_plotting import plot_geoprofiles
Expand Down Expand Up @@ -69,7 +70,6 @@ def __init__(self, plugin_name, canvas):
self.profile_windows = [] # used to maintain alive the plots, i.e. to avoid the C++ objects being destroyed

self.plane_attitudes_colors = []
#self.curve_colors = []

self.setup_gui()

Expand Down Expand Up @@ -207,6 +207,25 @@ def stop_rubberband():

if topo_source_type == self.demline_source: # sources are DEM(s) and line

# check total number of points in line(s) to create
estimated_total_num_pts = 0
for profile_line in source_profile_lines:

profile_length = profile_line.length_2d
profile_num_pts = profile_length / sample_distance
estimated_total_num_pts += profile_num_pts

estimated_total_num_pts = int(ceil(estimated_total_num_pts))

if estimated_total_num_pts > pt_num_threshold:
warn(
parent=self,
header=self.plugin_name,
msg="There are {} estimated points (limit is {}) in profile(s) to create.".format(estimated_total_num_pts, pt_num_threshold) +
"\nPlease increase sample distance value"
)
return

for profile_line in source_profile_lines:

try:
Expand Down Expand Up @@ -265,7 +284,7 @@ def stop_rubberband():
else: # source error
error(self,
self.plugin_name,
"Algorithm error: profile calculation not defined")
"Debug: profile calculation not defined")
return

info(self,
Expand Down
14 changes: 14 additions & 0 deletions qProf_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
import os
import webbrowser

from qgis.core import *

from qgis.PyQt.QtCore import *
from qgis.PyQt.QtGui import *
from qgis.PyQt.QtWidgets import *

from . import resources


from .qt_utils.tools import info, warn, error, update_ComboBox
from .qgis_utils.utils import create_action

from .qProf_QWidget import qprof_QWidget

_plugin_name_ = "qProf"
Expand Down Expand Up @@ -45,6 +50,15 @@ def unload(self):

def open_qprof(self):

project = QgsProject.instance()

if project.count() == 0:
warn(
parent=None,
header=_plugin_name_,
msg="No project/layer available.\nPlease open project and add layers.")
return

qprof_DockWidget = QDockWidget(self.plugin_name,
self.interface.mainWindow())
qprof_DockWidget.setAttribute(Qt.WA_DeleteOnClose)
Expand Down

0 comments on commit 5dec062

Please sign in to comment.