Permalink
Browse files

moved apps/geocamLens content into separate repo submodules/geocamLen…

…sWeb
  • Loading branch information...
1 parent 4f39923 commit 08a3cd873052f114fd47773041b92d93380e8a3c @trey0 committed Mar 10, 2011
Showing with 13 additions and 4,694 deletions.
  1. +2 −3 .gitignore
  2. +9 −1 .gitmodules
  3. +0 −145 apps/geocamLens/SearchAbstract.py
  4. +0 −18 apps/geocamLens/SearchSimple.py
  5. +0 −105 apps/geocamLens/UploadClient.py
  6. +0 −106 apps/geocamLens/ViewKml.py
  7. +0 −245 apps/geocamLens/ViewLensAbstract.py
  8. +0 −20 apps/geocamLens/ViewLensSimple.py
  9. +0 −39 apps/geocamLens/__init__.py
  10. +0 −13 apps/geocamLens/admin.py
  11. +0 −225 apps/geocamLens/bin/simpleImport.py
  12. +0 −13 apps/geocamLens/defaultSettings.py
  13. +0 −47 apps/geocamLens/forms.py
  14. 0 apps/geocamLens/management/__init__.py
  15. 0 apps/geocamLens/management/appCommands/__init__.py
  16. +0 −47 apps/geocamLens/management/appCommands/prep.py
  17. +0 −83 apps/geocamLens/media_src/icons/aerialhazard.svg
  18. +0 −83 apps/geocamLens/media_src/icons/aerialignition.svg
  19. +0 −103 apps/geocamLens/media_src/icons/base.svg
  20. +0 −125 apps/geocamLens/media_src/icons/commandpost.svg
  21. +0 −413 apps/geocamLens/media_src/icons/damaged.svg
  22. +0 −90 apps/geocamLens/media_src/icons/downlink.svg
  23. +0 −113 apps/geocamLens/media_src/icons/droppoint.svg
  24. +0 −173 apps/geocamLens/media_src/icons/fireline.svg
  25. +0 −181 apps/geocamLens/media_src/icons/fireorigin.svg
  26. +0 −95 apps/geocamLens/media_src/icons/hazmat.svg
  27. +0 −366 apps/geocamLens/media_src/icons/helispot.svg
  28. +0 −211 apps/geocamLens/media_src/icons/hotspot.svg
  29. +0 −253 apps/geocamLens/media_src/icons/relativelysafe.svg
  30. +0 −103 apps/geocamLens/media_src/icons/repeater.svg
  31. +0 −140 apps/geocamLens/media_src/icons/safetyzone.svg
  32. +0 −138 apps/geocamLens/media_src/icons/spotfire.svg
  33. +0 −103 apps/geocamLens/media_src/icons/stagingarea.svg
  34. +0 −86 apps/geocamLens/media_src/icons/unsafe.svg
  35. +0 −144 apps/geocamLens/media_src/icons/warning.svg
  36. +0 −105 apps/geocamLens/media_src/icons/watersource.svg
  37. +0 −427 apps/geocamLens/models.py
  38. BIN apps/geocamLens/static/geocamLens/icons/map/camera.png
  39. BIN apps/geocamLens/static/geocamLens/icons/map/cameraPoint.png
  40. +0 −34 apps/geocamLens/templates/editImage.html
  41. +0 −9 apps/geocamLens/templates/editImageWrapper.html
  42. +0 −13 apps/geocamLens/templates/upload.html
  43. +0 −30 apps/geocamLens/tests.py
  44. +0 −46 apps/geocamLens/urls.py
  45. +1 −0 submodules/geocamAwareWeb
  46. +1 −0 submodules/geocamLensWeb
