Table of Contents
Extensions
[TODO: this doc must be rewriten: matchWith () is missing, the other types of extension should be explained]
See also the Graphical extension manager and compatibility tuning with vetoes documentation.
Note for the developpers: the Extension framework has been refactored and an updated documentation is under progress. https://amap-dev.cirad.fr/projects/jeeb/wiki/Jeeb_Extension_Manager
What is an extension
An extension is a kind of plugin. It can be dynamically found, loaded and initialized.
An extension has a set of meta-information (author, version, description…)
An extension is compatible with a model or not.
Different type of extensions
Capsis supports the following extension
- Data Extractor
- Export
- Intervener
- Stand Viewer
- Model Tool
- Object Viewer
- Filter
- …
How to use an extension
Capsis search and propose automatically the available extension. To see the installed Extension, use the Graphical Extension Manager :
Tools → Extension Manager
For more information, see Graphical extension Manager
Interactive Mode
The available extensions will be automatically proposed in the dialog box, for instance in the intervention or in the export dialog.
Script Mode
In a script, an extension can be directly used, like other classes. However, to ensure a correct initialization, you should use specific methods.
Intervener thinner = new DHAThinner(DHAThinner.AGE, 50, 500); step = sc.runIntervener(thinner, step, step.getScene ().getInterventionBase ());
For more information, see the script mode
How to implement an extension
Create a class
An extension is a class which implements Extension
public class MyExtension implements Extension { // Meta Infos public static final String NAME = "MyExtension"; public static final String VERSION = "1.2"; public static final String AUTHOR = "F. de Coligny"; public static final String DESCRIPTION = "MyExtension.description"; public static final String SUBTYPE = "SpecificExtension"; // .... }
Before being able to use a new extension, the extension list cache must be updated. This can be done with the following command (in a terminal) :
Under Linux
sh capsis.sh -se
Under Windows
capsis -se
Export
public class TplIOFormat implements IFormat, OFormat { static public String NAME = "TplIOFormat"; static public String AUTHOR = "SDK"; static public String DESCRIPTION = "IOFormat test"; static public String VERSION = "1.0"; /** Initialize Export with a model and a step */ @Override public void initExport(GModel m, Step s) throws Exception { // TODO Auto-generated method stub } @Override public GScene load(GModel model) throws Exception { // TODO Auto-generated method stub return null; } @Override public void save(String fileName) throws Exception { // TODO Auto-generated method stub } @Override public void activate() { // TODO Auto-generated method stub } }
Intervener
public class TplInterverner implements Intervener { static public String name = "TplIntevener"; static public String author = "SDK"; static public String description = "Intervener test"; static public String version = "1.0"; int param; /** Default constructor */ public TplInterverner() {}; /** Specific constructor */ public TplInterverner(int p) { param = p; }; /** Initialize the extension * @Param m * @Param s * @Param scene * @Param c */ @Override public void init(GModel m, Step s, GScene scene, Collection c) { // TODO Auto-generated method stub } /** Open the dialog box in interactive mode */ @Override public void initGUI() { // TODO Auto-generated method stub } @Override public Object apply() throws Exception { // TODO Auto-generated method stub return null; } @Override public boolean isReadyToApply() { // TODO Auto-generated method stub return false; } @Override public void activate() { // TODO Auto-generated method stub } }