Wykres commitów

601 Commity (e62162fb38e261c2255220fd9d880e78875ada60)

Autor SHA1 Wiadomość Data
Yauhen Kharuzhy c3553b687c Belarusian (be) translation
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-10-29 14:40:27 -07:00
Joan Montané cea2e23359 Updated Catalan translation
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-10-22 09:29:01 -07:00
Rodrigo de Avila e691bff538 Portuguese (pt_BR) translation update
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-10-19 10:05:43 -07:00
Maxime Petazzoni c122be94c0 Merge commit 'remotes/public/d2-ocitysmap2' 2010-10-11 15:34:12 -07:00
David Decotigny c026a81ba6 Renamed --polygon-osmid cmdline option as --osmid 2010-10-11 10:13:14 +02:00
David Decotigny aafa11268b Fixed references to Poygon ctor in shapely 2010-10-11 10:11:16 +02:00
David Decotigny 6ecb283a8e Fix trivial error due to previous patch-cleanup 2010-10-10 16:30:00 +02:00
David Decotigny 5d121d4587 Accept empty indexes
This patch allows ocitysmap to support empty indexes (empty areas).
2010-10-10 16:01:37 +02:00
David Decotigny 093b95bcf6 Support for complex city envelopes
Some OSM Ids such as 365634 have several entries in the polygon/line
tables. The original maposmatic code crashed because it assumed only
one entry was in the DB, and the ocitysmap code only considered the
1st entry returned by postgis.

This patch allows to work on the union of all the areas returned by
the polygon and line tables.

