Class PlanComponent
Defined in: PlanComponent.js.
Constructor Attributes | Constructor Name and Description |
---|---|
PlanComponent(containerOrCanvasId, home, preferences, object3dFactory, controller)
Creates a new plan that displays
home . |
Field Attributes | Field Name and Description |
---|---|
<static> |
PlanComponent.PaintMode
The circumstances under which the home items displayed by this component will be painted.
|
Method Attributes | Method Name and Description |
---|---|
canImportDraggedItems(items, x, y)
Returns
true . |
|
Returns
x converted in screen coordinates space. |
|
Returns
x converted in model coordinates space. |
|
Returns
y converted in screen coordinates space. |
|
Returns
y converted in model coordinates space. |
|
createTransferData(dataType)
Returns an image of selected items in plan for transfer purpose.
|
|
Deletes all elements shown as feedback.
|
|
Deletes tool tip text from screen.
|
|
dispose()
Removes components added to this pane and their listeners.
|
|
exportData(out, formatType, settings)
Writes this plan in the given output stream at SVG (Scalable Vector Graphics) format if this is the requested format.
|
|
getBackgroundColor(mode)
Returns the background color used to draw content.
|
|
Returns an image of the selected items displayed by this component
(camera excepted) with no outline at scale 1/1 (1 pixel = 1cm).
|
|
<static> |
PlanComponent.getDefaultSelectionColor(planComponent)
Returns the default color used to draw selection outlines.
|
getFont(defaultFont, textStyle)
Returns the HTML font matching a given text style.
|
|
getFontMetrics(defaultFont, textStyle)
Returns the font metrics matching a given text style.
|
|
getForegroundColor(mode)
Returns the foreground color used to draw content.
|
|
Returns the color used to draw furniture outline of
the shape where a user can click to select a piece of furniture.
|
|
Returns a
Graphics2D object. |
|
Returns the component used as an horizontal ruler for this plan.
|
|
Returns the HTML element used to view this component at screen.
|
|
getIndicator(item, indicatorType)
Returns the shape of the given indicator type.
|
|
getItemBounds(g, item)
Returns the bounds of the given
item . |
|
Returns the collection of walls, furniture, rooms and dimension lines of the home
painted by this component wherever the level they belong to is selected or not.
|
|
Returns the size of the given piece of furniture in the horizontal plan,
or
null if the view isn't able to compute such a value. |
|
Returns the length in centimeters of a pixel with the current scale.
|
|
Returns the preferred size of this component in actual screen pixels size.
|
|
getPrintPreferredScale(g, pageFormat)
Returns the print preferred scale of the plan drawn in this component
to make it fill
pageFormat imageable size. |
|
getScale()
Returns the scale used to display the plan.
|
|
Returns the color used to draw selection outlines.
|
|
getTextBounds(text, style, x, y, angle)
Returns the coordinates of the bounding rectangle of the
text centered at
the point (x ,y ). |
|
Returns the component used as a vertical ruler for this plan.
|
|
Returns
true if plan's background should be painted. |
|
isFormatTypeSupported(formatType)
Returns
true if the given format is SVG. |
|
Returns
true if this component is able to compute the size of horizontally rotated furniture. |
|
Returns
true if the outline of home selected items should be painted. |
|
isViewableAtLevel(item, level)
Returns
true if the given item can be viewed in the plan at a level. |
|
Returns
true if the given item can be viewed in the plan at the selected level. |
|
makePointVisible(x, y)
Ensures the point at (
x , y ) is visible,
moving scroll bars if needed. |
|
Ensures selected items are visible at screen and moves
scroll bars if needed.
|
|
moveView(dx, dy)
Moves the view from (dx, dy) unit in the scrolling zone it belongs to.
|
|
Paints this component.
|
|
paintHomeItems(g, level, planScale, backgroundColor, foregroundColor, paintMode)
Paints home items at the given scale, and with background and foreground colors.
|
|
repaint()
Repaints this component elements when possible.
|
|
setAlignmentFeedback(alignedObjectClass, alignedObject, x, y, showPointFeedback)
Sets the location point for alignment feedback.
|
|
setAngleFeedback(xCenter, yCenter, x1, y1, x2, y2)
Sets the points used to draw an angle in plan view.
|
|
setBackgroundPainted(backgroundPainted)
Sets whether plan's background should be painted or not.
|
|
setCursor(cursorType)
Sets the cursor of this component.
|
|
setDimensionLinesFeedback(dimensionLines)
Sets the given dimension lines to be drawn as feedback.
|
|
setDraggedItemsFeedback(draggedItems)
Sets the feedback of dragged items drawn during a drag and drop operation,
initiated from outside of plan view.
|
|
setRectangleFeedback(x0, y0, x1, y1)
Sets rectangle selection feedback coordinates.
|
|
setResizeIndicatorVisible(resizeIndicatorVisible)
Sets whether the resize indicator of selected wall or piece of furniture
should be visible or not.
|
|
setScale(scale)
Sets the scale used to display the plan.
|
|
setSelectedItemsOutlinePainted(selectedItemsOutlinePainted)
Sets whether the outline of home selected items should be painted or not.
|
|
setToolTipEditedProperties(toolTipEditedProperties, toolTipPropertyValues, x, y)
Set tool tip edition.
|
|
setToolTipFeedback(toolTipFeedback, x, y)
Sets tool tip text displayed as feedback.
|
Class Detail
PlanComponent(containerOrCanvasId, home, preferences, object3dFactory, controller)
Creates a new plan that displays
Author: Emmanuel Puybaret, Renaud Pawlak.
home
.
Author: Emmanuel Puybaret, Renaud Pawlak.
- Parameters:
- {string} containerOrCanvasId
- the ID of a HTML DIV or CANVAS
- {Home} home
- the home to display
- {UserPreferences} preferences
- user preferences to retrieve used unit, grid visibility...
- {Object} object3dFactory Optional
- a factory able to create 3D objects from
home
furniture. The {@link Object3DFactory#createObject3D(Home, Selectable, boolean) createObject3D} of this factory is expected to return an instance of Object3DBranch in current implementation. - {PlanController} controller
- the optional controller used to manage home items modification
Field Detail
<static>
PlanComponent.PaintMode
The circumstances under which the home items displayed by this component will be painted.
Method Detail
{boolean}
canImportDraggedItems(items, x, y)
Returns
true
.
- Parameters:
- {Object[]} items
- {number} x
- {number} y
- Returns:
- {boolean}
{number}
convertXModelToScreen(x)
Returns
x
converted in screen coordinates space.
- Parameters:
- {number} x
- Returns:
- {number}
{number}
convertXPixelToModel(x)
Returns
x
converted in model coordinates space.
- Parameters:
- {number} x
- Returns:
- {number}
{number}
convertYModelToScreen(y)
Returns
y
converted in screen coordinates space.
- Parameters:
- {number} y
- Returns:
- {number}
{number}
convertYPixelToModel(y)
Returns
y
converted in model coordinates space.
- Parameters:
- {number} y
- Returns:
- {number}
{Object}
createTransferData(dataType)
Returns an image of selected items in plan for transfer purpose.
- Parameters:
- {TransferableView.DataType} dataType
- Returns:
- {Object}
deleteFeedback()
Deletes all elements shown as feedback.
deleteToolTipFeedback()
Deletes tool tip text from screen.
dispose()
Removes components added to this pane and their listeners.
exportData(out, formatType, settings)
Writes this plan in the given output stream at SVG (Scalable Vector Graphics) format if this is the requested format.
- Parameters:
- {java.io.OutputStream} out
- {ExportableView.FormatType} formatType
- {Object} settings
{string}
getBackgroundColor(mode)
Returns the background color used to draw content.
- Parameters:
- {PlanComponent.PaintMode} mode
- Returns:
- {string}
{HTMLImageElement}
getClipboardImage()
Returns an image of the selected items displayed by this component
(camera excepted) with no outline at scale 1/1 (1 pixel = 1cm).
- Returns:
- {HTMLImageElement}
<static>
{string}
PlanComponent.getDefaultSelectionColor(planComponent)
Returns the default color used to draw selection outlines.
Note that the default selection color may be forced using CSS by setting backgroundColor with the ::selection selector.
In case the browser does not support the ::selection selector, one can force the selectio color in JavaScript by setting PlanComponent.DEFAULT_SELECTION_COLOR.
- Parameters:
- {PlanComponent} planComponent
- Returns:
- {string}
{string}
getFont(defaultFont, textStyle)
Returns the HTML font matching a given text style.
- Parameters:
- {string} defaultFont Optional
- {TextStyle} textStyle Optional
- Returns:
- {string}
{FontMetrics}
getFontMetrics(defaultFont, textStyle)
Returns the font metrics matching a given text style.
- Parameters:
- {string} defaultFont
- {TextStyle} textStyle
- Returns:
- {FontMetrics}
{string}
getForegroundColor(mode)
Returns the foreground color used to draw content.
- Parameters:
- {PlanComponent.PaintMode} mode
- Returns:
- {string}
{string}
getFurnitureOutlineColor()
Returns the color used to draw furniture outline of
the shape where a user can click to select a piece of furniture.
- Returns:
- {string}
{Graphics2D}
getGraphics()
Returns a
Graphics2D
object.
- Returns:
- {Graphics2D}
{Object}
getHorizontalRuler()
Returns the component used as an horizontal ruler for this plan.
- Returns:
- {Object}
getHTMLElement()
Returns the HTML element used to view this component at screen.
{Object}
getIndicator(item, indicatorType)
Returns the shape of the given indicator type.
- Parameters:
- {Object} item
- {PlanComponent.IndicatorType} indicatorType
- Returns:
- {Object}
{java.awt.geom.Rectangle2D}
getItemBounds(g, item)
Returns the bounds of the given
item
.
- Parameters:
- {Graphics2D} g
- {Object} item
- Returns:
- {java.awt.geom.Rectangle2D}
{Object[]}
getPaintedItems()
Returns the collection of walls, furniture, rooms and dimension lines of the home
painted by this component wherever the level they belong to is selected or not.
- Returns:
- {Object[]}
{Array}
getPieceOfFurnitureSizeInPlan(piece)
Returns the size of the given piece of furniture in the horizontal plan,
or
null
if the view isn't able to compute such a value.
- Parameters:
- {HomePieceOfFurniture} piece
- Returns:
- {Array}
{number}
getPixelLength()
Returns the length in centimeters of a pixel with the current scale.
- Returns:
- {number}
{java.awt.Dimension}
getPreferredSize()
Returns the preferred size of this component in actual screen pixels size.
- Returns:
- {java.awt.Dimension}
{number}
getPrintPreferredScale(g, pageFormat)
Returns the print preferred scale of the plan drawn in this component
to make it fill
pageFormat
imageable size.
- Parameters:
- {Graphics2D} g
- {java.awt.print.PageFormat} pageFormat
- Returns:
- {number}
{number}
getScale()
Returns the scale used to display the plan.
- Returns:
- {number}
{string}
getSelectionColor()
Returns the color used to draw selection outlines.
- Returns:
- {string}
{Array}
getTextBounds(text, style, x, y, angle)
Returns the coordinates of the bounding rectangle of the
text
centered at
the point (x
,y
).
- Parameters:
- {string} text
- {TextStyle} style
- {number} x
- {number} y
- {number} angle
- Returns:
- {Array}
{Object}
getVerticalRuler()
Returns the component used as a vertical ruler for this plan.
- Returns:
- {Object}
{boolean}
isBackgroundPainted()
Returns
true
if plan's background should be painted.
- Returns:
- {boolean}
{boolean}
isFormatTypeSupported(formatType)
Returns
true
if the given format is SVG.
- Parameters:
- {ExportableView.FormatType} formatType
- Returns:
- {boolean}
{boolean}
isFurnitureSizeInPlanSupported()
Returns
true
if this component is able to compute the size of horizontally rotated furniture.
- Returns:
- {boolean}
{boolean}
isSelectedItemsOutlinePainted()
Returns
true
if the outline of home selected items should be painted.
- Returns:
- {boolean}
{boolean}
isViewableAtLevel(item, level)
Returns
true
if the given item can be viewed in the plan at a level.
- Parameters:
- {Object} item
- {Level} level
- Returns:
- {boolean}
{boolean}
isViewableAtSelectedLevel(item)
Returns
true
if the given item can be viewed in the plan at the selected level.
- Parameters:
- {Object} item
- Deprecated:
- Override #isViewableAtLevel if you want to print different levels
- Returns:
- {boolean}
makePointVisible(x, y)
Ensures the point at (
x
, y
) is visible,
moving scroll bars if needed.
- Parameters:
- {number} x
- {number} y
makeSelectionVisible()
Ensures selected items are visible at screen and moves
scroll bars if needed.
moveView(dx, dy)
Moves the view from (dx, dy) unit in the scrolling zone it belongs to.
- Parameters:
- {number} dx
- {number} dy
paintComponent(g)
Paints this component.
- Parameters:
- {Graphics2D} g
paintHomeItems(g, level, planScale, backgroundColor, foregroundColor, paintMode)
Paints home items at the given scale, and with background and foreground colors.
Outline around selected items will be painted only under
PAINT
mode.
- Parameters:
- {Graphics2D} g
- {Level} level
- {number} planScale
- {string} backgroundColor
- {string} foregroundColor
- {PlanComponent.PaintMode} paintMode
repaint()
Repaints this component elements when possible.
setAlignmentFeedback(alignedObjectClass, alignedObject, x, y, showPointFeedback)
Sets the location point for alignment feedback.
- Parameters:
- {Object} alignedObjectClass
- {Object} alignedObject
- {number} x
- {number} y
- {boolean} showPointFeedback
setAngleFeedback(xCenter, yCenter, x1, y1, x2, y2)
Sets the points used to draw an angle in plan view.
- Parameters:
- {number} xCenter
- {number} yCenter
- {number} x1
- {number} y1
- {number} x2
- {number} y2
setBackgroundPainted(backgroundPainted)
Sets whether plan's background should be painted or not.
Background may include grid and an image.
- Parameters:
- {boolean} backgroundPainted
setCursor(cursorType)
Sets the cursor of this component.
- Parameters:
- {PlanView.CursorType|string} cursorType
setDimensionLinesFeedback(dimensionLines)
Sets the given dimension lines to be drawn as feedback.
- Parameters:
- {DimensionLine[]} dimensionLines
setDraggedItemsFeedback(draggedItems)
Sets the feedback of dragged items drawn during a drag and drop operation,
initiated from outside of plan view.
- Parameters:
- {Object[]} draggedItems
setRectangleFeedback(x0, y0, x1, y1)
Sets rectangle selection feedback coordinates.
- Parameters:
- {number} x0
- {number} y0
- {number} x1
- {number} y1
setResizeIndicatorVisible(resizeIndicatorVisible)
Sets whether the resize indicator of selected wall or piece of furniture
should be visible or not.
- Parameters:
- {boolean} resizeIndicatorVisible
setScale(scale)
Sets the scale used to display the plan.
If this component is displayed in a scrolled panel the view position is updated
to ensure the center's view will remain the same after the scale change.
- Parameters:
- {number} scale
setSelectedItemsOutlinePainted(selectedItemsOutlinePainted)
Sets whether the outline of home selected items should be painted or not.
- Parameters:
- {boolean} selectedItemsOutlinePainted
setToolTipEditedProperties(toolTipEditedProperties, toolTipPropertyValues, x, y)
Set tool tip edition.
- Parameters:
- {Array} toolTipEditedProperties
- {Array} toolTipPropertyValues
- {number} x
- {number} y
setToolTipFeedback(toolTipFeedback, x, y)
Sets tool tip text displayed as feedback.
- Parameters:
- {string} toolTipFeedback
- the text displayed in the tool tip
or
null
to make tool tip disappear. - x
- y