update
This commit is contained in:
@ -2,12 +2,14 @@ import 'dart:convert';
|
||||
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:rogapp/utils/const.dart';
|
||||
|
||||
class LocationService{
|
||||
|
||||
static Future<GeoJsonFeatureCollection?> loadLocations() async {
|
||||
//String url = 'http://container.intranet.sumasen.net:8100/api/location/';
|
||||
String url = 'http://localhost:8100/api/location/';
|
||||
String server_url = ConstValues.currentServer();
|
||||
String url = '${server_url}/api/location/';
|
||||
//String url = 'http://localhost:8100/api/location/';
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
@ -23,13 +25,14 @@ class LocationService{
|
||||
|
||||
static Future<GeoJsonFeatureCollection?> loadLocationsFor(String perfecture, String cat) async {
|
||||
String url = "";
|
||||
String server_url = ConstValues.currentServer();
|
||||
if(cat.isNotEmpty){
|
||||
//url = 'http://container.intranet.sumasen.net:8100/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
||||
url = 'http://localhost:8100/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
||||
url = '${server_url}/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
||||
//url = 'http://localhost:8100/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
||||
}
|
||||
else{
|
||||
//url = 'http://container.intranet.sumasen.net:8100/api/inperf/?perf=' + perfecture;
|
||||
url = 'http://localhost:8100/api/inperf/?perf=' + perfecture;
|
||||
url = '${server_url}/api/inperf/?perf=' + perfecture;
|
||||
//url = 'http://localhost:8100/api/inperf/?perf=' + perfecture;
|
||||
}
|
||||
//print("----- url ---- ${url} --- ${cat}");
|
||||
//String url = 'http://localhost:8100/api/inperf/?perf=' + perfecture + '&cat=' + cat;
|
||||
@ -50,14 +53,15 @@ class LocationService{
|
||||
|
||||
static Future<GeoJsonFeatureCollection?> loadLocationsSubFor(String subperfecture, String cat) async {
|
||||
String url = "";
|
||||
String server_url = ConstValues.currentServer();
|
||||
if(cat.isNotEmpty){
|
||||
//url = 'http://container.intranet.sumasen.net:8100/api/insubperf?subperf=' + subperfecture + '&cat=' + cat;
|
||||
url = 'http://localhost:8100/api/insubperf?subperf=' + subperfecture + '&cat=' + cat;
|
||||
url = '${server_url}/api/insubperf?subperf=' + subperfecture + '&cat=' + cat;
|
||||
//url = 'http://localhost:8100/api/insubperf?subperf=' + subperfecture + '&cat=' + cat;
|
||||
}
|
||||
else{
|
||||
print("------ loading location in sub----");
|
||||
//url = 'http://container.intranet.sumasen.net:8100/api/insubperf?subperf=' + subperfecture;
|
||||
url = 'http://localhost:8100/api/insubperf?subperf=' + subperfecture;
|
||||
url = '${server_url}/api/insubperf?subperf=' + subperfecture;
|
||||
//url = 'http://localhost:8100/api/insubperf?subperf=' + subperfecture;
|
||||
}
|
||||
final response = await http.get(Uri.parse(url),
|
||||
headers: <String, String>{
|
||||
@ -76,14 +80,15 @@ class LocationService{
|
||||
|
||||
static Future<GeoJsonFeatureCollection?> loadLocationsBound(double lat1, double lon1, double lat2, double lon2, double lat3, double lon3, double lat4, double lon4, String cat) async {
|
||||
String url = "";
|
||||
String server_url = ConstValues.currentServer();
|
||||
print("cat is ----- ${cat}");
|
||||
if(cat.isNotEmpty){
|
||||
//url = 'http://container.intranet.sumasen.net:8100/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}' + '&cat=' + cat;
|
||||
url = 'http://localhost:8100/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}' + '&cat=' + cat;
|
||||
url = '${server_url}/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}' + '&cat=' + cat;
|
||||
//url = 'http://localhost:8100/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}' + '&cat=' + cat;
|
||||
}
|
||||
else{
|
||||
//url = 'http://container.intranet.sumasen.net:8100/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
|
||||
url = 'http://localhost:8100/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
|
||||
url = '${server_url}/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
|
||||
//url = 'http://localhost:8100/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
|
||||
}
|
||||
print("----url --- ${url}");
|
||||
final response = await http.get(Uri.parse(url),
|
||||
@ -109,16 +114,17 @@ class LocationService{
|
||||
}
|
||||
|
||||
|
||||
static Future<GeoJsonFeatureCollection?> loadCustomLocations(String cat) async {
|
||||
static Future<GeoJsonFeatureCollection?> loadCustomLocations(String name, String cat) async {
|
||||
String url = "";
|
||||
String server_url = ConstValues.currentServer();
|
||||
print("cat is ----- ${cat}");
|
||||
if(cat.isNotEmpty){
|
||||
//url = 'http://container.intranet.sumasen.net:8100/api/custom_area/?&cat=' + cat;
|
||||
url = 'http://localhost:8100/api/custom_area/?&cat=' + cat;
|
||||
url = '${server_url}/api/custom_area/?&cat=' + cat;
|
||||
//url = 'http://localhost:8100/api/customarea?name=${name}&cat=' + cat;
|
||||
}
|
||||
else{
|
||||
//url = 'http://container.intranet.sumasen.net:8100/api/custom_area/';
|
||||
url = 'http://localhost:8100/api/custom_area/';
|
||||
url = '${server_url}/api/customarea?name=${name}&';
|
||||
//url = 'http://localhost:8100/api/customarea?name=${name}&';
|
||||
}
|
||||
print("----url --- ${url}");
|
||||
final response = await http.get(Uri.parse(url),
|
||||
|
||||
Reference in New Issue
Block a user