### Home Classes Methods

### In Files

- lib/interfaces/guitools.rb

### Parent

Sketchup::EntitiesObserver

### Methods

- ::new
- #onElementAdded
- #onElementModified
- #onElementRemoved
- #onEraseEntities

### Files

- LessThan5BlueLabels.txt
- AtLeast2LargeSegments.txt

### Class Index

Quicksearch

- AddLabelTool
- AllRulesAppliedGoal
- Area
- AreaConstraint
- Array
- BalancedBinaryTree
- BalancedBinaryTreeNode
- CloseObserver
- Constants
- Constraint
- CurrentLabelledShape
- DistinctShapeConstraint
- Execution
- Goal
- Grammar
- Label
- LabelledShape
- LineDescriptor
- LinearLinkedList
- LinearLinkedListNode
- NoLabelsGoal
- NoMoreRulesGoal
- NoScalesConstraint
- Numeric
- Object
- OrderedPoint
- PiList
- Point
- Project
- Robot
- Rule
- RuleGroupsObserver
- RuleLabelledShape
- RuleShapeObserver
- Segment
- ShaDeLayersObserver
- Shade
- ShadeUtils
- UndoObserver

No matching classes.

# RuleShapeObserver

Author | Manuela Ruiz (mruiz@lcc.uma.es)

This class represents the observer for a rule shape group. There is one observer of this kind for every present rule shape.

### Public Class Methods

new(shape) click to toggle source

Initializing

        # File lib/interfaces/guitools.rb, line 15
    15:         def initialize(shape)

    16:                 @shape = shape

    17:         end

### Public Instance Methods

onElementAdded(entities, entity) click to toggle source

Method that triggers when some element is added into a rule shape group, in order to update the internal representation of the affected rule shape

        # File lib/interfaces/guitools.rb, line 49
    49:         def onElementAdded(entities, entity)

    50:

    51:                 if !Shade.project.modifying

    52:

    53:                         Shade.project.modifying = true

    54:                         execution = Shade.project.execution

    55:                         layer_name = Sketchup.active_model.active_layer.name

    56:                         @shape.refresh_from_entities(entities, @shape.transformation(layer_name), layer_name)

    57:                         execution.grammar.saved = false

    58:                         Shade.project.modifying = false

    59:                 end

    60:         end

onElementModified(entities, entity) click to toggle source

Method that triggers when something is modified inside a rule shape group, in order to update the internal representation of the affected rule shape

        # File lib/interfaces/guitools.rb, line 20
    20:         def onElementModified(entities, entity)

    21:

    22:                 if !Shade.project.modifying

    23:                         if !Shade.project.erasing

    24:                                 Shade.project.modifying = true

    25:                                 execution = Shade.project.execution

    26:                                 layer_name = Sketchup.active_model.active_layer.name

    27:                                 @shape.refresh_from_entities(entities, @shape.transformation(layer_name), layer_name)

    28:                                 execution.grammar.saved = false

    29:                                 Shade.project.modifying = false

    30:                         end

    31:                 end

    32:         end

onElementRemoved(entities, entity_id) click to toggle source

Method that triggers when some element is removed from a rule shape group, in order to update the internal representation of the affected rule shape

        # File lib/interfaces/guitools.rb, line 63
    63:         def onElementRemoved(entities, entity_id)

    64:

    65:                 if !Shade.project.modifying

    66:                         Shade.project.modifying = true

    67:                         execution = Shade.project.execution

    68:                         layer_name = Sketchup.active_model.active_layer.name

    69:                         @shape.refresh_from_entities(entities, @shape.transformation(layer_name), layer_name)

    70:                         execution.grammar.saved = false

    71:                         Shade.project.modifying = false

    72:                 end

    73:         end

onEraseEntities(entities) click to toggle source

Method that triggers when a rule shape group is erased, in order to update the internal representation of the affected rule shape

        # File lib/interfaces/guitools.rb, line 35
    35:         def onEraseEntities(entities)

    36:

    37:                 if !Shade.project.modifying

    38:                         Shade.project.modifying = true

    39:                         layer_name = Sketchup.active_model.active_layer.name

    40:                         @shape.p[layer_name] = LinearLinkedList.new

    41:                         @shape.s[layer_name] = LinearLinkedList.new

    42:                         execution = Shade.project.execution

    43:                         execution.grammar.saved = false

    44:                         Shade.project.modifying = false

    45:                 end

    46:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.