Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

finished changes to website for sve. #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions src/web_server/admin.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<!DOCTYPE html>
<html>
<head>
<title>GroundsBot</title>
<meta charset="utf-8">

<!-- Support for browsers on mobile phones. -->
<meta name="viewport"
content="width=device-width, initial-scale=1, user-scalable=no">

<!-- Google Web Fonts. -->
<link href='https://fonts.googleapis.com/css?family=Roboto+Condensed'
rel='stylesheet' type='text/css'>

<!-- Custom CSS styles for our application. -->
<link rel="stylesheet" href="/static/admin.css">

<!-- The Google JavaScript loader tool (for the Maps, Charts APIs). -->
<script src="https://www.google.com/jsapi"></script>

<!-- Our custom JavaScript for grudsby Lights. -->
<script src="/static/admin.js"></script>

</head>
<body>

<!-- The DOM of our application. -->
<div class="grudsby">

<!-- The title of the application. -->
<h1>GroundsBot Admin</h1>

<!-- The button to draw a polygon. -->
<button class="addObstacle">Add New Obstacle</button>

<!-- The button to draw a polygon. -->
<button class="clearObstacles">Clear All Obstacles</button>

<!-- The button to draw a polygon. -->
<button class="drawRegion">Draw New Geofence</button>

<!-- A container which the Maps API will populate with a map. -->
<div class="map"></div>

<img id="grudsby" src="/static/grudsby_top_tiny.png"/>

<img id="pylon" src="/static/some_beach_tiny.png"/>

<a href="https://earthengine.google.org">
<img class="powered-by-ee"
alt="Powered by Google Earth Engine"
src="/static/google_earthengine_powered_400px.png">
</a>
</div>

<!-- Boot our JavaScript once the body has loaded. -->
<script>
grudsby.boot(
'{{ eeMapId | safe }}',
'{{ eeToken | safe }}');
</script>

</body>
</html>
Binary file modified src/web_server/config.pyc
Binary file not shown.
3 changes: 2 additions & 1 deletion src/web_server/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ <h1>GroundsBot Mowing Selection</h1>

<img id="grudsby" src="/static/grudsby_top_tiny.png"/>

<img id="pylon" src="/static/some_beach_tiny.png"/>

<a href="https://earthengine.google.org">
<img class="powered-by-ee"
alt="Powered by Google Earth Engine"
src="/static/google_earthengine_powered_400px.png">
</a>
</div>


