com.partnersoft.formats.dxf
Class DxfLWPolyline

java.lang.Object
  extended by com.partnersoft.formats.dxf.DxfEntity
      extended by com.partnersoft.formats.dxf.DxfLWPolyline
All Implemented Interfaces:
DxfStructure

public class DxfLWPolyline
extends DxfEntity

A DXF LWPOLYLINE entity.

A LWPOLYLINE represents not just a multi-segment polyline in 3D space, but also allows specification of extrusions and bulges, so the segments may in fact be curves. A LWPOLYLINE is a more compact version of a POLYLINE; it uses repeated coordinate groups instead of individual VERTEX objects. More recent versions of AutoCAD automagically convert most POLYLINE objects to LWPOLYLINE objects when loading.

Representation of component groups is direct except for "polyline flag" (code 70), which we split into two booleans, closed and plinegen. The properties repeated for each vertex are are represented by DxfLWPolylineVertex objects.

Primary reference is pages 81-82 of AutoCAD 2007 DXF Reference, available from the AutoDesk website.

Copyright 2000-2006 Partner Software, Inc.

Version:
$Id: DxfLWPolyline.java 1012 2007-11-24 18:30:02Z paul $
Author:
Paul Reavis

Constructor Summary
DxfLWPolyline()
           
 
Method Summary
 double getConstantWidth()
          Constant width, code 43, optional, default 0.
 double getElevation()
          Elevation, code 38, optional, default 0.
 double getExtrusionX()
          Extrusion direction X, group 210, optional, default 0.
 double getExtrusionY()
          Extrusion direction Y, group 220, optional, default 0.
 double getExtrusionZ()
          Extrusion direction Z, group 230, optional, default 1.
 java.util.List<DxfGroup> getGroups(DxfVersion version)
          Get the internal state as DXFGroups.
 double getThickness()
          Thickness, code 39, optional, default 0.
 java.lang.String getType()
          The type name of this structure.
 java.util.List<DxfLWPolylineVertex> getVertices()
          Vertices.
 boolean isClosed()
          True if polyline should be closed.
 boolean isPlinegen()
          True if plinegen is set.
 void setClosed(boolean closed)
           
 void setConstantWidth(double constantWidth)
           
 void setElevation(double elevation)
           
 void setExtrusionX(double extrusionX)
           
 void setExtrusionY(double extrusionY)
           
 void setExtrusionZ(double extrusionZ)
           
 void setGroups(java.util.List<DxfGroup> groups)
          Set the internal state based on the given groups.
 void setPlinegen(boolean plinegen)
           
 void setThickness(double newThickness)
           
 void setVertices(java.util.List<DxfLWPolylineVertex> vertices)
          Sets the vertex list, replacing the old list.
 java.lang.String toString()
           
 
Methods inherited from class com.partnersoft.formats.dxf.DxfEntity
getApplicationDefinedStructures, getColor, getColorName, getHandle, getLayer, getLinetype, getLinetypeScale, getLineWeight, getMaterial, getOwnerHandle, getPlotStyle, getProxyEntityGraphics, getRgbColor, getShadowMode, getTransparency, isInvisible, isPaperSpace, setApplicationDefinedStructures, setColor, setColorName, setHandle, setInvisible, setLayer, setLinetype, setLinetypeScale, setLineWeight, setMaterial, setOwnerHandle, setPaperSpace, setPlotStyle, setProxyEntityGraphics, setRgbColor, setShadowMode, setTransparency
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DxfLWPolyline

public DxfLWPolyline()
Method Detail

getType

public java.lang.String getType()
Description copied from interface: DxfStructure
The type name of this structure. Generally this will be the same for all instances of the same implementing Java class, so a typical example might be:
 \/**
  * Type name of this structure. Always returns "POINT".
  * \@return "POINT"
  *\/
 public String getType() {
     return "POINT";
 }
 

Specified by:
getType in interface DxfStructure
Specified by:
getType in class DxfEntity
Returns:
type name of structure as defined in AutoCAD DXF specification

getGroups

public java.util.List<DxfGroup> getGroups(DxfVersion version)
Description copied from interface: DxfStructure
Get the internal state as DXFGroups.

Specified by:
getGroups in interface DxfStructure
Overrides:
getGroups in class DxfEntity
Returns:
list of groups containing the state data for this structure

setGroups

public void setGroups(java.util.List<DxfGroup> groups)
Description copied from interface: DxfStructure
Set the internal state based on the given groups.

Specified by:
setGroups in interface DxfStructure
Overrides:
setGroups in class DxfEntity
Parameters:
groups - list of groups containing data for this structure

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getThickness

public double getThickness()
Thickness, code 39, optional, default 0.

Returns:
thickness of the line

setThickness

public void setThickness(double newThickness)

isClosed

public boolean isClosed()
True if polyline should be closed.

This is derived from the 1-bit in group 70 (polyline flag).

Returns:
true if polyline is closed

setClosed

public void setClosed(boolean closed)

getConstantWidth

public double getConstantWidth()
Constant width, code 43, optional, default 0.

Not used if variable widths (startWidth/endWidth on DxfLWPolylineVertex) are set.


setConstantWidth

public void setConstantWidth(double constantWidth)
Parameters:
constantWidth - the constantWidth to set

getElevation

public double getElevation()
Elevation, code 38, optional, default 0.

Returns:
elevation

setElevation

public void setElevation(double elevation)

getExtrusionX

public double getExtrusionX()
Extrusion direction X, group 210, optional, default 0.

Returns:
x value of the extrusion vector

setExtrusionX

public void setExtrusionX(double extrusionX)

getExtrusionY

public double getExtrusionY()
Extrusion direction Y, group 220, optional, default 0.

Returns:
y value of the extrusion vector

setExtrusionY

public void setExtrusionY(double extrusionY)

getExtrusionZ

public double getExtrusionZ()
Extrusion direction Z, group 230, optional, default 1.

Returns:
z value of the extrusion vector

setExtrusionZ

public void setExtrusionZ(double extrusionZ)

isPlinegen

public boolean isPlinegen()
True if plinegen is set.

This is derived from the 128-bit in group 70 (polyline flag).

Returns:
true if plinegen is set.

setPlinegen

public void setPlinegen(boolean plinegen)

getVertices

public java.util.List<DxfLWPolylineVertex> getVertices()
Vertices. These are specified by repeated instances of codes 10, 20, 40, 41, 42. and represented as a list of DxfLWPolylineVertex objects.

Returns:
read-only list of vertices

setVertices

public void setVertices(java.util.List<DxfLWPolylineVertex> vertices)
Sets the vertex list, replacing the old list. Makes a defensive copy, so you modifying the list supplied after calling this method will not also modify the list in this object.

Parameters:
vertices - new list of vertices