Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tiesmaster/3019793 to your computer and use it in GitHub Desktop.
Save tiesmaster/3019793 to your computer and use it in GitHub Desktop.
Export internal world substation as PNG
remex(:export_internal_world_substation_union_lane_as_png)
$
@export_internal_world_substation_union_lane_as_png.delete()
$
def_slotted_exemplar(:export_internal_world_substation_union_lane_as_png, {})
$
_method export_internal_world_substation_union_lane_as_png.write_png
mv << _self.get_map_view_of_internal_world()
_self.wait_for_render_finishes(mv)
#_thisthread.sleep(1000)
mv.write_to_image_file("d:\union_lane.png", :png)
mv.discard()
system.do_command("start d:\union_lane.png")
_endmethod
$
_method export_internal_world_substation_union_lane_as_png.wait_for_render_finishes(a_map_view)
render_thread << a_map_view.sys!perform(:render_thread)
_if render_thread _isnt _unset
_then
render_thread.wait_for_termination()
_endif
_endmethod
$
_method export_internal_world_substation_union_lane_as_png.get_map_view_of_internal_world()
mmgr << _self.get_map_manager()
mv << mmgr.new_map_view(_self.get_internal_world_ace_name(), _self.get_internal_world_spatial_context().world)
mv.add_event_handler(:view_change, _self, :note_change|()|)
mv.set_rendering_surface(memory_canvas.new(300, 300))
mv.goto(_self.get_internal_world_spatial_context())
>> mv
_endmethod
$
_method export_internal_world_substation_union_lane_as_png.get_map_manager()
appl << _self.get_application()
>> appl.plugin(:maps)
_endmethod
$
_method export_internal_world_substation_union_lane_as_png.get_internal_world_ace_name()
>> _self.get_application().get_ace_name_for_spatial_context(_self.get_internal_world_spatial_context().spatial_context.name)
_endmethod
$
_method export_internal_world_substation_union_lane_as_png.get_application()
>> smallworld_product.applications.an_element()
_endmethod
$
_method export_internal_world_substation_union_lane_as_png.get_internal_world_spatial_context()
>> rope.new_from_iter(_self.get_union_station().get_spatial_context(:internals), :elements|()|).an_element()
_endmethod
$
_method export_internal_world_substation_union_lane_as_png.get_union_station()
>> _self.get_substation_collection().at(914910)
_endmethod
$
_method export_internal_world_substation_union_lane_as_png.get_substation_collection()
>> gis_program_manager.databases[:electricity].collection(:substation)
_endmethod
$
_block
export_internal_world_substation_union_lane_as_png.write_png
_endblock
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment