Permalink
Browse files

got the test from test/api.c in simple-tiles working

but for some reason, it always segfaults at the end
  • Loading branch information...
1 parent bd36cd8 commit e8687e3e6f0414ae0ab152351898243350acd758 @albertsun committed Mar 1, 2012
Binary file not shown.
@@ -0,0 +1 @@
+GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
Binary file not shown.
Binary file not shown.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -60,18 +60,18 @@ class Map:
set_bgcolor = simplet_class_method(status_output(lib.simplet_map_set_bgcolor, [c_void_p, c_char_p]))
get_bgcolor = simplet_class_method(str_ptr_output(lib.simplet_map_get_bgcolor, None, [c_void_p]))
- __add_layer = simplet_class_method(bind_function(lib.simplet_map_add_layer, c_void_p, [c_void_p, c_char_p]))
- def add_layer(self, datastring):
- lyr_ptr = c_void_p(self.__add_layer(self, datastring))
- lyr = Layer(ptr=lyr_ptr)
- self.layers.append(lyr)
- return lyr
-
- __add_layer_directly = simplet_class_method(bind_function(lib.simplet_map_add_layer_directly, c_void_p, [c_void_p, c_void_p]))
- def add_layer_directly(self, layer):
- lyr_ptr = c_void_p(self.__add_layer_directly(self, layer._simplet_ptr))
- self.layers.append(layer)
- return layer
+ __add_layer = simplet_class_method(bind_function(lib.simplet_map_add_layer, c_void_p, [c_void_p, c_char_p]))
+ def add_layer(self, datastring):
+ lyr_ptr = c_void_p(self.__add_layer(datastring))
+ lyr = Layer(ptr=lyr_ptr)
+ self.layers.append(lyr)
+ return lyr
+
+ __add_layer_directly = simplet_class_method(bind_function(lib.simplet_map_add_layer_directly, c_void_p, [c_void_p, c_void_p]))
+ def add_layer_directly(self, layer):
+ lyr_ptr = c_void_p(self.__add_layer_directly(layer._simplet_ptr))
+ self.layers.append(layer)
+ return layer
get_status = simplet_class_method(status_output(lib.simplet_map_get_status, [c_void_p]))
status_to_string = simplet_class_method(bind_function(lib.simplet_map_status_to_string, c_char_p, [c_void_p]))
@@ -110,18 +110,18 @@ class Layer:
set_source = simplet_class_method(bind_function(lib.simplet_layer_set_source, None, [c_void_p,c_char_p]))
get_source = simplet_class_method(str_ptr_output(lib.simplet_layer_get_source, None, [c_void_p]))
- __add_query = simplet_class_method(bind_function(lib.simplet_layer_add_query, c_void_p, [c_void_p, c_char_p]))
- def add_query(self, ogrsql):
- query_ptr = c_void_p(self.__add_query(self, ogrsql))
- query = Query(ptr=query_ptr)
- self.queries.append(query)
- return query
+ __add_query = simplet_class_method(bind_function(lib.simplet_layer_add_query, c_void_p, [c_void_p, c_char_p]))
+ def add_query(self, ogrsql):
+ query_ptr = c_void_p(self.__add_query(ogrsql))
+ query = Query(ptr=query_ptr)
+ self.queries.append(query)
+ return query
- __add_query_directly = simplet_class_method(bind_function(lib.simplet_layer_add_query_directly, c_void_p, [c_void_p, c_void_p]))
- def add_query_directly(self, query):
- query_ptr = c_void_p(self.__add_query_directly(self, query._simplet_ptr))
- self.queries.append(query)
- return query
+ __add_query_directly = simplet_class_method(bind_function(lib.simplet_layer_add_query_directly, c_void_p, [c_void_p, c_void_p]))
+ def add_query_directly(self, query):
+ query_ptr = c_void_p(self.__add_query_directly(query._simplet_ptr))
+ self.queries.append(query)
+ return query
def __init__(self, *args, **kwargs):
if kwargs.has_key("ptr"):
@@ -144,7 +144,7 @@ class Query:
__add_style = simplet_class_method(bind_function(lib.simplet_query_add_style, c_void_p, [c_void_p, c_char_p, c_char_p]))
def add_style(self, key, arg):
- style_ptr = c_void_p(self.__add_style(self, key, arg))
+ style_ptr = c_void_p(self.__add_style(key, arg))
style = Style(ptr=style_ptr)
self.styles.append(style)
return style
@@ -155,6 +155,8 @@ def __init__(self, *args, **kwargs):
elif kwargs.has_key("sqlquery"):
self._simplet_ptr = c_void_p(self.__query_new(kwargs.get("sqlquery")))
+ self.styles = []
+
def __del__(self):
self.__query_free(self._simplet_ptr)
View
@@ -1,8 +1,29 @@
from simpyl_tiles import *
-map = Map()
-print map.set_srs("WGS84")
-print map.status_to_string()
-print map.get_srs()
-del map
+m = Map()
+m.set_slippy(0,0,0)
+m.set_size(1000,1000)
+m.set_bgcolor("#ddeeff")
+layer = m.add_layer("data/ne_10m_admin_0_countries.shp")
+query = layer.add_query("SELECT * from 'ne_10m_admin_0_countries'")
+query.add_style("stroke", "#226688")
+query.add_style("line-join", "round")
+query.add_style("weight", "3")
+
+query2 = layer.add_query("SELECT * from 'ne_10m_admin_0_countries'")
+query2.add_style("weight", "0.5")
+query2.add_style("fill", "#d3e46f")
+query2.add_style("stroke", "#ffffff")
+query2.add_style("line-join", "round")
+
+query2.add_style("text-field", "NAME")
+query2.add_style("font", "Lucida Grande, Regular 8")
+query2.add_style("color", "#444444ff")
+query2.add_style("text-stroke-color", "#ffffffcc")
+query2.add_style("text-stroke-weight", "2")
+query2.add_style("letter-spacing", "1")
+
+if m.is_valid():
+ m.render_to_png("out.png")
+ print "done rendering"

0 comments on commit e8687e3

Please sign in to comment.