Parent

RuleGroupsObserver

Author

Manuela Ruiz (mruiz@lcc.uma.es)

This class represents the observer for all the rule shape groups. There is only one observer of this kind.

Attributes

observed_id_list[RW]

Public Class Methods

new() click to toggle source

Initializing the observer

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

84:                 #List of entity ids that cannot be modified

85:                 #These entities are the main groups of the rule shapes

86:                 @observed_id_list = Array.new

87:                 @undoing = false

88:                 super

89:         end

Public Instance Methods

onElementModified(entities, entity) click to toggle source

Method that triggers when some rule shape group is modified (transformed) as a whole, in order to update the internal representation of the affected rule shape

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

 93:                 

 94:                 if @observed_id_list.include? entity.entityID

 95:                         

 96:                         if !Shade.project.modifying

 97:                                 Shade.project.modifying = true

 98:                                 execution = Shade.project.execution

 99:                                 shape = execution.grammar.search_shape_by_id(entity.entityID)

100: 

101:                                 if shape

102:                                         #refresh the transformation                                                                                

103:                                         layout_t = shape.layout_transformation

104:                                         layout_t_i = layout_t.inverse

105:                                         shape_t = layout_t_i * entity.transformation

106:                                         

107:                                         layer_name = Sketchup.active_model.active_layer.name

108:                                         shape.shape_transformation[layer_name] = shape_t

109:                                         

110:                                         shape.refresh_from_entities(entity.entities, Geom::Transformation.new, layer_name)

111:                                         

112:                                         execution.grammar.saved = false

113:                                 end

114:                                 Shade.project.modifying = false

115:                         end

116:                 end

117:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.