lib/ctioga2/graphics/styles/factory.rb in ctioga2-0.10.1 vs lib/ctioga2/graphics/styles/factory.rb in ctioga2-0.11
- old
+ new
@@ -146,13 +146,13 @@
@name_to_target[name] = target
end
# A simple parameter is something whose target defines all, ie
# only the name and a documentation text is necessary.
- def self.simple_parameter(target, text, sets = nil)
+ def self.simple_parameter(target, text, sets = nil, short = nil)
name = target.gsub(/_/, '-')
- define_parameter(target, name, sets, text, nil)
+ define_parameter(target, name, sets, text, short)
end
# Returns the Hash containing the class parameters.
def self.parameters
return @parameters || {}
@@ -240,11 +240,11 @@
# Creates a new CurveStyleFactory.
def initialize
# Overrides as in the first ctioga
@override_parameters = {
'line_style' => LineStyles::Solid,
- 'marker_marker' => false,
+ 'marker' => false,
'marker_scale' => 0.5,
'fill_color' => '=color'.to_sym,
'error_bar_color' => '=marker_color'.to_sym
}
@parameters_carrays = {}
@@ -318,20 +318,18 @@
end
# Now, the parameters:
# Lines:
- define_parameter 'line_color', 'color',
- Sets::ColorSets, "line color", "-c"
+ simple_parameter 'color', "line color", Sets::ColorSets, "-c"
simple_parameter 'line_width', 'line width', Sets::LineWidthSets
simple_parameter 'line_style', 'line style', Sets::LineStyleSets
# Markers
- define_parameter 'marker_marker', 'marker',
- Sets::MarkerSets, "marker", '-m'
+ simple_parameter 'marker', 'marker', Sets::MarkerSets, '-m'
simple_parameter 'marker_color', "marker color", Sets::ColorSets
simple_parameter 'marker_scale', "marker scale", Sets::LineWidthSets
@@ -347,15 +345,16 @@
define_parameter 'location_yaxis', 'yaxis',
nil, "Y axis", nil, true
# Now, fill style
- define_parameter 'fill_close_type', 'fill',
- {}, "Fill until", nil
+ simple_parameter 'fill', 'Fill until', {}
simple_parameter 'fill_color', "fill color", Sets::ColorSets
+ simple_parameter 'fill_pattern', "fill pattern", nil
+
simple_parameter 'clipped', "clipped", nil
simple_parameter 'depth', "depth", nil
simple_parameter 'fill_transparency', 'fill transparency', {}
@@ -394,10 +393,25 @@
# A constant suitable for use as the optional arguments of the
# plot command.
PlotCommandOptions = plot_optional_arguments
+ # Converts the one-time parameters, which is a hash whose keys
+ # are the names of the parameters to targets.
+ def hash_name_to_target(h)
+ retval = {}
+ convert = self.class.name_to_target
+ for k,v in h
+ if convert.key? k
+ retval[convert[k]] = v
+ else
+ warn { "Unkown key for hash_name_to_target: #{k}" }
+ end
+ end
+ return retval
+ end
+
protected
# Returns the CurveFactoryParameterType object corresponding
# to the named parameter.
def get_parameter(target)
@@ -411,23 +425,9 @@
# Returns the class parameters hash
def parameters
return self.class.parameters
end
- # Converts the one-time parameters, which is a hash whose keys
- # are the names of the parameters to targets.
- def hash_name_to_target(h)
- retval = {}
- convert = self.class.name_to_target
- for k,v in h
- if convert.key? k
- retval[convert[k]] = v
- else
- warn { "Unkown key for hash_name_to_target: #{k}" }
- end
- end
- return retval
- end
# Resolve potential links in the form of :=stuff within the
# given hash, and returns a new version of the hash.
#
# \warning the _h_ parameter is completely destroyed in the