Class SvgSource
- Direct Known Subclasses:
GraphartScharen
,MaWiCM
,MaWiRic
,MovingForms
MfMain
is currently the tool-facade.
The derived classes realize different languages to define moving Svg graphics.
Two methods must be called from this class: first update()
,
which parses the time information into instance registers.
Iff this succeeds, followed by
(PrintWriter, String, int, int, int, int, int, int,String, double)
.
which constructs the general text frame of the generated Svg file and calls in turn
convertData()
, which must be overridden by the sub-class to generate the specific
Svg/Smil commands.
The usage of dynamic svg is rather well explained in
http://www.ibm.com/developerworks/xml/tutorials/x-dynamicsvg/section4.html
(this link is regrettably void, but see instead
https://web.archive.org/web/20110206162341/http://www.ibm.com/developerworks/xml/tutorials/x-dynamicsvg/section4.html
and
https://web.archive.org/web/20120330112222/http://www.ibm.com/developerworks/xml/tutorials/x-dynamicsvg/
It says
"[...] Synchronized Multimedia Integration Language (SMIL).
SMIL is an XML format to describe multi-media presentations, and it includes an
animation module that SVG borrows for its own use."
SMIL / animation in turn is documented in
http://www.w3.org/TR/SMIL/smil-animation.html#animationNS-BasicAnimationElements
The "svg homepage" is at
http://www.w3.org/Graphics/SVG/
The specs are in several files at
http://www.w3.org/TR/SVG11/
(( some hints from 2007 wrt. technical problems :
http://jwatt.org/svg/authoring/ ))
weiteres Tutorial SVG allgemein / incl animation, auf Deutsch:
http://svg.tutorial.aptico.de/start.php
weiteres Tutorial SVG allgemein / incl animation:
http://tutorials.jenkov.com/svg/
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
Visits all events of a given iterator pairwise and writes out the Svg/Smil commands.(package private) class
Visits all events of a given iterator pairwise and prepares time and interpolation values. -
Field Summary
Modifier and TypeFieldDescription(package private) final SortedMap<Duration_calendaric,
TpTop> Inverse of the Maptp2caldur
.protected final Modifiers
The modifiers for the parameter parsing process, including that of the time points.protected Tp
The very first time point, as specified in the input score data.protected int
The rightmost user coordinate.protected int
The numerically highest vertical user coordinate.protected Tp
The very last time point, as specified in the input score data.protected int
The leftmost user coordinate.protected int
The numerically lowest vertical user coordinate.protected MessageReceiver<SimpleMessage<eu.bandm.tools.util.xml.XMLDocumentIdentifier>>
Target of all local messages, maybe including a counter, etc.protected final MessageReceiver<SimpleMessage<eu.bandm.tools.util.xml.XMLDocumentIdentifier>>
External message receiver, to which all messages are finally sent.protected final Part
The tscore data to be processed.protected int
The numeric highest value of svg x coordinates.protected int
The numeric highest value of svg y coordinates.protected String
The string naming the unit of svg distance encoding.protected PrintWriter
The drain of all print commands which generate the source text.Inverse of the Maptp2rat
.protected double
A possible additional stretch factor for the time coordinates, supplied explicitly by the user.(package private) final Map<TpTop,
Duration_calendaric> Maps the score top-level time points to calendaric ("physical") duration values.Maps all time points to rational values.protected double
The stretch factor for the translation of the horizontal coordinates.protected double
The stretch factor for the translation of the vertical coordinates. -
Constructor Summary
ConstructorDescriptionSvgSource
(Part part, MessageReceiver<SimpleMessage<eu.bandm.tools.util.xml.XMLDocumentIdentifier>> msgr) Only constructor, sets the tscore score data and the drain of all messages. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
alpha2string
(int user) Returns in a target text string the encoding of the given opacity.protected String
animateString
(String attname, double t1, double duration, String v1, String v2) Generate a target text string which executes an animation.protected String
animateString_tp
(String attname, double t1, double t2, String v1, String v2) Generate a target text string which executes an animation.protected String
animateTransformString
(String attname, double t1, double t2, String v1, String v2) Generate a target text string which executes an animation.protected <T> boolean
Checks whether the very first event of a particular voice has a necessary parameter.static String
color2string
(Color_rgb_8 user) Returns in a target text string the encoding of the given color.protected abstract void
Must be overridden by the sub-class which realizes the specific conversion.void
convertToSvg
(PrintWriter pw, String title, int ulox, int uloy, int uhix, int uhiy, int phix, int phiy, MfOptions.physUnit punit, double timeFactor) Second main entry point, called after a successful execution ofupdate()
.protected String
height2device
(float userY) Returns in a target text string a given difference in user y-coordinates (y-height) encoded in svg coordinates.protected String
height2device
(int userY) Returns in a target text string a given difference in user y-coordinates (y-height) encoded in svg coordinates.protected void
printAlpha
(int user) Print the given vakue to the generated output text as an "opacity=" XML attribute.protected void
printColor
(Color_rgb_8 user) Print the given color to the generated output text as value of a "fill=" XML attribute.protected String
Generate a target text string which sets the value of an attribute.protected double
Returns in a target text string a given tscore time point encoded in svg/smil time point values.void
update()
First main entry point, called by the subclasses which realize the specializations, and executes parsing of time points, and further sort operations.protected double
when2device
(Event e) Returns in a target text string the onset of the given event encoded in svg/smil time point values.protected String
width2device
(float userX) Returns in a target text string a given difference in user x-coordinates (x-width) encoded in svg coordinates.protected String
width2device
(int userX) Returns in a target text string a given difference in user x-coordinates (x-width) encoded in svg coordinates.protected String
x2device
(int userX) Returns in a target text string a given position in user x-coordinates (x-pos) encoded in svg coordinates.protected String
y2device
(int userY) Returns in a target text string a given position in user y-coordinates (y-pos) encoded in svg coordinates.
-
Field Details
-
msg
Target of all local messages, maybe including a counter, etc. -
msgr
External message receiver, to which all messages are finally sent. -
part
The tscore data to be processed. -
defaultModifiers
The modifiers for the parameter parsing process, including that of the time points. -
tp2caldur
Maps the score top-level time points to calendaric ("physical") duration values. Currently only full seconds as text value in tp top FIXME support »1'04.322« -
caldur2tp
Inverse of the Maptp2caldur
. -
tp2rat
Maps all time points to rational values. FIXME WARUM ??? -
rat2tp
Inverse of the Maptp2rat
. -
firstTp
The very first time point, as specified in the input score data. -
lastTp
The very last time point, as specified in the input score data. -
pw
The drain of all print commands which generate the source text. -
lowX
protected int lowXThe leftmost user coordinate. Is translated into svg x coordinate 0 -
lowY
protected int lowYThe numerically lowest vertical user coordinate. Is translated into svg y coordinate 0. In the initial (=untransformed) coordinate system of Svg, the y coordinate expands downward, like "line numbers" in a Western text. See https://www.w3.org/TR/SVG11/coords.html#InitialCoordinateSystem This direction is taken over for the user coordinates. So the translation from user (=tscore socure text) coordinates to svg (=generated target text) coordinates works like...tscore coord --> svg coords x 20 70 0 800 y 20 70 0 800
-
hiX
protected int hiXThe rightmost user coordinate. Is translated into svg x coordinatephysHiX
. -
hiY
protected int hiY -
punit
The string naming the unit of svg distance encoding. (Can be "mm" or "pt", etc.) -
physHiX
protected int physHiXThe numeric highest value of svg x coordinates. -
physHiY
protected int physHiYThe numeric highest value of svg y coordinates. -
xFact
protected double xFactThe stretch factor for the translation of the horizontal coordinates. -
yFact
protected double yFactThe stretch factor for the translation of the vertical coordinates. -
timeFactor
protected double timeFactorA possible additional stretch factor for the time coordinates, supplied explicitly by the user. Defaults to 1.0.
-
-
Constructor Details
-
SvgSource
public SvgSource(Part part, MessageReceiver<SimpleMessage<eu.bandm.tools.util.xml.XMLDocumentIdentifier>> msgr) Only constructor, sets the tscore score data and the drain of all messages.
-
-
Method Details
-
update
public void update() -
width2device
Returns in a target text string a given difference in user x-coordinates (x-width) encoded in svg coordinates. -
width2device
Returns in a target text string a given difference in user x-coordinates (x-width) encoded in svg coordinates. -
x2device
Returns in a target text string a given position in user x-coordinates (x-pos) encoded in svg coordinates. -
height2device
Returns in a target text string a given difference in user y-coordinates (y-height) encoded in svg coordinates. -
height2device
Returns in a target text string a given difference in user y-coordinates (y-height) encoded in svg coordinates. -
y2device
Returns in a target text string a given position in user y-coordinates (y-pos) encoded in svg coordinates. -
tp2device
Returns in a target text string a given tscore time point encoded in svg/smil time point values. -
when2device
Returns in a target text string the onset of the given event encoded in svg/smil time point values. -
color2string
Returns in a target text string the encoding of the given color. cf http://www.w3.org/TR/SVG11/types.html#DataTypeColor but see also css 2.0 definition at http://www.w3.org/TR/2008/REC-CSS2-20080411/syndata.html#value-def-color DISLOC to Color_rgb_16.getSvgString() !?!? FIXME -
printColor
Print the given color to the generated output text as value of a "fill=" XML attribute. -
alpha2string
Returns in a target text string the encoding of the given opacity. Cf http://www.w3.org/TR/SVG11/masking.html#OpacityProperty -
printAlpha
protected void printAlpha(int user) Print the given vakue to the generated output text as an "opacity=" XML attribute. -
check_init_def
Checks whether the very first event of a particular voice has a necessary parameter.- Parameters:
firstEv
- the event to checkv
- the voice, for error message onlymap
- the parameter values, by events.pname
- the name of the parameter, for error message only.
-
animateTransformString
Generate a target text string which executes an animation. In Svg/Smil there are two different classes of animations "animate" and "animateTransform".- Parameters:
attname
- the name of the attribute to animatet1
- the starting time point of the changing processt2
- the final time point of the changing processv1
- the start value of the changing processv2
- the final value of the changing process
-
animateString
Generate a target text string which executes an animation. In Svg/Smil there are two different classes of animations "animate" and "animateTransform".- Parameters:
attname
- the name of the attribute to animatet1
- the starting time point of the changing processduration
- the duration of the changing processv1
- the start value of the changing processv2
- the final value of the changing process
-
animateString_tp
Generate a target text string which executes an animation. In Svg/Smil there are two different classes of animations "animate" and "animateTransform".- Parameters:
attname
- the name of the attribute to animatet1
- the starting time point of the changing processv1
- the start value of the changing processt2
- the final time point of the changing processv2
- the final value of the changing process
-
setString
Generate a target text string which sets the value of an attribute.- Parameters:
attname
- the name of the attribute to animatet1
- the time point of the changev1
- the value to which to change
-
convertData
protected abstract void convertData()Must be overridden by the sub-class which realizes the specific conversion. This may use all parameters in local registers and the auxiliary write-out methods. -
convertToSvg
public void convertToSvg(PrintWriter pw, String title, int ulox, int uloy, int uhix, int uhiy, int phix, int phiy, MfOptions.physUnit punit, double timeFactor) Second main entry point, called after a successful execution ofupdate()
. Creates SVG file constant header and footer. Copies parameters into local registers and then calls the (specific)convertData()
.
-