Пример #1
0
def select_data_of_header(request):
    type_location = request.POST.get(u"\u201dtype_location\u201d")
    data_loc = request.POST.get('data_loc')
    parseManager = ParseManager.getParseManager("")

    print "Location data"

    # I rest 1 for prosecute correctly on the parseManager
    if type_location == "coor":
        print "HEy I'm coordinates"
        parseManager.coor_lat = int(request.POST['location_lat']) - 1
        parseManager.coor_lng = int(request.POST['location_lng']) - 1
        print "Coor Lat: " + str(parseManager.coor_lat)
        print "Coor Lng: " + str(parseManager.coor_lng)

    elif type_location == "name":
        parseManager.extra_location = request.POST['extra_location']
        location_headers_selected = request.POST.get(
            'location_headers_selected')
        if location_headers_selected != None:
            parseManager.location_name = int(location_headers_selected) - 1
        else:
            parseManager.location_name = -1
        print "Location: " + str(parseManager.location_name)
        print "Extra Location" + parseManager.extra_location

    request.session['headers'] = parseManager.get_header()

    if data_loc == None:
        parseManager.type_loc = type_location
        return render(request, 'parser/parser_selector_data.html')
    else:
        parseManager.data_loc = int(data_loc) - 1
        print "Data loc: " + str(parseManager.data_loc)
        return HttpResponseRedirect('/VYD/layers/create/loadParseData')
Пример #2
0
def make_cylinder_KML(request):
    if request.method == 'POST':
        kml_name = request.POST.get('kml_name')
        color = request.POST.get('color')
        altitude = int(request.POST.get('altitude'))
        multiplier = float(request.POST.get('multiplier'))
        radius = int(request.POST.get('radius'))
        parseManager = ParseManager.getParseManager("")

        print parseManager.data
        print " "
        print " "

        print kml_name
        print color
        print altitude
        print multiplier

        dome_Generator = CylinderGenerator(parseManager.data[0], kml_name,
                                           color, altitude, multiplier, radius)
        dome_Generator.generate()
        kml_file = Kml(visibility=False)
        kml_file.file.name = 'kmls_management/static/' + kml_name
        kml_file.save()

        request.session.clear()

        return HttpResponseRedirect('/VYD/KmlManager/kmls')

    return render(request, 'presentation/presentation_form_cylinder.html')
Пример #3
0
def submit_url(request):
    # if this is a POST request we need to process the form data
    if request.method == 'POST':

        # create a form instance and populate it with data from the request:
        form = UrlForm(request.POST)
        # check whether it's valid:
        if form.is_valid():
            # process the data in form.cleaned_data as required
            # ...
            url = form.cleaned_data['url']

            print url

            parseManager = ParseManager.getParseManager(url, True)

            # redirect to a new URL:
            return HttpResponseRedirect('/VYD/layers/create/downloadPage/')

    # if a GET (or any other method) we'll create a blank form
    else:
        form = UrlForm()

    return render(request, 'parser/parser_download_url_submit.html',
                  {'form': form})
Пример #4
0
def select_data_of_header(request):
    type_location = request.POST.get(u"\u201dtype_location\u201d")
    data_loc = request.POST.get('data_loc')
    parseManager = ParseManager.getParseManager("")

    print "Location data"

    # I rest 1 for prosecute correctly on the parseManager
    if type_location == "coor":
        print "HEy I'm coordinates"
        parseManager.coor_lat = int(request.POST['location_lat']) - 1
        parseManager.coor_lng = int(request.POST['location_lng']) - 1
        print "Coor Lat: " + str(parseManager.coor_lat)
        print "Coor Lng: " + str(parseManager.coor_lng)

    elif type_location == "name":
        parseManager.extra_location = request.POST['extra_location']
        location_headers_selected = request.POST.get('location_headers_selected')
        if location_headers_selected !=None:
            parseManager.location_name = int(location_headers_selected) - 1
        else:
            parseManager.location_name =  -1
        print "Location: " + str(parseManager.location_name)
        print "Extra Location" + parseManager.extra_location

    request.session['headers'] = parseManager.get_header()

    if data_loc == None:
        parseManager.type_loc = type_location
        return render(request, 'parser/parser_selector_data.html')
    else:
        parseManager.data_loc = int(data_loc) - 1
        print "Data loc: " + str(parseManager.data_loc)
        return HttpResponseRedirect('/VYD/layers/create/loadParseData')
Пример #5
0
def make_cylinder_KML(request):
    if request.method == 'POST':
        kml_name = request.POST.get('kml_name')
        color = request.POST.get('color')
        altitude = int(request.POST.get('altitude'))
        multiplier = float(request.POST.get('multiplier'))
        radius = int(request.POST.get('radius'))
        parseManager = ParseManager.getParseManager("")

        print parseManager.data
        print " "
        print " "

        print kml_name
        print color
        print altitude
        print multiplier

        dome_Generator = CylinderGenerator(parseManager.data[0], kml_name, color, altitude, multiplier, radius)
        dome_Generator.generate()
        kml_file = Kml(visibility=False)
        kml_file.file.name = 'kmls_management/static/' + kml_name
        kml_file.save()

        request.session.clear()

        return HttpResponseRedirect('/VYD/KmlManager/kmls')

    return render(request, 'presentation/presentation_form_cylinder.html')
Пример #6
0
def redirect_for_type_location(request):
    parseManager = ParseManager.getParseManager("")
    request.session['headers'] = parseManager.get_header()

    typelocation = request.POST['type_location']
    if typelocation == "1":
        return render(request, 'parser/parser_selector_location_name.html')
    elif typelocation == "2":
        return render(request, 'parser/parser_selector_location_coordinates.html')
Пример #7
0
def redirect_for_type_location(request):
    parseManager = ParseManager.getParseManager("")
    request.session['headers'] = parseManager.get_header()

    typelocation = request.POST['type_location']
    if typelocation == "1":
        return render(request, 'parser/parser_selector_location_name.html')
    elif typelocation == "2":
        return render(request,
                      'parser/parser_selector_location_coordinates.html')
Пример #8
0
def parse_data(request):
    parseManager = ParseManager.getParseManager("")

    if parseManager.type_loc == "name":
        print parseManager.get_data_by_location(parseManager.data_loc, parseManager.location_name, "")
    elif parseManager.type_loc == "coor":
        print parseManager.get_data_by_coordinates(parseManager.data_loc, parseManager.coor_lat, parseManager.coor_lng)

    else:
        return render(request, 'error_page.html')

    return HttpResponseRedirect('/VYD/layers/create/viewDataAndLocation/')
Пример #9
0
def parse_data(request):
    parseManager = ParseManager.getParseManager("")

    if parseManager.type_loc == "name":
        print parseManager.get_data_by_location(parseManager.data_loc,
                                                parseManager.location_name, "")
    elif parseManager.type_loc == "coor":
        print parseManager.get_data_by_coordinates(parseManager.data_loc,
                                                   parseManager.coor_lat,
                                                   parseManager.coor_lng)

    else:
        return render(request, 'error_page.html')

    return HttpResponseRedirect('/VYD/layers/create/viewDataAndLocation/')
Пример #10
0
def view_data_and_location_selected(request):
    parseManager = ParseManager.getParseManager("")

    request.session['data_set'] = ParseManager.data

    setData = []
    setCoordinates = []

    for line in parseManager.data[0]:
        print line
        setData.append(line['data'])

    # print "DATA In PARSE MANAGER : "
    # print parseManager.data

    return render(request, 'parser/parser_result_data.html',
                  {'data_set': parseManager.data[0]})
Пример #11
0
def view_data_and_location_selected(request):
    parseManager = ParseManager.getParseManager("")

    request.session['data_set'] = ParseManager.data

    setData = []
    setCoordinates = []

    for line in parseManager.data[0]:
        print line
        setData.append(line['data'])


    # print "DATA In PARSE MANAGER : "
    # print parseManager.data


    return render(request, 'parser/parser_result_data.html', {'data_set': parseManager.data[0]})
Пример #12
0
def download_file(request):
    # if this is a POST request we need to process the form data
    if request.method == 'POST':

        parseManager = ParseManager.getParseManager("")
        parseManager.parse()
        name = parseManager.get_file_name()
        print name
        type = parseManager.get_type_file()

        request.session['name'] = name
        request.session['type'] = type

        return HttpResponseRedirect('/VYD/layers/create/fileInfo/')

    # if a GET (or any other method) we'll create a blank form
    else:

        return HttpResponseRedirect('/VYD/layers/create/submitUrl/')
Пример #13
0
def download_file(request):
    # if this is a POST request we need to process the form data
    if request.method == 'POST':

        parseManager = ParseManager.getParseManager("")
        parseManager.parse()
        name = parseManager.get_file_name()
        print name
        type = parseManager.get_type_file()

        request.session['name'] = name
        request.session['type'] = type

        return HttpResponseRedirect('/VYD/layers/create/fileInfo/')

    # if a GET (or any other method) we'll create a blank form
    else:

        return HttpResponseRedirect('/VYD/layers/create/submitUrl/')
Пример #14
0
def make_marker_KML(request):
    if request.method == 'POST':
        kml_name = request.POST.get('kml_name')
        icon_marker = request.POST.get('icon_marker')
        print " "
        print " "
        print kml_name
        print icon_marker

        parseManager = ParseManager.getParseManager("")

        print parseManager.data

        markerTours = MarkersTour(parseManager.data[0], kml_name, icon_marker)

        markerTours.makeFile()

        kml_file = Kml(visibility=False)
        kml_file.file.name = 'kmls_management/static/' + kml_name
        kml_file.save()
        request.session.clear()
        return HttpResponseRedirect('/VYD/KmlManager/kmls')

    return render(request, 'presentation/presentation_form_markers.html')
Пример #15
0
def make_marker_KML(request):
    if request.method == 'POST':
        kml_name = request.POST.get('kml_name')
        icon_marker = request.POST.get('icon_marker')
        print " "
        print " "
        print kml_name
        print icon_marker

        parseManager = ParseManager.getParseManager("")

        print parseManager.data

        markerTours = MarkersTour(parseManager.data[0], kml_name, icon_marker)

        markerTours.makeFile()

        kml_file = Kml(visibility=False)
        kml_file.file.name = 'kmls_management/static/' + kml_name
        kml_file.save()
        request.session.clear()
        return HttpResponseRedirect('/VYD/KmlManager/kmls')

    return render(request, 'presentation/presentation_form_markers.html')
Пример #16
0
def submit_url(request):
    # if this is a POST request we need to process the form data
    if request.method == 'POST':

        # create a form instance and populate it with data from the request:
        form = UrlForm(request.POST)
        # check whether it's valid:
        if form.is_valid():
            # process the data in form.cleaned_data as required
            # ...
            url = form.cleaned_data['url']

            print url

            parseManager = ParseManager.getParseManager(url, True)

            # redirect to a new URL:
            return HttpResponseRedirect('/VYD/layers/create/downloadPage/')

    # if a GET (or any other method) we'll create a blank form
    else:
        form = UrlForm()

    return render(request, 'parser/parser_download_url_submit.html', {'form': form})