RoofStructure
Summary
Roof associated with a subslope.
Constructor
RoofStructure
Syntax
RoofStructure
()
Summary
Item Index
Methods
- add
- addRaccord
- applyOverhangMagnetism
- closePopup
- computeValues
- computeWalls
- copyFrom
- copyToOpposite
- deserialize
- draw2D
- drawAngle
- drawHighlight
- drawMeasure
- drawPolygon
- getElementByName
- getFloor
- getValueFromName
- initialize
- isSmall
- openPopup
- polygonPoints
- polygonPointsExtended
- ridgeAlignMagnetism
- ridgeCornerMagnetism
- serialize
- update
- updateDisplayFields
- updateFields
- updateReferences
Methods
add
Syntax
add
-
propertyName
-
value
Summary
Adds an element to the collection in parameter.Returns:
addRaccord
Syntax
addRaccord
-
topPoint
-
bottomPoint
Summary
Adds connection (two points) in list of connections of this roof
Parameters:
-
topPoint
BABYLON.Vector2top point of the connection
-
bottomPoint
BABYLON.Vector2bottom point of the connection
applyOverhangMagnetism
Syntax
applyOverhangMagnetism
()
private
Summary
Applies magnetism to overhang so it fits with a neighbor's overhang if close enough
closePopup
Syntax
closePopup
()
private
Summary
Closes the popup showing a cut of the roof
computeValues
Syntax
computeValues
-
subSlope
Summary
Associates a new subslope with the roof and recomputes the properties "angle" and "subslopeLength" accordingly (might also modify "overhang" if truss roof).
Parameters:
-
subSlope
SubSlopeStructurenew subslope associated to the roof
computeWalls
Syntax
computeWalls
()
private
Summary
Computes and draws walls of roof cut in popup canvas
copyFrom
Syntax
copyFrom
-
roof
Summary
Updates all attributes to same values as roof in parameter
Parameters:
-
roof
RoofStructureroof to copy attributes from
copyToOpposite
Syntax
copyToOpposite
()
Summary
Copies all properties to opposite roof
deserialize
Syntax
Summary
Deserializes the object (from JSON).Parameters:
-
hybrid
ObjectJSON describing the object, built with the method serialize.
Returns:
draw2D
Syntax
draw2D
()
private
Summary
Draws walls of roof cut in popup canvas, with highlight if needed and image of the outline of a man for scale
drawAngle
Syntax
drawAngle
-
ctx
-
translation
-
zoom
-
center
-
color
Summary
Draws an arc representing the angle of the roof
drawHighlight
Syntax
drawHighlight
-
ctx
-
translation
-
zoom
Summary
Highlights portion of wall corresponding to field in focus in the popup
drawMeasure
Syntax
drawMeasure
-
ctx
-
translation
-
zoom
-
point0
-
point1
-
offset
-
color
Summary
Draws the measure of a segment with double arrows
Parameters:
-
ctx
ObjectHTML canvas context obtained with getContext('2d')
-
translation
BABYLON.Vector2translation to apply to the origin before drawing
-
zoom
Numbervalue of zoom
-
point0
BABYLON.Vector2First point of the segment
-
point1
BABYLON.Vector2Second point of the segment
-
offset
Numberdistance between the measure and the segment
-
color
StringColor to fill the polygon
drawPolygon
Syntax
drawPolygon
-
ctx
-
translation
-
zoom
-
vectors
-
color
Summary
Draws a polygon on the given canvas
getElementByName
Syntax
Summary
Gets an element of the collection by its name.Parameters:
Returns:
getFloor
Syntax
Summary
Gets the floor referencing this objectParameters:
-
collection
StringCollection to search within.
Returns:
getValueFromName
Syntax
getValueFromName
()
private
Summary
Returns value of roof attribute associated with field name in parameter.
initialize
Syntax
initialize
()
private
Summary
Method called after the loading of the componentisSmall
Syntax
Summary
Checks if the roof exists
Returns:
true if offset is zero or angle is 90°
openPopup
Syntax
openPopup
()
private
Summary
Opens the popup showing a cut of the roof
polygonPoints
Syntax
polygonPoints
()
BABYLON.Vector2
Summary
Returns the polygon points of the roof, that is the subslope extended points, extended again to include the overhangs (at gable too).
Returns:
roof points with overhangs
polygonPointsExtended
Syntax
polygonPointsExtended
-
check
Summary
Returns the polygon points of the roof extended to the ridge formed with opposite roof.
Parameters:
-
check
Booleanif not false then compute connections with other roofs (raccords)
Returns:
roof points with overhangs and meeting of roofs
ridgeAlignMagnetism
Syntax
Summary
Applies magnetism to ridge so it aligns with other ridges when close enough
Parameters:
Returns:
new offset to apply to subslope (and the opposite too if symmetry) to make the ridges fit
ridgeCornerMagnetism
Syntax
Summary
Applies magnetism to subslope offset so this ridge fits at corner with ridge of neighbors when close enough
Parameters:
Returns:
new offset to apply to subslope (and the opposite too if symmetry) to make the ridges fit
serialize
Syntax
Summary
Serializes the object (to JSON)Returns:
update
Syntax
update
()
Summary
Generic update method, must be overridden.updateDisplayFields
Syntax
updateDisplayFields
()
private
Summary
Updates fields of popup depending on values of roof properties
updateFields
Syntax
updateFields
-
fieldName
-
fieldValue
-
locked
Summary
Changes value of a property and computes induced changes to other properties
Parameters:
-
fieldName
Stringthe name of the field that needs to be modified among "thickness","start_height","end_height","offset","subslope_length","angle","overhang","gable"
-
fieldValue
Numberthe new value of the field
-
locked
String[]list of attributes that can't be modified, helps choose the way to update the field
updateReferences
Syntax
updateReferences
-
structure
Summary
Generic method for rebuilding references after the deserialization. For example : restoring the link between a PointStructure and its parent WallStructureParameters:
-
structure
wnp.StructureFloor Structure to work with
Properties
angle
Syntax
angle
Number
Summary
Angle of the roof with horizontal plane in radians, computed with subslope info.
canvas
Syntax
canvas
photonui.Canvas
private
Summary
Canvas to draw roof cut
hasPanel
Syntax
hasPanel
Boolean
Summary
Is there a panel (horizontal filling under the overhang).
Default: true
overhang
Syntax
overhang
Number
Summary
Size of the overhang of the roof (part that extends beyond the base wall).
Default: 50
planPos
Syntax
planPos
BABYLON.Vector2
private
Summary
The position of the mouse on the plan when it was clicked to open the popup
roofOffset
Syntax
roofOffset
Number
Summary
Horizontal offset to add on top of the subslope offset to make the roof meet with its opposite roof, computed after finding the opposite subslope.
roofPopup
Syntax
roofPopup
photonui.Dialog
private
Summary
The 2D pop up of the roof cut
roofType
Syntax
roofType
Number
Summary
Type of roof: 0 = no roof, 1 = rafter roof (regular roof), 2 = truss roof (overhang always at floor level)
Default: 1
selectedField
Syntax
Summary
Stores the name of the field in focus to highlight corresponding measure on the cut drawing
subslopeLength
Syntax
subslopeLength
Number
Summary
Length of the inside slope of the subslope, computed with subslope info.
symmetry
Syntax
symmetry
Boolean
Summary
If true then we will apply all modifications to this roof to the opposite roof too.
Default: true
translation
Syntax
translation
BABYLON.Vector2
private
Summary
The translation necessary for drawing on the canvas