|
Sweet Home 3D 4.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
com.eteks.sweethome3d.swing.PlanComponent
public class PlanComponent
A component displaying the plan of a home.
Nested Class Summary | |
---|---|
protected static class |
PlanComponent.PaintMode
The circumstances under which the home items displayed by this component will be painted. |
class |
PlanComponent.PlanRulerComponent
A component displaying the plan horizontal or vertical ruler associated to this plan. |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Nested classes/interfaces inherited from interface com.eteks.sweethome3d.viewcontroller.PlanView |
---|
PlanView.CursorType |
Field Summary |
---|
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.print.Printable |
---|
NO_SUCH_PAGE, PAGE_EXISTS |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
PlanComponent(Home home,
UserPreferences preferences,
PlanController controller)
Creates a new plan that displays home . |
Method Summary | |
---|---|
boolean |
canImportDraggedItems(List<Selectable> items,
int x,
int y)
Returns true . |
int |
convertXModelToScreen(float x)
Returns x converted in screen coordinates space. |
float |
convertXPixelToModel(int x)
Returns x converted in model coordinates space. |
int |
convertYModelToScreen(float y)
Returns y converted in screen coordinates space. |
float |
convertYPixelToModel(int y)
Returns y converted in model coordinates space. |
protected Cursor |
createCustomCursor(URL smallCursorImageUrl,
URL largeCursorImageUrl,
float xCursorHotSpot,
float yCursorHotSpot,
String cursorName,
Cursor defaultCursor)
Returns a custom cursor created from images in parameters. |
void |
deleteFeedback()
Deletes all elements shown as feedback. |
void |
deleteToolTipFeedback()
Deletes tool tip text from screen. |
void |
exportToSVG(OutputStream outputStream)
Writes this plan in the given output stream at SVG (Scalable Vector Graphics) format. |
protected Color |
getBackgroundColor(PlanComponent.PaintMode mode)
Returns the background color used to draw content. |
BufferedImage |
getClipboardImage()
Returns an image of the selected items displayed by this component (camera excepted) with no outline at scale 1/1 (1 pixel = 1cm). |
protected Font |
getFont(Font defaultFont,
TextStyle textStyle)
Returns the AWT font matching a given text style. |
protected FontMetrics |
getFontMetrics(Font defaultFont,
TextStyle textStyle)
Returns the font metrics matching a given text style. |
protected Color |
getForegroundColor(PlanComponent.PaintMode mode)
Returns the foreground color used to draw content. |
protected Color |
getFurnitureOutlineColor()
Returns the color used to draw furniture outline of the shape where a user can click to select a piece of furniture. |
View |
getHorizontalRuler()
Returns the component used as an horizontal ruler for this plan. |
protected Rectangle2D |
getItemBounds(Graphics g,
Selectable item)
Returns the bounds of the given item . |
protected List<Selectable> |
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. |
float |
getPixelLength()
Returns the length in centimeters of a pixel with the current scale. |
Dimension |
getPreferredScrollableViewportSize()
|
Dimension |
getPreferredSize()
Returns the preferred size of this component. |
float |
getPrintPreferredScale(Graphics g,
PageFormat pageFormat)
Returns the print preferred scale of the plan drawn in this component to make it fill pageFormat imageable size. |
float |
getScale()
Returns the scale used to display the plan. |
int |
getScrollableBlockIncrement(Rectangle visibleRect,
int orientation,
int direction)
|
boolean |
getScrollableTracksViewportHeight()
|
boolean |
getScrollableTracksViewportWidth()
|
int |
getScrollableUnitIncrement(Rectangle visibleRect,
int orientation,
int direction)
|
protected Color |
getSelectionColor()
Returns the color used to draw selection outlines. |
float[][] |
getTextBounds(String text,
TextStyle style,
float x,
float y,
float angle)
Returns the coordinates of the bounding rectangle of the text centered at
the point (x ,y ). |
View |
getVerticalRuler()
Returns the component used as a vertical ruler for this plan. |
boolean |
isBackgroundPainted()
Returns true if plan's background should be painted. |
boolean |
isSelectedItemsOutlinePainted()
Returns true if the outline of home selected items should be painted. |
void |
makePointVisible(float x,
float y)
Ensures the point at ( x , y ) is visible,
moving scroll bars if needed. |
void |
makeSelectionVisible()
Ensures selected items are visible at screen and moves scroll bars if needed. |
void |
moveView(float dx,
float dy)
Moves the view from (dx, dy) unit in the scrolling zone it belongs to. |
protected void |
paintComponent(Graphics g)
Paints this component. |
protected void |
paintHomeItems(Graphics g,
float planScale,
Color backgroundColor,
Color foregroundColor,
PlanComponent.PaintMode paintMode)
Paints home items at the given scale, and with background and foreground colors. |
int |
print(Graphics g,
PageFormat pageFormat,
int pageIndex)
Prints this component plan at the scale given in the home print attributes or at a scale that makes it fill pageFormat imageable size if this attribute is null . |
void |
revalidate()
Revalidates and repaints this component and its rulers. |
void |
setAlignmentFeedback(Class<? extends Selectable> alignedObjectClass,
Selectable alignedObject,
float x,
float y,
boolean showPointFeedback)
Sets the location point for alignment feedback. |
void |
setAngleFeedback(float xCenter,
float yCenter,
float x1,
float y1,
float x2,
float y2)
Sets the points used to draw an angle in plan view. |
void |
setBackgroundPainted(boolean backgroundPainted)
Sets whether plan's background should be painted or not. |
void |
setCursor(PlanView.CursorType cursorType)
Sets the cursor of this component as rotation cursor. |
void |
setDimensionLinesFeedback(List<DimensionLine> dimensionLines)
Sets the given dimension lines to be drawn as feedback. |
void |
setDraggedItemsFeedback(List<Selectable> draggedItems)
Sets the feedback of dragged items drawn during a drag and drop operation, initiated from outside of plan view. |
void |
setRectangleFeedback(float x0,
float y0,
float x1,
float y1)
Sets rectangle selection feedback coordinates. |
void |
setResizeIndicatorVisible(boolean resizeIndicatorVisible)
Sets whether the resize indicator of selected wall or piece of furniture should be visible or not. |
void |
setScale(float scale)
Sets the scale used to display the plan. |
void |
setSelectedItemsOutlinePainted(boolean selectedItemsOutlinePainted)
Sets whether the outline of home selected items should be painted or not. |
void |
setToolTipEditedProperties(PlanController.EditableProperty[] toolTipEditedProperties,
Object[] toolTipPropertyValues,
float x,
float y)
Set tool tip edition. |
void |
setToolTipFeedback(String toolTipFeedback,
float x,
float y)
Sets tool tip text displayed as feedback. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PlanComponent(Home home, UserPreferences preferences, PlanController controller)
home
.
Method Detail |
---|
public void revalidate()
revalidate
in class JComponent
protected Cursor createCustomCursor(URL smallCursorImageUrl, URL largeCursorImageUrl, float xCursorHotSpot, float yCursorHotSpot, String cursorName, Cursor defaultCursor)
public Dimension getPreferredSize()
getPreferredSize
in class JComponent
protected List<Selectable> getPaintedItems()
protected Rectangle2D getItemBounds(Graphics g, Selectable item)
item
.
public float[][] getTextBounds(String text, TextStyle style, float x, float y, float angle)
text
centered at
the point (x
,y
).
getTextBounds
in interface PlanView
protected Font getFont(Font defaultFont, TextStyle textStyle)
protected FontMetrics getFontMetrics(Font defaultFont, TextStyle textStyle)
public void setBackgroundPainted(boolean backgroundPainted)
public boolean isBackgroundPainted()
true
if plan's background should be painted.
public void setSelectedItemsOutlinePainted(boolean selectedItemsOutlinePainted)
public boolean isSelectedItemsOutlinePainted()
true
if the outline of home selected items should be painted.
protected void paintComponent(Graphics g)
paintComponent
in class JComponent
public float getPrintPreferredScale(Graphics g, PageFormat pageFormat)
pageFormat
imageable size.
public int print(Graphics g, PageFormat pageFormat, int pageIndex)
pageFormat
imageable size if this attribute is null
.
print
in interface Printable
public BufferedImage getClipboardImage()
public void exportToSVG(OutputStream outputStream) throws IOException
IOException
protected Color getForegroundColor(PlanComponent.PaintMode mode)
protected Color getBackgroundColor(PlanComponent.PaintMode mode)
protected void paintHomeItems(Graphics g, float planScale, Color backgroundColor, Color foregroundColor, PlanComponent.PaintMode paintMode) throws InterruptedIOException
PAINT
mode.
InterruptedIOException
protected Color getSelectionColor()
protected Color getFurnitureOutlineColor()
public void setRectangleFeedback(float x0, float y0, float x1, float y1)
setRectangleFeedback
in interface PlanView
public void makeSelectionVisible()
makeSelectionVisible
in interface PlanView
public void makePointVisible(float x, float y)
x
, y
) is visible,
moving scroll bars if needed.
makePointVisible
in interface PlanView
public void moveView(float dx, float dy)
moveView
in interface PlanView
public float getScale()
getScale
in interface PlanView
public void setScale(float scale)
setScale
in interface PlanView
public float convertXPixelToModel(int x)
x
converted in model coordinates space.
convertXPixelToModel
in interface PlanView
public float convertYPixelToModel(int y)
y
converted in model coordinates space.
convertYPixelToModel
in interface PlanView
public int convertXModelToScreen(float x)
x
converted in screen coordinates space.
convertXModelToScreen
in interface PlanView
public int convertYModelToScreen(float y)
y
converted in screen coordinates space.
convertYModelToScreen
in interface PlanView
public float getPixelLength()
getPixelLength
in interface PlanView
public void setCursor(PlanView.CursorType cursorType)
setCursor
in interface PlanView
public void setToolTipFeedback(String toolTipFeedback, float x, float y)
setToolTipFeedback
in interface PlanView
toolTipFeedback
- the text displayed in the tool tip
or null
to make tool tip disappear.public void setToolTipEditedProperties(PlanController.EditableProperty[] toolTipEditedProperties, Object[] toolTipPropertyValues, float x, float y)
setToolTipEditedProperties
in interface PlanView
public void deleteToolTipFeedback()
deleteToolTipFeedback
in interface PlanView
public void setResizeIndicatorVisible(boolean resizeIndicatorVisible)
setResizeIndicatorVisible
in interface PlanView
public void setAlignmentFeedback(Class<? extends Selectable> alignedObjectClass, Selectable alignedObject, float x, float y, boolean showPointFeedback)
setAlignmentFeedback
in interface PlanView
public void setAngleFeedback(float xCenter, float yCenter, float x1, float y1, float x2, float y2)
setAngleFeedback
in interface PlanView
public void setDraggedItemsFeedback(List<Selectable> draggedItems)
setDraggedItemsFeedback
in interface PlanView
public void setDimensionLinesFeedback(List<DimensionLine> dimensionLines)
setDimensionLinesFeedback
in interface PlanView
public void deleteFeedback()
deleteFeedback
in interface PlanView
public boolean canImportDraggedItems(List<Selectable> items, int x, int y)
true
.
canImportDraggedItems
in interface PlanView
public Dimension getPreferredScrollableViewportSize()
getPreferredScrollableViewportSize
in interface Scrollable
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
getScrollableBlockIncrement
in interface Scrollable
public boolean getScrollableTracksViewportHeight()
getScrollableTracksViewportHeight
in interface Scrollable
public boolean getScrollableTracksViewportWidth()
getScrollableTracksViewportWidth
in interface Scrollable
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
getScrollableUnitIncrement
in interface Scrollable
public View getHorizontalRuler()
getHorizontalRuler
in interface PlanView
public View getVerticalRuler()
getVerticalRuler
in interface PlanView
|
Sweet Home 3D 4.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
![]() |
© Copyrights 2006-2013 eTeks - All rights reserved
Distributed under GNU General Public License |