You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

This is a collection of thoughts on AIDA Styles and on their use in the new plotter.

Style Store

This is an object that can save and retrieve styles from a store (xml file on disk, database table). The basic xml style definition is the AIDA one. Next to the style itself we also identified the need to define Style Rules that should also be saved/retrieved to/from the store:

<styleStore>
   <styles>
       <style>
          .......
          <rules>
             <rule>
                .......
             </rule>
          </rules>
       </style>
   </styles>
</styleStore>

Multiple stores might be loaded at once: System Store, Personal Store, Group Store, Experiment Store. Their information is grouped and managed by a Style Registry

Style Rules

It should be possible to define rules on how to attach a style to a particular plot object. Multiple rules might be applied to a given style. It should be possible to apply rules to:

  • object type: hep.aida.IHistogram1D, org.myproject.MyData1D
  • object path: with path expressions like "MC/**"
  • plot order: a specific order position, 0, 7 or a cyclical recurrence (3) -> every third plot
  • action: like printing (plots for printing might require less details)
  • category: "experiment=GLAST, quality=preliminary"

Style Registry

A style registry combines the styles and rules from different style stores and provides the right set of styles (with the appropriate Style Order) for a given plot object.

Style Order

We have to define the order in which the styles are applied to an object:

  • passed style (when plotting)
  • explicit in annotation (like labels)
  • implicit:
    • action
    • category
    • plot order
    • path
    • type

Style Editor

GUI front end for viewing and editing individual styles or combinations of styles.
We already have a first version of the style editor. We need to add the possibility to view the information contained in a style registry, i.e. the chain of styles contributing to a given object and the set of rules that have contributed to it.

Comments to AIDA Styles

  • does isVisible() belong to IBaseStyle?
  • can we plot an object by passing only an IDataStyle (rather than an IPlotterStyle)?

 

Ideas for Implementation

 Let's leave Style Store out of this discussion just for the moment.

So Style Registry is created and is getting populated by (or just acts as a manager/façade for) the Style Stores, but it has access to Style/Rules information.

Just before object is plotted/printed and we know the object's path in a Tree, object's type, order of the object in particular IPlotterRegion, etc. All this information is used to query the Style Registry and create a cumulative IPlotterStyle for the implicit parameters.

Information that we need:

  • Object type: from the object itself
  • Object path: from AIDA tree, from initial user plotting request, or from the object
  • Plot order: from the current IPlotterRegion - is it overlay, if not how many objects are already plotted there
  • Action: program that is trying perform action should know what it is doing - plotting, printing, etc.
    • Action looks a lot like Category: "printing" -> "printing=true"
  • Category: this is an external parameter and has to come from separate service.
    • Can be part of Style Registry functionality, or independent service

If any styles are passed explicitly to the plotter, this cumulative style will be set as parent (or merged in).

I've set three interfaces that might do the job (below), have a look.

IStyleRegistry interface:

IPlotterStyle in StyleRegistry is identified by a name (styleName). Style names have to be unique.

public interface IStyleRegistry {
   
    // Following methods are used for setup and save/restore of IStyleRegistry
   
    void addStyle(String styleName, IPlotterStyle style);
   
    boolean hasStyle(String styleName);
   
    IPlotterStyle getStyle(String styleName);
   
    String[] getAllNames();
   
    IStyleRule[] getRulesForStyle(String styleName);
   
    void addRuleForStyle(String styleName, IStyleRule rule);
   
    void setRuleForStyle(String styleName, IStyleRule rule);
   
    void removeRuleForStyle(String styleName, IStyleRule rule);
   
    void removeAllRulesForStyle(String styleName);
   
   
    // Following methods are used to obtain cumulative IPlotterStyle
    // for particular region, object, and action
   
    IPlotterStyle getStyleForState(IPlotterState state);
}

IStyleRule interface:

public interface IStyleRule {    // Possible types of Style Rules
    static int CLASS    = 0;  // Class of the object: hep.aida.IHistogram1D
    static int PATH     = 1;  // Position of the object in a Tree
    static int ORDER    = 2;  // Order in the IPlotterRegion: specific number, or cyclical
    static int ACTION   = 3;  // What is going to happen with the object: plotting, printing
    static int CATEGORY = 4;  // "experiment=GLAST", "quality=preliminary"
                              // ACTION seems like a sub-type of CATEGORY: "printing=true"    int getType();
   
    /**
     * Priority determines the order in which corresponding IPlotterStyle
     * should be used when assembling the cumulative IPlotterStyle
     */
    int getPriority();
   
    String getValue();
   
    /**
     * Determines if this rule should be used.
     *
     * If type=CATEGORY, same rule as for AIDA options should be applied:
     * have to pass "key=value" pair as value, for only "key" -> "key=true",
     */
    boolean ruleApplies(int type, String value);
   
    /**
     * Or maybe it is better to hide this type/"key=value" complexity and do this:
     */
    boolean ruleApplies(IPlotterState state);
}

IPlotterState interface:

/**
 * This object encapsulates information about relevant
 * IPlotterRegion, object, action, and category.
 * It is used for obtaining implicit IPlotterStyle
 */public interface IPlotterState {
   
    // IStyleRule types are used here
    String getValueForType(int styleRuleType);
   
}
  • No labels