|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jpicedt.graphic.PageFormat
public class PageFormat
Size and margins data for a PECanvas
.
This class provides a convenient way of converting b/w millimeters (ie model) coordinates and pixel coordinates. The dot-per-mm scale factor is computed from the AWT's ToolKit.
[SR:todo] adapt to fit with PageFormat
.
Nested Class Summary | |
---|---|
static class |
PageFormat.Customizer
a dialog box used to change a PageFormat |
Field Summary | |
---|---|
static double |
bottomMarginMmDEFAULT
|
static double |
DPMM
screen dot per mm ; used during coordinates translation from model to view. |
static double |
heightMmDEFAULT
|
static String |
KEY_PAGE_FORMAT
key used to retrieve parameters from Properties |
static double |
leftMarginMmDEFAULT
|
static double |
widthMmDEFAULT
|
Constructor Summary | |
---|---|
PageFormat()
Construct a new PageFormat with the default values (170,100,5,5) |
|
PageFormat(double widthMm,
double heightMm)
Constructor a new PageFormat with length given in mm. |
|
PageFormat(double widthMm,
double heightMm,
double leftMarginMm,
double bottomMarginMm)
Construct a new PageFormat with lengths given in mm. |
|
PageFormat(Properties preferences)
Construct a new PageFormat with values fetched from the given Properties : Key = KEY_PAGE_FORMAT Value = width height leftMargin bottomMargin (separated with spaces) If some values aren't found (including Properties's default), the local default values are used. |
Method Summary | |
---|---|
PageFormat.Customizer |
createCustomizer(PECanvas canvas)
Return a dialog for editing this PageFormat attached to the given canvas (a reference to the hosting canvas is needed so that setPageFormat() can be ultimately called when "ok" is pressed). |
static PageFormat.Customizer |
createCustomizer(Properties preferences)
Return a dialog for editing the PageFormat's values stored in the given Properties. |
void |
enlargeTo(Rectangle2D r)
Adjusts this PageFormat so that it is not smaller than the given rectangle (in mm) |
void |
fitTo(Rectangle2D r)
Adjusts this PageFormat so that it fits to the given rectangle (in mm) |
double |
getBottomMarginMm()
Return the bottom-margin in mm |
double |
getHeightMm()
Return the page height in mm. |
int |
getHeightPx(double zoom)
Return the page height in pixels. |
double |
getLeftMarginMm()
Return the left-margin in mm |
AffineTransform |
getModel2ViewTransform(double zoom)
x' = zoom * DPMM * (x + leftMarginMm) y' = zoom * DPMM * (-y + heightMm-bottomMarginMm) Return the AffineTransform that translates from model to view coordinate using the given zoom factor and this page format (ie most notably the left and bottom margins) |
PicPoint |
getOrgPx(double zoom)
Return (x,y) double-precision pixel-coordinates of the (0,0) model origin. |
Dimension |
getSizePx(double zoom)
Return the page dimension (w,h) in pixels. |
AffineTransform |
getView2ModelTransform(double zoom)
x' = zoom * DPMM * (x + leftMarginMm) y' = zoom * DPMM * (-y + heightMm-bottomMarginMm) |
double |
getWidthMm()
Return the page width in mm. |
int |
getWidthPx(double zoom)
Return the page width in pixels. |
int |
getXOrgPx(double zoom)
Return the left margin in pixels, ie the x-coordinate of the (0,0) model origin. |
int |
getYOrgPx(double zoom)
Return the y-coordinate in pixels (starting from the canvas's top-side) of the (0,0) model origin. |
boolean |
isFitInto(Rectangle2D r)
Returns whether the given rectangle (in mm units) fits into this page. |
void |
setBottomMarginMm(double margin)
Set the bottom margin in mm |
void |
setHeightMm(double h)
Set the page height in mm. |
void |
setLeftMarginMm(double margin)
Set the left margin in mm |
void |
setMarginsMm(double left,
double bottom)
Set the page margins in mm |
void |
setSizeMm(double w,
double h)
Sets the page size in millimeters |
void |
setWidthMm(double w)
Set the page width in mm. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final double DPMM
public static final String KEY_PAGE_FORMAT
public static final double widthMmDEFAULT
public static final double heightMmDEFAULT
public static final double leftMarginMmDEFAULT
public static final double bottomMarginMmDEFAULT
Constructor Detail |
---|
public PageFormat()
public PageFormat(Properties preferences)
public PageFormat(double widthMm, double heightMm, double leftMarginMm, double bottomMarginMm)
widthMm
- page width in mmheightMm
- page height in mmleftMarginMm
- left margin in mmbottomMarginMm
- bottom margin in mmpublic PageFormat(double widthMm, double heightMm)
widthMm
- page width in mmheightMm
- page height in mmMethod Detail |
---|
public double getWidthMm()
public void setWidthMm(double w)
public void setHeightMm(double h)
public double getHeightMm()
public void setSizeMm(double w, double h)
public double getLeftMarginMm()
public double getBottomMarginMm()
public void setLeftMarginMm(double margin)
public void setBottomMarginMm(double margin)
public void setMarginsMm(double left, double bottom)
public boolean isFitInto(Rectangle2D r)
public void fitTo(Rectangle2D r)
public void enlargeTo(Rectangle2D r)
public int getWidthPx(double zoom)
zoom
- the current zoom factorpublic int getHeightPx(double zoom)
zoom
- the current zoom factorpublic Dimension getSizePx(double zoom)
zoom
- the current zoom factorpublic int getXOrgPx(double zoom)
zoom
- the current zoom factorpublic int getYOrgPx(double zoom)
zoom
- the current zoom factorpublic PicPoint getOrgPx(double zoom)
zoom
- the current zoom factorpublic AffineTransform getModel2ViewTransform(double zoom)
zoom
- the current zoom factorpublic AffineTransform getView2ModelTransform(double zoom)
zoom
- the current zoom factor
public PageFormat.Customizer createCustomizer(PECanvas canvas)
public static PageFormat.Customizer createCustomizer(Properties preferences)
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |