public class HomeXMLHandler extends DefaultHandler
<!ELEMENT home (property*, furnitureVisibleProperty*, environment?, backgroundImage?, print?, compass?, (camera | observerCamera)*, level*, (pieceOfFurniture | doorOrWindow | furnitureGroup | light)*, wall*, room*, polyline*, dimensionLine*, label*)> <!ATTLIST home version CDATA #IMPLIED name CDATA #IMPLIED camera (observerCamera | topCamera) "topCamera" selectedLevel CDATA #IMPLIED wallHeight CDATA #IMPLIED basePlanLocked (false | true) "false" furnitureSortedProperty CDATA #IMPLIED furnitureDescendingSorted (false | true) "false"> <!ELEMENT property EMPTY> <!ATTLIST property name CDATA #REQUIRED value CDATA #REQUIRED> <!ELEMENT furnitureVisibleProperty EMPTY> <!ATTLIST furnitureVisibleProperty name CDATA #REQUIRED> <!ELEMENT environment ((camera | observerCamera)*, texture?, texture?) > <!ATTLIST environment groundColor CDATA #IMPLIED skyColor CDATA #IMPLIED lightColor CDATA #IMPLIED wallsAlpha CDATA "0" allLevelsVisible (false | true) "false" observerCameraElevationAdjusted (false | true) "true" ceillingLightColor CDATA #IMPLIED drawingMode (FILL | OUTLINE | FILL_AND_OUTLINE) "FILL" subpartSizeUnderLight CDATA "0" photoWidth CDATA "400" photoHeight CDATA "300" photoAspectRatio (FREE_RATIO | VIEW_3D_RATIO | RATIO_4_3 | RATIO_3_2 | RATIO_16_9 | RATIO_2_1 | SQUARE_RATIO) "VIEW_3D_RATIO" photoQuality CDATA "0" videoWidth CDATA "320" videoAspectRatio (RATIO_4_3 | RATIO_16_9) "RATIO_4_3" videoQuality CDATA "0" videoFrameRate CDATA "25"> <!ELEMENT backgroundImage EMPTY> <!ATTLIST backgroundImage image CDATA #REQUIRED scaleDistance CDATA #REQUIRED scaleDistanceXStart CDATA #REQUIRED scaleDistanceYStart CDATA #REQUIRED scaleDistanceXEnd CDATA #REQUIRED scaleDistanceYEnd CDATA #REQUIRED xOrigin CDATA "0" yOrigin CDATA "0" visible (false | true) "true"> <!ELEMENT print EMPTY> <!ATTLIST print headerFormat CDATA #IMPLIED footerFormat CDATA #IMPLIED planScale CDATA #IMPLIED furniturePrinted (false | true) "true" planPrinted (false | true) "true" view3DPrinted (false | true) "true" paperWidth CDATA #REQUIRED paperHeight CDATA #REQUIRED paperTopMargin CDATA #REQUIRED paperLeftMargin CDATA #REQUIRED paperBottomMargin CDATA #REQUIRED paperRightMargin CDATA #REQUIRED paperOrientation (PORTRAIT | LANDSCAPE | REVERSE_LANDSCAPE) #REQUIRED> <!ELEMENT compass (property*)> <!ATTLIST compass x CDATA #REQUIRED y CDATA #REQUIRED diameter CDATA #REQUIRED northDirection CDATA "0" longitude CDATA #IMPLIED latitude CDATA #IMPLIED timeZone CDATA #IMPLIED visible (false | true) "true"> <!ENTITY % cameraCommonAttributes 'name CDATA #IMPLIED lens (PINHOLE | NORMAL | FISHEYE | SPHERICAL) "PINHOLE" x CDATA #REQUIRED y CDATA #REQUIRED z CDATA #REQUIRED yaw CDATA #REQUIRED pitch CDATA #REQUIRED time CDATA #IMPLIED fieldOfView CDATA #REQUIRED'> <!ELEMENT camera (property*)> <!ATTLIST camera %cameraCommonAttributes; attribute (topCamera | storedCamera | cameraPath) #REQUIRED> <!ELEMENT observerCamera (property*)> <!ATTLIST observerCamera %cameraCommonAttributes; attribute (observerCamera | storedCamera | cameraPath) #REQUIRED fixedSize (false | true) "false"> <!ELEMENT level (property*, backgroundImage?)> <!ATTLIST level id ID #REQUIRED name CDATA #REQUIRED elevation CDATA #REQUIRED floorThickness CDATA #REQUIRED height CDATA #REQUIRED elevationIndex CDATA "-1" visible (false | true) "true" viewable (false | true) "true"> <!ENTITY % furnitureCommonAttributes 'name CDATA #REQUIRED angle CDATA "0" visible (false | true) "true" movable (false | true) "true" description CDATA #IMPLIED modelMirrored (false | true) "false" nameVisible (false | true) "false" nameAngle CDATA "0" nameXOffset CDATA "0" nameYOffset CDATA "0" price CDATA #IMPLIED'> <!ELEMENT furnitureGroup ((pieceOfFurniture | doorOrWindow | furnitureGroup | light)*, property*, textStyle?)> <!ATTLIST furnitureGroup %furnitureCommonAttributes; level IDREF #IMPLIED x CDATA #IMPLIED y CDATA #IMPLIED elevation CDATA #IMPLIED width CDATA #IMPLIED depth CDATA #IMPLIED height CDATA #IMPLIED dropOnTopElevation CDATA #IMPLIED> <!ENTITY % pieceOfFurnitureCommonAttributes 'level IDREF #IMPLIED catalogId CDATA #IMPLIED x CDATA #REQUIRED y CDATA #REQUIRED elevation CDATA "0" width CDATA #REQUIRED depth CDATA #REQUIRED height CDATA #REQUIRED dropOnTopElevation CDATA "1" information CDATA #IMPLIED model CDATA #IMPLIED icon CDATA #IMPLIED planIcon CDATA #IMPLIED modelRotation CDATA "1 0 0 0 1 0 0 0 1" backFaceShown (false | true) "false" doorOrWindow (false | true) "false" resizable (false | true) "true" deformable (false | true) "true" texturable (false | true) "true" staircaseCutOutShape CDATA #IMPLIED color CDATA #IMPLIED shininess CDATA #IMPLIED creator CDATA #IMPLIED valueAddedTaxPercentage CDATA #IMPLIED currency CDATA #IMPLIED'> <!ELEMENT pieceOfFurniture (property*, textStyle?, texture?, material*)> <!ATTLIST pieceOfFurniture %furnitureCommonAttributes; %pieceOfFurnitureCommonAttributes;> <!ELEMENT doorOrWindow (sash*, property*, textStyle?, texture?, material*)> <!ATTLIST doorOrWindow %furnitureCommonAttributes; %pieceOfFurnitureCommonAttributes; wallThickness CDATA "1" wallDistance CDATA "0" cutOutShape CDATA #IMPLIED boundToWall (false | true) "true"> <!ELEMENT sash EMPTY> <!ATTLIST sash xAxis CDATA #REQUIRED yAxis CDATA #REQUIRED width CDATA #REQUIRED startAngle CDATA #REQUIRED endAngle CDATA #REQUIRED> <!ELEMENT light (lightSource*, property*, textStyle?, texture?, material*)> <!ATTLIST light %furnitureCommonAttributes; %pieceOfFurnitureCommonAttributes; power CDATA "0.5"> <!ELEMENT lightSource EMPTY> <!ATTLIST lightSource x CDATA #REQUIRED y CDATA #REQUIRED z CDATA #REQUIRED color CDATA #REQUIRED diameter CDATA #IMPLIED> <!ELEMENT textStyle EMPTY> <!ATTLIST textStyle attribute (nameStyle | areaStyle | lengthStyle) #IMPLIED fontName CDATA #IMPLIED fontSize CDATA #REQUIRED bold (false | true) "false" italic (false | true) "false"> <!ELEMENT texture EMPTY> <!ATTLIST texture attribute (groundTexture | skyTexture | leftSideTexture | rightSideTexture | floorTexture | ceilingTexture) #IMPLIED catalogId CDATA #IMPLIED name CDATA #REQUIRED width CDATA #REQUIRED height CDATA #REQUIRED angle CDATA "0" leftToRightOriented (true | false) "true" image CDATA #REQUIRED> <!ELEMENT material (texture?)> <!ATTLIST material name CDATA #REQUIRED key CDATA #IMPLIED color CDATA #IMPLIED shininess CDATA #IMPLIED> <!ELEMENT wall (property*, texture?, texture?, baseboard?, baseboard?)> <!ATTLIST wall id ID #REQUIRED level IDREF #IMPLIED wallAtStart IDREF #IMPLIED wallAtEnd IDREF #IMPLIED xStart CDATA #REQUIRED yStart CDATA #REQUIRED xEnd CDATA #REQUIRED yEnd CDATA #REQUIRED height CDATA #IMPLIED heightAtEnd CDATA #IMPLIED thickness CDATA #REQUIRED arcExtent CDATA #IMPLIED pattern CDATA #IMPLIED topColor CDATA #IMPLIED leftSideColor CDATA #IMPLIED leftSideShininess CDATA "0" rightSideColor CDATA #IMPLIED rightSideShininess CDATA "0"> <!ELEMENT baseboard (texture?)> <!ATTLIST baseboard attribute (leftSideBaseboard | rightSideBaseboard) #REQUIRED thickness CDATA #REQUIRED height CDATA #REQUIRED color CDATA #IMPLIED> <!ELEMENT room (property*, textStyle?, textStyle?, texture?, texture?, point+)> <!ATTLIST room level IDREF #IMPLIED name CDATA #IMPLIED nameAngle CDATA "0" nameXOffset CDATA "0" nameYOffset CDATA "-40" areaVisible (false | true) "false" areaAngle CDATA "0" areaXOffset CDATA "0" areaYOffset CDATA "0" floorVisible (false | true) "true" floorColor CDATA #IMPLIED floorShininess CDATA "0" ceilingVisible (false | true) "true" ceilingColor CDATA #IMPLIED ceilingShininess CDATA "0"> <!ELEMENT point EMPTY> <!ATTLIST point x CDATA #REQUIRED y CDATA #REQUIRED> <!ELEMENT polyline (property*, point+)> <!ATTLIST polyline level IDREF #IMPLIED thickness CDATA "1" capStyle (BUTT | SQUARE | ROUND) "BUTT" joinStyle (BEVEL | MITER | ROUND | CURVED) "MITER" dashStyle (SOLID | DOT | DASH | DASH_DOT | DASH_DOT_DOT) "SOLID" startArrowStyle (NONE | DELTA | OPEN | DISC) "NONE" endArrowStyle (NONE | DELTA | OPEN | DISC) "NONE" color CDATA #IMPLIED closedPath (false | true) "false"> <!ELEMENT dimensionLine (property*, textStyle?)> <!ATTLIST dimensionLine level IDREF #IMPLIED xStart CDATA #REQUIRED yStart CDATA #REQUIRED xEnd CDATA #REQUIRED yEnd CDATA #REQUIRED offset CDATA #REQUIRED> <!ELEMENT label (property*, textStyle?, text)> <!ATTLIST label level IDREF #IMPLIED x CDATA #REQUIRED y CDATA #REQUIRED angle CDATA "0" elevation CDATA "0" pitch CDATA #IMPLIED color CDATA #IMPLIED outlineColor CDATA #IMPLIED> <!ELEMENT text (#PCDATA)>with
home
as root element.
Attributes named attribute
indicate the names of the object fields
where some elements should be stored.Constructor and Description |
---|
HomeXMLHandler() |
HomeXMLHandler(UserPreferences preferences) |
Modifier and Type | Method and Description |
---|---|
void |
characters(char[] ch,
int start,
int length) |
protected HomePrint |
createPrint(Map<String,String> attributes)
Returns a new
Print instance initialized from the given attributes . |
void |
endDocument() |
void |
endElement(String uri,
String localName,
String name) |
Home |
getHome()
Returns the home read by this handler.
|
protected void |
setCameraAttributes(Camera camera,
String elementName,
Map<String,String> attributes)
Sets the attributes of the given
camera . |
protected void |
setCompassAttributes(Compass compass,
String elementName,
Map<String,String> attributes)
Sets the attributes of the given
compass . |
protected void |
setDimensionLineAttributes(DimensionLine dimensionLine,
String elementName,
Map<String,String> attributes)
Sets the attributes of the given dimension line.
|
protected void |
setHome(Home home)
Sets the home that will be updated by this handler.
|
protected void |
setHomeAttributes(Home home,
String elementName,
Map<String,String> attributes)
Sets the attributes of the given
home . |
protected void |
setLabelAttributes(Label label,
String elementName,
Map<String,String> attributes)
Sets the attributes of the given
label . |
protected void |
setLevelAttributes(Level level,
String elementName,
Map<String,String> attributes)
Sets the attributes of the given
level . |
protected void |
setPieceOfFurnitureAttributes(HomePieceOfFurniture piece,
String elementName,
Map<String,String> attributes)
Sets the attributes of the given
piece . |
protected void |
setPolylineAttributes(Polyline polyline,
String elementName,
Map<String,String> attributes)
Sets the attributes of the given
polyline . |
protected void |
setRoomAttributes(Room room,
String elementName,
Map<String,String> attributes)
Sets the attributes of the given
room . |
protected void |
setWallAttributes(Wall wall,
String elementName,
Map<String,String> attributes)
Sets the attributes of the given
wall . |
void |
startDocument() |
void |
startElement(String uri,
String localName,
String name,
Attributes attributes) |
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
public HomeXMLHandler()
public HomeXMLHandler(UserPreferences preferences)
public void startDocument() throws SAXException
startDocument
in interface ContentHandler
startDocument
in class DefaultHandler
SAXException
public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException
startElement
in interface ContentHandler
startElement
in class DefaultHandler
SAXException
public void characters(char[] ch, int start, int length) throws SAXException
characters
in interface ContentHandler
characters
in class DefaultHandler
SAXException
public void endElement(String uri, String localName, String name) throws SAXException
endElement
in interface ContentHandler
endElement
in class DefaultHandler
SAXException
public void endDocument() throws SAXException
endDocument
in interface ContentHandler
endDocument
in class DefaultHandler
SAXException
protected void setHomeAttributes(Home home, String elementName, Map<String,String> attributes) throws SAXException
home
.
If needed, this method should be called from endElement(java.lang.String, java.lang.String, java.lang.String)
.SAXException
protected HomePrint createPrint(Map<String,String> attributes) throws SAXException
Print
instance initialized from the given attributes
.SAXException
protected void setCompassAttributes(Compass compass, String elementName, Map<String,String> attributes) throws SAXException
compass
.
If needed, this method should be called from endElement(java.lang.String, java.lang.String, java.lang.String)
.SAXException
protected void setCameraAttributes(Camera camera, String elementName, Map<String,String> attributes) throws SAXException
camera
.
If needed, this method should be called from endElement(java.lang.String, java.lang.String, java.lang.String)
.SAXException
protected void setLevelAttributes(Level level, String elementName, Map<String,String> attributes) throws SAXException
level
.
If needed, this method should be called from endElement(java.lang.String, java.lang.String, java.lang.String)
.SAXException
protected void setPieceOfFurnitureAttributes(HomePieceOfFurniture piece, String elementName, Map<String,String> attributes) throws SAXException
piece
.
If needed, this method should be called from endElement(java.lang.String, java.lang.String, java.lang.String)
.SAXException
protected void setWallAttributes(Wall wall, String elementName, Map<String,String> attributes) throws SAXException
wall
.
If needed, this method should be called from endElement(java.lang.String, java.lang.String, java.lang.String)
.SAXException
protected void setRoomAttributes(Room room, String elementName, Map<String,String> attributes) throws SAXException
room
.
If needed, this method should be called from endElement(java.lang.String, java.lang.String, java.lang.String)
.SAXException
protected void setPolylineAttributes(Polyline polyline, String elementName, Map<String,String> attributes) throws SAXException
polyline
.
If needed, this method should be called from endElement(java.lang.String, java.lang.String, java.lang.String)
.SAXException
protected void setDimensionLineAttributes(DimensionLine dimensionLine, String elementName, Map<String,String> attributes) throws SAXException
endElement(java.lang.String, java.lang.String, java.lang.String)
.SAXException
protected void setLabelAttributes(Label label, String elementName, Map<String,String> attributes) throws SAXException
label
.
If needed, this method should be called from endElement(java.lang.String, java.lang.String, java.lang.String)
.SAXException
protected void setHome(Home home)
home
,
it should call this method from startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
to store the
Home
subclass instance read from the XML stream.public Home getHome()
© Copyrights 2006-2017 Emmanuel PUYBARET / eTeks
Distributed under GNU General Public License