It adds another dependency: shapely. This allows to call libgeos
functions from within python. This also calls for some code
refactoring (=> TODO): the coords et al. API should be replaced by the
plain shapelib API
(http://gispython.org/shapely/docs/1.2/manual.html).
2010-10-10 15:54:55 +02:00
David Decotigny f595f4520d Updated for compat with maposmatic 2010-09-19 17:18:48 +02:00
David Decotigny d931e3571a Fixed install inst for karmic + deprecating main INSTALL 2010-09-11 17:04:52 +02:00
David Decotigny f7deea3dca Updated setup.py
Also make sure ocitysmap2 is still working even if the logo cannot be found
2010-09-11 16:59:42 +02:00
David Decotigny f95dd525f6 fixed typo 2010-09-11 16:39:27 +02:00
David Decotigny d270ac53f7 Reorganized global layout managers
Split the renderers.py file info:
 - renderers.py: the layour registry
 - abstract_renderer: the ABC for a renderer
 - singe_page_renderer: 3 classes to render into a single page
2010-09-11 16:38:16 +02:00
David Decotigny 8ad862d265 Updated i18n 2010-09-11 15:44:22 +02:00
David Decotigny ee9a2b19bd Updated doc 2010-09-11 15:38:25 +02:00
David Decotigny b46e66b7cc Make sure PostGIS is >= 1.5
Raise an AssertionError when postgis is not >= 1.5.
2010-09-11 15:27:38 +02:00
David Decotigny a3286243a2 Command-line frontend.
Implemented ocitysmap2-render command-line frontend. Tested it on
Chevreuse (OSM ID -943886) with many possible cmdline option
combinations. Default layout is now map with index at bottom.
2010-09-11 15:14:03 +02:00
David Decotigny 04377283a9 Major reorganization, new maplib/indexlib/layoutlib hierarchy
New maplib (map creation routines), indexlib (index creation routines)
and layoutlib (page layout & rendering) structure. Besides moving
files around, a new layoutlib.commons module has been create to host
the mm to/from pt conversion routines.
2010-09-11 12:31:08 +02:00
Maxime Petazzoni d262015ea3 Ajout de 'Lotissement' dans les préfixes français
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-09-07 16:39:10 +02:00
David Decotigny 0d165fb78a Support ps.gz output 2010-09-05 20:30:28 +02:00
David Decotigny 1c26a805ba more verbose 2010-09-05 20:28:28 +02:00
David Decotigny abb04dd4bf pure cosmetics 2010-09-05 20:27:47 +02:00
David Decotigny 7f9e6f92d1 Better index layout with small fonts + code more tolerant
When the small start to be small, avoid rounding errors (such as font
em = 0) by using floats as much as possible. And also try to signal
when the number of cols we draw is < expected, without raising an
exception.
2010-09-05 20:24:50 +02:00
David Decotigny 524c7baca5 Support for PNG output identical to PDF
This has not been so easy because:
 - we need some kind of scaling because by default 1 pt in PDF = 1 px
   in PNG... And we would prefer to have 1 pt in PDF = 300/72. px
   (assuming PNG is 300dpi)
 - we cannot call ctx.scale() before rendering the index because pango
   takes the transformation matrix into account when it chooses the
   font metrics. So with ctx.scale(), we could have the actual font
   metrics different from those computed in
   precompute_index_occupation() { which is called on a PDF surface by
   SinglePageRenderer::render() }.
 - we cannot render to a 72dpi vector surface (eg. PDF) and then
   project it with a scaling factor onto a 300 DPI PNG surface,
   because the result is ugly (pixelized)
 - we cannot push_group()/post_group().set_matrix(xx=factor,
   yy=factor=)/set_source() for the same reasons (pixelized)

So the solution we adopt is to trick pango into believing it is
rendering without any scale factor, which for us corresponds to a
72dpi resolution, and which for it corresponds to a 96 dpi cairo
resolution (see sources): this should always generate the same font
metrics as precompute_index_occupation() did. Then we tell it that the
cairo resolution, instead of being 96dpi as it assumes, is
96*desired_resolution/72. This is what this patch does.

One more note: we don't use an ImageSurface cairo surface for PNG
output because, for some other reason, it leads to different font
metrics. So, for PNG, we do use a PDF cairo surface !...
2010-09-05 19:06:37 +02:00
David Decotigny bbce200910 Demonstrate rendering with all possible output formats 2010-09-05 12:39:33 +02:00
David Decotigny 93a58eca87 Minor index rendering fiexes + cosmetics + comments
Fixed a trivial function name bug in __init__.py and a few index style
issues with the margins around the index. Added comments and reorder
the drawing operations to make sure the rectangle are printed last.

As a result, all 3 page layout renderer work in vector format... but
NOT in raster because the layout preparation is entirely based on
vector rendering engines even if the actual rendering engine is
raster... and both seem to handle font parameters differently.
2010-09-05 12:29:49 +02:00
David Decotigny 538ccfe92d Prepared 3 renderers, out of which only SinglePageRendererNonIndex has been tested
This patch defines a generic SinglePageRenderer renderer which is able
to render a single page without an index, with an index on the side
(on the right for non RTL languages, on the left for RTL) or with an
index at the bottom of the page. This generic renderer is subclassed
to define the SinglePageRendererNoIndex ("plain") class, the
SinglePageRendererIndexOnSide ("single_page_index_side") class,
SinglePageRendererIndexBottom ("single_page_index_bottom").

IMPORTANT: Only SinglePageRendererNoIndex has been tested and leads to
the exact same result as before. Chances are that the index rendering
doesn't work for raster cairo devices, because of the lack of DPI
support in the index rendering API.

The RenderingConfiguration has a new "i18n" field, setup by render()
and which replaces rtl: corresponds to the language used in the
rendering.

Added docstrings.

Note: the struct placeholder mechanism implemented in previous patch
has been dropped, in favor of a much cleaner API with only 2
parameters passed (w_dots, h_dots).
2010-09-04 19:48:51 +02:00
David Decotigny 81d0afa312 Major refactoring of the main rendering process
The RenderingSession system has disappeared in favor of a much simpler
ctor()/render() API for the Renderers. As a consequence, it's the job
of each renderer to create the grid, the map_canvas and the index
renderer (if any). But this is needed because the renderer is in
charge of the page layout, which impacts the way the map_canvas is
rendered and which depends on the index. Potentially every renderer
need to manage the chicken-and-egg problem in their own way. Of
course, now this ctor takes a street_index as parameter, which allows
it (by way of an index renderer) to update the global layout depending
on the size of the index.

For now only the PlainRenderer has been updated. It users an object
placeholder to replace the RenderingSession object. This object
placeholder allows one to define a set of attributes and to access
them through the standard dotted notation. This object has a meaning
only internally to the PlainRenderer::render(). We don't define a
global structure like RenderingSession in order not to pollute the
code with global names. And such an object placeholder is only a
private placeholder for render() and the function it calls, to avoid
having to write 6235 arguments to pass the helper functions it calls.
2010-09-02 23:43:24 +02:00
David Decotigny 230e2ccda2 Updated doc and simpler object for StreetIndex objects
This patch makes the ctor args minimal for the StreetIndex indexer
objects, and also drops the ref to the DB after the object has been
created. Also cleans up the rendering process a bit (WIP, still).
2010-09-02 21:20:39 +02:00
David Decotigny f612534ec6 Can update the street index label according to the grid's location.
With this patch, the street index should now have its labels A1-B2
correct for the location of streets. The street indexer has a new
method apply_grid() that calls item.update_location_str(grid) so that
all the items have their location_str field correct. The items are
updated in-place: beware if multiple threads are manipulating a
StreetIndex object...
2010-08-31 22:39:46 +02:00
David Decotigny bdcc6b01f0 Determine the font size to use to render index in area.
With this patch, it is now possible to specify different header/label
styles when contructing StreetIndexRenederer objects. This will allow
the renderer to use the first header/label font from this list that
allows to render the index into the specified area. For now the list
of possible header/label fonts is hard-coded as the default parameter
of the constructor.
2010-08-31 21:40:07 +02:00
Maxime Petazzoni 7261e11b81 Add the now required NaturalEarthData files for Mapnik
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-15 22:01:03 +02:00
David Decotigny 362a0f8812 write to csv reimplemented
Signed-off-by: David Decotigny <david@decotigny.fr>
2010-08-15 16:37:21 +02:00
David Decotigny 025d2ea543 endpoints must all be passed to index items ctor
Signed-off-by: David Decotigny <david@decotigny.fr>
2010-08-15 16:22:15 +02:00
David Decotigny c9b0026b6f Grid neutral localization of the amenities
As for the grid-neutral street index generation, with this patch we
compute the extension of each amenity with ST_LongestLine. This allows
to store geographic coordinates of the amenity in the index, hence
independent on any grid that might be used to locate them.

Signed-off-by: David Decotigny <david@decotigny.fr>
2010-08-15 16:15:32 +02:00
David Decotigny 77a25e392a Updated installation instructions for Lucid
Signed-off-by: David Decotigny <david@decotigny.fr>
2010-08-15 14:40:20 +02:00
David Decotigny 6b91632903 Updated to current commons Index API + random grid indices
Signed-off-by: David Decotigny <david@decotigny.fr>
2010-08-15 14:39:27 +02:00
David Decotigny a17ea7fc49 Fixed missing dep
Signed-off-by: David Decotigny <david@decotigny.fr>
2010-08-15 14:38:54 +02:00
David Decotigny c6ca10365d Cosmetic information message for unit tests
Signed-off-by: David Decotigny <d2@maposmatic.org>
2010-08-09 12:42:22 +02:00
David Decotigny 377e14acca Provide a mock for gettext ('_') in unit test
Signed-off-by: David Decotigny <d2@maposmatic.org>
2010-08-09 12:41:25 +02:00
David Decotigny 00a48aa29a Map street paths onto grid, pass 1
To map the street paths onto a Grid, we proceed in 2 passes since the
grid is not known before the streets are determined (size of the
rendered bbox depends on the number of streets => grid position over
the city's rendering is not fixed). This patch allows to optimize the
number of GIS queries: we only need to perform them in pass 1.

First pass gets the positions of the most distant points from the
street. This is what this patch implements. The second pass will then
map these points onto the grid.

This patch also changes the IndexItem structure to include the 2 most
distant endpoints of the item.

We only deal with the streets for now. The code for amenities is dummy
at that point; we'll work on this later.

Signed-off-by: David Decotigny <d2@maposmatic.org>
2010-08-09 12:33:44 +02:00
David Decotigny 2d8bc371c8 Simple API for 2D Points
Signed-off-by: David Decotigny <d2@maposmatic.org>
2010-08-09 12:28:00 +02:00
Maxime Petazzoni ec9f38cfbb More cleanup
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-08 12:36:48 +02:00
Maxime Petazzoni 42c360378f Provide a unified way to get bounding box and contour from OSM IDs
The new get_geographic_info method in OCitySMap allows one to query the
PostGIS database for the commonly-needed geographic information about a
set of OSM IDs.

This is used by OCitySMap itself, of course, for map rendering when it
needs to find the bounding box and contour of the requested OSM ID. This
will also be used by the Nominatim search gateway in MapOSMatic in the
near future.

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-08 12:36:48 +02:00
Maxime Petazzoni f776df2938 Improve OCitySMap's API and documentation
Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-08 12:36:27 +02:00
David Decotigny bacb8e42a0 fixed todo + dead code 2010-08-08 09:47:06 +02:00
Maxime Petazzoni 118f0a4210 Fix compatible paper size calculation
The compatible paper size calculation in the PlainRenderer was not
properly using the returned result of BoundingBox.spheric_size(): the
width and height were switched, resulting in wrong chosen paper
orientations and sizes.

Signed-off-by: Maxime Petazzoni <maxime.petazzoni@bulix.org>
2010-08-08 09:35:33 +02:00
David Decotigny 3f5dce84cd Split index rendering into 2 steps
We split the index rendering phase into 2 steps:
 - first pre-position the index and precompute its size
 - this will allow the main page renderer to prepare the page layout,
   place the grid and computhe the exact "square locations" in the index
 - render the actual index, with the actual square positions (eg. A1,
   B2, etc.)

Signed-off-by: David Decotigny <d2@maposmatic.org>
2010-08-07 21:40:49 +02:00
David Decotigny ebb9e6ca01 Integrate street index api + tests 2010-08-07 21:40:49 +02:00