Class Attributes
java.lang.Object
org.gvsig.app.project.documents.layout.Attributes
- All Implemented Interfaces:
Cloneable,org.gvsig.tools.persistence.Persistent
Attributes of Layout.
- Author:
- Vicente Caballero Navarro, jldominguez
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final Sizestatic final Sizestatic final Sizestatic final Sizestatic final Sizestatic final Sizestatic final Sizestatic final Sizestatic final Sizestatic final Sizestatic final Stringstatic final intstatic final Stringstatic intstatic final Stringstatic intstatic final Stringstatic final intstatic final Stringstatic final intstatic final Stringstatic final Sizestatic final Sizestatic final Sizestatic final Sizestatic final Sizestatic final Sizestatic final intstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final doublestatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Sizestatic final Sizestatic final Sizestatic final Sizestatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcalculateGridGapX(Rectangle2D rect) Calculates the grid gap for the x axis, in pixels, based on the paper width (in cm) and the width of the rectangle of sheet in screen, measured in pixels.voidcalculateGridGapY(Rectangle2D rect) Calculates the grid gap for the y axis, in pixels, based on the paper height (in cm) and the height of the rectangle of sheet in screen, measured in pixels.clone()doublefromUnits(double d) Returns a double in centimeters from the the unit of measure selected.getArea()Returns the printing area.double[]Returns attributes of PrintDialog.static doublegetConversionFactorToCm(int unit) Gets the conversion factor from the specified unit to centimeters.Gets the last selected custom paper size.static Point2DGets the default grid gap, in centimeters.static intgetDistanceAbbrPosition(String unitAbbr) doubleGets the grid gap for the x axis, in centimeters.doubleGets the grid gap for the x axis, in pixels.Returns the name of the selected units.Returns a PageFormat with the properties of printing.Paper size, measured in centimeters.getPaperSizeinUnits(boolean isLand, int type) Returns the size of sheet.Returns the size of sheet in the units of measure selected.doublegetPixXCm(Rectangle2D rect) Returns one centimeter in pixels on screen in this moment.getRectangleLandscape(Rectangle2D rect, int w, int h) It obtains the rect that is adjusted to the size of the window, to see the full extent of horizontal layout.getRectanglePortrait(Rectangle2D rect, int w, int h) It obtains the rect that is adjusted to the size of the window, to see the full extent of vertical layout.intReturns the resolution of properties to print.intDeprecated.Deprecated.UsegetPaperSizeInUnits()insteadintgetType()Returns the format of sheet.intgetUnit()Returns the type of unit in use (cm, mm, km, etc), codified as a position in the array returned byMapContext.getDistanceNames()doubleGets the grid gap for the y axis, in centimeters.doubleGets the grid gap for the y axis, in pixels.booleanbooleanisMargin()Returns true if the margin should be used.booleanvoidloadFromState(org.gvsig.tools.persistence.PersistentState state) voidobtainRect(boolean isPrint, Rectangle2D rect, int w, int h) Obtains the rectangle that represents the sheet with the characteristics that contains attributesstatic voidvoidsaveToState(org.gvsig.tools.persistence.PersistentState state) static voidsetDefaultGridGap(double hGap, double vGap, String hUnitAbbr, String vUnitAbbr) Sets the default grid gap.voidsetHGridGrapCm(double d) Inserts the number of units to define the coords X grid.voidsetIsLandScape(boolean b) Inserts true if the sheet is horizontal or false if is vertical.voidInserts the attributes with a PageFormat.voidsetPaperSize(Size paperSize) Sets the paper size, measured in centimetersvoidsetPaperSizeInUnits(Size sizeInUnits) Sets the paper size, measured on the selected unitsvoidsetResolution(int i) Inserts the resolution to apply at printing.voidsetSelectedOptions(int typeSel, int units, boolean isLand, boolean margin, int resolution, double[] _area_tplr) Inserts the Layout's properties to print.voidsetType(int t) Sets the type of sheet to show.voidsetUnit(int sel) Sets the type of unit that is used in the Layout, defined as an integer indicating a position in the arrayMapContext.getDistanceNames().voidsetVGridGrapCm(double d) Inserts the number of units to define the coords X grid.org.gvsig.compat.print.PrintAttributesReturns a PrintRequestAttributeSet with all properties to the PrintDialog.static PrintQualitytoPrintQuality(int quality) Returns a PrintRequestAttributeSet with all properties to the PrintDialog.doubletoUnits(double d) Returns a double in the unit of measure selected from the double in centimeters.
-
Field Details
-
PERSISTENCE_DEFINITION_NAME
- See Also:
-
DPI_FIELD
- See Also:
-
DPISCREEN_FIELD
- See Also:
-
TYPEUNIT_FIELD
- See Also:
-
NUMX_FIELD
- See Also:
-
NUMY_FIELD
- See Also:
-
UNITX_FIELD
- See Also:
-
UNITY_FIELD
- See Also:
-
HASMARGIN_FIELD
- See Also:
-
RESOLUTIONSEL_FIELD
- See Also:
-
TYPESEL_FIELD
- See Also:
-
SELTYPEUNIT_FIELD
- See Also:
-
SIZEPAPER_FIELD
- See Also:
-
AREA_FIELD
- See Also:
-
SIZEINUNITS_FIELD
- See Also:
-
ISLANDSEL_FIELD
- See Also:
-
DEGREES
- See Also:
-
HIGH
public static final int HIGH- See Also:
-
NORMAL
public static final int NORMAL- See Also:
-
DRAFT
public static final int DRAFT- See Also:
-
PULGADA
public static final double PULGADA- See Also:
-
STANDARD_LETTER_PAPER_SIZE
-
STANDARD_FOLIO_PAPER_SIZE
-
STANDARD_LEGAL_PAPER_SIZE
-
STANDARD_TABLOID_PAPER_SIZE
-
METRIC_A0_PAPER_SIZE
-
METRIC_A1_PAPER_SIZE
-
METRIC_A2_PAPER_SIZE
-
METRIC_A3_PAPER_SIZE
-
METRIC_A4_PAPER_SIZE
-
METRIC_A5_PAPER_SIZE
-
ANSI_ENG_A_PAPER_SIZE
-
ANSI_ENG_B_PAPER_SIZE
-
ANSI_ENG_C_PAPER_SIZE
-
ANSI_ENG_D_PAPER_SIZE
-
ANSI_ENG_E_PAPER_SIZE
-
ANSI_ARCH_A_PAPER_SIZE
-
ANSI_ARCH_B_PAPER_SIZE
-
ANSI_ARCH_C_PAPER_SIZE
-
ANSI_ARCH_D_PAPER_SIZE
-
ANSI_ARCH_E_PAPER_SIZE
-
PRINT
public static final int PRINT- See Also:
-
CUSTOM
public static final int CUSTOM- See Also:
-
A0
public static final int A0- See Also:
-
A1
public static final int A1- See Also:
-
A2
public static final int A2- See Also:
-
A3
public static final int A3- See Also:
-
A4
public static final int A4- See Also:
-
DPI
public static int DPI -
DPISCREEN
public static int DPISCREEN
-
-
Constructor Details
-
Attributes
public Attributes()Create a new object of Attributes.
-
-
Method Details
-
isLandscape
public boolean isLandscape()- Returns:
-
isPortrait
public boolean isPortrait()- Returns:
-
setSelectedOptions
public void setSelectedOptions(int typeSel, int units, boolean isLand, boolean margin, int resolution, double[] _area_tplr) Inserts the Layout's properties to print.- Parameters:
typeSel- Type of sheet.units- Units.isLand- True if the sheet is horizontal.margin- True if the sheet has margin.resolution- Type of quality of resolution.area- Printing area (top, bottom, left, right).
-
getPaperSize
Paper size, measured in centimeters. This field knows about orientation. Note that this size is always measured in centimeters, regardless the selected unit for the page. However, the user should be always presented measures in the selected unit.- Returns:
- See Also:
-
setPaperSize
Sets the paper size, measured in centimeters- Parameters:
paperSize-
-
getCustomPaperSize
Gets the last selected custom paper size. It will be equal togetPaperSize()whengetType()isCUSTOM.- Returns:
-
getPageFormat
Returns a PageFormat with the properties of printing.- Returns:
- PageFormat
-
getArea
Returns the printing area. The value returned changes if orientation changes (it "knows" about portrait/landscape)- Returns:
- Rectangle Area.
-
getAreaInsets
public double[] getAreaInsets() -
setPageFormat
Inserts the attributes with a PageFormat.- Parameters:
pf- PageFormat.
-
toPrintRequestAttributeSet
Returns a PrintRequestAttributeSet with all properties to the PrintDialog.- Returns:
- PrintRequestAttributesSet.
-
toDocAttributes
-
toPrintAttributes
public org.gvsig.compat.print.PrintAttributes toPrintAttributes() -
toPrintAttributeSet
Returns a PrintRequestAttributeSet with all properties to the PrintDialog.- Returns:
- PrintRequestAttributesSet.
-
isMargin
public boolean isMargin()Returns true if the margin should be used.- Returns:
- True if margin should be used.
-
getResolution
public int getResolution()Returns the resolution of properties to print.- Returns:
- Resolution.
-
setResolution
public void setResolution(int i) Inserts the resolution to apply at printing.- Parameters:
i- Type of resolution. The type of resolution can be: DRAFT: 27 dpi. NORMAL: 300 dpi. HIGH: 600 dpi.
-
toPrintQuality
- Parameters:
quality-- Returns:
-
getAttributes
Returns attributes of PrintDialog.- Returns:
- Attributes of printing.
-
getType
public int getType()Returns the format of sheet.- Returns:
- Format of sheet.
-
setHGridGrapCm
public void setHGridGrapCm(double d) Inserts the number of units to define the coords X grid.- Parameters:
d- number of units to define the grid.
-
getHGridGapCm
public double getHGridGapCm()Gets the grid gap for the x axis, in centimeters. The grip gap is the distance from one point to the next point in the snapping grid.- Returns:
- Default grid gap for the x axis, measured in centimeters
-
getVGridGapCm
public double getVGridGapCm()Gets the grid gap for the y axis, in centimeters. The grip gap is the distance from one point to the next point in the snapping grid.- Returns:
- Default grid gap for the y axis, measured in centimeters
-
setVGridGrapCm
public void setVGridGrapCm(double d) Inserts the number of units to define the coords X grid.- Parameters:
d- number of units to define the grid.
-
setIsLandScape
public void setIsLandScape(boolean b) Inserts true if the sheet is horizontal or false if is vertical.- Parameters:
b- True if sheet is horizontal.
-
setType
public void setType(int t) - Parameters:
t- Type of sheet.
-
setPaperSizeInUnits
Sets the paper size, measured on the selected units- Parameters:
sizeInUnits-- See Also:
-
getPaperSizeinUnits
Returns the size of sheet.- Parameters:
isLand- True if is horizontal and false if is vertical.type- Type of sheet.- Returns:
- Size of sheet with these properties.
-
getUnit
public int getUnit()Returns the type of unit in use (cm, mm, km, etc), codified as a position in the array returned byMapContext.getDistanceNames()- Returns:
- Type of units.
- See Also:
-
getSelTypeUnit
Deprecated.UsegetUnit()instead- Returns:
-
getNameUnit
Returns the name of the selected units.- Returns:
- String Name of units.
- See Also:
-
setUnit
public void setUnit(int sel) Sets the type of unit that is used in the Layout, defined as an integer indicating a position in the arrayMapContext.getDistanceNames(). By default is centimeters.- Parameters:
sel- Type of unit.- See Also:
-
toUnits
public double toUnits(double d) Returns a double in the unit of measure selected from the double in centimeters.- Parameters:
d- Distance in centimeters.- Returns:
- Distance in the unit measure selected.
-
fromUnits
public double fromUnits(double d) Returns a double in centimeters from the the unit of measure selected.- Parameters:
d- Distance in the unit measure selected.- Returns:
- Distance in centimeters.
-
getPixXCm
Returns one centimeter in pixels on screen in this moment.- Parameters:
rect- Rectangle of sheet.- Returns:
- Pixels from centimeter.
-
calculateGridGapX
Calculates the grid gap for the x axis, in pixels, based on the paper width (in cm) and the width of the rectangle of sheet in screen, measured in pixels. The grip gap is the distance from one point to the next point in the snapping grid.- Parameters:
rect- Rectangle of sheet, measured in pixels
-
calculateGridGapY
Calculates the grid gap for the y axis, in pixels, based on the paper height (in cm) and the height of the rectangle of sheet in screen, measured in pixels. The grip gap is the distance from one point to the next point in the snapping grid.- Parameters:
rect- Rectangle of sheet, measured in pixels
-
obtainRect
Obtains the rectangle that represents the sheet with the characteristics that contains attributes- Parameters:
isPrint-rect- rectangle.w-h-
-
getRectangleLandscape
It obtains the rect that is adjusted to the size of the window, to see the full extent of horizontal layout.- Parameters:
rect- Rectangle sheet.w- Width of Layout.h- Height of Layout.- Returns:
- Rectangle modified.
-
getPaperSizeInUnits
Returns the size of sheet in the units of measure selected.- Returns:
- Size of sheet.
-
getSizeInUnits
Deprecated.UsegetPaperSizeInUnits()instead- Returns:
-
getRectanglePortrait
It obtains the rect that is adjusted to the size of the window, to see the full extent of vertical layout.- Parameters:
rect- Rectangle sheet.w- Width of Layout.h- Height of Layout.- Returns:
- Rectangle modified.
-
setDefaultGridGap
Sets the default grid gap. The grip gap is the distance from one point to the next point in the snapping grid.- Parameters:
hGap- Horizontal distance.vGap- Vertical distance.hUnitAbbr- The abbreviation of the measure in which hGap has been provided, codified as one of the abbreviations specified inMapContext.getDistanceAbbr()vUnitAbbr- The abbreviation of the measure in which vGap has been provided, codified as one of the abbreviations specified inMapContext.getDistanceAbbr()
-
getDefaultGridGap
Gets the default grid gap, in centimeters. The grip gap is the distance from one point to the next point in the snapping grid.- Returns:
- Default grid gap, measured in centimeters
-
getDistanceAbbrPosition
-
getVGridGapPx
public double getVGridGapPx()Gets the grid gap for the y axis, in pixels. The grip gap is the distance from one point to the next point in the snapping grid.- Returns:
- Number of pixels of each grid gap for the y axis
-
getHGridGapPx
public double getHGridGapPx()Gets the grid gap for the x axis, in pixels. The grip gap is the distance from one point to the next point in the snapping grid.- Returns:
- Number of pixels of each grid gap for the x axis
-
registerPersistent
public static void registerPersistent() -
loadFromState
public void loadFromState(org.gvsig.tools.persistence.PersistentState state) throws org.gvsig.tools.persistence.exception.PersistenceException - Specified by:
loadFromStatein interfaceorg.gvsig.tools.persistence.Persistent- Throws:
org.gvsig.tools.persistence.exception.PersistenceException
-
saveToState
public void saveToState(org.gvsig.tools.persistence.PersistentState state) throws org.gvsig.tools.persistence.exception.PersistenceException - Specified by:
saveToStatein interfaceorg.gvsig.tools.persistence.Persistent- Throws:
org.gvsig.tools.persistence.exception.PersistenceException
-
getConversionFactorToCm
public static double getConversionFactorToCm(int unit) Gets the conversion factor from the specified unit to centimeters. If you have some distance measured in the specified unit, you can multiply it by this factor in order to convert the distance to cm.- Parameters:
unit- The source unit, codified as a position in the arrayMapContext.getDistanceNames()- Returns:
- A conversion factor from the specified unit to cm
-
clone
-
getUnit()instead