|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.latexdraw.glib.models.impl.LShape
net.sf.latexdraw.glib.models.impl.LModifiablePointsShape
net.sf.latexdraw.glib.models.impl.LAbstractCtrlPointShape
abstract class LAbstractCtrlPointShape
Defines a model of a abstract shape that contains control points.
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.
07/05/2009
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface net.sf.latexdraw.glib.models.interfaces.IShape |
---|
IShape.BorderPos, IShape.FillingStyle, IShape.LineStyle, IShape.Position |
Field Summary | |
---|---|
protected int |
balanceGap
Define the gap between a control point and its point in pixel when using balance() method. |
protected java.util.List<IPoint> |
firstCtrlPts
This vector contains the points which allows to change the angles of the curves |
protected java.util.List<IPoint> |
secondCtrlPts
Contains the second control points of each points; useful for closed curve. |
Fields inherited from class net.sf.latexdraw.glib.models.impl.LShape |
---|
arrows, bordersPosition, dashSepBlack, dashSepWhite, dbleBordCol, dbleBordSep, dotSep, fillingCol, fillingStyle, gradAngle, gradColEnd, gradColStart, gradMidPt, hasDbleBord, hasShadow, hatchingsAngle, hatchingsCol, hatchingsSep, hatchingsWidth, id, lineColour, lineStyle, modified, opacity, points, rotationAngle, shadowAngle, shadowCol, shadowSize, showPts, thickness |
Fields inherited from interface net.sf.latexdraw.glib.models.interfaces.IControlPointShape |
---|
DEFAULT_BALANCE_GAP, DEFAULT_POSITION_CTRL |
Fields inherited from interface net.sf.latexdraw.glib.models.interfaces.IShape |
---|
GOLDEN_ANGLE, PPC |
Constructor Summary | |
---|---|
LAbstractCtrlPointShape(boolean uniqueID)
Creates the shape. |
Method Summary | |
---|---|
void |
addPoint(IPoint pt,
int position)
Adds the given point to the points list at the given position. |
void |
balance()
Balances all the control points in order the create a rounded shape. |
void |
copy(IShape sh)
Copies a shape using another. |
protected void |
copyPoints(IShape sh)
|
private IPoint[] |
getBalancedPoints(IPoint pt,
IPoint prevPt,
IPoint nextPt)
Method used by the balance method. |
int |
getBalanceGap()
|
IPoint |
getFirstCtrlPtAt(int position)
|
java.util.List<IPoint> |
getFirstCtrlPts()
|
IPoint |
getSecondCtrlPtAt(int position)
|
java.util.List<IPoint> |
getSecondCtrlPts()
|
IPoint |
removePoint(int position)
Removes the point at the given position. |
boolean |
removePoint(IPoint pt)
Removes the given point of the shape. |
IPoint |
replacePoint(IPoint pt,
int position)
Replaces the point at the given position by the given point. |
void |
scale(double x,
double y,
IShape.Position pos,
java.awt.geom.Rectangle2D bound)
Scales the shape where the move reference point is the bottom right point, and the fixation point the top left point. |
void |
setBalanceGap(int balanceGap)
|
private void |
setControlPoints(int position,
IPoint[] ctrlPts)
Method used by the balance method. |
boolean |
setPoint(double x,
double y,
int position)
Sets the point at the given position to the given coordinate. |
void |
setXFirstCtrlPt(double x,
int id)
Sets the X-coordinate of one of the first control point. |
void |
setXSecondCtrlPt(double x,
int id)
Sets the X-coordinate of one of the second control point. |
void |
setYFirstCtrlPt(double y,
int id)
Sets the Y-coordinate of one of the first control point. |
void |
setYSecondCtrlPt(double y,
int id)
Sets the Y-coordinate of one of the second control point. |
void |
translate(double tx,
double ty)
Translates the shape. |
void |
updateSecondControlPoints()
Updates the second control points by using the first control points. |
Methods inherited from class net.sf.latexdraw.glib.models.impl.LModifiablePointsShape |
---|
addPoint, setPoint |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sf.latexdraw.glib.models.interfaces.IModifiablePointsShape |
---|
addPoint, setPoint |
Methods inherited from interface org.malai.properties.Modifiable |
---|
isModified, setModified |
Methods inherited from interface net.sf.latexdraw.glib.models.interfaces.IArrowable |
---|
getArrowInset, getArrowLength, getArrowSizeDim, getArrowSizeNum, getBracketNum, getDotSizeDim, getDotSizeNum, getRBracketNum, getTBarSizeDim, getTBarSizeNum, setArrowInset, setArrowLength, setArrowSizeDim, setArrowSizeNum, setBracketNum, setDotSizeDim, setDotSizeNum, setRBracketNum, setTBarSizeDim, setTBarSizeNum |
Field Detail |
---|
protected java.util.List<IPoint> firstCtrlPts
protected java.util.List<IPoint> secondCtrlPts
protected int balanceGap
balance()
method.
Constructor Detail |
---|
public LAbstractCtrlPointShape(boolean uniqueID)
uniqueID
- True: the model will have a unique ID.Method Detail |
---|
public void scale(double x, double y, IShape.Position pos, java.awt.geom.Rectangle2D bound)
IShape
scale
in interface IShape
scale
in class LShape
x
- The X scale factor, in ]0,double].y
- The Y scale factor, in ]0,double].pos
- The position of the reference point: if the reference point is top-left point,
then the scale will extend or reduce the shape at the bottom-right point. If the reference
position is NORTH or SOUTH the sx parameter will not be used. If it is EAST or WEST the sy
parameter will not be used.bound
- The bound (e.g. the border of the selected shapes) used to compute the scaling.public int getBalanceGap()
getBalanceGap
in interface IControlPointShape
public void setBalanceGap(int balanceGap)
setBalanceGap
in interface IControlPointShape
balanceGap
- the balanceGap to set.private IPoint[] getBalancedPoints(IPoint pt, IPoint prevPt, IPoint nextPt)
private void setControlPoints(int position, IPoint[] ctrlPts)
public void balance()
IControlPointShape
balance
in interface IControlPointShape
public IPoint getFirstCtrlPtAt(int position)
getFirstCtrlPtAt
in interface IControlPointShape
position
- The position of the wanted points (-1 for the last point).
public java.util.List<IPoint> getFirstCtrlPts()
getFirstCtrlPts
in interface IControlPointShape
public IPoint getSecondCtrlPtAt(int position)
getSecondCtrlPtAt
in interface IControlPointShape
position
- The position of the wanted points (-1 for the last point).
public java.util.List<IPoint> getSecondCtrlPts()
getSecondCtrlPts
in interface IControlPointShape
public void setXFirstCtrlPt(double x, int id)
IControlPointShape
setXFirstCtrlPt
in interface IControlPointShape
x
- The new X-coordinate.id
- The position of the point to set.public void setXSecondCtrlPt(double x, int id)
IControlPointShape
setXSecondCtrlPt
in interface IControlPointShape
x
- The new X-coordinate.id
- The position of the point to set.public void setYFirstCtrlPt(double y, int id)
IControlPointShape
setYFirstCtrlPt
in interface IControlPointShape
y
- The new Y-coordinate.id
- The position of the point to set.public void setYSecondCtrlPt(double y, int id)
IControlPointShape
setYSecondCtrlPt
in interface IControlPointShape
y
- The new Y-coordinate.id
- The position of the point to set.public void updateSecondControlPoints()
IControlPointShape
updateSecondControlPoints
in interface IControlPointShape
public boolean setPoint(double x, double y, int position)
IModifiablePointsShape
setPoint
in interface IModifiablePointsShape
setPoint
in class LModifiablePointsShape
x
- The new X-coordinate. The model is not updated!y
- The new Y-coordinate.position
- The position of the point to move in the points list (-1 corresponds to the last point).
public boolean removePoint(IPoint pt)
IModifiablePointsShape
removePoint
in interface IModifiablePointsShape
removePoint
in class LModifiablePointsShape
pt
- The point to remove.
public IPoint removePoint(int position)
IModifiablePointsShape
removePoint
in interface IModifiablePointsShape
removePoint
in class LModifiablePointsShape
position
- The position of the point to remove (-1 corresponds to the last point).
public IPoint replacePoint(IPoint pt, int position)
IModifiablePointsShape
replacePoint
in interface IModifiablePointsShape
replacePoint
in class LModifiablePointsShape
pt
- The new point. Must not be a point of the shape.position
- The position of the point to remove (-1 corresponds to the last point).
public void addPoint(IPoint pt, int position)
IModifiablePointsShape
addPoint
in interface IModifiablePointsShape
addPoint
in class LModifiablePointsShape
pt
- The point to add.position
- The position of insertion (-1 corresponds to the last point).protected void copyPoints(IShape sh)
copyPoints
in class LShape
public void translate(double tx, double ty)
IShape
translate
in interface IShape
translate
in class LShape
tx
- The X translation.ty
- The Y translation.public void copy(IShape sh)
IShape
copy
in interface IShape
copy
in class LShape
sh
- The shape to copy.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |