Skip to content

Commit

Permalink
Merged in andyneff/sattel_voxel_globe/get_site_geometry (pull request #…
Browse files Browse the repository at this point in the history
…56)

Get_site_geometry
  • Loading branch information
andyneff committed Aug 10, 2016
2 parents bb0edc2 + 793fc16 commit 76e757c
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 7 deletions.
14 changes: 7 additions & 7 deletions just
Original file line number Diff line number Diff line change
Expand Up @@ -895,23 +895,23 @@ while (( $# > 0 )); do
shift 1
;;
le-cert) # Runs let's encrypt, registering a certificate against $1
${DOCKER_EXEC} ${VIP_DOCKER_HTTPD_CONTAINER_NAME} /opt/vip/wrap \
${DOCKER_EXEC} ${VIP_DOCKER_HTTPD_CONTAINER_NAME} ${WIN}/opt/vip/wrap \
./conf/monkey_certbot certonly -n --apache \
--domains=$1 --apache-server-root=/usr/local/apache2 \
--apache-handle-sites /usr/local/apache2/conf \
--domains=$1 --apache-server-root=${WIN}/usr/local/apache2 \
--apache-handle-sites ${WIN}/usr/local/apache2/conf \
--agree-tos --email ${VIP_ADMIN_EMAIL} \
--apache-challenge-location /tmp
--apache-challenge-location ${WIN}/tmp
#I don't know WHY I need to do this, but oh well...
${DOCKER_EXEC} ${VIP_DOCKER_HTTPD_CONTAINER_NAME} \
chmod -R 755 ${VIP_HTTPD_SSL_DIR_DOCK}
chmod -R 755 ${WIN}${VIP_HTTPD_SSL_DIR_DOCK}
shift 1
;;
le-renew) #Renews let's encrypt certificate
${DOCKER_EXEC} ${VIP_DOCKER_HTTPD_CONTAINER_NAME} /opt/vip/wrap \
${DOCKER_EXEC} ${VIP_DOCKER_HTTPD_CONTAINER_NAME} ${WIN}/opt/vip/wrap \
./conf/monkey_certbot renew -n --apache
#I don't know WHY I need to do this, but oh well...
${DOCKER_EXEC} ${VIP_DOCKER_HTTPD_CONTAINER_NAME} \
chmod -R 755 ${VIP_HTTPD_SSL_DIR_DOCK}
chmod -R 755 ${WIN}${VIP_HTTPD_SSL_DIR_DOCK}
;;
help) # Please see 'help' to see what this command does
echo "List of possible J.U.S.T. commands:"
Expand Down
1 change: 1 addition & 0 deletions voxel_globe/event_trigger/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
url(r'^create_event_trigger$', views.create_event_trigger, name='create_event_trigger'),
url(r'^update_geometry_polygon$', views.update_geometry_polygon , name='update_geometry_polygon'),
url(r'^get_event_geometry$', views.get_event_geometry, name='get_event_geometry'),
url(r'^get_site_geometry$', views.get_site_geometry, name='get_site_geometry'),
url(r'^run_event_trigger$', views.run_event_trigger, name='run_event_trigger'),
url(r'^eventTriggerCreator/$', views.eventTriggerCreator, name='eventTriggerCreator'),
)
34 changes: 34 additions & 0 deletions voxel_globe/event_trigger/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,40 @@ def get_event_geometry(request):

return HttpResponse(json.dumps(points))

def get_site_geometry(request):
import json
from django.shortcuts import HttpResponse
import voxel_globe.meta.models as models
import brl_init
import vpgl_adaptor_boxm2_batch as vpgl_adaptor

image_id = int(request.GET['image_id'])
site_id = int(request.GET['site_id'])

image = models.Image.objects.get(id=image_id)
site = models.SattelSite.objects.get(id=site_id)
camera = image.camera_set.filter(cameraset=site.camera_set).select_subclasses('rpccamera')[0]
vxl_camera = vpgl_adaptor.load_rational_camera_from_txt(camera.rpc_path)

x1 = site.bbox_min[0]
y1 = site.bbox_min[1]
x2 = site.bbox_max[0]
y2 = site.bbox_max[1]
z = site.bbox_min[2]

points = []
coords = [[x1,y1,z],
[x1,y2,z],
[x2,y2,z],
[x2,y1,z],
[x1,y1,z]]

for coord in coords:
points.append(vpgl_adaptor.project_point(vxl_camera, *coord))

return HttpResponse(json.dumps(points))


def create_event_trigger(request):
import voxel_globe.meta.models as models
from django.contrib.gis.geos import Point, Polygon
Expand Down

0 comments on commit 76e757c

Please sign in to comment.