Merge pull request #2 from kiruma524/tutorial

Changes in documentation
This commit is contained in:
Kira Dmitrieva 2021-08-22 12:25:23 +03:00 committed by GitHub
commit ab1ff5b16f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 25 additions and 14 deletions

View File

@ -95,7 +95,7 @@ The `prototypes` property tree is defined in `SolidGroup` class via `PrototypeHo
##### Styles ##### Styles
`SolidGroup` has a `styleSheet` property that can optionally define styles at the Group's `VisionGroup` has a `styleSheet` property that can optionally define styles at the Group's
level. Styles are applied to child (descendant) objects using `Vision.styles: List<String>` property. level. Styles are applied to child (descendant) objects using `Vision.styles: List<String>` property.

View File

@ -27,6 +27,7 @@ low structure changes of this group. Unconsumed changes are discarded.
Interface for 3-dimensional Vision. Interface for 3-dimensional Vision.
### SolidGroup ### SolidGroup
3D Visual Group with a container for templates visible inside this group. It has an interface `PrototypeHolder` which stands for being a container with prototype support.
* function `getPrototype(name: Name)` - get a prototype redirecting the request to the parent if prototype is not found. If prototype is a ref, then it is unfolded automatically. * function `getPrototype(name: Name)` - get a prototype redirecting the request to the parent if prototype is not found. If prototype is a ref, then it is unfolded automatically.
@ -34,10 +35,16 @@ Interface for 3-dimensional Vision.
### SolidReferenceGroup ### SolidReferenceGroup
A reference Solid to reuse a template object. A class with `SolidReference` interface with reference `Solid`s for template objects reuse.
### VisionGroupBase
Abstract implementation of mutable group of `Vision`.
### RootVisionGroup ### RootVisionGroup
Non-serializable root group used to propagate manager to its children. Non-serializable root group used to propagate manager to its children.
* function Vision.root(manager: VisionManager) - designate this [VisionGroup] as a root group and assign a [VisionManager] as its parent. ### MutableVisionGroup
Just a mutable version of `VisionGroup`

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 152 KiB

View File

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

View File

@ -2,6 +2,7 @@
Inheritance is an ability of an element to transfer a pack of properties to its `children` elements 'wrapped inside'. Inheritance is an ability of an element to transfer a pack of properties to its `children` elements 'wrapped inside'.
Properties have to be set in a specific order: Properties have to be set in a specific order:
### Main properties' inheritance: ### Main properties' inheritance:
* styles * styles
@ -16,8 +17,9 @@ As for `prototypes`, this property has to be set after styles, but before parent
* parents * parents
* parent's styles * parent's styles
* defaults * defaults
------------------------
Let's take a closer look using a [Muon Monitor Visualization](demo/muon-monitor/README.md).
Let's take a closer look using a [Muon Monitor Visualization](../demo/muon-monitor/README.md).
Running the demo, we will see this: Running the demo, we will see this:
![](../docs/images/inheritance-1.png) ![](../docs/images/inheritance-1.png)
@ -31,15 +33,15 @@ On the right, there is a list with changeable properties.
![](../docs/images/inheritance-properties.png) ![](../docs/images/inheritance-properties.png)
Properties, which can or cannot be inherited, are these: Properties, which can or cannot be inherited, are these:
* `visible` - toggles the visibility of an element. To be exact, the invisibility of an element is inheritable. * `visible` &ndash; toggles the visibility of an element. To be exact, the invisibility of an element is inheritable.
If a `parent` element is invisible, other elements are invisible as well, and they cannot be changed to visible mode. If a `parent` element is invisible, other elements are invisible as well, and they cannot be changed to visible mode.
![](../docs/images/inheritance-2-1-1.png) ![](../docs/images/inheritance-2-1-1.png)
![](../docs/images/inheritance-2-1-2.png) ![](../docs/images/inheritance-2-1-2.png)
* `material` - a group of properties, which can be inherited and which can be changed in `children` elements. * `material` &ndash; a group of properties, which can be inherited and which can be changed in `children` elements.
* `color` - color of an element. * `color` &ndash; color of an element.
* `opacity` - a number from 0 to 1 which represents percents of opacity (0 for 0%, 1 for 100%). * `opacity` &ndash; a number from 0 to 1 which represents percents of opacity (0 for 0%, 1 for 100%).
* `wireframe` - toggles the wireframe mode. * `wireframe` &ndash; toggles the wireframe mode.
Let's see how elements of the `material` group inherit changing `color` property; ***other properties of this group inherit in the same way.*** Let's see how elements of the `material` group inherit changing `color` property; ***other properties of this group inherit in the same way.***
@ -51,7 +53,7 @@ Properties, which can or cannot be inherited, are these:
![](../docs/images/inheritance-2-2-2.png) ![](../docs/images/inheritance-2-2-2.png)
It changes only, 'bottom' and 'middle' stays the same. It changes only, 'bottom' and 'middle' stays the same.
'top' is a `parent` element as well: it has `children` - 'SC72', 'SC73', ... ,'SC80'. 'top' is a `parent` element as well: it has `children` &ndash; 'SC72', 'SC73', ... ,'SC80'.
Let's change the color of 'SC76': Let's change the color of 'SC76':
![](../docs/images/inheritance-2-2-3.png) ![](../docs/images/inheritance-2-2-3.png)
Again, only 'SC76' has changed among other 'siblings'. Again, only 'SC76' has changed among other 'siblings'.
@ -64,5 +66,5 @@ Properties, which can or cannot be inherited, are these:
If after all those changes we set at the 'World' element grey color, changes won't disappear: If after all those changes we set at the 'World' element grey color, changes won't disappear:
![](../docs/images/inheritance-2-2-5.png) ![](../docs/images/inheritance-2-2-5.png)
* `rotation` - rotation of an element. Here, it is set by `x` value. It is inheritable and unable to be changed in `children` elements. * `rotation` &ndash; rotation of an element. Here, it is set by `x` value. It is inheritable and unable to be changed in `children` elements.
* `position` - position of an element, cannot be inherited. * `position` &ndash; position of an element, cannot be inherited.

View File

@ -84,6 +84,7 @@ interface SolidReference{
fun getPropertyValue(name,inherit,includeStyles,includeDefaults): Value? fun getPropertyValue(name,inherit,includeStyles,includeDefaults): Value?
} }
VisionGroup <---- SolidReference VisionGroup <---- SolidReference
SolidReferenceGroup -- SolidReference
class SolidReferenceGroup{ class SolidReferenceGroup{
val refName: Name val refName: Name
@ -93,6 +94,7 @@ class SolidReferenceGroup{
fun getPropertyValue(name,inherit,includeStyles,includeDefaults): Value? fun getPropertyValue(name,inherit,includeStyles,includeDefaults): Value?
} }
VisionBase <-- SolidReferenceGroup VisionBase <-- SolidReferenceGroup
VisionGroup <-- SolidReferenceGroup
interface MutableVisionGroup{ interface MutableVisionGroup{
fun onStructureChanged(owner, block) fun onStructureChanged(owner, block)

View File

@ -23,7 +23,7 @@ internal data class MetaListener(
/** /**
* A full base implementation for a [Vision] * A full base implementation for a [Vision]
* @param parent the parent object for this vision. Could ve set later. Not serialized. * @param parent the parent object for this vision. Could've set later. Not serialized.
*/ */
@Serializable @Serializable
@SerialName("vision") @SerialName("vision")