Package org.arakhne.afc.gis.io.xml
Class XMLGISElementUtil
- java.lang.Object
-
- org.arakhne.afc.gis.io.xml.XMLGISElementUtil
-
public final class XMLGISElementUtil extends Object
This class provides tools to create an XML representation of map elements or to create map elements from an XML representation.- Since:
- 15.0
- Version:
- 17.0 2020-01-04 14:41:54
- Author:
- Stéphane GALLAND
- See Also:
XMLUtil
- Maven Group Id:
- org.arakhne.afc.gis
- Maven Artifact Id:
- gisinputoutput
-
-
Field Summary
Fields Modifier and Type Field Description static String
ATTR_DOUBLEFRAME
doubleFrame=""
.static String
ATTR_FIRSTPOINTINDEX
firstPointIndex=""
.static String
ATTR_LASTPOINTINDEX
lastPointIndex=""
.static String
ATTR_RADIUS
radius=""
.static String
ATTR_SIZE
size=""
.static String
ATTR_WIDE
wide=""
.static String
ATTR_WIDTH
width=""
.static String
ATTR_X
x=""
.static String
ATTR_Y
y=""
.static String
NODE_CIRCLE
<circle />
.static String
NODE_ELEMENTS
<elements />
.static String
NODE_GROUP
<group />
.static String
NODE_GROUPS
<groups />
.static String
NODE_MULTIPOINT
<multipoint />
.static String
NODE_POINT
<point />
.static String
NODE_POINTS
<points />
.static String
NODE_POLYGON
<polygon />
.static String
NODE_POLYLINE
<polyline />
.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getDefaultMapElementNodeName(Class<? extends MapElement> type)
Replies the default name of the XML node for the given type of map element.static void
readGISElementAttributes(Element element, GISElement primitive, PathBuilder pathBuilder, XMLResources resources)
Read the attributes of a GISElement from the XML description.static <T extends MapElement>
voidreadGISElementContainer(Element xmlNode, GISElementContainer<T> primitive, String elementNodeName, PathBuilder pathBuilder, XMLResources resources)
Read map elements from the XML description.static <T extends MapElement>
voidreadGISElementContainer(Element xmlNode, GISElementContainer<T> primitive, PathBuilder pathBuilder, XMLResources resources)
Read map elements from the XML description.static <T extends MapElement>
TreadMapElement(Element element, String elementNodeName, Class<T> type, PathBuilder pathBuilder, XMLResources resources)
Read a map element from the XML description.static MapElement
readMapElement(Element element, String elementNodeName, PathBuilder pathBuilder, XMLResources resources)
Read a map element from the XML description.static void
writeGISElementAttributes(Element element, GISElement primitive, XMLBuilder builder, XMLResources resources)
Write the attributes of the given GISElement in the the XML description.static void
writeGISElementContainer(Element xmlNode, GISElementContainer<?> primitive, String elementNodeName, XMLBuilder builder, PathBuilder pathBuilder, XMLResources resources)
Write the XML description for the given container of map elements.static void
writeGISElementContainer(Element xmlNode, GISElementContainer<?> primitive, XMLBuilder builder, PathBuilder pathBuilder, XMLResources resources)
Write the XML description for the given container of map elements.static Element
writeMapElement(MapElement primitive, String primitiveNodeName, XMLBuilder builder, XMLResources resources)
Write the XML description for the given map element.static Element
writeMapElement(MapElement primitive, XMLBuilder builder, XMLResources resources)
Write the XML description for the given map element.
-
-
-
Field Detail
-
NODE_CIRCLE
public static final String NODE_CIRCLE
<circle />
.- See Also:
- Constant Field Values
-
NODE_ELEMENTS
public static final String NODE_ELEMENTS
<elements />
.- See Also:
- Constant Field Values
-
NODE_GROUP
public static final String NODE_GROUP
<group />
.- See Also:
- Constant Field Values
-
NODE_GROUPS
public static final String NODE_GROUPS
<groups />
.- See Also:
- Constant Field Values
-
NODE_MULTIPOINT
public static final String NODE_MULTIPOINT
<multipoint />
.- See Also:
- Constant Field Values
-
NODE_POINT
public static final String NODE_POINT
<point />
.- See Also:
- Constant Field Values
-
NODE_POINTS
public static final String NODE_POINTS
<points />
.- See Also:
- Constant Field Values
-
NODE_POLYGON
public static final String NODE_POLYGON
<polygon />
.- See Also:
- Constant Field Values
-
NODE_POLYLINE
public static final String NODE_POLYLINE
<polyline />
.- See Also:
- Constant Field Values
-
ATTR_DOUBLEFRAME
public static final String ATTR_DOUBLEFRAME
doubleFrame=""
.- See Also:
- Constant Field Values
-
ATTR_FIRSTPOINTINDEX
public static final String ATTR_FIRSTPOINTINDEX
firstPointIndex=""
.- See Also:
- Constant Field Values
-
ATTR_LASTPOINTINDEX
public static final String ATTR_LASTPOINTINDEX
lastPointIndex=""
.- See Also:
- Constant Field Values
-
ATTR_RADIUS
public static final String ATTR_RADIUS
radius=""
.- See Also:
- Constant Field Values
-
ATTR_SIZE
public static final String ATTR_SIZE
size=""
.- See Also:
- Constant Field Values
-
ATTR_WIDE
public static final String ATTR_WIDE
wide=""
.- See Also:
- Constant Field Values
-
ATTR_WIDTH
public static final String ATTR_WIDTH
width=""
.- See Also:
- Constant Field Values
-
ATTR_X
public static final String ATTR_X
x=""
.- See Also:
- Constant Field Values
-
ATTR_Y
public static final String ATTR_Y
y=""
.- See Also:
- Constant Field Values
-
-
Method Detail
-
writeMapElement
public static Element writeMapElement(MapElement primitive, XMLBuilder builder, XMLResources resources) throws IOException
Write the XML description for the given map element.- Parameters:
primitive
- is the map element to output.builder
- is the tool to create XML nodes.resources
- is the tool that permits to gather the resources.- Returns:
- the XML node of the map element.
- Throws:
IOException
- in case of error.
-
writeMapElement
public static Element writeMapElement(MapElement primitive, String primitiveNodeName, XMLBuilder builder, XMLResources resources) throws IOException
Write the XML description for the given map element.- Parameters:
primitive
- is the map element to output.primitiveNodeName
- is the name of the XML node that should contains the map element data. It may benull
to use the default name.builder
- is the tool to create XML nodes.resources
- is the tool that permits to gather the resources.- Returns:
- the XML node of the map element.
- Throws:
IOException
- in case of error.
-
readMapElement
public static MapElement readMapElement(Element element, String elementNodeName, PathBuilder pathBuilder, XMLResources resources) throws IOException
Read a map element from the XML description.- Parameters:
element
- is the XML node to read.elementNodeName
- is the name of the XML node that should contains the map element data. It must be one ofNODE_POINT
,NODE_CIRCLE
,NODE_POLYGON
,NODE_POLYLINE
,NODE_MULTIPOINT
, ornull
for the XML node name itself.pathBuilder
- is the tool to make paths absolute.resources
- is the tool that permits to gather the resources.- Returns:
- the map element.
- Throws:
IOException
- in case of error.
-
readMapElement
public static <T extends MapElement> T readMapElement(Element element, String elementNodeName, Class<T> type, PathBuilder pathBuilder, XMLResources resources) throws IOException
Read a map element from the XML description.- Type Parameters:
T
- is the type of the element to create.- Parameters:
element
- is the XML node to read.elementNodeName
- is the name of the XML node that should contains the map element data. It must be one ofNODE_POINT
,NODE_CIRCLE
,NODE_POLYGON
,NODE_POLYLINE
,NODE_MULTIPOINT
, ornull
for the XML node name itself.type
- is the type of the element to create, ornull
to use the default.pathBuilder
- is the tool to make paths absolute.resources
- is the tool that permits to gather the resources.- Returns:
- the map element.
- Throws:
IOException
- in case of error.
-
getDefaultMapElementNodeName
public static String getDefaultMapElementNodeName(Class<? extends MapElement> type)
Replies the default name of the XML node for the given type of map element.- Parameters:
type
- the type of the map element.- Returns:
- the default XML node name; or
null
if the type if unknown.
-
writeGISElementContainer
public static void writeGISElementContainer(Element xmlNode, GISElementContainer<?> primitive, XMLBuilder builder, PathBuilder pathBuilder, XMLResources resources) throws IOException
Write the XML description for the given container of map elements.- Parameters:
xmlNode
- is the XML node to fill with the container data.primitive
- is the container of map elements to output.builder
- is the tool to create XML nodes.pathBuilder
- is the tool to make paths relative.resources
- is the tool that permits to gather the resources.- Throws:
IOException
- in case of error.
-
writeGISElementContainer
public static void writeGISElementContainer(Element xmlNode, GISElementContainer<?> primitive, String elementNodeName, XMLBuilder builder, PathBuilder pathBuilder, XMLResources resources) throws IOException
Write the XML description for the given container of map elements.- Parameters:
xmlNode
- is the XML node to fill with the container data.primitive
- is the container of map elements to output.elementNodeName
- is the name of the XML node that should contains the map element data. It may benull
to use the default name.builder
- is the tool to create XML nodes.pathBuilder
- is the tool to make paths relative.resources
- is the tool that permits to gather the resources.- Throws:
IOException
- in case of error.
-
readGISElementContainer
public static <T extends MapElement> void readGISElementContainer(Element xmlNode, GISElementContainer<T> primitive, PathBuilder pathBuilder, XMLResources resources) throws IOException
Read map elements from the XML description.- Type Parameters:
T
- is the type of the elements inside the container.- Parameters:
xmlNode
- is the XML node to read.primitive
- is the container of map elements to output.pathBuilder
- is the tool to make paths absolute.resources
- is the tool that permits to gather the resources.- Throws:
IOException
- in case of error.
-
readGISElementContainer
public static <T extends MapElement> void readGISElementContainer(Element xmlNode, GISElementContainer<T> primitive, String elementNodeName, PathBuilder pathBuilder, XMLResources resources) throws IOException
Read map elements from the XML description.- Type Parameters:
T
- is the type of the elements inside the container.- Parameters:
xmlNode
- is the XML node to read.primitive
- is the container of map elements to output.elementNodeName
- is the name of the XML node that should contains the map element data. It may benull
to use the default name.pathBuilder
- is the tool to make paths absolute.resources
- is the tool that permits to gather the resources.- Throws:
IOException
- in case of error.
-
writeGISElementAttributes
public static void writeGISElementAttributes(Element element, GISElement primitive, XMLBuilder builder, XMLResources resources) throws IOException
Write the attributes of the given GISElement in the the XML description. Only the name, geoId, id, and additional attributes are written. Icon and color are not written.- Parameters:
element
- is the XML node to fill with the attributesprimitive
- is the map element to output. It may benull
to use the default name.builder
- is the tool to create XML nodes.resources
- is the tool that permits to gather the resources.- Throws:
IOException
- in case of error.
-
readGISElementAttributes
public static void readGISElementAttributes(Element element, GISElement primitive, PathBuilder pathBuilder, XMLResources resources) throws IOException
Read the attributes of a GISElement from the XML description. Only the name and additional attributes are read. Id, geoId, icon and color are not read.- Parameters:
element
- is the XML node to read.primitive
- is the GISElement to set up.pathBuilder
- is the tool to make paths absolute.resources
- is the tool that permits to gather the resources.- Throws:
IOException
- in case of error.
-
-