Module: CTioga
- Defined in:
- lib/CTioga/shortcuts.rb,
lib/CTioga/log.rb,
lib/CTioga/axes.rb,
lib/CTioga/debug.rb,
lib/CTioga/utils.rb,
lib/CTioga/ctable.rb,
lib/CTioga/layout.rb,
lib/CTioga/styles.rb,
lib/CTioga/themes.rb,
lib/CTioga/legends.rb,
lib/CTioga/backends.rb,
lib/CTioga/dimension.rb,
lib/CTioga/partition.rb,
lib/CTioga/plotmaker.rb,
lib/CTioga/boundaries.rb,
lib/CTioga/plot_style.rb,
lib/CTioga/structures.rb,
lib/CTioga/curve_style.rb,
lib/CTioga/themes/demo.rb,
lib/CTioga/themes/fits.rb,
lib/CTioga/themes/mono.rb,
lib/CTioga/legends/item.rb,
lib/CTioga/movingarrays.rb,
lib/CTioga/elements/base.rb,
lib/CTioga/legends/style.rb,
lib/CTioga/elements/curves.rb,
lib/CTioga/legends/cmdline.rb,
lib/CTioga/themes/classical.rb,
lib/CTioga/elements/containers.rb,
lib/CTioga/elements/tioga_primitives.rb
Overview
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details (in the COPYING file).
Defined Under Namespace
Modules: Axes, Backends, Debug, Legends, Log, Styles, Themes, Utils, Version Classes: CTable, Container, Curve2D, CurveLegend, CurveStyle, Dimension, EdgesAndAxes, FixedLayout, GridItemLayout, GridLayout, Histogram2D, Label, Layout, LayoutPreferences, LegendItem, LegendLine, LegendStyle, LineSemiPrimitive, MovingArray, PlotMaker, PlotStyle, Region, RulerSemiPrimitive, SharedAxisPlot, Shortcut, SimpleLayout, SpecialArray, SubPlot, TangentSemiPrimitive, TextDimension, TickLabels, TiogaElement, TiogaFuncall, TiogaPrimitiveMaker
Constant Summary collapse
- DEFAULT_RE =
The regular expression saying that what we see on the command-line means “use default value”.
/^\s*(auto|default)\s*$/i
- DISABLE_RE =
The regular expression saying that what we see on the command-line means “disable”.
/^\s*(no(ne)?|off)\s*$/i
- TRUE_RE =
The regular expression saying that what we see on the command-line means “true”.
/^\s*(true|yes|on)\s*$/i
Class Method Summary collapse
-
.define_tioga_figure(t, name, *args) ⇒ Object
This function provides a ‘command-line’ interface from within Tioga !.
-
.get_tioga_color(str) ⇒ Object
A helper function that converts user input into a Tioga color.
-
.pdftex_quote_string(str) ⇒ Object
A small function to help quoting a string for inclusion in a pdfTeX primitive.
-
.shell_quote_string(str) ⇒ Object
Takes a string a returns a quoted version that should be able to go through shell expansion.
-
.show_tioga_plot(t, *args) ⇒ Object
This function provides a ‘command-line’ interface from within Tioga !.
Class Method Details
.define_tioga_figure(t, name, *args) ⇒ Object
This function provides a ‘command-line’ interface from within Tioga !
1651 1652 1653 1654 1655 |
# File 'lib/CTioga/plotmaker.rb', line 1651 def CTioga.define_tioga_figure(t, name, *args) t.def_figure(name) { CTioga.show_tioga_plot(t, *args) } end |
.get_tioga_color(str) ⇒ Object
A helper function that converts user input into a Tioga color.
TODO: allow designs such as in LaTeX xcolor: Red!10!Blue !
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/CTioga/movingarrays.rb', line 26 def self.get_tioga_color(str) if str =~ /([\d.]+),([\d.]+),([\d.]+)/ # Array notation color = Dobjects::Dvector.new([$1.to_f,$2.to_f,$3.to_f]) if color.max > 1 color *= 1.0/255.0 end return color.to_a elsif str =~ /#([0-9a-fA-F]{6})/ # HTML notation return $1.scan(/../).map { |i| i.to_i(16)/255.0 } else return Tioga::FigureConstants.const_get(str) end end |
.pdftex_quote_string(str) ⇒ Object
A small function to help quoting a string for inclusion in a pdfTeX primitive.
136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/CTioga/plotmaker.rb', line 136 def self.pdftex_quote_string(str) return str.gsub(/([%#])|([()])|([{}~_^])|\\/) do if $1 "\\#{$1}" elsif $2 # Quoting (), as they can be quite nasty !! "\\string\\#{$2}" elsif $3 "\\string#{$3}" else # Quoting \ "\\string\\\\" end end end |
.shell_quote_string(str) ⇒ Object
Takes a string a returns a quoted version that should be able to go through shell expansion. For now, it won’t work with strings containing ‘, but that’s already a good help.
1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 |
# File 'lib/CTioga/plotmaker.rb', line 1637 def CTioga.shell_quote_string(str) if str =~ /[\s"*$()\[\]{}';]/ if str =~ /'/ a = str.gsub(/(["$\\])/) { "\\#$1" } return "\"#{a}\"" else return "'#{str}'" end else return str end end |
.show_tioga_plot(t, *args) ⇒ Object
This function provides a ‘command-line’ interface from within Tioga !
1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 |
# File 'lib/CTioga/plotmaker.rb', line 1658 def CTioga.show_tioga_plot(t, *args) plot = PlotMaker.new plot.parse_command_line_arguments(args) plot.setup_figure_maker(t) width = 72 * t. convert_output_to_inches(t. convert_figure_to_output_dx(t.convert_frame_to_figure_dx(1))) height = 72 * t. convert_output_to_inches(t. convert_figure_to_output_dy(t.convert_frame_to_figure_dy(1))) plot.set_root_frame(0, width, height, 0) plot.do_figure(t) end |