### Home Classes Methods

### In Files

- lib/interfaces/guitools.rb

### Parent

Object

### Methods

- ::new
- #activate
- #onLButtonDown
- #onSetCursor

### 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.

# AddLabelTool

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

Tool for painting a label

### Public Class Methods

new(shape, value) click to toggle source

shape | the shape to which the label is going to be added
value | the value of the label

Initializing the tool

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

    154:                 @id_cursor = nil

    155:                 @shape = shape

    156:                 @value = value

    157:         end

### Public Instance Methods

activate() click to toggle source

Activates the cursor

         # File lib/interfaces/guitools.rb, line 160
    160:         def activate

    161:                 file_name = Sketchup.find_support_file "add_label.png", "Plugins/ShaDe/#{Constants::ABS_ICONS_DIR}"

    162:                 @id_cursor = UI.create_cursor file_name, 18, 18

    163:         end

onLButtonDown(flags, x, y, view) click to toggle source

Method that triggers when the left button of the mouse is pressed

         # File lib/interfaces/guitools.rb, line 171
    171:         def onLButtonDown(flags, x, y, view)

    172:

    173:                 inputpoint = view.inputpoint x,y

    174:                 point = inputpoint.position

    175:

    176:                 #Obtain point relative to shape

    177:                 t = @shape.layout_transformation.inverse

    178:                 pt_label = t * point

    179:                 layer_name = Sketchup.active_model.active_layer.name

    180:                 @shape.add_label(pt_label, @value, layer_name)

    181:

    182:                 @shape.changed = true

    183:

    184:                 Shade.project.refresh

    185:                 Shade.project.execution.reset

    186:         end

onSetCursor() click to toggle source

Method that triggers when the cursor is chosen

         # File lib/interfaces/guitools.rb, line 166
    166:         def onSetCursor

    167:                 UI.set_cursor  @id_cursor

    168:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.