|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.latexdraw.glib.ui.LMagneticGrid
public class LMagneticGrid
This class defines a magnetic grid.
This file is part of LaTeXDraw
Copyright (c) 2005-2012 Arnaud BLOUIN
LaTeXDraw is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
LaTeXDraw is distributed without any warranty; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU General Public License for more details.
01/21/08
Nested Class Summary | |
---|---|
static class |
LMagneticGrid.GridStyle
This enumeration contains the different style of a magnetic grid. |
Field Summary | |
---|---|
protected ICanvas |
canvas
The canvas that paints the grid. |
protected int |
gridSpacing
defines the spacing between the lines of the grid. |
protected int |
height
The height of the grid. |
protected boolean |
isMagnetic
Allows to know if the grid is magnetic or not. |
protected boolean |
modified
Defined if the canvas has been modified. |
static java.awt.BasicStroke |
STROKE
The stroke of the grid. |
protected LMagneticGrid.GridStyle |
style
The style of the grid. |
protected int |
width
The width of the grid. |
Constructor Summary | |
---|---|
LMagneticGrid(int width,
int height,
ICanvas canvas)
Creates the magnetic grid. |
Method Summary | |
---|---|
ICanvas |
getCanvas()
|
int |
getGridSpacing()
|
int |
getHeight()
|
double |
getMagneticGridGap()
|
LMagneticGrid.GridStyle |
getStyle()
|
IPoint |
getTransformedPointToGrid(java.awt.geom.Point2D pt)
Transform a point to another "stick" to the magnetic grid. |
int |
getWidth()
|
boolean |
isGridDisplayed()
|
boolean |
isMagnetic()
|
boolean |
isModified()
|
boolean |
isPersonalGrid()
|
void |
load(boolean generalPreferences,
java.lang.String nsURI,
org.w3c.dom.Element meta)
Loads data save in an XML document. |
void |
paint(java.awt.Graphics2D gaph)
Paints the magnetic grid is activated. |
protected void |
paintMainLines(java.awt.Graphics2D graph,
double gap)
|
protected void |
paintSubLines(java.awt.Graphics2D graph)
|
void |
reinitGrid()
Reinitialises the magnetic grid. |
void |
save(boolean generalPreferences,
java.lang.String nsURI,
org.w3c.dom.Document document,
org.w3c.dom.Element root)
Saves the parameters of the instrument into an XML tag. |
void |
setGridSpacing(int gridSpacing)
|
void |
setMagnetic(boolean isMagnetic)
|
void |
setModified(boolean modified)
Sets the Modifiable object as modified. |
void |
setSize(int width,
int height)
Sets the size of the magnetic grid. |
void |
setStyle(LMagneticGrid.GridStyle style)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.awt.BasicStroke STROKE
protected boolean isMagnetic
protected int gridSpacing
protected int width
protected int height
protected LMagneticGrid.GridStyle style
protected ICanvas canvas
protected boolean modified
Constructor Detail |
---|
public LMagneticGrid(int width, int height, ICanvas canvas)
width
- The width of the grid.height
- The height of the grid.canvas
- The canvas in which the grid will work.
java.lang.IllegalArgumentException
- if the given parameters are not valid.Method Detail |
---|
public void paint(java.awt.Graphics2D gaph)
gaph
- The graphics in which the grid will be drawn.protected void paintSubLines(java.awt.Graphics2D graph)
protected void paintMainLines(java.awt.Graphics2D graph, double gap)
public IPoint getTransformedPointToGrid(java.awt.geom.Point2D pt)
pt
- The point to transform.
public double getMagneticGridGap()
public void reinitGrid()
public boolean isMagnetic()
public void setMagnetic(boolean isMagnetic)
isMagnetic
- True: the grid will be magnetic.public int getGridSpacing()
public void setGridSpacing(int gridSpacing)
gridSpacing
- The new spacing between lines of the personal grid.public boolean isPersonalGrid()
public int getWidth()
public int getHeight()
public void setSize(int width, int height)
width
- The new width.height
- The new height.public LMagneticGrid.GridStyle getStyle()
public void setStyle(LMagneticGrid.GridStyle style)
style
- The new style of the grid. If null, nothing is performed.public boolean isGridDisplayed()
public ICanvas getCanvas()
public void setModified(boolean modified)
Modifiable
setModified
in interface Modifiable
modified
- True: the element is will tagged as modified.public boolean isModified()
isModified
in interface Modifiable
public void save(boolean generalPreferences, java.lang.String nsURI, org.w3c.dom.Document document, org.w3c.dom.Element root)
Preferenciable
save
in interface Preferenciable
generalPreferences
- True: this operation is called to save the general preferences of the interactive system.
Otherwise, it is called to save a presentation in a document. This parameter is useful when different information
must be saved during a presentation backup or a general preferences backup.nsURI
- The namespace that must be added to tags corresponding to the instrument's parameters.document
- The XML document.root
- The root element that will contains the instrument's parameters.public void load(boolean generalPreferences, java.lang.String nsURI, org.w3c.dom.Element meta)
Preferenciable
load
in interface Preferenciable
generalPreferences
- True: this operation is called to load the general preferences of the interactive system.
Otherwise, it is called to load a presentation in a document. This parameter is useful when different information
must be loaded during a presentation backup or a general preferences backup.nsURI
- The namespace that must be added to tags corresponding to the instrument's parameters.meta
- The meta data element.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |