def main() : gobject.threads_init() clutter.init() stage = clutter.Stage(default=True) actor = champlain.View() layer = champlain.Layer() marker = AnimatedMarker() #Starting the animation, that's what we want after all ! marker.start_animation() #Set marker position on the map marker.set_position(*POSITION) stage.set_size(*SCREEN_SIZE) actor.set_size(*SCREEN_SIZE) stage.add(actor) layer.show() actor.add_layer(layer) layer.add(marker) # Finish initialising the map view actor.set_property("zoom-level", 5) actor.set_property("scroll-mode", champlain.SCROLL_MODE_KINETIC) actor.center_on(*POSITION) stage.show() clutter.main()
def main(self): """Node finder main loads map and inits the GUI.""" self.data = osm.OSMModel('../data/hannover2.osm') self.data.initialize(self.data) global markers gobject.threads_init() clutter.init() stage = clutter.Stage(default=True) self.actor = champlain.View() layer = champlain.Layer() self.marker = AnimatedMarker() layer.add(self.marker) stage.set_user_resizable(True) stage.connect("allocation-changed", self.resize_actor) stage.connect("button-press-event", self.button_pressed) stage.set_size(*SCREEN_SIZE) self.actor.set_size(*SCREEN_SIZE) stage.add(self.actor) layer.show() self.actor.add_layer(layer) # Finish initialising the map view self.actor.set_property("zoom-level", 16) self.actor.set_property("scroll-mode", champlain.SCROLL_MODE_KINETIC) self.actor.center_on(*POSITION) stage.show() clutter.main()
def main(): gobject.threads_init() clutter.init() stage = clutter.Stage(default=True) stage.set_size(800, 600) stage.connect("event", event_cb) # Create the map view view = champlain.View() view.set_size(800, 600) stage.add(view) # Create the markers and marker layer layer = champlain.Layer() view.add_layer(layer) create_marker_from_url(layer, 48.218611, 17.146397, "http://hexten.net/cpan-faces/potyl.jpg") create_marker_from_url(layer, 48.21066, 16.31476, "http://hexten.net/cpan-faces/jkutej.jpg") create_marker_from_url(layer, 48.14838, 17.10791, "http://bratislava.pm.org/images/whoiswho/jnthn.jpg") # Finish initialising the map view view.set_property("scroll-mode", champlain.SCROLL_MODE_KINETIC) view.set_property("zoom-level", 10) view.center_on(48.22, 16.8) stage.show_all() reactor.run()
def main(self): """The window, stage, marker init and so on ...""" global markers gobject.threads_init() clutter.init() stage = clutter.Stage(default=True) self.actor = champlain.View() layer = champlain.Layer() stage.connect("button-press-event", self.button_pressed) stage.connect("key-press-event", self.key_press) stage.set_user_resizable(True) stage.connect("allocation-changed", self.resize_actor) self.markers = [] self.num_marker = int(sys.stdin.readline()) self.minlat = float(sys.stdin.readline()) self.minlon = float(sys.stdin.readline()) self.maxlat = float(sys.stdin.readline()) self.maxlon = float(sys.stdin.readline()) self.zone = int(sys.stdin.readline()) print 'showing %i marker' % self.num_marker for i in xrange(self.num_marker): marker = AnimatedMarker(markersize=self.markersize) # marker.set_position(*POSITION) layer.add(marker) self.markers.append(marker) bbox = champlain.Polygon() bbox.append_point(self.minlat, self.minlon) bbox.append_point(self.minlat, self.maxlon) bbox.append_point(self.maxlat, self.maxlon) bbox.append_point(self.maxlat, self.minlon) bbox.set_stroke_width(1.0); bbox.set_property("closed-path", True) bbox.set_property("mark-points", True) bbox.set_property("stroke-color", clutter.Color(red=64,green=64,blue=64,alpha=128)) self.actor.add_polygon(bbox) self.POSITION = [ self.minlat+((self.maxlat-self.minlat)/2), self.minlon+(self.maxlon-self.minlon)/2] stage.set_size(*self.screensize) self.actor.set_size(*self.screensize) stage.add(self.actor) layer.show() self.actor.add_layer(layer) # Finish initialising the map view self.actor.set_property("zoom-level", self.init_zoom) self.actor.set_property("scroll-mode", champlain.SCROLL_MODE_KINETIC) self.actor.center_on(*self.POSITION) self.night = clutter.Rectangle(clutter.Color(0, 0, 50)) self.night.set_size(*self.screensize) self.night.set_opacity(120) self.night.show() if not '-n' in sys.argv: stage.add(self.night) self.date = clutter.Text() self.date.set_text("Hello World") stage.add(self.date) stage.show() gobject.timeout_add(200, self.update) clutter.main()
polygon.append_point(45.4151, -73.2126) polygon.append_point(45.4016, -73.1926) polygon.append_point(45.3994, -73.1877) polygon.append_point(45.4000, -73.1815) polygon.append_point(45.4151, -73.1218) polygon.set_stroke_width(5.0) actor.add_polygon(polygon) # draw a polygon polygon = champlain.Polygon() polygon.append_point(45.1386, -73.9196) polygon.append_point(45.1229, -73.8991) polygon.append_point(45.0946, -73.9531) polygon.append_point(45.1085, -73.9714) polygon.append_point(45.1104, -73.9761) polygon.set_fill(True) polygon.set_property('closed-path', True) actor.add_polygon(polygon) # Connect to the click event actor.set_reactive(True) actor.connect('button-release-event', map_view_button_release_cb, actor) actor.center_on(45.466, -73.75) if __name__ == "__main__": gobject.threads_init() clutter.init() main() clutter.main()