View
@@ -1,9 +1,6 @@
*~
\#*
*.pyc
-*--gds.*
-*--geocam.*
-*--tracking.*
/build
/apps/*/build
/data
@@ -14,3 +11,5 @@
/sourceme.sh
/gigapan
/apps/geocamUtil
+/apps/geocamAware
+/apps/geocamLens
View
@@ -1,3 +1,11 @@
[submodule "submodules/geocamUtilWeb"]
path = submodules/geocamUtilWeb
- url = git@github.com:geocam/geocamUtilWeb.git
+ url = git://github.com/geocam/geocamUtilWeb.git
+
+[submodule "submodules/geocamAwareWeb"]
+ path = submodules/geocamAwareWeb
+ url = git://github.com/geocam/geocamAwareWeb.git
+
+[submodule "submodules/geocamLensWeb"]
+ path = submodules/geocamLensWeb
+ url = git://github.com/geocam/geocamLensWeb.git
@@ -1,145 +0,0 @@
-# __BEGIN_LICENSE__
-# Copyright (C) 2008-2010 United States Government as represented by
-# the Administrator of the National Aeronautics and Space Administration.
-# All Rights Reserved.
-# __END_LICENSE__
-
-import re
-import sys
-
-from django.db.models import Q
-
-from geocamUtil import TimeUtil
-
-class BadQuery(Exception):
- pass
-
-class SearchAbstract:
- # override these settings in derived classes
- getAllFeatures = None
- fields = ()
- fieldAliases = ()
- timeField = 'timestamp'
-
- def __init__(self):
- self.flookup = dict([(name, name) for name in self.fields])
- self.flookup.update(dict(self.fieldAliases))
-
- def filterFieldBefore(self, query, clause, field, term, negated):
- if negated:
- raise BadQuery("Oops, can't use minus sign with BEFORE in clause '%s' of search '%s'" % (clause, query))
- try:
- # intervalStart=False to get end of specified interval
- # (inclusive before)
- utcDT = TimeUtil.stringToUtcDT(term, intervalStart=False)
- except ValueError, msg:
- raise BadQuery("Oops, %s in clause '%s' of search '%s'"
- % (msg, clause, query))
- return Q(**{self.timeField+'__lte': utcDT})
-
- def filterFieldAfter(self, query, clause, field, term, negated):
- if negated:
- raise BadQuery("Oops, can't use minus sign with AFTER in clause '%s' of search '%s'" % (clause, query))
- try:
- # intervalStart=True to get start of specified interval
- # (inclusive after)
- utcDT = TimeUtil.stringToUtcDT(term, intervalStart=True)
- except ValueError, msg:
- raise BadQuery("Oops, %s in clause '%s' of search '%s'"
- % (msg, clause, query))
- return Q(**{self.timeField+'__gte': utcDT})
-
- def filterFieldDefault(self, query, clause, field, term, negated):
- if field == None:
- fields = self.flookup.keys()
- elif field not in self.flookup:
- raise BadQuery("Oops, can't understand field name '%s' of search '%s'. Legal field names are: %s."
- % (field, query, ', '.join(self.flookup.keys())))
- else:
- fields = [field]
- if not re.search('^[\.\-\_a-zA-Z0-9]*$', term):
- raise BadQuery("Oops, can't understand term '%s' in search '%s'. Terms must contain only letters, numbers, periods, hyphens, and underscores."
- % (term, query))
- if term == '':
- raise BadQuery("Oops, empty search term in clause '%s' of search '%s'."
- % (clause, query))
- qfilter = Q()
- for f in fields:
- dbField = self.flookup[f]
- qAdd = Q(**{dbField+'__icontains': term})
- if negated:
- qfilter = qfilter & ~qAdd
- else:
- qfilter = qfilter | qAdd
- return qfilter
-
- def filterField(self, query, clause, field, term, negated):
- if field:
- filterFuncName = 'filterField'+field.capitalize()
- if hasattr(self, filterFuncName):
- filterFunc = getattr(self, filterFuncName)
- return filterFunc(query, clause, field, term, negated)
- return self.filterFieldDefault(query, clause, field, term, negated)
-
- def filterClause(self, query, clause):
- if clause.startswith('-'):
- negated = True
- clause = clause[1:]
- else:
- negated = False
- if ':' in clause:
- field, term = clause.split(':', 1)
- field = field.lower()
- else:
- field, term = None, clause
- return self.filterField(query, clause, field, term, negated)
-
- def queryTreeToString(self, queryTree):
- return (' OR '
- .join(['(%s)' % (' AND '
- .join(['"%s"' % clause
- for clause in term]))
- for term in queryTree]))
-
- def parseQuery(self, query):
- if not re.search('^[\-\.\:\_a-zA-Z0-9 ]*$', query):
- raise BadQuery("Oops, can't understand search '%s'. Searches must contain only letters, numbers, minus signs, colons, periods, underscores, and spaces."
- % query)
- queryClauses = query.split()
- #print >>sys.stderr, 'queryClauses:', queryClauses
-
- queryTree = [[]]
- for clause in queryClauses:
- if clause.lower() == 'or':
- if queryTree[-1] == []:
- raise BadQuery("Oops, 'or' must come between normal clauses in search '%s'" % query)
- queryTree.append([])
- elif clause.lower() == 'and':
- if queryTree[-1] == []:
- raise BadQuery("Oops, 'and' must come between normal clauses in search '%s'")
- # ignore -- 'and' is default connective
- else:
- queryTree[-1].append(clause)
- #print >>sys.stderr, 'queryTree:', queryTreeToString(queryTree)
- return queryTree
-
- def treeToFilter(self, query, queryTree):
- queryFilter = Q()
- for term in queryTree:
- termFilter = Q()
- for clause in term:
- clauseFilter = self.filterClause(query, clause)
- termFilter = termFilter & clauseFilter
- queryFilter = queryFilter | termFilter
- return queryFilter
-
- def searchFeatures0(self, startSet, query):
- queryTree = self.parseQuery(query)
- queryFilter = self.treeToFilter(query, queryTree)
- return startSet.filter(queryFilter)
-
- def searchFeatures(self, startSet, query):
- result = startSet
- if query:
- result = self.searchFeatures0(result, query)
- return result.distinct().order_by('-'+self.timeField)
@@ -1,18 +0,0 @@
-# __BEGIN_LICENSE__
-# Copyright (C) 2008-2010 United States Government as represented by
-# the Administrator of the National Aeronautics and Space Administration.
-# All Rights Reserved.
-# __END_LICENSE__
-
-from geocamCore.models import PointFeature
-
-from geocamLens.SearchAbstract import SearchAbstract
-
-class SearchSimple(SearchAbstract):
- def getAllFeatures(self):
- return PointFeature.objects.filter(processed=True)
-
- fields = ('name', 'user', 'notes', 'tags', 'uuid')
- timeField = 'timestamp' # FIX: handle features with non-zero time extent
- # pairs (user-facing-field-name, django-field-name)
- fieldAliases = (('user', 'author__username'),)
@@ -1,105 +0,0 @@
-# __BEGIN_LICENSE__
-# Copyright (C) 2008-2010 United States Government as represented by
-# the Administrator of the National Aeronautics and Space Administration.
-# All Rights Reserved.
-# __END_LICENSE__
-
-import os
-import urllib2
-import tempfile
-import re
-import base64
-
-import PIL.Image
-
-from geocamUtil import MimeMultipartFormData
-
-class UploadClient:
- def __init__(self, url, userName='root', password=''):
- self.url = url
- self.userName = userName
- self.password = password
-
- self.imageName = None
- self.im = None
-
- def addAuthentication(self, headers, url):
- '''update headers and return transformed url to support share
- basic authentication.'''
- if self.password:
- # ensure https so we don't send password unencrypted
- assert url.startswith('http')
- url = re.sub(r'^http:', 'https:', url)
- # new-style url which does not include userName
- url = '%s/upload-m/' % url
- # add pre-emptive basic authentication
- auth = base64.encodestring('%s:%s' % (self.userName, self.password))[:-1]
- headers['Authorization'] = 'Basic %s' % auth
- else:
- # no password means use old-style upload
- url = '%s/upload/%s/' % (url, self.userName)
- return url
-
- def uploadImage(self, imageName, attributes, downsampleFactor=1):
- if downsampleFactor != 1:
- im = PIL.Image.open(imageName)
- w, h = im.size
- thRes = (w//downsampleFactor, h//downsampleFactor)
- im.thumbnail(thRes, PIL.Image.ANTIALIAS)
- fd, tmpName = tempfile.mkstemp('uploadImageThumb.jpg')
- os.close(fd)
- im.save(tmpName)
- del im
- imageData = file(tmpName, 'r').read()
- os.unlink(tmpName)
- else:
- imageData = file(imageName, 'r').read()
-
- #cookieProcessor = urllib2.HTTPCookieProcessor()
- opener = urllib2.build_opener() # (cookieProcessor)
- headers = {'User-Agent': 'GeoCam Upload Tester'}
-
- multipart = MimeMultipartFormData.MimeMultipartFormData()
- for k, v in attributes.iteritems():
- multipart[k] = v
- multipart.addFile(name='photo',
- filename=os.path.basename(imageName),
- data=imageData,
- contentType='image/jpeg')
-
- h2 = headers.copy()
- h2.update(multipart.getHeaders())
- url = self.addAuthentication(h2, self.url)
- req = urllib2.Request(url=url,
- data=multipart.getPostData(),
- headers=h2)
- resp = opener.open(req)
- return resp
-
- def uploadTrack(self, url, trackName, attributes=None):
- trackData = file(trackName, 'r').read()
-
- if attributes == None:
- attributes = dict(trackUploadProtocolVersion='1.0')
-
- #cookieProcessor = urllib2.HTTPCookieProcessor()
- opener = urllib2.build_opener() # (cookieProcessor)
- headers = {'User-Agent': 'GeoCam Upload Tester'}
- url = '%s/track' % self.url
-
- multipart = MimeMultipartFormData.MimeMultipartFormData()
- for k, v in attributes.iteritems():
- multipart[k] = v
- multipart.addFile(name='gpxFile',
- filename=os.path.basename(trackName),
- data=trackData,
- contentType='text/xml')
-
- h2 = headers.copy()
- h2.update(multipart.getHeaders())
- url = self.addAuthentication(h2, url)
- req = urllib2.Request(url=url,
- data=multipart.getPostData(),
- headers=h2)
- resp = opener.open(req)
- return resp
Oops, something went wrong.

0 comments on commit 08a3cd8

Please sign in to comment.