@@ -40,13 +40,13 @@ Some additional steps need to be done for Python C# and Java, see the sections b
where **YOURNAME** is your GitHub username.
5. Add the __REPO_NAME__ repository as a *remote* called *upstream*
* Add the __REPO_NAME__ repository as a *remote* called *upstream*
``` bash
git remote add upstream __REPOSITORY__
```
6. Before adding your examples, sync your repository with the __REPO_NAME__ repository. Remember that to run the following commands, you need to be in the **__REPO_NAME__** directory.
* Before adding your examples, sync your repository with the __REPO_NAME__ repository. Remember that to run the following commands, you need to be in the **__REPO_NAME__** directory.
``` bash
git fetch upstream
...
...
@@ -55,7 +55,7 @@ Some additional steps need to be done for Python C# and Java, see the sections b
git push
```
7. Build the __REPO_NAME__ code
* Build the __REPO_NAME__ code
``` bash
cd __REPO_NAME__
...
...
@@ -77,27 +77,27 @@ DataStructures, Filters, GeometricObjects, Images, Meshes, etc.
**Note**: Steps 4, 5 and 7 apply to C++. For Python, Java, and C# see the steps in the section **Steps for Python, Java and C#**.
1. Create a branch in your repository
* Create a branch in your repository
``` bash
git checkout -b MyNewExample
```
where **MyNewExample** is the name of your new example.
where **MyNewExample** is the name of your new example.
2. Check the:
* Check the:
- [Cxx available snippets](../../Cxx/Snippets).
- [Python available snippets](../../Python/Snippets).
- [Java available snippets](../../Java/Snippets).
*[Cxx available snippets](../../Cxx/Snippets).
*[Python available snippets](../../Python/Snippets).
*[Java available snippets](../../Java/Snippets).
3. Save your source code in __REPO_NAME__/src/**LANGUAGE**/**TOPIC**/
* Save your source code in __REPO_NAME__/src/**LANGUAGE**/**TOPIC**/
where **LANGUAGE** is Cxx, Python, CSharp or Java.
and **TOPIC** is the topic that you have chosen.
4. Build and test your example (**NOTE:** only for cxx examples)
* Build and test your example (**NOTE:** only for cxx examples)
- for Cxx
...
...
@@ -114,11 +114,11 @@ Note: If **MyNewExample** is not built, then in the directory where you put the
touch CMakeLists.txt
```
5. If your C++ example does any rendering, the test will fail the first time and create an image in __REPO_NAME__/build/Testing/Temporary. The image will be called Test**MyNewExample**.png.
* If your C++ example does any rendering, the test will fail the first time and create an image in __REPO_NAME__/build/Testing/Temporary. The image will be called Test**MyNewExample**.png.
6. Copy the image into: __REPO_NAME__/src/Testing/Baseline/**LANG**/**TOPIC**/. For Python and other languages, create an image with the proper name using a screen capture and copy that image into the proper location.
* Copy the image into: __REPO_NAME__/src/Testing/Baseline/**LANG**/**TOPIC**/. For Python and other languages, create an image with the proper name using a screen capture and copy that image into the proper location.
7. Rerun ctest and the test should pass.
* Rerun ctest and the test should pass.
#### Steps for Python, Java and C#
...
...
@@ -126,7 +126,7 @@ If you are basing your code on a Cxx example use the same name as the Cxx exampl
Keep the same directory structure as that in Cxx.
- Follow steps 1-3 above.
- Follow first three steps above.
- Manually create a test image if your example does any rendering. The image should be called Test**MyNewExample**.png.
The following snippets can be used to write the image out:
...
...
@@ -182,9 +182,9 @@ If your example could benefit from an extended description, you can create a fil
If your example requires arguments, you will need to edit the *CMakeLists.txt* in the topic directory.
1. Add the name of your example to the *NEEDS_ARGS* variable
* Add the name of your example to the *NEEDS_ARGS* variable
2. Add an *ADD_TEST* line. See other *CMakeLists.txt* files for examples.
* Add an *ADD_TEST* line. See other *CMakeLists.txt* files for examples.
#### Add extra files to a C++ example
...
...
@@ -200,15 +200,15 @@ extra filename in the *.extras* file, one filename per line.
If you want to preview your changes in a browser (**NOTE:** You must have Python installed on your system)
1. Install the markdown package for Python. Go [here](https://pythonhosted.org/Markdown/install.html)
* Install the markdown package for Python. Go [here](https://pythonhosted.org/Markdown/install.html)
2. Install the material theme for markdown. Go [here](http://squidfunk.github.io/mkdocs-material/#quick-start).
* Install the material theme for markdown. Go [here](http://squidfunk.github.io/mkdocs-material/#quick-start).
3. Sync your site with your repository with a command like this:
* Sync your site with your repository with a command like this:
@@ -14,7 +14,7 @@ All examples should follow the VTK programming style and there should be a singl
### C++
- The indentation style can be characterized as the [AllmannStyle](https://en.wikipedia.org/wiki/Indent_style#Allman_style). The curly brace (scope delimiter) is on a separate line and aligns with the control statement, The control block is indented by two spaces (**no tabs**). A suitable `.clang-format` is provided in `src/Cxx`[see here](__BLOB__/src/Cxx/.clang-format).
* The indentation style can be characterized as the [AllmannStyle](https://en.wikipedia.org/wiki/Indent_style#Allman_style). The curly brace (scope delimiter) is on a separate line and aligns with the control statement, The control block is indented by two spaces (**no tabs**). A suitable `.clang-format` is provided in `src/Cxx`[see here](__BLOB__/src/Cxx/.clang-format).
Example:
...
...
@@ -30,7 +30,7 @@ All examples should follow the VTK programming style and there should be a singl
}
```
- Where appropriate, explicitly use the std:: namespace:
* Where appropriate, explicitly use the std:: namespace:
``` c++
std::cout<<"Print something"<<std::endl;
...
...
@@ -42,11 +42,11 @@ All examples should follow the VTK programming style and there should be a singl
cout<<"Print something"<<endl;
```
- All includes from the toolkit should use <> notation. This follows C++ programming conventions.
* All includes from the toolkit should use <> notation. This follows C++ programming conventions.
For example: `#include <vtkContourFilter.h>` is preferred over `#include "vtkContourFilter.h"`
- The main program must have the following signature:
* The main program must have the following signature:
``` c++
intmain(intargc,char*argv[])
...
...
@@ -58,7 +58,7 @@ All examples should follow the VTK programming style and there should be a singl
intmain(int,char*[])
```
- If arguments are required, a check similar to the following should be made at the start of the main program.
* If arguments are required, a check similar to the following should be made at the start of the main program.
``` c++
if(argc!=3)
...
...
@@ -68,7 +68,7 @@ All examples should follow the VTK programming style and there should be a singl
}
```
- An example should **never call exit()**. If the main program executes successfully, it should
* An example should **never call exit()**. If the main program executes successfully, it should
``` c++
returnEXIT_SUCCESS;
...
...
@@ -80,7 +80,7 @@ All examples should follow the VTK programming style and there should be a singl
returnEXIT_FAILURE;
```
- The use of SmartPointers is preferred in VTK examples.
* The use of SmartPointers is preferred in VTK examples.
@@ -98,13 +98,13 @@ All examples should follow the VTK programming style and there should be a singl
vtkCutter*cutter=vtkCutter::New();
```
- When building pipelines, the new `SetInputConnection()`, `GetOutputPort()` methods should be used instead of `SetInput()`, `GetOutput()`
* When building pipelines, the new `SetInputConnection()`, `GetOutputPort()` methods should be used instead of `SetInput()`, `GetOutput()`
- Input/Output filenames
* Input/Output filenames
When possible, filenames should be passed on the command line. This gives the examples utility beyond the data that is used in the specific example.
- If there are just a few parameters for the example, these should be passed in as arguments. This increases the utility of the example and facilitates testing.
* If there are just a few parameters for the example, these should be passed in as arguments. This increases the utility of the example and facilitates testing.
For example, this program
...
...
@@ -120,9 +120,9 @@ All examples should follow the VTK programming style and there should be a singl
writer->SetFileName(argv[3]);
```
- Always provide a background for the renderers. Avoid setting the background to white.
* Always provide a background for the renderers. Avoid setting the background to white.
- Use [vtkNamedColors](http://www.vtk.org/doc/nightly/html/classvtkNamedColors.html) for setting colors of actors and renderer backgrounds. [VTKNamedColorPatches](http://htmlpreview.github.io/?__BLOB__/VTKNamedColorPatches.html) shows the colors that are available. If you are using a color series, then you can choose what you want from here [VTKColorSeriesPatches](http://htmlpreview.github.io/?__BLOB__/VTKColorSeriesPatches.html).
* Use [vtkNamedColors](http://www.vtk.org/doc/nightly/html/classvtkNamedColors.html) for setting colors of actors and renderer backgrounds. [VTKNamedColorPatches](http://htmlpreview.github.io/?__BLOB__/VTKNamedColorPatches.html) shows the colors that are available. If you are using a color series, then you can choose what you want from here [VTKColorSeriesPatches](http://htmlpreview.github.io/?__BLOB__/VTKColorSeriesPatches.html).
For example,
...
...
@@ -141,7 +141,7 @@ All examples should follow the VTK programming style and there should be a singl
renderer->SetBackground(0.9412,0.9020,0.5490);
```
- Use admonitions to warn/cite/info, etc. [Here is a summary of admonitions](__SITE__/Instructions/ForAdministrators/#admonition).
* Use admonitions to warn/cite/info, etc. [Here is a summary of admonitions](__SITE__/Instructions/ForAdministrators/#admonition).
### Python
...
...
@@ -168,9 +168,7 @@ if __name__ == '__main__':
```
- Input/Output of filenames and parameters.
Use this snippet [GetProgramParameters](__SITE__/Python/Snippets/GetProgramParameters/)
For the Input/Output of filenames and parameters. Use this snippet [GetProgramParameters](__SITE__/Python/Snippets/GetProgramParameters/)
### Java
...
...
@@ -182,5 +180,5 @@ Java code styling follows the usual style as implemented in the IDEs.