<!-- Boot our JavaScript once the body has loaded. -->
<script>
grudsby.boot(
Expand Down
Binary file modified src/web_server/pyasn1/__init__.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1/codec/__init__.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1/codec/ber/__init__.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1/codec/ber/decoder.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1/codec/ber/encoder.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1/codec/ber/eoo.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1/codec/cer/__init__.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1/codec/cer/decoder.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1/codec/cer/encoder.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1/codec/der/__init__.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1/codec/der/decoder.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1/codec/der/encoder.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1/compat/__init__.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1/compat/octets.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1/debug.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1/error.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1/type/__init__.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1/type/base.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1/type/char.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1/type/constraint.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1/type/error.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1/type/namedtype.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1/type/namedval.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1/type/tag.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1/type/tagmap.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1/type/univ.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1/type/useful.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1_modules/__init__.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1_modules/pem.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1_modules/rfc2251.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1_modules/rfc2459.pyc
Binary file not shown.
Binary file modified src/web_server/pyasn1_modules/rfc5208.pyc
Binary file not shown.
Binary file modified src/web_server/rsa/__init__.pyc
Binary file not shown.
Binary file modified src/web_server/rsa/_compat.pyc
Binary file not shown.
Binary file modified src/web_server/rsa/common.pyc
Binary file not shown.
Binary file modified src/web_server/rsa/core.pyc
Binary file not shown.
Binary file modified src/web_server/rsa/key.pyc
Binary file not shown.
Binary file modified src/web_server/rsa/pem.pyc
Binary file not shown.
Binary file modified src/web_server/rsa/pkcs1.pyc
Binary file not shown.
Binary file modified src/web_server/rsa/prime.pyc
Binary file not shown.
Binary file modified src/web_server/rsa/randnum.pyc
Binary file not shown.
Binary file modified src/web_server/rsa/transform.pyc
Binary file not shown.
92 changes: 91 additions & 1 deletion src/web_server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,45 @@ def get(self, path=''):
template = JINJA2_ENVIRONMENT.get_template('index.html')
self.response.out.write(template.render(template_values))

class AdminHandler(webapp2.RequestHandler):
"""A servlet to handle requests to load the main grudsby web page."""
def get(self, path=''):
mapid = GetgrudsbyMapId()
template_values = {
'eeMapId': mapid['mapid'],
'eeToken': mapid['token']
}
template = JINJA2_ENVIRONMENT.get_template('admin.html')
self.response.out.write(template.render(template_values))

class GeofenceHandler(webapp2.RequestHandler):
"""A servlet to handle requests for details about a Geofence."""
def get(self):
polygon_id = self.request.get('polygon_id')
loadedPath = getString(polygon_id + "_geofence")
try:
content = json.dumps(json.loads(loadedPath), sort_keys=True, indent=2)
except ValueError, e:
content = json.dumps({'error': 'Stored data not formatted correctly'})
self.response.headers['Content-Type'] = 'application/json'
self.response.out.write(content)

class SaveGeofenceHandler(webapp2.RequestHandler):
"""A servlet to save details about a Region."""
def get(self):
rawJson = str(self.request.get('jsonData'))
try:
polygonData = json.loads(rawJson)
except ValueError, e:
False
if ('coordinates' in polygonData and 'regionID' in polygonData):
content = json.dumps({'result': 'Successfully received region ' + polygonData['regionID']})
setString(polygonData['regionID']+"_geofence", json.dumps(polygonData, ensure_ascii=False))
else:
content = json.dumps({'error': 'Request not formatted correctly'})
self.response.headers['Content-Type'] = 'application/json'
self.response.out.write(content)


class RegionHandler(webapp2.RequestHandler):
"""A servlet to handle requests for details about a Region."""
Expand Down Expand Up @@ -155,13 +194,61 @@ def get(self):
self.response.out.write(content)


class ObstaclesHandler(webapp2.RequestHandler):
"""A servlet to handle requests for details about an Approval."""
def get(self):
loadedPath = getString("obstacles")
try:
content = json.dumps(json.loads(loadedPath), sort_keys=True, indent=2)
except ValueError, e:
content = json.dumps({'error': 'Stored data not formatted correctly'})
self.response.headers['Content-Type'] = 'application/json'
self.response.out.write(content)


class ClearObstaclesHandler(webapp2.RequestHandler):
"""A servlet to handle requests for details about an Approval."""
def get(self):
setString('obstacles',"{\"obstacles\":[]}")
content = json.dumps({'result':'cleared the obstacles'})
self.response.headers['Content-Type'] = 'application/json'
self.response.out.write(content)



class AddObstacleHandler(webapp2.RequestHandler):
"""A servlet to add an Obstacle."""
def get(self):
rawJson = str(self.request.get('jsonData'))
try:
obstaclePos = json.loads(rawJson)
except ValueError, e:
False
if ('lat' in obstaclePos and 'lng' in obstaclePos):
content = json.dumps({'result': 'Successfully received obstacle position.'})
obstacles = getString("obstacles")
try:
obstaclesJSON = json.loads(obstacles)
obstaclesJSON["obstacles"].append({"lat":obstaclePos['lat'],"lng":obstaclePos['lng']})
setString("obstacles", json.dumps(obstaclesJSON))
except ValueError, e:
setString('obstacles',"{\"obstacles\":[{\"lat\":"+str(obstaclePos['lat'])+",\"lng\":"+str(obstaclePos['lng'])+"}]}")
content = json.dumps({'error': 'Stored data not formatted correctly. Added new obstacles object'})

else:
content = json.dumps({'error': ' Received data not formatted correctly'})
self.response.headers['Content-Type'] = 'application/json'
self.response.out.write(content)



# Define webapp2 routing from URL paths to web request handlers. See:
# http://webapp-improved.appspot.com/tutorials/quickstart.html
app = webapp2.WSGIApplication([
#('/details', DetailsHandler),
('/', MainHandler),
('/admin', AdminHandler),
('/geofence', GeofenceHandler),
('/saveGeofence', SaveGeofenceHandler),
('/region', RegionHandler),
('/saveRegion', SaveRegionHandler),
('/plan', MowingPlanHandler),
Expand All @@ -170,6 +257,9 @@ def get(self):
('/setApproval', SetApprovalHandler),
('/mowerPos', MowerPosHandler),
('/setMowerPos', SetMowerPosHandler),
('/obstacles', ObstaclesHandler),
('/clearObstacles', ClearObstaclesHandler),
('/addObstacle', AddObstacleHandler)
])


Expand Down
Binary file modified src/web_server/server.pyc
Binary file not shown.
Binary file modified src/web_server/six.pyc
Binary file not shown.
Loading