BowlerKernel
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
eu.mihosoft.vrl.v3d.svg.SVGLoad Class Reference
Collaboration diagram for eu.mihosoft.vrl.v3d.svg.SVGLoad:
Collaboration graph
[legend]

Classes

class  MetaPostPath2
 

Public Member Functions

void setHolePolarity (boolean p)
 
 SVGLoad (URI uri) throws IOException
 
 SVGLoad (File f) throws IOException
 
 SVGLoad (String data) throws IOException
 
ArrayList< CSGextrude (double thickness) throws IOException
 
HashMap< String, List< Polygon > > toPolygons (double resolution)
 
HashMap< String, List< Polygon > > toPolygons ()
 
List< String > getLayers ()
 
CSG extrudeLayerToCSG (double t, String layer)
 
ArrayList< CSGextrudeLayer (double t, String layer)
 
HashMap< String, ArrayList< CSG > > extrudeLayers (double t)
 
HashMap< String, ArrayList< CSG > > extrudeLayers (double t, double resolution, String targetLayer)
 
ArrayList< CSGextrude (double t, double resolution) throws IOException
 
void setSVGDocument (Document document)
 
Document getSVGDocument ()
 
ISVGLoadProgress getProgress ()
 
void setProgress (ISVGLoadProgress progress)
 

Static Public Member Functions

static ArrayList< CSGextrude (File f, double thickness) throws IOException
 
static HashMap< String, List< Polygon > > toPolygons (File f) throws IOException
 
static ArrayList< CSGextrude (File f, double thickness, double resolution) throws IOException
 
static ArrayList< CSGextrude (URI uri, double thickness) throws IOException
 
static ArrayList< CSGextrude (URI uri, double thickness, double resolution) throws IOException
 
static boolean isCCW (Polygon polygon)
 
static ISVGLoadProgress getProgressDefault ()
 

Private Member Functions

double toPx (String value)
 
void setScale (double value)
 
Double getScale ()
 
double toMM (String value)
 
void loadAllGroups (double resolution, Transform startingFrame)
 
void loadGroup (SVGOMGElement element, double resolution, Transform startingFrame, String encapsulatingLayer)
 
Transform getNewframe (Transform startingFrame, Node transforms)
 
void loadPath (Node pathNode, double resolution, Transform startingFrame, String encapsulatingLayer)
 
void loadComposite (String code, double resolution, Transform startingFrame, String encapsulatingLayer, Color c)
 
void loadSingle (String code, double resolution, Transform startingFrame, String encapsulatingLayer, Color c)
 
void initSVGDOM (Document document)
 
Document createSVGDocument (URI uri) throws IOException
 
HashMap< String, List< Polygon > > getPolygonByLayers ()
 
void setPolygonByLayers (HashMap< String, List< Polygon >> polygonByLayers)
 

Private Attributes

Document svgDocument
 
HashMap< String, List< Polygon > > polygonByLayers = null
 
HashMap< String, ArrayList< CSG > > csgByLayers = new HashMap<String, ArrayList<CSG>>()
 
HashMap< Polygon, Color > colors =new HashMap<>()
 
ISVGLoadProgress progress = null
 
double thickness
 
boolean negativeThickness = false
 
double height = 0
 
double width = 0
 
Double scale =null
 
HashMap< String, Double > units =new HashMap<>()
 

Static Private Attributes

static final String PATH_ELEMENT_NAME = "path"
 
static final String GROUP_ELEMENT_NAME = "g"
 
static ISVGLoadProgress progressDefault
 

Detailed Description

Responsible for converting all SVG path elements into MetaPost curves.

Definition at line 49 of file SVGLoad.java.

Constructor & Destructor Documentation

◆ SVGLoad() [1/3]

eu.mihosoft.vrl.v3d.svg.SVGLoad.SVGLoad ( URI  uri) throws IOException

Creates an SVG Document given a URI.

Parameters
uriPath to the file.
Exceptions
ExceptionSomething went wrong parsing the SVG file.

