Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Pierre GIRAUD
committed
Jul 9, 2011
1 parent
37ba394
commit f3c750c
Showing
30 changed files
with
990 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
OSMTM.egg-info/ | ||
data/ | ||
*.pyc | ||
env/ | ||
build/ | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
0.0 | ||
--- | ||
|
||
- Initial version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
include *.txt *.ini *.cfg *.rst | ||
recursive-include OSMTM *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from pyramid_beaker import session_factory_from_settings | ||
from pyramid.config import Configurator | ||
from sqlalchemy import engine_from_config | ||
|
||
from OSMTM.models import initialize_sql | ||
|
||
def main(global_config, **settings): | ||
""" This function returns a Pyramid WSGI application. | ||
""" | ||
|
||
settings['mako.directories'] = 'OSMTM:templates' | ||
engine = engine_from_config(settings, 'sqlalchemy.') | ||
initialize_sql(engine) | ||
config = Configurator(settings=settings) | ||
|
||
session_factory = session_factory_from_settings(settings) | ||
config.set_session_factory(session_factory) | ||
|
||
config.add_static_view('static', 'OSMTM:static') | ||
config.add_route('home', '/') | ||
config.add_route('login', '/login') | ||
config.add_route('logout', '/logout') | ||
config.add_route('job_new', '/job/new') | ||
config.add_route('job', '/job/{id}') | ||
config.add_route('osmproxy', '/osmproxy') | ||
config.add_route('oauth_callback', '/oauth_callback') | ||
config.scan() | ||
|
||
import papyrus_ogcproxy | ||
config.include(papyrus_ogcproxy) | ||
return config.make_wsgi_app() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import transaction | ||
|
||
from sqlalchemy import Column | ||
from sqlalchemy import Integer | ||
from sqlalchemy import Unicode | ||
|
||
from sqlalchemy.exc import IntegrityError | ||
from sqlalchemy.ext.declarative import declarative_base | ||
|
||
from sqlalchemy.orm import scoped_session | ||
from sqlalchemy.orm import sessionmaker | ||
|
||
from zope.sqlalchemy import ZopeTransactionExtension | ||
|
||
DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension())) | ||
Base = declarative_base() | ||
|
||
class Job(Base): | ||
""" The SQLAlchemy declarative model class for a Page object. """ | ||
__tablename__ = 'jobs' | ||
id = Column(Integer, primary_key=True) | ||
title = Column(Unicode, unique=True) | ||
description = Column(Unicode) | ||
geometry = Column(Unicode) | ||
workflow = Column(Unicode) | ||
zoom = Column(Integer) | ||
|
||
def __init__(self, title=None, description=None, geometry=None, workflow=None, zoom=None): | ||
self.title = title | ||
self.descript = description | ||
self.geometry = geometry | ||
self.workflow = workflow | ||
self.zoom = zoom | ||
|
||
def populate(): | ||
session = DBSession() | ||
job = Job(u'Sendai Quake, Spot Imagery Tracing', | ||
u'A short description', | ||
'POLYGON((15682967.276231 4613965.847168, 15683464.116915 4611581.6652221, 15686330.505475 4612019.5348445, 15687247.749814 4613868.5228206, 15686330.505475 4616058.5430414, 15685260.387079 4615961.1989223, 15682967.276231 4613965.847168))', | ||
u'Trace buildings from satellite imagery, Survey buildings to create attribute information, Enter survey information, Quality Assurance Check by Work Lead', | ||
12) | ||
session.add(job) | ||
session.flush() | ||
transaction.commit() | ||
|
||
def initialize_sql(engine): | ||
DBSession.configure(bind=engine) | ||
Base.metadata.bind = engine | ||
Base.metadata.create_all(engine) | ||
try: | ||
populate() | ||
except IntegrityError: | ||
# already created | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ADMIN_USERS = ['pgiraud', 'fvdb'] |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
var map = new OpenLayers.Map('map', { | ||
controls: [] | ||
}); | ||
var osm = new OpenLayers.Layer.OSM(); | ||
map.addLayer(osm); | ||
var layer = new OpenLayers.Layer.Vector("Objects", { | ||
style: { | ||
strokeColor: "blue", | ||
strokeWidth: 3, | ||
strokeOpacity: 0.5, | ||
fillOpacity: 0.2, | ||
fillColor: "lightblue", | ||
pointRadius: 6 | ||
}, | ||
projection: new OpenLayers.Projection("EPSG:4326"), | ||
displayInLayerSwitcher: false | ||
}); | ||
|
||
map.addLayer(layer); | ||
|
||
var format = new OpenLayers.Format.WKT(); | ||
layer.addFeatures(format.read(geometry)); | ||
map.zoomToExtent(layer.getDataExtent()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
var map = null; | ||
$('#id_relation') | ||
.blur(function() { | ||
$('#relation_map').show(); | ||
map && map.destroy(); | ||
map = new OpenLayers.Map('map', { | ||
controls: [] | ||
}); | ||
var osm = new OpenLayers.Layer.OSM(); | ||
map.addLayer(osm); | ||
OpenLayers.ProxyHost = '/osmproxy?url='; | ||
|
||
var url = "http://www.openstreetmap.org/api/0.6/relation/" + this.value + '/full'; | ||
var layer = new OpenLayers.Layer.GML("Objects", url, { | ||
format: OpenLayers.Format.OSM, | ||
style: { | ||
strokeColor: "blue", | ||
strokeWidth: 3, | ||
strokeOpacity: 0.5, | ||
fillOpacity: 0.2, | ||
fillColor: "lightblue", | ||
pointRadius: 6 | ||
}, | ||
projection: new OpenLayers.Projection("EPSG:4326"), | ||
displayInLayerSwitcher: false | ||
}); | ||
|
||
layer.events.register("loadend", layer, function() { | ||
map.zoomToExtent(layer.getDataExtent()); | ||
var format = new OpenLayers.Format.WKT(); | ||
$('#geometry')[0].value = format.write(layer.features[0]); | ||
}); | ||
|
||
map.addLayer(layer); | ||
|
||
layer.loadGML(); | ||
}); | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.