diff --git a/docs/design.md b/docs/design.md index 79014d73..17e52a35 100644 --- a/docs/design.md +++ b/docs/design.md @@ -14,6 +14,6 @@ The actual layering scheme is more complicated. All objects support styling. The ### Intermediate representation -An important thing about VisionForge is that it does not strictly bound to a single format representation. +An important thing about VisionForge is that it does not strictly bound to a single format representation. ### Kotlin DSL for creating vision-graphs \ No newline at end of file diff --git a/docs/hierarchy.md b/docs/hierarchy.md new file mode 100644 index 00000000..eee02697 --- /dev/null +++ b/docs/hierarchy.md @@ -0,0 +1,32 @@ +# Hierarchy + +![](../docs/images/hierarchy.png) + +### Vision + +* function `getProperty(name: Name, inherit: Boolean, includeStyles: Boolean, includeDefaults: Boolean)`. + +It gets properties of element with `name` identification. +`inherit` — toggles parent node property lookup. Null means inference from descriptor. Default is false. +`includeStyles` — toggles inclusion of. Null means inference from descriptor. Default is true. +`includeDefaults` — default is false. + +* function `setProperty(name: Name, item: MetaItem?, notify: Boolean = true)` + +Sets the `item` property to the element with the `name` identification. `notify` is a value which toggles the necessity of the change notification. Default is true. + +### About properties +**Properties have to be set in particular order:** + +* styles +* prototypes +* parent +* parent's styles +* defaults + + +## Inheritance + +Inheritance is a very useful ability of `children` elements to get the same property in default as his parent does have (to 'inherit' it). + + diff --git a/docs/images/hierarchy.png b/docs/images/hierarchy.png new file mode 100644 index 00000000..e202c6af Binary files /dev/null and b/docs/images/hierarchy.png differ diff --git a/docs/tutorial.md b/docs/tutorial.md index 886fe641..8989bd49 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -42,9 +42,7 @@ fun main(){ *Basic properties:* 1. `opacity` — It is set in `float`. It takes on values from 0 to 1, which represent percents of solid opacity. It's initial value is 1. 2. `color` — It can be specified as `Int`, `String`, or as three `Ubytes`, which represent color in `rgb`. Elementally, the solid will have `green` color. - 3. `rotation` — it's the point, which sets rotations along axes. Initially, the value is `Point3D(0, 0, 0)`. Changing `x` coordinate of the point, you make pivot around `x axis`. The same for other coordinates: changing `y` — pivot around `y axis`, changing `z` — pivot around `z axis`. - 4. position, which is given by values `x`, `y`, `z`. Initial values are `x = 0`, `y = 0`, `z = 0`. The coordinate system is Cartesian. It's elemental position is this — vertical `y` axis and horizontal `Oxz` plane. Let's see how properties are set in solids. diff --git a/docs/uml/Vision.puml b/docs/uml/Vision.puml index 2028b097..d7fd7103 100644 --- a/docs/uml/Vision.puml +++ b/docs/uml/Vision.puml @@ -5,6 +5,7 @@ interface Vision{ val parent: Vision? fun getProperty(name): MetaItem? fun setProperty(name, value) + } class VisionBase{ diff --git a/visionforge-core/src/commonMain/kotlin/space/kscience/visionforge/VisionBase.kt b/visionforge-core/src/commonMain/kotlin/space/kscience/visionforge/VisionBase.kt index 78b75124..08927448 100644 --- a/visionforge-core/src/commonMain/kotlin/space/kscience/visionforge/VisionBase.kt +++ b/visionforge-core/src/commonMain/kotlin/space/kscience/visionforge/VisionBase.kt @@ -17,11 +17,6 @@ import space.kscience.dataforge.values.ValueType import space.kscience.visionforge.Vision.Companion.STYLE_KEY import kotlin.jvm.Synchronized -internal data class PropertyListener( - val owner: Any? = null, - val action: (name: Name) -> Unit, -) - /** * A full base implementation for a [Vision] * @param properties Object own properties excluding styles and inheritance @@ -43,7 +38,7 @@ public open class VisionBase( } /** - * A fast accessor method to get own property (no inheritance or styles + * A fast accessor method to get own property (no inheritance or styles) */ override fun getOwnProperty(name: Name): MetaItem? = if (name == Name.EMPTY) { properties?.asMetaItem()