Definition at line 204 of file SVGLoad.java.

References eu.mihosoft.vrl.v3d.svg.SVGLoad.createSVGDocument(), and eu.mihosoft.vrl.v3d.svg.SVGLoad.setSVGDocument().

Referenced by eu.mihosoft.vrl.v3d.svg.SVGLoad.extrude(), and eu.mihosoft.vrl.v3d.svg.SVGLoad.toPolygons().

Here is the call graph for this function:

◆ SVGLoad() [2/3]

eu.mihosoft.vrl.v3d.svg.SVGLoad.SVGLoad ( File  f) throws IOException

Creates an SVG Document given a URI.

Parameters
fPath to the file.
Exceptions
ExceptionSomething went wrong parsing the SVG file.

Definition at line 216 of file SVGLoad.java.

References eu.mihosoft.vrl.v3d.svg.SVGLoad.createSVGDocument(), and eu.mihosoft.vrl.v3d.svg.SVGLoad.setSVGDocument().

Here is the call graph for this function:

◆ SVGLoad() [3/3]

eu.mihosoft.vrl.v3d.svg.SVGLoad.SVGLoad ( String  data) throws IOException

Creates an SVG Document String of SVG data.

Parameters
dataContents of an svg file
Exceptions
ExceptionSomething went wrong parsing the SVG file.

Definition at line 228 of file SVGLoad.java.

References eu.mihosoft.vrl.v3d.svg.SVGLoad.createSVGDocument(), and eu.mihosoft.vrl.v3d.svg.SVGLoad.setSVGDocument().

Here is the call graph for this function:

Member Function Documentation

◆ createSVGDocument()

Document eu.mihosoft.vrl.v3d.svg.SVGLoad.createSVGDocument ( URI  uri) throws IOException
private

Use the SAXSVGDocumentFactory to parse the given URI into a DOM.

Parameters
uriThe path to the SVG file to read.
Returns
A Document instance that represents the SVG file.
Exceptions
ExceptionThe file could not be read.

Definition at line 770 of file SVGLoad.java.

Referenced by eu.mihosoft.vrl.v3d.svg.SVGLoad.SVGLoad().

◆ extrude() [1/6]

ArrayList<CSG> eu.mihosoft.vrl.v3d.svg.SVGLoad.extrude ( double  t,
double  resolution 
) throws IOException

Definition at line 706 of file SVGLoad.java.

References eu.mihosoft.vrl.v3d.svg.SVGLoad.extrudeLayers().

Here is the call graph for this function:

◆ extrude() [2/6]

ArrayList<CSG> eu.mihosoft.vrl.v3d.svg.SVGLoad.extrude ( double  thickness) throws IOException

Definition at line 239 of file SVGLoad.java.

References eu.mihosoft.vrl.v3d.svg.SVGLoad.thickness.

◆ extrude() [3/6]

static ArrayList<CSG> eu.mihosoft.vrl.v3d.svg.SVGLoad.extrude ( File  f,
double  thickness 
) throws IOException
static

Definition at line 245 of file SVGLoad.java.

References eu.mihosoft.vrl.v3d.svg.SVGLoad.SVGLoad(), and eu.mihosoft.vrl.v3d.svg.SVGLoad.thickness.

Here is the call graph for this function:

◆ extrude() [4/6]

static ArrayList<CSG> eu.mihosoft.vrl.v3d.svg.SVGLoad.extrude ( File  f,
double  thickness,
double  resolution 
) throws IOException
static

Definition at line 280 of file SVGLoad.java.

References eu.mihosoft.vrl.v3d.svg.SVGLoad.SVGLoad(), and eu.mihosoft.vrl.v3d.svg.SVGLoad.thickness.

Here is the call graph for this function:

◆ extrude() [5/6]

static ArrayList<CSG> eu.mihosoft.vrl.v3d.svg.SVGLoad.extrude ( URI  uri,
double  thickness 
) throws IOException
static

Definition at line 284 of file SVGLoad.java.

References eu.mihosoft.vrl.v3d.svg.SVGLoad.SVGLoad(), and eu.mihosoft.vrl.v3d.svg.SVGLoad.thickness.

Here is the call graph for this function:

◆ extrude() [6/6]

static ArrayList<CSG> eu.mihosoft.vrl.v3d.svg.SVGLoad.extrude ( URI  uri,
double  thickness,
double  resolution 
) throws IOException
static

Definition at line 290 of file SVGLoad.java.

References eu.mihosoft.vrl.v3d.svg.SVGLoad.SVGLoad(), and eu.mihosoft.vrl.v3d.svg.SVGLoad.thickness.

Here is the call graph for this function:

◆ extrudeLayer()

ArrayList<CSG> eu.mihosoft.vrl.v3d.svg.SVGLoad.extrudeLayer ( double  t,
String  layer 
)

Definition at line 663 of file SVGLoad.java.

References eu.mihosoft.vrl.v3d.svg.SVGLoad.extrudeLayers().

Here is the call graph for this function:

◆ extrudeLayers() [1/2]

HashMap<String,ArrayList<CSG> > eu.mihosoft.vrl.v3d.svg.SVGLoad.extrudeLayers ( double  t)

◆ extrudeLayers() [2/2]

HashMap<String,ArrayList<CSG> > eu.mihosoft.vrl.v3d.svg.SVGLoad.extrudeLayers ( double  t,
double  resolution,
String  targetLayer 
)

◆ extrudeLayerToCSG()

CSG eu.mihosoft.vrl.v3d.svg.SVGLoad.extrudeLayerToCSG ( double  t,
String  layer 
)

◆ getLayers()

List<String> eu.mihosoft.vrl.v3d.svg.SVGLoad.getLayers ( )

◆ getNewframe()

Transform eu.mihosoft.vrl.v3d.svg.SVGLoad.getNewframe ( Transform  startingFrame,
Node  transforms 
)
private

◆ getPolygonByLayers()

HashMap<String,List<Polygon> > eu.mihosoft.vrl.v3d.svg.SVGLoad.getPolygonByLayers ( )
private

◆ getProgress()

ISVGLoadProgress eu.mihosoft.vrl.v3d.svg.SVGLoad.getProgress ( )

Definition at line 776 of file SVGLoad.java.

References eu.mihosoft.vrl.v3d.svg.SVGLoad.progress.

◆ getProgressDefault()

static ISVGLoadProgress eu.mihosoft.vrl.v3d.svg.SVGLoad.getProgressDefault ( )
static

Definition at line 784 of file SVGLoad.java.

References eu.mihosoft.vrl.v3d.svg.SVGLoad.progressDefault.

◆ getScale()

Double eu.mihosoft.vrl.v3d.svg.SVGLoad.getScale ( )
private

◆ getSVGDocument()

Document eu.mihosoft.vrl.v3d.svg.SVGLoad.getSVGDocument ( )

Returns the SVG document parsed upon instantiating this class.

Returns
A valid, parsed, non-null SVG document instance.

Definition at line 739 of file SVGLoad.java.

References eu.mihosoft.vrl.v3d.svg.SVGLoad.svgDocument.

Referenced by eu.mihosoft.vrl.v3d.svg.SVGLoad.loadAllGroups().

◆ initSVGDOM()

void eu.mihosoft.vrl.v3d.svg.SVGLoad.initSVGDOM ( Document  document)
private

Enhance the SVG DOM for the given document to provide CSS- and SVG-specific DOM interfaces.

Parameters
documentThe document to enhance. http://wiki.apache.org/xmlgraphics-batik/BootSvgAndCssDom

Definition at line 751 of file SVGLoad.java.

Referenced by eu.mihosoft.vrl.v3d.svg.SVGLoad.setSVGDocument().

◆ isCCW()

static boolean eu.mihosoft.vrl.v3d.svg.SVGLoad.isCCW ( Polygon  polygon)
static

Definition at line 610 of file SVGLoad.java.

References eu.mihosoft.vrl.v3d.Edge.fromPolygon().

Here is the call graph for this function:

◆ loadAllGroups()

void eu.mihosoft.vrl.v3d.svg.SVGLoad.loadAllGroups ( double  resolution,
Transform  startingFrame 
)
private

◆ loadComposite()

void eu.mihosoft.vrl.v3d.svg.SVGLoad.loadComposite ( String  code,
double  resolution,
Transform  startingFrame,
String  encapsulatingLayer,
Color  c 
)
private

Definition at line 580 of file SVGLoad.java.

References eu.mihosoft.vrl.v3d.svg.SVGLoad.loadSingle().

Referenced by eu.mihosoft.vrl.v3d.svg.SVGLoad.loadPath().

Here is the call graph for this function:

◆ loadGroup()

void eu.mihosoft.vrl.v3d.svg.SVGLoad.loadGroup ( SVGOMGElement  element,
double  resolution,
Transform  startingFrame,
String  encapsulatingLayer 
)
private

Definition at line 335 of file SVGLoad.java.

References eu.mihosoft.vrl.v3d.svg.SVGLoad.getNewframe(), and eu.mihosoft.vrl.v3d.svg.SVGLoad.loadPath().

Referenced by eu.mihosoft.vrl.v3d.svg.SVGLoad.loadAllGroups().

Here is the call graph for this function:

◆ loadPath()

void eu.mihosoft.vrl.v3d.svg.SVGLoad.loadPath ( Node  pathNode,
double  resolution,
Transform  startingFrame,
String  encapsulatingLayer 
)
private

◆ loadSingle()

void eu.mihosoft.vrl.v3d.svg.SVGLoad.loadSingle ( String  code,
double  resolution,
Transform  startingFrame,
String  encapsulatingLayer,
Color  c 
)
private

◆ setHolePolarity()

void eu.mihosoft.vrl.v3d.svg.SVGLoad.setHolePolarity ( boolean  p)

Definition at line 122 of file SVGLoad.java.

◆ setPolygonByLayers()

void eu.mihosoft.vrl.v3d.svg.SVGLoad.setPolygonByLayers ( HashMap< String, List< Polygon >>  polygonByLayers)
private

◆ setProgress()

void eu.mihosoft.vrl.v3d.svg.SVGLoad.setProgress ( ISVGLoadProgress  progress)

Definition at line 780 of file SVGLoad.java.

References eu.mihosoft.vrl.v3d.svg.SVGLoad.progress.

◆ setScale()

void eu.mihosoft.vrl.v3d.svg.SVGLoad.setScale ( double  value)
private

◆ setSVGDocument()

void eu.mihosoft.vrl.v3d.svg.SVGLoad.setSVGDocument ( Document  document)

This will set the document to parse. This method also initializes the SVG DOM enhancements, which are necessary to perform SVG and CSS manipulations. The initialization is also required to extract information from the SVG path elements.

Parameters
documentThe document that contains SVG content.

Definition at line 729 of file SVGLoad.java.

References eu.mihosoft.vrl.v3d.svg.SVGLoad.initSVGDOM().

Referenced by eu.mihosoft.vrl.v3d.svg.SVGLoad.SVGLoad().

Here is the call graph for this function:

◆ toMM()

double eu.mihosoft.vrl.v3d.svg.SVGLoad.toMM ( String  value)
private

Definition at line 109 of file SVGLoad.java.

References eu.mihosoft.vrl.v3d.svg.SVGLoad.getScale(), and eu.mihosoft.vrl.v3d.svg.SVGLoad.toPx().

Referenced by eu.mihosoft.vrl.v3d.svg.SVGLoad.loadAllGroups().

Here is the call graph for this function:

◆ toPolygons() [1/3]

HashMap<String,List<Polygon> > eu.mihosoft.vrl.v3d.svg.SVGLoad.toPolygons ( )

