Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pyTSPrf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XCG
pyTSPrf
Commits
a3818007090f
Commit
a3818007090f
authored
9 years ago
by
Patrice Journoud
Browse files
Options
Downloads
Patches
Plain Diff
code refactoring to provide distance getter as a plugin for the tsp solver
parent
d102ccd1d6b4
Branches
topic/default/dockerfile
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pytsprf/assets/js/pytsprf.js
+4
-4
4 additions, 4 deletions
pytsprf/assets/js/pytsprf.js
pytsprf/views.py
+23
-13
23 additions, 13 deletions
pytsprf/views.py
with
27 additions
and
17 deletions
pytsprf/assets/js/pytsprf.js
+
4
−
4
View file @
a3818007
...
...
@@ -198,7 +198,7 @@
contentType
:
"
application/json; charset=utf-8
"
,
headers
:{
'
X-Messaging-Token
'
:
'
localhost:6544-b32de4d5-d979-4e84-bfe7-a7e52026016c
'
,
'
start
'
:
0
,
'
end
'
:
latlng
.
length
-
1
},
'
end
'
:
0
},
data
:
JSON
.
stringify
(
zlatlng
)
}))
.
done
(
function
(
response
)
{
...
...
@@ -216,9 +216,9 @@
var
marker_start
=
markers
[
0
];
marker_start
.
setIcon
(
green_icon
);
var
red_icon
=
get_icon
(
"
red
"
);
var
marker_end
=
markers
[
markers
.
length
-
1
];
marker_end
.
setIcon
(
red_icon
);
//
var red_icon = get_icon("red");
//
var marker_end = markers[markers.length-1];
//
marker_end.setIcon(red_icon);
var
polyline
=
L
.
polyline
(
latlngs
,
...
...
This diff is collapsed.
Click to expand it.
pytsprf/views.py
+
23
−
13
View file @
a3818007
...
...
@@ -9,7 +9,8 @@
from
cornice
import
Service
import
logging
from
pytsp.distance_getter.gpsdistancegetter
import
GpsDistanceGetter
from
pytsp.distance_getter.osrmdistancegetter
import
OsrmDistanceGetter
from
pytsp.viaroute
import
Viaroute
from
pytsprf.conf
import
get
as
conf_get
from
pytsprf.models
import
get_db_user_token
,
get_db_user
...
...
@@ -188,6 +189,6 @@
def
get_route
(
points
,
start
,
end
,
is_debug_mode
=
False
):
scheme
=
conf_get
(
'
osrm.scheme
'
)
host
name
=
conf_get
(
'
osrm.hostname
'
)
osrm
host
=
conf_get
(
'
osrm.hostname
'
)
conf_max_points_for_brute_force
=
\
int
(
conf_get
(
'
tsp.max_points_for_brute_force
'
))
...
...
@@ -192,7 +193,4 @@
conf_max_points_for_brute_force
=
\
int
(
conf_get
(
'
tsp.max_points_for_brute_force
'
))
obj
=
Viaroute
(
osrmhost
=
hostname
,
scheme
=
scheme
,
is_debug_mode
=
is_debug_mode
)
cache_url
=
'
localhost
'
...
...
@@ -198,11 +196,23 @@
return
\
obj
.
compute
(
points
,
start
,
end
,
max_points_for_brute_force
=
conf_max_points_for_brute_force
)
if
is_debug_mode
:
distance_getter
=
\
GpsDistanceGetter
(
is_cache_required
=
True
,
cache_url
=
cache_url
)
else
:
distance_getter
=
\
OsrmDistanceGetter
(
osrmhost
,
scheme
,
is_cache_required
=
True
,
cache_url
=
cache_url
)
obj
=
Viaroute
(
osrmhost
,
distance_getter
,
points
,
start
=
start
,
end
=
end
,
max_points_for_brute_force
=
conf_max_points_for_brute_force
)
return
obj
.
get_route_geometry
()
def
log_connections
(
request
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment