From: Frank W. <war...@po...> - 2004-07-28 13:30:58
|
Morgenthaler, David G wrote: > Does OpenEV have support for display of icons? I need to be able to display small graphics (e.g., 30x30 pixels) that don't change size when the view is zoomed. > > Thanks, > > David G. Morgenthaler David, The answer is yes, OpenEV does display of fixed sized raster icons. I won't claim it is a particularly simple example, but this is the chunk of Python from the render test script that places some raster icons as point features. ############################################################################### # Test of raster symbol. def raster_symbol( self ): self.set_step_name( 'Raster Symbol Test' ) self.set_text( 'A red symbol (the busy indicator from thet toolbar)\n' +'should be shown. When zooming in or out it should\n' +'remain the same size on screen.\n' +'' +'NOTE: This symbols should really be green but it\n' +'seems that currently the color attribute of\n' +'SYMBOL directives for raster symbols is ignored\n' +'\n' +'\n' +'' ) shapes = gview.GvShapes() gview.undo_register( shapes) layer = gview.GvShapesLayer( shapes ) layer.set_name( 'test' ) if os.name == "nt": sym_file = gview.home_dir + '\\pics\\busy.xpm' sym_file2 = gview.home_dir + '\\pics\\idle.xpm' sym_name = '\\three_idle' else: sym_file = gview.home_dir + '/pics/busy.xpm' sym_file2 = gview.home_dir + '/pics/idle.xpm' sym_name = '/three_idle' # Unoffset icon shape = gview.GvShape( type = gview.GVSHAPE_POINT ) shape.set_node( 20, 50, node=0 ) shape.set_property('_gv_ogrfs', 'SYMBOL(c:#00FF00,id:"'+sym_file+'")' ) shapes.append( shape ) # Pixel Offset shape = gview.GvShape( type = gview.GVSHAPE_POINT ) shape.set_node( 20, 50, node=0 ) shape.set_property('_gv_ogrfs', 'SYMBOL(c:#00FF00,dx:30px,dy:-10px,id:"'+sym_file+'")' ) shapes.append( shape ) # Geo Offset shape = gview.GvShape( type = gview.GVSHAPE_POINT ) shape.set_node( 20, 50, node=0 ) shape.set_property('_gv_ogrfs', 'SYMBOL(c:#00FF00,dx:30g,dy:-30g,id:"'+sym_file+'")' ) shapes.append( shape ) # Inject a vector icon symbol that consists of three raster symbols, # but do it on the vector layer. sm = layer.get_symbol_manager( 1 ) shape = gview.GvShape( type = gview.GVSHAPE_POINT ) shape.set_node( 0.0, 0, node=0 ) shape.set_property('_gv_ogrfs', 'SYMBOL(dy:-10px,dx:-40px,id:"' + sym_file2 + '");' + \ 'SYMBOL(id:"' + sym_file2 + '");' + \ 'SYMBOL(dy:10px,dx:40px,id:"' + sym_file2 + '")' ) sm.inject_vector_symbol( sym_name, shape ) # Place the "3" idle symbol. shape = gview.GvShape( type = gview.GVSHAPE_POINT ) shape.set_node( 60, 50, node=0 ) shape.set_property('_gv_ogrfs', 'SYMBOL(c:#00FF00,id:"'+sym_name+'")' ) shapes.append( shape ) # Add line for context. shape = gview.GvShape( type = gview.GVSHAPE_LINE ) shape.set_node( 10, 10, node=0 ) shape.set_node( 80, 10, node=1 ) shape.set_node( 80, 90, node=2 ) shape.set_node( 50, 80, node=3 ) shape.set_node( 10, 90, node=4 ) shapes.append( shape ) self.view.add_layer( layer ) self.view.set_active_layer( layer ) self.view.fit_extents( 0, 0, 100, 100 ) -- ---------------------------------------+-------------------------------------- I set the clouds in motion - turn up | Frank Warmerdam, war...@po... light and sound - activate the windows | http://pobox.com/~warmerdam and watch the world go round - Rush | Geospatial Programmer for Rent |