◆ toPolygons() [2/3]

HashMap<String,List<Polygon> > eu.mihosoft.vrl.v3d.svg.SVGLoad.toPolygons ( double  resolution)

◆ toPolygons() [3/3]

static HashMap<String,List<Polygon> > eu.mihosoft.vrl.v3d.svg.SVGLoad.toPolygons ( File  f) throws IOException
static

This function will create a list of polygons that can be exported back to an SVG

Parameters
fthe file containing the SVG data
Returns
Exceptions
IOException

Definition at line 259 of file SVGLoad.java.

References eu.mihosoft.vrl.v3d.svg.SVGLoad.SVGLoad().

Referenced by com.neuronrobotics.bowlerstudio.scripting.SvgLoader.run().

Here is the call graph for this function:

◆ toPx()

double eu.mihosoft.vrl.v3d.svg.SVGLoad.toPx ( String  value)
private

Member Data Documentation

◆ colors

HashMap<Polygon,Color> eu.mihosoft.vrl.v3d.svg.SVGLoad.colors =new HashMap<>()
private

◆ csgByLayers

HashMap<String,ArrayList<CSG> > eu.mihosoft.vrl.v3d.svg.SVGLoad.csgByLayers = new HashMap<String, ArrayList<CSG>>()
private

Definition at line 55 of file SVGLoad.java.

Referenced by eu.mihosoft.vrl.v3d.svg.SVGLoad.extrudeLayers().

◆ GROUP_ELEMENT_NAME

final String eu.mihosoft.vrl.v3d.svg.SVGLoad.GROUP_ELEMENT_NAME = "g"
staticprivate

Definition at line 51 of file SVGLoad.java.

◆ height

double eu.mihosoft.vrl.v3d.svg.SVGLoad.height = 0
private

◆ negativeThickness

boolean eu.mihosoft.vrl.v3d.svg.SVGLoad.negativeThickness = false
private

Definition at line 63 of file SVGLoad.java.

Referenced by eu.mihosoft.vrl.v3d.svg.SVGLoad.extrudeLayers().

◆ PATH_ELEMENT_NAME

final String eu.mihosoft.vrl.v3d.svg.SVGLoad.PATH_ELEMENT_NAME = "path"
staticprivate

Definition at line 50 of file SVGLoad.java.

◆ polygonByLayers

HashMap<String,List<Polygon> > eu.mihosoft.vrl.v3d.svg.SVGLoad.polygonByLayers = null
private

◆ progress

ISVGLoadProgress eu.mihosoft.vrl.v3d.svg.SVGLoad.progress = null
private

◆ progressDefault

ISVGLoadProgress eu.mihosoft.vrl.v3d.svg.SVGLoad.progressDefault
staticprivate
Initial value:
= new ISVGLoadProgress() {
@Override
public void onShape(CSG newShape) {
}
}

Definition at line 113 of file SVGLoad.java.

Referenced by eu.mihosoft.vrl.v3d.svg.SVGLoad.getProgressDefault().

◆ scale

Double eu.mihosoft.vrl.v3d.svg.SVGLoad.scale =null
private

◆ svgDocument

Document eu.mihosoft.vrl.v3d.svg.SVGLoad.svgDocument
private

Definition at line 52 of file SVGLoad.java.

Referenced by eu.mihosoft.vrl.v3d.svg.SVGLoad.getSVGDocument().

◆ thickness

double eu.mihosoft.vrl.v3d.svg.SVGLoad.thickness
private

◆ units

HashMap<String,Double> eu.mihosoft.vrl.v3d.svg.SVGLoad.units =new HashMap<>()
private

◆ width

double eu.mihosoft.vrl.v3d.svg.SVGLoad.width = 0
private

Definition at line 65 of file SVGLoad.java.

Referenced by eu.mihosoft.vrl.v3d.svg.SVGLoad.loadAllGroups().


The documentation for this class was generated from the following file: