public class IlvDefaultDXFGraphicFactory extends Object implements IlvDXFGraphicFactory
IlvDXFGraphicFactory
.IlvDXFReader
,
IlvDXFReaderConfigurator.setGraphicFactory(ilog.views.dxf.IlvDXFGraphicFactory)
Constructor and Description |
---|
IlvDefaultDXFGraphicFactory()
Creates a new default graphic factory for importing DXF files as
Rogue Wave JViews graphic objects.
|
Modifier and Type | Method and Description |
---|---|
void |
addObject(IlvGraphic obj,
IlvGraphicBag bag)
Adds a graphic object to a given graphic bag.
|
void |
addObject(IlvGraphic obj,
IlvManager manager,
int layerIndex)
Adds a graphic object to a given layer of a manager.
|
IlvGraphic |
create3DFace(IlvPoint[] points,
Color color)
Creates a graphic object for the DXF entity 3DFACE
(rendered in 2D).
|
IlvGraphic |
createArc(IlvPoint center,
double radius,
double startAngle,
double angleRange,
double thickness,
Color color)
Creates a graphic object for the DXF entity ARC.
|
IlvGraphic |
createCircle(IlvPoint center,
double radius,
double thickness,
Color color)
Creates a graphic object for the DXF entity CIRCLE.
|
IlvGraphic |
createDimension(String text,
short type,
IlvPoint p0,
IlvPoint p1,
IlvPoint p2,
IlvPoint p3,
IlvPoint p4,
IlvPoint p5,
IlvPoint p6)
Creates a graphic object for the DXF entity DIMENSION.
|
IlvGraphic |
createInsert(IlvGraphicVector children,
String blockName,
Color color)
Creates a graphic object for the DXF entity INSERT,
The default implementation creates an
IlvGraphicSet
containing the child objects, except if there is only one child
object, in which case this object is returned. |
IlvGraphic |
createLine(IlvPoint from,
IlvPoint to,
double thickness,
Color color)
Creates a graphic object for the DXF entity LINE.
|
IlvGraphic |
createPoint(IlvPoint point,
double thickness,
Color color)
Creates a graphic object for the DXF entity POINT.
|
IlvGraphic |
createPolyline(IlvPoint[] points,
boolean closed,
boolean filled,
double thickness,
Color color)
Creates a graphic object for the DXF entities POLYLINE
and LWPOLYLINE.
|
IlvGraphic |
createSolid(IlvPoint[] points,
double thickness,
Color color)
Creates a graphic object for the DXF entity SOLID.
|
IlvGraphic |
createSpline(IlvPoint[] points,
boolean closed,
double thickness,
Color color)
Creates a graphic object for the DXF entity SPLINE.
|
IlvGraphic |
createText(IlvPoint location,
String text,
boolean underlined,
boolean antialiased,
Font font,
Color color)
Creates a graphic object for the DXF entities TEXT and
MTEXT.
|
IlvGraphic |
createTrace(IlvPoint[] points,
double thickness,
Color color)
Creates a graphic object for the DXF entity TRACE.
|
static String |
getBlockName(IlvGraphic blockGraphic)
Returns the name of block represented by the provided graphic
object.
|
IlvManagerLayer |
prepareLayer(IlvManager manager,
String layerName)
Prepares a manager layer.
|
static void |
setBlockName(IlvGraphic blockGraphic,
String blockName)
Sets the name of the block represented by the provided graphic object.
|
public IlvDefaultDXFGraphicFactory()
public void addObject(IlvGraphic obj, IlvManager manager, int layerIndex)
The DXF reader calls this method if the contents of the DXF file is read
into an IlvManager
or a subclass. Otherwise,
if the read is done in another type of IlvGraphicBag
,
for instance in an IlvGraphicSet
, the reader calls
the method addObject(IlvGraphic, IlvGraphicBag)
instead.
addObject
in interface IlvDXFGraphicFactory
obj
- The graphic object to be added to the manager.manager
- The manager into which the contents of the DXF file is read.layerIndex
- The index of the manager layer where the object must
be added.public void addObject(IlvGraphic obj, IlvGraphicBag bag)
The DXF reader calls this method if the contents of the DXF file is read
into a IlvGraphicBag
which is not an IlvManager
or
a subclass, for instance an IlvGraphicSet
.
Otherwise, if the read is done in an IlvManager
or a subclass,
the reader calls the method addObject(IlvGraphic, IlvManager, int)
instead.
addObject
in interface IlvDXFGraphicFactory
obj
- The graphic object to be added to the bag.bag
- The bag where the graphic object must be added.public IlvManagerLayer prepareLayer(IlvManager manager, String layerName)
The default implementation adds a new layer on top of the existing
layers (if any), and sets the name of this layer (see
IlvManager.setLayerName(int, String)
).
Notice the following:
layerIndex
argument of the method
addObject(IlvGraphic, IlvManager, int)
the index of the
layer (see IlvManagerLayer.getIndex()
) returned by the
method prepareLayer
for the corresponding layer.
prepareLayer
in interface IlvDXFGraphicFactory
manager
- The manager into which the contents of the DXF file is read.layerName
- The name of the layer as read in the DXF file.manager
where the entities of the DXF
file that belong to the layer named layerName
must be added.public IlvGraphic createPoint(IlvPoint point, double thickness, Color color)
IlvMarker
of type IlvMarker.IlvMarkerPlus
.createPoint
in interface IlvDXFGraphicFactory
point
- The location of the graphic object.thickness
- The thickness parameter.color
- The color.public IlvGraphic createLine(IlvPoint from, IlvPoint to, double thickness, Color color)
IlvLine
.createLine
in interface IlvDXFGraphicFactory
from
- The starting point of the line.to
- The ending point of the line.thickness
- The thickness of the line.color
- The color of the line.public IlvGraphic createArc(IlvPoint center, double radius, double startAngle, double angleRange, double thickness, Color color)
IlvArc
.createArc
in interface IlvDXFGraphicFactory
center
- The center of the arc.radius
- The radius of the arc.startAngle
- The start angle of the arc in degrees.angleRange
- The angle range of the arc in degrees.thickness
- The thickness of the arc.color
- The color of the arc.public IlvGraphic createCircle(IlvPoint center, double radius, double thickness, Color color)
IlvEllipse
with
circular shape.createCircle
in interface IlvDXFGraphicFactory
center
- The center of the circle.radius
- The radius of the circle.thickness
- The thickness of the circle.color
- The color of the circle.public IlvGraphic createPolyline(IlvPoint[] points, boolean closed, boolean filled, double thickness, Color color)
IlvPolygon
if
closed
and filled
are both true
,
otherwise it creates an IlvPolyline
.createPolyline
in interface IlvDXFGraphicFactory
points
- The array of points defining the polyline.closed
- Indicates whether the polyline is closed (in this case,
the first and last points in the array of points have
equal coordinates).filled
- Indicates whether the interior of the polyline is
filled.thickness
- The thickness of the polyline.color
- The color of the polyline.public IlvGraphic createSpline(IlvPoint[] points, boolean closed, double thickness, Color color)
IlvSpline
.createSpline
in interface IlvDXFGraphicFactory
points
- The array of points defining the control points of the spline.closed
- Indicates whether the spline is closed.thickness
- The thickness of the spline.color
- The color of the spline.public IlvGraphic createTrace(IlvPoint[] points, double thickness, Color color)
IlvPolyline
.createTrace
in interface IlvDXFGraphicFactory
points
- The array of points defining the trace.thickness
- The thickness of the trace.color
- The color of the trace.public IlvGraphic createSolid(IlvPoint[] points, double thickness, Color color)
IlvPolyline
.createSolid
in interface IlvDXFGraphicFactory
points
- The array of points defining the solid.thickness
- The thickness of the solid.color
- The color of the solid.public IlvGraphic create3DFace(IlvPoint[] points, Color color)
IlvPolyline
.create3DFace
in interface IlvDXFGraphicFactory
points
- The array of points defining the 3D face.color
- The color of the 3D face.public IlvGraphic createText(IlvPoint location, String text, boolean underlined, boolean antialiased, Font font, Color color)
IlvText
.createText
in interface IlvDXFGraphicFactory
location
- The location of the text.text
- The text to be shown.underlined
- Tells whether the text must be underlined.antialiased
- Tells whether the text must be antialiased.font
- The font of the text.color
- The color of the text.public IlvGraphic createDimension(String text, short type, IlvPoint p0, IlvPoint p1, IlvPoint p2, IlvPoint p3, IlvPoint p4, IlvPoint p5, IlvPoint p6)
IlvGraphicSet
containing the various graphic objects needed for rendering
the dimension entity.createDimension
in interface IlvDXFGraphicFactory
text
- The text of the dimension.type
- The dimension type. See the Autodesk documentation of the
DXF format: Values 0-6 are integer values that represent the dimension type.
Values 32, 64, and 128 are bit values, which are added to the integer values
(value 32 is always set in R13 and later releases).
p0
- Definition point.p1
- Middle point.p2
- Insertion point.p3
- Definition point for linear and angular dimensions.p4
- Definition point for linear and angular dimensions.p5
- Definition point for diameter, radius, and angular dimensions.p6
- Point defining dimension arc for angular dimensions.public IlvGraphic createInsert(IlvGraphicVector children, String blockName, Color color)
The default implementation creates an IlvGraphicSet
containing the child objects, except if there is only one child
object, in which case this object is returned.
The name of the block is stored by calling the method
setBlockName(IlvGraphic, String)
.
To retrieve this name, use the method getBlockName(IlvGraphic)
.
createInsert
in interface IlvDXFGraphicFactory
children
- The graphic objects contained in the instance
of the block.blockName
- The name of the DXF BLOCK, as read in the DXF file.color
- The color of the instance of the block.getBlockName(IlvGraphic)
,
setBlockName(IlvGraphic, String)
public static void setBlockName(IlvGraphic blockGraphic, String blockName)
null
or an empty string.
The name of the block is stored in a named property of the
returned graphic object. To retrieve this name after the DXF
file has been read, use the method getBlockName(IlvGraphic)
.
You do not need to call this method, but you can use it if
if you override createInsert(IlvGraphicVector, String, Color)
.
blockGraphic
- The graphic object corresponding to the instance of
DXF block.blockName
- The name of the DXF block.createInsert(IlvGraphicVector, String, Color)
,
getBlockName(IlvGraphic)
public static String getBlockName(IlvGraphic blockGraphic)
null
if the object does not belong to
a block. It can also return null
if the method
createInsert(IlvGraphicVector, String, Color)
is
overridden and does not store the name.blockGraphic
- The graphic object corresponding to the instance of
DXF block.createInsert(IlvGraphicVector, String, Color)
,
setBlockName(IlvGraphic, String)
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.