@@ -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,35 +30,35 @@ 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;
std::cout<<"Print something"<<std::endl;
```
rather than
rather than
``` c++
cout<<"Print something"<<endl;
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[])
```
or, if argc and argv are not referenced in the code,
or, if argc and argv are not referenced in the code,
``` c++
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,51 +68,51 @@ 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;
```
otherwise
otherwise
``` c++
returnEXIT_FAILURE;
```
* The use of SmartPointers is preferred in VTK examples.
- The use of SmartPointers is preferred in VTK examples.
* 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.
@@ -120,11 +120,11 @@ 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,
For example,
``` c++
#include<vtkNamedColors.h>
...
...
@@ -135,13 +135,13 @@ All examples should follow the VTK programming style and there should be a singl