Custom Styles
AKA Custom Type
This allows you to select a style based on attribution. This is not as fast as default styles, as magik code must be read, versus the default styling where everything is done in C. You need to have the method style_data_for_app_type() available to the RWO/record exemplar. You may need to re-select the RWO before selecting the function button for the options to appear in the sub-gui.
In order for the data to show up nicely in the style editor, without the nameless numbers, you need to return a hash table from style_data_for_app_type() whose keys are the following
- :style_method which is the method that will be called to determine sub code
- :strings which contains the strings that will be shown in the style editor
- :numbers which are the numbers that will be replaced by the strings above.
The style method defined above will return the sub code to draw as an integer. By default 0 is drawn.
Defining your own dash patterns
Note this is only good for the gis style editor. Not sure how the newer property editor patterns are defined yet. You have to create your own dash pattern. You must not change the name or value after you use it the 1st time. The name is stored in the style dataset.
line_style_palette.standard_patterns[:fcsi_very_long_dash]<< dash_pattern.new( { 20, 4 } )
Under the Covers
This describes how styles are stored and what collections are used. For the Hackers out there:)
Style Editor Info
gis_style_editor.pick_style() This method is what is called when you select a style. So if you need to get a handle on a style or something, you can add a global in this method.
Dumping/Loading Styles
In SW 4.1X The only way to copy the styles is using the style dumper and loaders. I believe in 4.2+ there is a pulldown in the style editor… This allows you to copy styles from one DS to another. The biggest issue is the fact you have to have all the same style scales for it to copy correctly. Otherwise you basically end up with the "Auto" style scale.
sw_module_manager.load_module(:style_dump_and_load_engine)
$
!sd << style_dumper.new( gis_program_manager.style_view)
$
!sd.dump_style_tables( "C:/temp/pole.dump", _unset, _unset, {:poles} )
$
!sl << style_loader.new( gis_program_manager.style_view)
$
!sl.overwrite? << _true
$
!sl.load_style_tables(C:/temp/pole.dump")
The DUMP file is a basic magik file. This is great because you can edit the file and make global changes relatively easily.
Handling "Using default style for :" Message
Do you run processes and you see a bunch of "Using default style for :"? This is a condition that is raised in rwo_style_system.get_default_rwo_style() If you don't want to see any of these message use the following
_handling style_info _with _proc() _endproc
ACE/Style Relationship
Styles are not independent of different Named ACEs. If you modify a style in one Named ACE, any other ACE that has the same style scale is shared and will be updated also. Basically if you have a style scale at 1:2500 in multiple ACEs, and you edit the style in one ACE, it will modify the other ACE styles at 1:2500. If you want to keep your styles/aces from updating ensure your style scales on the different Named ACEs are different. Maybe get rid of Auto in the styles that don't need it?