nudge 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Rakefile +11 -7
- data/VERSION +1 -1
- data/lib/instructions/bool/bool_and.rb +19 -0
- data/lib/instructions/bool/bool_define.rb +6 -0
- data/lib/instructions/bool/bool_depth.rb +6 -0
- data/lib/instructions/bool/bool_duplicate.rb +6 -0
- data/lib/instructions/bool/bool_equal_q.rb +19 -0
- data/lib/instructions/bool/bool_flush.rb +6 -0
- data/lib/instructions/bool/bool_not.rb +18 -0
- data/lib/instructions/bool/bool_or.rb +19 -0
- data/lib/instructions/bool/bool_pop.rb +6 -0
- data/lib/instructions/bool/bool_random.rb +13 -0
- data/lib/instructions/bool/bool_rotate.rb +6 -0
- data/lib/instructions/bool/bool_shove.rb +6 -0
- data/lib/instructions/bool/bool_swap.rb +6 -0
- data/lib/instructions/bool/bool_xor.rb +19 -0
- data/lib/instructions/bool/bool_yank.rb +6 -0
- data/lib/instructions/bool/bool_yankdup.rb +6 -0
- data/lib/instructions/code/code_atom_q.rb +16 -0
- data/lib/instructions/code/code_backbone_points.rb +24 -0
- data/lib/instructions/code/code_car.rb +20 -0
- data/lib/instructions/code/code_cdr.rb +20 -0
- data/lib/instructions/code/code_concatenate.rb +31 -0
- data/lib/instructions/code/code_cons.rb +25 -0
- data/lib/instructions/code/code_container.rb +28 -0
- data/lib/instructions/code/code_contains_q.rb +22 -0
- data/lib/instructions/code/code_define.rb +21 -0
- data/lib/instructions/code/code_depth.rb +6 -0
- data/lib/instructions/code/code_discrepancy.rb +29 -0
- data/lib/instructions/code/code_do_count.rb +27 -0
- data/lib/instructions/code/code_do_range.rb +42 -0
- data/lib/instructions/code/code_do_times.rb +38 -0
- data/lib/instructions/code/code_duplicate.rb +6 -0
- data/lib/instructions/code/code_equal_q.rb +17 -0
- data/lib/instructions/code/code_execute.rb +19 -0
- data/lib/instructions/code/code_execute_then_pop.rb +20 -0
- data/lib/instructions/code/code_flush.rb +6 -0
- data/lib/instructions/code/code_gsub.rb +35 -0
- data/lib/instructions/code/code_if.rb +22 -0
- data/lib/instructions/code/code_instructions.rb +15 -0
- data/lib/instructions/code/code_list.rb +19 -0
- data/lib/instructions/code/code_member_q.rb +26 -0
- data/lib/instructions/code/code_name_lookup.rb +19 -0
- data/lib/instructions/code/code_nth.rb +24 -0
- data/lib/instructions/code/code_nth_cdr.rb +30 -0
- data/lib/instructions/code/code_nth_point.rb +21 -0
- data/lib/instructions/code/code_null_q.rb +15 -0
- data/lib/instructions/code/code_parses_q.rb +15 -0
- data/lib/instructions/code/code_points.rb +19 -0
- data/lib/instructions/code/code_pop.rb +6 -0
- data/lib/instructions/code/code_position.rb +22 -0
- data/lib/instructions/code/code_quote.rb +14 -0
- data/lib/instructions/code/code_replace_nth_point.rb +30 -0
- data/lib/instructions/code/code_rotate.rb +6 -0
- data/lib/instructions/code/code_shove.rb +6 -0
- data/lib/instructions/code/code_swap.rb +6 -0
- data/lib/instructions/code/code_yank.rb +6 -0
- data/lib/instructions/code/code_yankdup.rb +6 -0
- data/lib/instructions/conversion/bool_from_float.rb +14 -0
- data/lib/instructions/conversion/bool_from_int.rb +14 -0
- data/lib/instructions/conversion/code_from_bool.rb +16 -0
- data/lib/instructions/conversion/code_from_float.rb +16 -0
- data/lib/instructions/conversion/code_from_int.rb +17 -0
- data/lib/instructions/conversion/code_from_name.rb +16 -0
- data/lib/instructions/conversion/float_from_bool.rb +14 -0
- data/lib/instructions/conversion/float_from_int.rb +14 -0
- data/lib/instructions/conversion/int_from_bool.rb +14 -0
- data/lib/instructions/conversion/int_from_float.rb +14 -0
- data/lib/instructions/exec/exec_define.rb +6 -0
- data/lib/instructions/exec/exec_depth.rb +6 -0
- data/lib/instructions/exec/exec_do_count.rb +23 -0
- data/lib/instructions/exec/exec_do_range.rb +36 -0
- data/lib/instructions/exec/exec_do_times.rb +34 -0
- data/lib/instructions/exec/exec_duplicate.rb +6 -0
- data/lib/instructions/exec/exec_equal_q.rb +17 -0
- data/lib/instructions/exec/exec_flush.rb +6 -0
- data/lib/instructions/exec/exec_if.rb +8 -0
- data/lib/instructions/exec/exec_k.rb +14 -0
- data/lib/instructions/exec/exec_pop.rb +6 -0
- data/lib/instructions/exec/exec_rotate.rb +6 -0
- data/lib/instructions/exec/exec_s.rb +18 -0
- data/lib/instructions/exec/exec_shove.rb +6 -0
- data/lib/instructions/exec/exec_swap.rb +6 -0
- data/lib/instructions/exec/exec_y.rb +15 -0
- data/lib/instructions/exec/exec_yank.rb +6 -0
- data/lib/instructions/exec/exec_yankdup.rb +6 -0
- data/lib/instructions/float/float_abs.rb +14 -0
- data/lib/instructions/float/float_add.rb +15 -0
- data/lib/instructions/float/float_cosine.rb +14 -0
- data/lib/instructions/float/float_define.rb +6 -0
- data/lib/instructions/float/float_depth.rb +6 -0
- data/lib/instructions/float/float_divide.rb +20 -0
- data/lib/instructions/float/float_duplicate.rb +6 -0
- data/lib/instructions/float/float_equal_q.rb +15 -0
- data/lib/instructions/float/float_flush.rb +6 -0
- data/lib/instructions/float/float_greater_than_q.rb +15 -0
- data/lib/instructions/float/float_if.rb +8 -0
- data/lib/instructions/float/float_less_than_q.rb +15 -0
- data/lib/instructions/float/float_max.rb +15 -0
- data/lib/instructions/float/float_min.rb +15 -0
- data/lib/instructions/float/float_modulo.rb +20 -0
- data/lib/instructions/float/float_multiply.rb +15 -0
- data/lib/instructions/float/float_negative.rb +14 -0
- data/lib/instructions/float/float_pop.rb +6 -0
- data/lib/instructions/float/float_power.rb +20 -0
- data/lib/instructions/float/float_random.rb +13 -0
- data/lib/instructions/float/float_rotate.rb +6 -0
- data/lib/instructions/float/float_shove.rb +6 -0
- data/lib/instructions/float/float_sine.rb +14 -0
- data/lib/instructions/float/float_sqrt.rb +18 -0
- data/lib/instructions/float/float_subtract.rb +15 -0
- data/lib/instructions/float/float_swap.rb +6 -0
- data/lib/instructions/float/float_tangent.rb +14 -0
- data/lib/instructions/float/float_yank.rb +6 -0
- data/lib/instructions/float/float_yankdup.rb +6 -0
- data/lib/instructions/infrastructure.rb +335 -17
- data/lib/instructions/int/int_abs.rb +14 -0
- data/lib/instructions/int/int_add.rb +15 -0
- data/lib/instructions/int/int_define.rb +6 -0
- data/lib/instructions/int/int_depth.rb +6 -0
- data/lib/instructions/int/int_divide.rb +20 -0
- data/lib/instructions/int/int_duplicate.rb +6 -0
- data/lib/instructions/int/int_equal_q.rb +15 -0
- data/lib/instructions/int/int_flush.rb +6 -0
- data/lib/instructions/int/int_greater_than_q.rb +15 -0
- data/lib/instructions/int/int_if.rb +8 -0
- data/lib/instructions/int/int_less_than_q.rb +15 -0
- data/lib/instructions/int/int_max.rb +16 -0
- data/lib/instructions/int/int_min.rb +16 -0
- data/lib/instructions/int/int_modulo.rb +20 -0
- data/lib/instructions/int/int_multiply.rb +15 -0
- data/lib/instructions/int/int_negative.rb +14 -0
- data/lib/instructions/int/int_pop.rb +6 -0
- data/lib/instructions/int/int_power.rb +16 -0
- data/lib/instructions/int/int_random.rb +13 -0
- data/lib/instructions/int/int_rotate.rb +6 -0
- data/lib/instructions/int/int_shove.rb +6 -0
- data/lib/instructions/int/int_subtract.rb +16 -0
- data/lib/instructions/int/int_swap.rb +6 -0
- data/lib/instructions/int/int_yank.rb +6 -0
- data/lib/instructions/int/int_yankdup.rb +6 -0
- data/lib/instructions/name/name_depth.rb +6 -0
- data/lib/instructions/name/name_disable_lookup.rb +12 -0
- data/lib/instructions/name/name_duplicate.rb +6 -0
- data/lib/instructions/name/name_equal_q.rb +15 -0
- data/lib/instructions/name/name_flush.rb +6 -0
- data/lib/instructions/name/name_next.rb +14 -0
- data/lib/instructions/name/name_pop.rb +6 -0
- data/lib/instructions/name/name_random_bound.rb +14 -0
- data/lib/instructions/name/name_rotate.rb +6 -0
- data/lib/instructions/name/name_shove.rb +6 -0
- data/lib/instructions/name/name_swap.rb +6 -0
- data/lib/instructions/name/name_unbind.rb +17 -0
- data/lib/instructions/name/name_yank.rb +6 -0
- data/lib/instructions/name/name_yankdup.rb +6 -0
- data/lib/interpreter/grammars/nudge_codeblock.treetop +17 -0
- data/lib/interpreter/grammars/nudge_codeblock_helpers.rb +19 -0
- data/lib/interpreter/grammars/nudge_common.treetop +15 -0
- data/lib/interpreter/grammars/nudge_instruction.treetop +14 -0
- data/lib/interpreter/grammars/nudge_instruction_helpers.rb +14 -0
- data/lib/interpreter/grammars/nudge_reference.treetop +9 -0
- data/lib/interpreter/grammars/nudge_reference_helpers.rb +14 -0
- data/lib/interpreter/grammars/nudge_value.treetop +14 -0
- data/lib/interpreter/grammars/nudge_value_helpers.rb +19 -0
- data/lib/interpreter/interpreter.rb +74 -23
- data/lib/interpreter/nudge_program.rb +253 -0
- data/lib/interpreter/parse.tab.rb +264 -0
- data/lib/interpreter/programPoints.rb +119 -98
- data/lib/interpreter/types/codeType.rb +114 -89
- data/lib/interpreter/types/pushTypes.rb +33 -20
- data/lib/nudge.rb +25 -26
- data/readme.md +13 -10
- data/spec/fixtures/long_arithmetic.example +7 -4
- data/spec/instructions/bool/bool_and_spec.rb +61 -0
- data/spec/instructions/bool/bool_define_spec.rb +69 -0
- data/spec/instructions/bool/bool_depth_spec.rb +39 -0
- data/spec/instructions/bool/bool_equal_q_spec.rb +61 -0
- data/spec/instructions/bool/bool_flush_spec.rb +37 -0
- data/spec/instructions/bool/bool_not_spec.rb +61 -0
- data/spec/instructions/bool/bool_or_spec.rb +61 -0
- data/spec/instructions/bool/bool_random_spec.rb +39 -0
- data/spec/instructions/bool/bool_shove_spec.rb +69 -0
- data/spec/instructions/bool/bool_xor_spec.rb +61 -0
- data/spec/instructions/bool/bool_yank_spec.rb +71 -0
- data/spec/instructions/bool/bool_yankdup_spec.rb +70 -0
- data/spec/instructions/code/code_atom_q_spec.rb +44 -0
- data/spec/instructions/code/code_backbone_points_spec.rb +57 -0
- data/spec/instructions/code/code_car_spec.rb +50 -0
- data/spec/instructions/code/code_cdr_spec.rb +51 -0
- data/spec/instructions/code/code_concatenate_spec.rb +81 -0
- data/spec/instructions/code/code_cons_spec.rb +63 -0
- data/spec/instructions/code/code_container_spec.rb +77 -0
- data/spec/instructions/code/code_contains_q_spec.rb +82 -0
- data/spec/instructions/code/code_define_spec.rb +76 -0
- data/spec/instructions/code/code_discrepancy_spec.rb +81 -0
- data/spec/instructions/code/code_do_count_spec.rb +83 -0
- data/spec/instructions/code/code_do_range_spec.rb +113 -0
- data/spec/instructions/code/code_do_times_spec.rb +116 -0
- data/spec/instructions/code/code_equal_q_spec.rb +49 -0
- data/spec/instructions/code/code_execute_spec.rb +52 -0
- data/spec/instructions/code/code_execute_then_pop_spec.rb +61 -0
- data/spec/instructions/code/code_fromname_spec.rb +37 -0
- data/spec/instructions/code/code_gsub_spec.rb +112 -0
- data/spec/instructions/code/code_if_spec.rb +53 -0
- data/spec/instructions/code/code_instructions_spec.rb +42 -0
- data/spec/instructions/code/code_list_spec.rb +49 -0
- data/spec/instructions/code/code_member_q_spec.rb +77 -0
- data/spec/instructions/code/code_name_lookup_spec.rb +65 -0
- data/spec/instructions/code/code_noop_spec.rb +38 -0
- data/spec/instructions/code/code_nth_cdr_spec.rb +77 -0
- data/spec/instructions/code/code_nth_point_spec.rb +67 -0
- data/spec/instructions/code/code_nth_spec.rb +62 -0
- data/spec/instructions/code/code_null_q_spec.rb +44 -0
- data/spec/instructions/code/code_parses_q_spec.rb +73 -0
- data/spec/instructions/code/code_points_spec.rb +49 -0
- data/spec/instructions/code/code_position_spec.rb +74 -0
- data/spec/instructions/code/code_quote_spec.rb +53 -0
- data/spec/instructions/code/code_replace_nth_point_spec.rb +115 -0
- data/spec/instructions/code/code_stack_spec.rb +386 -0
- data/spec/instructions/exec/exec_define_spec.rb +70 -0
- data/spec/instructions/exec/exec_depth_spec.rb +39 -0
- data/spec/instructions/exec/exec_do_count_spec.rb +79 -0
- data/spec/instructions/exec/exec_do_range_spec.rb +98 -0
- data/spec/instructions/exec/exec_do_times_spec.rb +105 -0
- data/spec/instructions/exec/exec_duplicate_spec.rb +44 -0
- data/spec/instructions/exec/exec_equal_q_spec.rb +50 -0
- data/spec/instructions/exec/exec_flush_spec.rb +37 -0
- data/spec/instructions/exec/exec_if_spec.rb +51 -0
- data/spec/instructions/exec/exec_k_spec.rb +39 -0
- data/spec/instructions/exec/exec_pop_spec.rb +38 -0
- data/spec/instructions/exec/exec_rotate_spec.rb +40 -0
- data/spec/instructions/exec/exec_s_spec.rb +41 -0
- data/spec/instructions/exec/exec_shove_spec.rb +68 -0
- data/spec/instructions/exec/exec_swap_spec.rb +41 -0
- data/spec/instructions/exec/exec_y_spec.rb +41 -0
- data/spec/instructions/exec/exec_yank_spec.rb +66 -0
- data/spec/instructions/exec/exec_yankdup_spec.rb +69 -0
- data/spec/instructions/float/float_abs_spec.rb +50 -0
- data/spec/instructions/float/float_add_spec.rb +50 -0
- data/spec/instructions/float/float_cosine_spec.rb +61 -0
- data/spec/instructions/float/float_define_spec.rb +69 -0
- data/spec/instructions/float/float_depth_spec.rb +39 -0
- data/spec/instructions/float/float_divide_spec.rb +59 -0
- data/spec/instructions/float/float_equal_q_spec.rb +53 -0
- data/spec/instructions/float/float_flush_spec.rb +37 -0
- data/spec/instructions/float/float_greater_than_q_spec.rb +59 -0
- data/spec/instructions/float/float_if_spec.rb +49 -0
- data/spec/instructions/float/float_less_than_q_spec.rb +59 -0
- data/spec/instructions/float/float_max_spec.rb +51 -0
- data/spec/instructions/float/float_min_spec.rb +51 -0
- data/spec/instructions/float/float_modulo_spec.rb +59 -0
- data/spec/instructions/float/float_multiply_spec.rb +51 -0
- data/spec/instructions/float/float_negative_spec.rb +51 -0
- data/spec/instructions/float/float_power_spec.rb +59 -0
- data/spec/instructions/float/float_random_spec.rb +36 -0
- data/spec/instructions/float/float_shove_spec.rb +67 -0
- data/spec/instructions/float/float_sine_spec.rb +61 -0
- data/spec/instructions/float/float_sqrt_spec.rb +60 -0
- data/spec/instructions/float/float_subtract_spec.rb +51 -0
- data/spec/instructions/float/float_tangent_spec.rb +62 -0
- data/spec/instructions/float/float_yank_spec.rb +65 -0
- data/spec/instructions/float/float_yankdup_spec.rb +70 -0
- data/spec/instructions/instruction_class_spec.rb +31 -0
- data/spec/instructions/int/int_abs_spec.rb +61 -0
- data/spec/instructions/int/int_add_spec.rb +60 -0
- data/spec/instructions/int/int_define_spec.rb +73 -0
- data/spec/instructions/int/int_depth_spec.rb +37 -0
- data/spec/instructions/int/int_divide_spec.rb +69 -0
- data/spec/instructions/int/int_equal_q_spec.rb +52 -0
- data/spec/instructions/int/int_flush_spec.rb +37 -0
- data/spec/instructions/int/int_greater_than_q_spec.rb +59 -0
- data/spec/instructions/int/int_if_spec.rb +48 -0
- data/spec/instructions/int/int_less_than_q_spec.rb +59 -0
- data/spec/instructions/int/int_max_spec.rb +61 -0
- data/spec/instructions/int/int_min_spec.rb +61 -0
- data/spec/instructions/int/int_modulo_spec.rb +69 -0
- data/spec/instructions/int/int_multiply_spec.rb +61 -0
- data/spec/instructions/int/int_negative_spec.rb +61 -0
- data/spec/instructions/int/int_power_spec.rb +73 -0
- data/spec/instructions/int/int_random_spec.rb +36 -0
- data/spec/instructions/int/int_shove_spec.rb +67 -0
- data/spec/instructions/int/int_subtract_spec.rb +61 -0
- data/spec/instructions/int/int_yank_spec.rb +85 -0
- data/spec/instructions/int/int_yankdup_spec.rb +70 -0
- data/spec/instructions/name/name_depth_spec.rb +39 -0
- data/spec/instructions/name/name_disable_lookup_spec.rb +47 -0
- data/spec/instructions/name/name_equal_q_spec.rb +38 -0
- data/spec/instructions/name/name_flush_spec.rb +37 -0
- data/spec/instructions/name/name_next_spec.rb +39 -0
- data/spec/instructions/name/name_random_bound_spec.rb +57 -0
- data/spec/instructions/name/name_shove_spec.rb +67 -0
- data/spec/instructions/name/name_unbind_spec.rb +62 -0
- data/spec/instructions/name/name_yank_spec.rb +65 -0
- data/spec/instructions/name/name_yankdup_spec.rb +69 -0
- data/spec/instructions/split_these/bool_stack_spec.rb +95 -0
- data/spec/instructions/split_these/conversions_spec.rb +103 -0
- data/spec/instructions/split_these/float_stack_spec.rb +92 -0
- data/spec/instructions/split_these/int_stack_spec.rb +81 -0
- data/spec/instructions/split_these/name_stack_spec.rb +84 -0
- data/spec/interpreter/codeblock_point_spec.rb +164 -0
- data/spec/interpreter/codetype_spec.rb +219 -185
- data/spec/interpreter/instruction_spec.rb +87 -25
- data/spec/interpreter/interpreter_spec.rb +230 -36
- data/spec/interpreter/nil_point_spec.rb +32 -0
- data/spec/interpreter/nudge_program_spec.rb +774 -0
- data/spec/interpreter/reference_point_spec.rb +73 -0
- data/spec/interpreter/stack_spec.rb +1 -1
- data/spec/interpreter/treetophelpers.rb +94 -1
- data/spec/interpreter/types_spec.rb +125 -77
- data/spec/interpreter/value_point_spec.rb +173 -0
- data/spec/parsers/nudge_program_parser_spec.rb +86 -0
- data/spec/spec_helper.rb +26 -2
- metadata +464 -664
- data/_spikes/couch_document_spike.rb +0 -24
- data/_spikes/nested_parsing/nested.treetop +0 -6
- data/_spikes/nudge3_syntax_spike.txt +0 -23
- data/_spikes/nudgeview/init.rb +0 -19
- data/_spikes/nudgeview/public/javascripts/app.js +0 -12
- data/_spikes/nudgeview/public/javascripts/jquery.js +0 -4376
- data/_spikes/nudgeview/public/javascripts/jquery.svg.js +0 -1325
- data/_spikes/nudgeview/views/index.erb +0 -18
- data/_spikes/nudgeview/views/index.haml +0 -8
- data/_spikes/simplestWeb/simplest.rb +0 -44
- data/_spikes/simplestWeb/views/main.erb +0 -19
- data/_spikes/sketches/nudgecode_spike.rb +0 -146
- data/_spikes/sketches/searchDSL_spike.rb +0 -25
- data/_spikes/sketches/search_operator_sketch_spike.txt +0 -287
- data/_spikes/sketches/searchspace_spike.rb +0 -96
- data/_spikes/symbolic_regression/activate.rb +0 -35
- data/_spikes/symbolic_regression/config/environment.rb +0 -340
- data/_spikes/symbolic_regression/config/environments/deployment.rb +0 -0
- data/_spikes/symbolic_regression/config/environments/development.rb +0 -0
- data/_spikes/symbolic_regression/experiment/objectives/programLength.rb +0 -2
- data/_spikes/symbolic_regression/experiment/objectives/summedSquaredError.rb +0 -2
- data/_spikes/symbolic_regression/lib/tasks/run.rake +0 -0
- data/app_generators/nudge/USAGE +0 -5
- data/app_generators/nudge/nudge_generator.rb +0 -73
- data/app_generators/nudge/templates/activate.rb +0 -0
- data/bin/nudge +0 -17
- data/doc/classes/BlockNode.html +0 -146
- data/doc/classes/BlockNode.src/M000246.html +0 -18
- data/doc/classes/BoolAndInstruction.html +0 -218
- data/doc/classes/BoolAndInstruction.src/M000003.html +0 -15
- data/doc/classes/BoolAndInstruction.src/M000004.html +0 -16
- data/doc/classes/BoolAndInstruction.src/M000005.html +0 -15
- data/doc/classes/BoolAndInstruction.src/M000006.html +0 -15
- data/doc/classes/BoolEqualQInstruction.html +0 -218
- data/doc/classes/BoolEqualQInstruction.src/M000015.html +0 -15
- data/doc/classes/BoolEqualQInstruction.src/M000016.html +0 -16
- data/doc/classes/BoolEqualQInstruction.src/M000017.html +0 -15
- data/doc/classes/BoolEqualQInstruction.src/M000018.html +0 -15
- data/doc/classes/BoolFromFloatInstruction.html +0 -218
- data/doc/classes/BoolFromFloatInstruction.src/M000071.html +0 -15
- data/doc/classes/BoolFromFloatInstruction.src/M000072.html +0 -15
- data/doc/classes/BoolFromFloatInstruction.src/M000073.html +0 -15
- data/doc/classes/BoolFromFloatInstruction.src/M000074.html +0 -15
- data/doc/classes/BoolFromIntInstruction.html +0 -218
- data/doc/classes/BoolFromIntInstruction.src/M000067.html +0 -15
- data/doc/classes/BoolFromIntInstruction.src/M000068.html +0 -15
- data/doc/classes/BoolFromIntInstruction.src/M000069.html +0 -15
- data/doc/classes/BoolFromIntInstruction.src/M000070.html +0 -15
- data/doc/classes/BoolNotInstruction.html +0 -218
- data/doc/classes/BoolNotInstruction.src/M000019.html +0 -15
- data/doc/classes/BoolNotInstruction.src/M000020.html +0 -15
- data/doc/classes/BoolNotInstruction.src/M000021.html +0 -15
- data/doc/classes/BoolNotInstruction.src/M000022.html +0 -15
- data/doc/classes/BoolOrInstruction.html +0 -218
- data/doc/classes/BoolOrInstruction.src/M000007.html +0 -15
- data/doc/classes/BoolOrInstruction.src/M000008.html +0 -16
- data/doc/classes/BoolOrInstruction.src/M000009.html +0 -15
- data/doc/classes/BoolOrInstruction.src/M000010.html +0 -15
- data/doc/classes/BoolRandomInstruction.html +0 -218
- data/doc/classes/BoolRandomInstruction.src/M000187.html +0 -15
- data/doc/classes/BoolRandomInstruction.src/M000188.html +0 -14
- data/doc/classes/BoolRandomInstruction.src/M000189.html +0 -15
- data/doc/classes/BoolRandomInstruction.src/M000190.html +0 -15
- data/doc/classes/BoolType.html +0 -196
- data/doc/classes/BoolType.src/M000240.html +0 -16
- data/doc/classes/BoolType.src/M000241.html +0 -15
- data/doc/classes/BoolType.src/M000242.html +0 -15
- data/doc/classes/BoolXorInstruction.html +0 -218
- data/doc/classes/BoolXorInstruction.src/M000011.html +0 -15
- data/doc/classes/BoolXorInstruction.src/M000012.html +0 -16
- data/doc/classes/BoolXorInstruction.src/M000013.html +0 -15
- data/doc/classes/BoolXorInstruction.src/M000014.html +0 -15
- data/doc/classes/ChannelNode.html +0 -161
- data/doc/classes/ChannelNode.src/M000249.html +0 -15
- data/doc/classes/ChannelNode.src/M000250.html +0 -16
- data/doc/classes/CodeType.html +0 -269
- data/doc/classes/CodeType.src/M000219.html +0 -38
- data/doc/classes/CodeType.src/M000220.html +0 -16
- data/doc/classes/CodeType.src/M000221.html +0 -16
- data/doc/classes/CodeType.src/M000222.html +0 -16
- data/doc/classes/CodeType.src/M000223.html +0 -24
- data/doc/classes/CodeType.src/M000224.html +0 -42
- data/doc/classes/ERCNode.html +0 -183
- data/doc/classes/ERCNode.src/M000254.html +0 -15
- data/doc/classes/ERCNode.src/M000255.html +0 -16
- data/doc/classes/ERCNode.src/M000256.html +0 -16
- data/doc/classes/ExecPopInstruction.html +0 -218
- data/doc/classes/ExecPopInstruction.src/M000075.html +0 -15
- data/doc/classes/ExecPopInstruction.src/M000076.html +0 -14
- data/doc/classes/ExecPopInstruction.src/M000077.html +0 -15
- data/doc/classes/ExecPopInstruction.src/M000078.html +0 -14
- data/doc/classes/FloatAbsInstruction.html +0 -218
- data/doc/classes/FloatAbsInstruction.src/M000107.html +0 -15
- data/doc/classes/FloatAbsInstruction.src/M000108.html +0 -15
- data/doc/classes/FloatAbsInstruction.src/M000109.html +0 -15
- data/doc/classes/FloatAbsInstruction.src/M000110.html +0 -15
- data/doc/classes/FloatAddInstruction.html +0 -218
- data/doc/classes/FloatAddInstruction.src/M000079.html +0 -15
- data/doc/classes/FloatAddInstruction.src/M000080.html +0 -16
- data/doc/classes/FloatAddInstruction.src/M000081.html +0 -15
- data/doc/classes/FloatAddInstruction.src/M000082.html +0 -15
- data/doc/classes/FloatCosineInstruction.html +0 -218
- data/doc/classes/FloatCosineInstruction.src/M000123.html +0 -15
- data/doc/classes/FloatCosineInstruction.src/M000124.html +0 -15
- data/doc/classes/FloatCosineInstruction.src/M000125.html +0 -15
- data/doc/classes/FloatCosineInstruction.src/M000126.html +0 -15
- data/doc/classes/FloatDivideInstruction.html +0 -218
- data/doc/classes/FloatDivideInstruction.src/M000091.html +0 -15
- data/doc/classes/FloatDivideInstruction.src/M000092.html +0 -16
- data/doc/classes/FloatDivideInstruction.src/M000093.html +0 -20
- data/doc/classes/FloatDivideInstruction.src/M000094.html +0 -15
- data/doc/classes/FloatFromBoolInstruction.html +0 -218
- data/doc/classes/FloatFromBoolInstruction.src/M000055.html +0 -15
- data/doc/classes/FloatFromBoolInstruction.src/M000056.html +0 -15
- data/doc/classes/FloatFromBoolInstruction.src/M000057.html +0 -15
- data/doc/classes/FloatFromBoolInstruction.src/M000058.html +0 -15
- data/doc/classes/FloatFromIntInstruction.html +0 -218
- data/doc/classes/FloatFromIntInstruction.src/M000063.html +0 -15
- data/doc/classes/FloatFromIntInstruction.src/M000064.html +0 -15
- data/doc/classes/FloatFromIntInstruction.src/M000065.html +0 -15
- data/doc/classes/FloatFromIntInstruction.src/M000066.html +0 -15
- data/doc/classes/FloatGreaterThanQInstruction.html +0 -218
- data/doc/classes/FloatGreaterThanQInstruction.src/M000035.html +0 -15
- data/doc/classes/FloatGreaterThanQInstruction.src/M000036.html +0 -16
- data/doc/classes/FloatGreaterThanQInstruction.src/M000037.html +0 -15
- data/doc/classes/FloatGreaterThanQInstruction.src/M000038.html +0 -15
- data/doc/classes/FloatIfInstruction.html +0 -218
- data/doc/classes/FloatIfInstruction.src/M000047.html +0 -16
- data/doc/classes/FloatIfInstruction.src/M000048.html +0 -15
- data/doc/classes/FloatIfInstruction.src/M000049.html +0 -14
- data/doc/classes/FloatIfInstruction.src/M000050.html +0 -17
- data/doc/classes/FloatLessThanQInstruction.html +0 -218
- data/doc/classes/FloatLessThanQInstruction.src/M000039.html +0 -15
- data/doc/classes/FloatLessThanQInstruction.src/M000040.html +0 -16
- data/doc/classes/FloatLessThanQInstruction.src/M000041.html +0 -15
- data/doc/classes/FloatLessThanQInstruction.src/M000042.html +0 -15
- data/doc/classes/FloatMaxInstruction.html +0 -218
- data/doc/classes/FloatMaxInstruction.src/M000095.html +0 -15
- data/doc/classes/FloatMaxInstruction.src/M000096.html +0 -16
- data/doc/classes/FloatMaxInstruction.src/M000097.html +0 -15
- data/doc/classes/FloatMaxInstruction.src/M000098.html +0 -15
- data/doc/classes/FloatMinInstruction.html +0 -218
- data/doc/classes/FloatMinInstruction.src/M000099.html +0 -15
- data/doc/classes/FloatMinInstruction.src/M000100.html +0 -16
- data/doc/classes/FloatMinInstruction.src/M000101.html +0 -15
- data/doc/classes/FloatMinInstruction.src/M000102.html +0 -15
- data/doc/classes/FloatMultiplyInstruction.html +0 -218
- data/doc/classes/FloatMultiplyInstruction.src/M000083.html +0 -15
- data/doc/classes/FloatMultiplyInstruction.src/M000084.html +0 -16
- data/doc/classes/FloatMultiplyInstruction.src/M000085.html +0 -15
- data/doc/classes/FloatMultiplyInstruction.src/M000086.html +0 -15
- data/doc/classes/FloatNegativeInstruction.html +0 -218
- data/doc/classes/FloatNegativeInstruction.src/M000103.html +0 -15
- data/doc/classes/FloatNegativeInstruction.src/M000104.html +0 -15
- data/doc/classes/FloatNegativeInstruction.src/M000105.html +0 -15
- data/doc/classes/FloatNegativeInstruction.src/M000106.html +0 -15
- data/doc/classes/FloatPowerInstruction.html +0 -218
- data/doc/classes/FloatPowerInstruction.src/M000111.html +0 -15
- data/doc/classes/FloatPowerInstruction.src/M000112.html +0 -16
- data/doc/classes/FloatPowerInstruction.src/M000113.html +0 -20
- data/doc/classes/FloatPowerInstruction.src/M000114.html +0 -15
- data/doc/classes/FloatRandomInstruction.html +0 -218
- data/doc/classes/FloatRandomInstruction.src/M000191.html +0 -15
- data/doc/classes/FloatRandomInstruction.src/M000192.html +0 -14
- data/doc/classes/FloatRandomInstruction.src/M000193.html +0 -15
- data/doc/classes/FloatRandomInstruction.src/M000194.html +0 -15
- data/doc/classes/FloatSineInstruction.html +0 -218
- data/doc/classes/FloatSineInstruction.src/M000119.html +0 -15
- data/doc/classes/FloatSineInstruction.src/M000120.html +0 -15
- data/doc/classes/FloatSineInstruction.src/M000121.html +0 -15
- data/doc/classes/FloatSineInstruction.src/M000122.html +0 -15
- data/doc/classes/FloatSqrtInstruction.html +0 -218
- data/doc/classes/FloatSqrtInstruction.src/M000115.html +0 -15
- data/doc/classes/FloatSqrtInstruction.src/M000116.html +0 -15
- data/doc/classes/FloatSqrtInstruction.src/M000117.html +0 -19
- data/doc/classes/FloatSqrtInstruction.src/M000118.html +0 -15
- data/doc/classes/FloatSubtractInstruction.html +0 -218
- data/doc/classes/FloatSubtractInstruction.src/M000087.html +0 -15
- data/doc/classes/FloatSubtractInstruction.src/M000088.html +0 -16
- data/doc/classes/FloatSubtractInstruction.src/M000089.html +0 -15
- data/doc/classes/FloatSubtractInstruction.src/M000090.html +0 -15
- data/doc/classes/FloatTangentInstruction.html +0 -218
- data/doc/classes/FloatTangentInstruction.src/M000127.html +0 -15
- data/doc/classes/FloatTangentInstruction.src/M000128.html +0 -15
- data/doc/classes/FloatTangentInstruction.src/M000129.html +0 -15
- data/doc/classes/FloatTangentInstruction.src/M000130.html +0 -15
- data/doc/classes/FloatType.html +0 -196
- data/doc/classes/FloatType.src/M000243.html +0 -19
- data/doc/classes/FloatType.src/M000244.html +0 -15
- data/doc/classes/FloatType.src/M000245.html +0 -15
- data/doc/classes/Helpers.html +0 -161
- data/doc/classes/Helpers.src/M000343.html +0 -21
- data/doc/classes/Helpers.src/M000344.html +0 -24
- data/doc/classes/Instruction/InstructionMethodError.html +0 -110
- data/doc/classes/Instruction/NaNResultError.html +0 -110
- data/doc/classes/Instruction/NotEnoughStackItems.html +0 -110
- data/doc/classes/Instruction.html +0 -500
- data/doc/classes/Instruction.src/M000131.html +0 -17
- data/doc/classes/Instruction.src/M000132.html +0 -15
- data/doc/classes/Instruction.src/M000133.html +0 -15
- data/doc/classes/Instruction.src/M000134.html +0 -15
- data/doc/classes/Instruction.src/M000135.html +0 -15
- data/doc/classes/Instruction.src/M000136.html +0 -15
- data/doc/classes/Instruction.src/M000137.html +0 -15
- data/doc/classes/Instruction.src/M000138.html +0 -15
- data/doc/classes/Instruction.src/M000139.html +0 -22
- data/doc/classes/Instruction.src/M000140.html +0 -15
- data/doc/classes/Instruction.src/M000141.html +0 -25
- data/doc/classes/Instruction.src/M000142.html +0 -15
- data/doc/classes/Instruction.src/M000143.html +0 -15
- data/doc/classes/Instruction.src/M000144.html +0 -15
- data/doc/classes/Instruction.src/M000145.html +0 -15
- data/doc/classes/Instruction.src/M000146.html +0 -15
- data/doc/classes/InstructionNode.html +0 -161
- data/doc/classes/InstructionNode.src/M000247.html +0 -15
- data/doc/classes/InstructionNode.src/M000248.html +0 -16
- data/doc/classes/IntAbsInstruction.html +0 -218
- data/doc/classes/IntAbsInstruction.src/M000175.html +0 -15
- data/doc/classes/IntAbsInstruction.src/M000176.html +0 -15
- data/doc/classes/IntAbsInstruction.src/M000177.html +0 -15
- data/doc/classes/IntAbsInstruction.src/M000178.html +0 -15
- data/doc/classes/IntAddInstruction.html +0 -218
- data/doc/classes/IntAddInstruction.src/M000147.html +0 -15
- data/doc/classes/IntAddInstruction.src/M000148.html +0 -16
- data/doc/classes/IntAddInstruction.src/M000149.html +0 -15
- data/doc/classes/IntAddInstruction.src/M000150.html +0 -15
- data/doc/classes/IntDepthInstruction.html +0 -218
- data/doc/classes/IntDepthInstruction.src/M000211.html +0 -15
- data/doc/classes/IntDepthInstruction.src/M000212.html +0 -14
- data/doc/classes/IntDepthInstruction.src/M000213.html +0 -15
- data/doc/classes/IntDepthInstruction.src/M000214.html +0 -15
- data/doc/classes/IntDivideInstruction.html +0 -218
- data/doc/classes/IntDivideInstruction.src/M000155.html +0 -15
- data/doc/classes/IntDivideInstruction.src/M000156.html +0 -16
- data/doc/classes/IntDivideInstruction.src/M000157.html +0 -20
- data/doc/classes/IntDivideInstruction.src/M000158.html +0 -15
- data/doc/classes/IntDuplicateInstruction.html +0 -218
- data/doc/classes/IntDuplicateInstruction.src/M000203.html +0 -15
- data/doc/classes/IntDuplicateInstruction.src/M000204.html +0 -15
- data/doc/classes/IntDuplicateInstruction.src/M000205.html +0 -15
- data/doc/classes/IntDuplicateInstruction.src/M000206.html +0 -15
- data/doc/classes/IntEqualQInstruction.html +0 -218
- data/doc/classes/IntEqualQInstruction.src/M000023.html +0 -15
- data/doc/classes/IntEqualQInstruction.src/M000024.html +0 -16
- data/doc/classes/IntEqualQInstruction.src/M000025.html +0 -15
- data/doc/classes/IntEqualQInstruction.src/M000026.html +0 -15
- data/doc/classes/IntFlushInstruction.html +0 -218
- data/doc/classes/IntFlushInstruction.src/M000215.html +0 -15
- data/doc/classes/IntFlushInstruction.src/M000216.html +0 -14
- data/doc/classes/IntFlushInstruction.src/M000217.html +0 -14
- data/doc/classes/IntFlushInstruction.src/M000218.html +0 -15
- data/doc/classes/IntFromBoolInstruction.html +0 -218
- data/doc/classes/IntFromBoolInstruction.src/M000051.html +0 -15
- data/doc/classes/IntFromBoolInstruction.src/M000052.html +0 -15
- data/doc/classes/IntFromBoolInstruction.src/M000053.html +0 -15
- data/doc/classes/IntFromBoolInstruction.src/M000054.html +0 -15
- data/doc/classes/IntFromFloatInstruction.html +0 -218
- data/doc/classes/IntFromFloatInstruction.src/M000059.html +0 -15
- data/doc/classes/IntFromFloatInstruction.src/M000060.html +0 -15
- data/doc/classes/IntFromFloatInstruction.src/M000061.html +0 -15
- data/doc/classes/IntFromFloatInstruction.src/M000062.html +0 -15
- data/doc/classes/IntGreaterThanQInstruction.html +0 -218
- data/doc/classes/IntGreaterThanQInstruction.src/M000031.html +0 -15
- data/doc/classes/IntGreaterThanQInstruction.src/M000032.html +0 -16
- data/doc/classes/IntGreaterThanQInstruction.src/M000033.html +0 -15
- data/doc/classes/IntGreaterThanQInstruction.src/M000034.html +0 -15
- data/doc/classes/IntIfInstruction.html +0 -218
- data/doc/classes/IntIfInstruction.src/M000043.html +0 -16
- data/doc/classes/IntIfInstruction.src/M000044.html +0 -15
- data/doc/classes/IntIfInstruction.src/M000045.html +0 -14
- data/doc/classes/IntIfInstruction.src/M000046.html +0 -17
- data/doc/classes/IntLessThanQInstruction.html +0 -218
- data/doc/classes/IntLessThanQInstruction.src/M000027.html +0 -15
- data/doc/classes/IntLessThanQInstruction.src/M000028.html +0 -16
- data/doc/classes/IntLessThanQInstruction.src/M000029.html +0 -15
- data/doc/classes/IntLessThanQInstruction.src/M000030.html +0 -15
- data/doc/classes/IntMaxInstruction.html +0 -218
- data/doc/classes/IntMaxInstruction.src/M000167.html +0 -15
- data/doc/classes/IntMaxInstruction.src/M000168.html +0 -16
- data/doc/classes/IntMaxInstruction.src/M000169.html +0 -16
- data/doc/classes/IntMaxInstruction.src/M000170.html +0 -15
- data/doc/classes/IntMinInstruction.html +0 -218
- data/doc/classes/IntMinInstruction.src/M000171.html +0 -15
- data/doc/classes/IntMinInstruction.src/M000172.html +0 -16
- data/doc/classes/IntMinInstruction.src/M000173.html +0 -16
- data/doc/classes/IntMinInstruction.src/M000174.html +0 -15
- data/doc/classes/IntModuloInstruction.html +0 -218
- data/doc/classes/IntModuloInstruction.src/M000163.html +0 -15
- data/doc/classes/IntModuloInstruction.src/M000164.html +0 -16
- data/doc/classes/IntModuloInstruction.src/M000165.html +0 -20
- data/doc/classes/IntModuloInstruction.src/M000166.html +0 -15
- data/doc/classes/IntMultiplyInstruction.html +0 -218
- data/doc/classes/IntMultiplyInstruction.src/M000151.html +0 -15
- data/doc/classes/IntMultiplyInstruction.src/M000152.html +0 -16
- data/doc/classes/IntMultiplyInstruction.src/M000153.html +0 -15
- data/doc/classes/IntMultiplyInstruction.src/M000154.html +0 -15
- data/doc/classes/IntNegativeInstruction.html +0 -218
- data/doc/classes/IntNegativeInstruction.src/M000179.html +0 -15
- data/doc/classes/IntNegativeInstruction.src/M000180.html +0 -15
- data/doc/classes/IntNegativeInstruction.src/M000181.html +0 -15
- data/doc/classes/IntNegativeInstruction.src/M000182.html +0 -15
- data/doc/classes/IntPopInstruction.html +0 -218
- data/doc/classes/IntPopInstruction.src/M000195.html +0 -15
- data/doc/classes/IntPopInstruction.src/M000196.html +0 -15
- data/doc/classes/IntPopInstruction.src/M000197.html +0 -14
- data/doc/classes/IntPopInstruction.src/M000198.html +0 -14
- data/doc/classes/IntRandomInstruction.html +0 -218
- data/doc/classes/IntRandomInstruction.src/M000183.html +0 -15
- data/doc/classes/IntRandomInstruction.src/M000184.html +0 -14
- data/doc/classes/IntRandomInstruction.src/M000185.html +0 -15
- data/doc/classes/IntRandomInstruction.src/M000186.html +0 -15
- data/doc/classes/IntRotateInstruction.html +0 -218
- data/doc/classes/IntRotateInstruction.src/M000207.html +0 -15
- data/doc/classes/IntRotateInstruction.src/M000208.html +0 -17
- data/doc/classes/IntRotateInstruction.src/M000209.html +0 -14
- data/doc/classes/IntRotateInstruction.src/M000210.html +0 -17
- data/doc/classes/IntSubtractInstruction.html +0 -218
- data/doc/classes/IntSubtractInstruction.src/M000159.html +0 -15
- data/doc/classes/IntSubtractInstruction.src/M000160.html +0 -16
- data/doc/classes/IntSubtractInstruction.src/M000161.html +0 -16
- data/doc/classes/IntSubtractInstruction.src/M000162.html +0 -15
- data/doc/classes/IntSwapInstruction.html +0 -218
- data/doc/classes/IntSwapInstruction.src/M000199.html +0 -15
- data/doc/classes/IntSwapInstruction.src/M000200.html +0 -16
- data/doc/classes/IntSwapInstruction.src/M000201.html +0 -14
- data/doc/classes/IntSwapInstruction.src/M000202.html +0 -16
- data/doc/classes/IntType.html +0 -240
- data/doc/classes/IntType.src/M000235.html +0 -15
- data/doc/classes/IntType.src/M000236.html +0 -15
- data/doc/classes/IntType.src/M000237.html +0 -18
- data/doc/classes/IntType.src/M000238.html +0 -15
- data/doc/classes/IntType.src/M000239.html +0 -15
- data/doc/classes/LiteralNode.html +0 -183
- data/doc/classes/LiteralNode.src/M000251.html +0 -15
- data/doc/classes/LiteralNode.src/M000252.html +0 -16
- data/doc/classes/LiteralNode.src/M000253.html +0 -16
- data/doc/classes/Nudge/Channel.html +0 -437
- data/doc/classes/Nudge/Channel.src/M000286.html +0 -15
- data/doc/classes/Nudge/Channel.src/M000287.html +0 -19
- data/doc/classes/Nudge/Channel.src/M000288.html +0 -15
- data/doc/classes/Nudge/Channel.src/M000289.html +0 -15
- data/doc/classes/Nudge/Channel.src/M000290.html +0 -15
- data/doc/classes/Nudge/Channel.src/M000291.html +0 -19
- data/doc/classes/Nudge/Channel.src/M000292.html +0 -19
- data/doc/classes/Nudge/Channel.src/M000293.html +0 -17
- data/doc/classes/Nudge/Channel.src/M000294.html +0 -15
- data/doc/classes/Nudge/Channel.src/M000295.html +0 -20
- data/doc/classes/Nudge/Channel.src/M000296.html +0 -15
- data/doc/classes/Nudge/Channel.src/M000297.html +0 -17
- data/doc/classes/Nudge/Channel.src/M000298.html +0 -15
- data/doc/classes/Nudge/CodeBlock.html +0 -331
- data/doc/classes/Nudge/CodeBlock.src/M000263.html +0 -15
- data/doc/classes/Nudge/CodeBlock.src/M000264.html +0 -15
- data/doc/classes/Nudge/CodeBlock.src/M000265.html +0 -15
- data/doc/classes/Nudge/CodeBlock.src/M000266.html +0 -15
- data/doc/classes/Nudge/CodeBlock.src/M000267.html +0 -15
- data/doc/classes/Nudge/CodeBlock.src/M000268.html +0 -17
- data/doc/classes/Nudge/CodeBlock.src/M000269.html +0 -20
- data/doc/classes/Nudge/CodeBlock.src/M000270.html +0 -15
- data/doc/classes/Nudge/CodeBlock.src/M000271.html +0 -19
- data/doc/classes/Nudge/DeadLocation.html +0 -152
- data/doc/classes/Nudge/DeadLocation.src/M000334.html +0 -17
- data/doc/classes/Nudge/Erc.html +0 -335
- data/doc/classes/Nudge/Erc.src/M000278.html +0 -16
- data/doc/classes/Nudge/Erc.src/M000279.html +0 -15
- data/doc/classes/Nudge/Erc.src/M000280.html +0 -15
- data/doc/classes/Nudge/Erc.src/M000281.html +0 -15
- data/doc/classes/Nudge/Erc.src/M000282.html +0 -18
- data/doc/classes/Nudge/Erc.src/M000283.html +0 -15
- data/doc/classes/Nudge/Erc.src/M000284.html +0 -17
- data/doc/classes/Nudge/Erc.src/M000285.html +0 -15
- data/doc/classes/Nudge/Individual.html +0 -313
- data/doc/classes/Nudge/Individual.src/M000314.html +0 -21
- data/doc/classes/Nudge/Individual.src/M000315.html +0 -15
- data/doc/classes/Nudge/Individual.src/M000316.html +0 -15
- data/doc/classes/Nudge/Individual.src/M000317.html +0 -17
- data/doc/classes/Nudge/Individual.src/M000318.html +0 -25
- data/doc/classes/Nudge/InstructionPoint/InstructionNotFoundError.html +0 -110
- data/doc/classes/Nudge/InstructionPoint.html +0 -350
- data/doc/classes/Nudge/InstructionPoint.src/M000299.html +0 -15
- data/doc/classes/Nudge/InstructionPoint.src/M000300.html +0 -15
- data/doc/classes/Nudge/InstructionPoint.src/M000301.html +0 -17
- data/doc/classes/Nudge/InstructionPoint.src/M000302.html +0 -15
- data/doc/classes/Nudge/InstructionPoint.src/M000303.html +0 -17
- data/doc/classes/Nudge/InstructionPoint.src/M000304.html +0 -17
- data/doc/classes/Nudge/InstructionPoint.src/M000305.html +0 -17
- data/doc/classes/Nudge/InstructionPoint.src/M000306.html +0 -15
- data/doc/classes/Nudge/Interpreter.html +0 -369
- data/doc/classes/Nudge/Interpreter.src/M000257.html +0 -20
- data/doc/classes/Nudge/Interpreter.src/M000258.html +0 -19
- data/doc/classes/Nudge/Interpreter.src/M000259.html +0 -15
- data/doc/classes/Nudge/Interpreter.src/M000260.html +0 -19
- data/doc/classes/Nudge/Interpreter.src/M000261.html +0 -17
- data/doc/classes/Nudge/LiteralPoint.html +0 -291
- data/doc/classes/Nudge/LiteralPoint.src/M000272.html +0 -16
- data/doc/classes/Nudge/LiteralPoint.src/M000273.html +0 -15
- data/doc/classes/Nudge/LiteralPoint.src/M000274.html +0 -15
- data/doc/classes/Nudge/LiteralPoint.src/M000275.html +0 -18
- data/doc/classes/Nudge/LiteralPoint.src/M000276.html +0 -17
- data/doc/classes/Nudge/LiteralPoint.src/M000277.html +0 -15
- data/doc/classes/Nudge/Location.html +0 -525
- data/doc/classes/Nudge/Location.src/M000319.html +0 -19
- data/doc/classes/Nudge/Location.src/M000320.html +0 -15
- data/doc/classes/Nudge/Location.src/M000321.html +0 -26
- data/doc/classes/Nudge/Location.src/M000322.html +0 -15
- data/doc/classes/Nudge/Location.src/M000323.html +0 -20
- data/doc/classes/Nudge/Location.src/M000324.html +0 -16
- data/doc/classes/Nudge/Location.src/M000325.html +0 -25
- data/doc/classes/Nudge/Location.src/M000326.html +0 -15
- data/doc/classes/Nudge/Location.src/M000327.html +0 -21
- data/doc/classes/Nudge/Location.src/M000328.html +0 -16
- data/doc/classes/Nudge/Location.src/M000329.html +0 -15
- data/doc/classes/Nudge/Location.src/M000330.html +0 -16
- data/doc/classes/Nudge/Location.src/M000331.html +0 -20
- data/doc/classes/Nudge/Location.src/M000332.html +0 -17
- data/doc/classes/Nudge/Location.src/M000333.html +0 -17
- data/doc/classes/Nudge/NondominatedSubset.html +0 -196
- data/doc/classes/Nudge/NondominatedSubset.src/M000005.html +0 -19
- data/doc/classes/Nudge/NondominatedSubset.src/M000006.html +0 -19
- data/doc/classes/Nudge/NondominatedSubset.src/M000007.html +0 -25
- data/doc/classes/Nudge/NondominatedSubset.src/M000339.html +0 -19
- data/doc/classes/Nudge/NondominatedSubset.src/M000340.html +0 -19
- data/doc/classes/Nudge/NondominatedSubset.src/M000341.html +0 -25
- data/doc/classes/Nudge/PopulationResample.html +0 -175
- data/doc/classes/Nudge/PopulationResample.src/M000003.html +0 -22
- data/doc/classes/Nudge/PopulationResample.src/M000337.html +0 -22
- data/doc/classes/Nudge/ProgramPoint.html +0 -148
- data/doc/classes/Nudge/ProgramPoint.src/M000262.html +0 -15
- data/doc/classes/Nudge/RandomGuess.html +0 -176
- data/doc/classes/Nudge/RandomGuess.src/M000002.html +0 -21
- data/doc/classes/Nudge/RandomGuess.src/M000336.html +0 -21
- data/doc/classes/Nudge/ResampleValues.html +0 -169
- data/doc/classes/Nudge/ResampleValues.src/M000004.html +0 -36
- data/doc/classes/Nudge/ResampleValues.src/M000338.html +0 -36
- data/doc/classes/Nudge/SearchOperator.html +0 -175
- data/doc/classes/Nudge/SearchOperator.src/M000001.html +0 -15
- data/doc/classes/Nudge/SearchOperator.src/M000335.html +0 -15
- data/doc/classes/Nudge/Stack.html +0 -350
- data/doc/classes/Nudge/Stack.src/M000307.html +0 -15
- data/doc/classes/Nudge/Stack.src/M000308.html +0 -15
- data/doc/classes/Nudge/Stack.src/M000309.html +0 -18
- data/doc/classes/Nudge/Stack.src/M000310.html +0 -15
- data/doc/classes/Nudge/Stack.src/M000311.html +0 -15
- data/doc/classes/Nudge/Stack.src/M000312.html +0 -15
- data/doc/classes/Nudge/Stack.src/M000313.html +0 -15
- data/doc/classes/Nudge/UniformBackboneCrossover.html +0 -152
- data/doc/classes/Nudge/UniformBackboneCrossover.src/M000008.html +0 -35
- data/doc/classes/Nudge/UniformBackboneCrossover.src/M000342.html +0 -35
- data/doc/classes/Nudge.html +0 -174
- data/doc/classes/NudgeType.html +0 -363
- data/doc/classes/NudgeType.src/M000225.html +0 -17
- data/doc/classes/NudgeType.src/M000226.html +0 -15
- data/doc/classes/NudgeType.src/M000227.html +0 -15
- data/doc/classes/NudgeType.src/M000228.html +0 -15
- data/doc/classes/NudgeType.src/M000229.html +0 -15
- data/doc/classes/NudgeType.src/M000230.html +0 -15
- data/doc/classes/NudgeType.src/M000231.html +0 -15
- data/doc/classes/NudgeType.src/M000232.html +0 -15
- data/doc/classes/NudgeType.src/M000233.html +0 -15
- data/doc/classes/NudgeType.src/M000234.html +0 -15
- data/doc/created.rid +0 -1
- data/doc/files/lib/instructions/bool_basics_rb.html +0 -90
- data/doc/files/lib/instructions/comparisons_rb.html +0 -90
- data/doc/files/lib/instructions/conditionals_rb.html +0 -90
- data/doc/files/lib/instructions/conversions_rb.html +0 -90
- data/doc/files/lib/instructions/exec_rb.html +0 -90
- data/doc/files/lib/instructions/float_arithmetic_rb.html +0 -90
- data/doc/files/lib/instructions/float_transcendental_rb.html +0 -90
- data/doc/files/lib/instructions/infrastructure_rb.html +0 -100
- data/doc/files/lib/instructions/int_arithmetic_rb.html +0 -90
- data/doc/files/lib/instructions/random_value_rb.html +0 -90
- data/doc/files/lib/instructions/stack_manipulation_rb.html +0 -90
- data/doc/files/lib/interpreter/grammars/nudge_language_helpers_rb.html +0 -97
- data/doc/files/lib/interpreter/grammars/nudge_language_treetop.html +0 -180
- data/doc/files/lib/interpreter/interpreter_rb.html +0 -90
- data/doc/files/lib/interpreter/programPoints_rb.html +0 -90
- data/doc/files/lib/interpreter/stack_rb.html +0 -90
- data/doc/files/lib/interpreter/types/codeType_rb.html +0 -157
- data/doc/files/lib/interpreter/types/codeType_rb.src/M000001.html +0 -15
- data/doc/files/lib/interpreter/types/codeType_rb.src/M000002.html +0 -15
- data/doc/files/lib/interpreter/types/pushTypes_rb.html +0 -107
- data/doc/files/lib/nudge_rb.html +0 -152
- data/doc/files/lib/search/evaluators/structural_complexity_rb.html +0 -90
- data/doc/files/lib/search/helpers_rb.html +0 -90
- data/doc/files/lib/search/individual/individual_rb.html +0 -90
- data/doc/files/lib/search/locations/location_rb.html +0 -100
- data/doc/files/lib/search/operators/basic_operators_rb.html +0 -90
- data/doc/fr_class_index.html +0 -191
- data/doc/fr_file_index.html +0 -71
- data/doc/fr_method_index.html +0 -711
- data/doc/index.html +0 -21
- data/doc/rdoc-style.css +0 -299
- data/features/parser_recognizes_nudge_language.feature +0 -9
- data/lib/instructions/bool_basics.rb +0 -85
- data/lib/instructions/comparisons.rb +0 -152
- data/lib/instructions/conditionals.rb +0 -44
- data/lib/instructions/conversions.rb +0 -94
- data/lib/instructions/exec.rb +0 -154
- data/lib/instructions/float_arithmetic.rb +0 -201
- data/lib/instructions/float_transcendental.rb +0 -47
- data/lib/instructions/int_arithmetic.rb +0 -160
- data/lib/instructions/name_basics.rb +0 -44
- data/lib/instructions/name_bindings.rb +0 -65
- data/lib/instructions/random_value.rb +0 -43
- data/lib/instructions/stack_manipulation.rb +0 -739
- data/lib/interpreter/grammars/nudge_language.treetop +0 -83
- data/lib/interpreter/grammars/nudge_language_helpers.rb +0 -64
- data/lib/search/experiments/experiment.rb +0 -53
- data/lib/search/helpers.rb +0 -22
- data/lib/search/individual/batch.rb +0 -25
- data/lib/search/individual/individual.rb +0 -145
- data/lib/search/operators/basic_operators.rb +0 -230
- data/lib/search/operators/evaluators.rb +0 -107
- data/lib/search/operators/samplers_and_selectors.rb +0 -123
- data/lib/search/stations/station.rb +0 -147
- data/nudge.gemspec +0 -706
- data/push_language_coverage.md +0 -177
- data/script/console +0 -10
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/spec/data/couchdb_spec.rb +0 -2
- data/spec/instructions/bool_basics_spec.rb +0 -97
- data/spec/instructions/bool_stack_spec.rb +0 -391
- data/spec/instructions/code_basics_spec.rb +0 -43
- data/spec/instructions/code_stack_spec.rb +0 -382
- data/spec/instructions/comparisons_spec.rb +0 -486
- data/spec/instructions/conditionals_spec.rb +0 -162
- data/spec/instructions/conversions_spec.rb +0 -92
- data/spec/instructions/exec_spec.rb +0 -883
- data/spec/instructions/float_calculations_spec.rb +0 -148
- data/spec/instructions/float_stack_spec.rb +0 -382
- data/spec/instructions/float_transcendental_spec.rb +0 -89
- data/spec/instructions/int_calculations_spec.rb +0 -125
- data/spec/instructions/int_stack_spec.rb +0 -398
- data/spec/instructions/name_basics_spec.rb +0 -158
- data/spec/instructions/name_bindings_spec.rb +0 -257
- data/spec/instructions/name_stack_spec.rb +0 -382
- data/spec/instructions/random_values_spec.rb +0 -68
- data/spec/integration/search_integration.rb +0 -67
- data/spec/interpreter/channel_spec.rb +0 -92
- data/spec/interpreter/codeblock_spec.rb +0 -135
- data/spec/interpreter/erc_spec.rb +0 -130
- data/spec/interpreter/literal_spec.rb +0 -94
- data/spec/interpreter/parser_spec.rb +0 -324
- data/spec/search/batch_spec.rb +0 -30
- data/spec/search/experiments/experiment_spec.rb +0 -101
- data/spec/search/helpers_spec.rb +0 -59
- data/spec/search/individual_spec.rb +0 -356
- data/spec/search/operators/any_one_sampler_spec.rb +0 -40
- data/spec/search/operators/dominated_quantile_spec.rb +0 -111
- data/spec/search/operators/duplicate_genomes_spec.rb +0 -35
- data/spec/search/operators/evaluators/program_point_evaluator_spec.rb +0 -43
- data/spec/search/operators/evaluators/test_case_evaluator_spec.rb +0 -133
- data/spec/search/operators/infrastructure_spec.rb +0 -47
- data/spec/search/operators/most_dominated_subset_spec.rb +0 -47
- data/spec/search/operators/nondominated_subset_spec.rb +0 -97
- data/spec/search/operators/pointCrossover_spec.rb +0 -55
- data/spec/search/operators/pointDeletion_spec.rb +0 -57
- data/spec/search/operators/pointMutation_spec.rb +0 -71
- data/spec/search/operators/random_guess_spec.rb +0 -51
- data/spec/search/operators/resample_and_clone_spec.rb +0 -50
- data/spec/search/operators/resample_values_spec.rb +0 -126
- data/spec/search/operators/sizePreservingMutation_spec.rb +0 -2
- data/spec/search/operators/uniformBackboneCrossover_spec.rb +0 -63
- data/spec/search/stations/station_spec.rb +0 -496
- data/test/test_generator_helper.rb +0 -29
- data/test/test_nudge_generator.rb +0 -43
- /data/lib/instructions/{code_basics.rb → code/code_noop.rb} +0 -0
- /data/{_spikes/nested_parsing/nested.rb → spec/support/shared_examples.rb} +0 -0
@@ -1,1325 +0,0 @@
|
|
1
|
-
/* http://keith-wood.name/svg.html
|
2
|
-
SVG for jQuery v1.4.2.
|
3
|
-
Written by Keith Wood (kbwood{at}iinet.com.au) August 2007.
|
4
|
-
Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and
|
5
|
-
MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses.
|
6
|
-
Please attribute the author if you use it. */
|
7
|
-
|
8
|
-
(function($) { // Hide scope, no $ conflict
|
9
|
-
|
10
|
-
/* SVG manager.
|
11
|
-
Use the singleton instance of this class, $.svg,
|
12
|
-
to interact with the SVG functionality. */
|
13
|
-
function SVGManager() {
|
14
|
-
this._settings = []; // Settings to be remembered per SVG object
|
15
|
-
this._extensions = []; // List of SVG extensions added to SVGWrapper
|
16
|
-
// for each entry [0] is extension name, [1] is extension class (function)
|
17
|
-
// the function takes one parameter - the SVGWrapper instance
|
18
|
-
this.regional = []; // Localisations, indexed by language, '' for default (English)
|
19
|
-
this.regional[''] = {errorLoadingText: 'Error loading',
|
20
|
-
notSupportedText: 'This browser does not support SVG'};
|
21
|
-
this.local = this.regional['']; // Current localisation
|
22
|
-
this._uuid = new Date().getTime();
|
23
|
-
this._renesis = detectActiveX('RenesisX.RenesisCtrl');
|
24
|
-
}
|
25
|
-
|
26
|
-
/* Determine whether a given ActiveX control is available.
|
27
|
-
@param classId (string) the ID for the ActiveX control
|
28
|
-
@return (boolean) true if found, false if not */
|
29
|
-
function detectActiveX(classId) {
|
30
|
-
try {
|
31
|
-
return !!(window.ActiveXObject && new ActiveXObject(classId));
|
32
|
-
}
|
33
|
-
catch (e) {
|
34
|
-
return false;
|
35
|
-
}
|
36
|
-
}
|
37
|
-
|
38
|
-
var PROP_NAME = 'svgwrapper';
|
39
|
-
|
40
|
-
$.extend(SVGManager.prototype, {
|
41
|
-
/* Class name added to elements to indicate already configured with SVG. */
|
42
|
-
markerClassName: 'hasSVG',
|
43
|
-
|
44
|
-
/* SVG namespace. */
|
45
|
-
svgNS: 'http://www.w3.org/2000/svg',
|
46
|
-
/* XLink namespace. */
|
47
|
-
xlinkNS: 'http://www.w3.org/1999/xlink',
|
48
|
-
|
49
|
-
/* SVG wrapper class. */
|
50
|
-
_wrapperClass: SVGWrapper,
|
51
|
-
|
52
|
-
/* Camel-case versions of attribute names containing dashes or are reserved words. */
|
53
|
-
_attrNames: {class_: 'class', in_: 'in',
|
54
|
-
alignmentBaseline: 'alignment-baseline', baselineShift: 'baseline-shift',
|
55
|
-
clipPath: 'clip-path', clipRule: 'clip-rule',
|
56
|
-
colorInterpolation: 'color-interpolation',
|
57
|
-
colorInterpolationFilters: 'color-interpolation-filters',
|
58
|
-
colorRendering: 'color-rendering', dominantBaseline: 'dominant-baseline',
|
59
|
-
enableBackground: 'enable-background', fillOpacity: 'fill-opacity',
|
60
|
-
fillRule: 'fill-rule', floodColor: 'flood-color',
|
61
|
-
floodOpacity: 'flood-opacity', fontFamily: 'font-family',
|
62
|
-
fontSize: 'font-size', fontSizeAdjust: 'font-size-adjust',
|
63
|
-
fontStretch: 'font-stretch', fontStyle: 'font-style',
|
64
|
-
fontVariant: 'font-variant', fontWeight: 'font-weight',
|
65
|
-
glyphOrientationHorizontal: 'glyph-orientation-horizontal',
|
66
|
-
glyphOrientationVertical: 'glyph-orientation-vertical',
|
67
|
-
horizAdvX: 'horiz-adv-x', horizOriginX: 'horiz-origin-x',
|
68
|
-
imageRendering: 'image-rendering', letterSpacing: 'letter-spacing',
|
69
|
-
lightingColor: 'lighting-color', markerEnd: 'marker-end',
|
70
|
-
markerMid: 'marker-mid', markerStart: 'marker-start',
|
71
|
-
stopColor: 'stop-color', stopOpacity: 'stop-opacity',
|
72
|
-
strikethroughPosition: 'strikethrough-position',
|
73
|
-
strikethroughThickness: 'strikethrough-thickness',
|
74
|
-
strokeDashArray: 'stroke-dasharray', strokeDashOffset: 'stroke-dashoffset',
|
75
|
-
strokeLineCap: 'stroke-linecap', strokeLineJoin: 'stroke-linejoin',
|
76
|
-
strokeMiterLimit: 'stroke-miterlimit', strokeOpacity: 'stroke-opacity',
|
77
|
-
strokeWidth: 'stroke-width', textAnchor: 'text-anchor',
|
78
|
-
textDecoration: 'text-decoration', textRendering: 'text-rendering',
|
79
|
-
underlinePosition: 'underline-position', underlineThickness: 'underline-thickness',
|
80
|
-
vertAdvY: 'vert-adv-y', vertOriginY: 'vert-origin-y',
|
81
|
-
wordSpacing: 'word-spacing', writingMode: 'writing-mode'},
|
82
|
-
|
83
|
-
/* Add the SVG object to its container. */
|
84
|
-
_attachSVG: function(container, settings) {
|
85
|
-
if ($(container).hasClass(this.markerClassName)) {
|
86
|
-
return;
|
87
|
-
}
|
88
|
-
if (typeof settings == 'string') {
|
89
|
-
settings = {loadURL: settings};
|
90
|
-
}
|
91
|
-
else if (typeof settings == 'function') {
|
92
|
-
settings = {onLoad: settings};
|
93
|
-
}
|
94
|
-
$(container).addClass(this.markerClassName);
|
95
|
-
try {
|
96
|
-
var svg = document.createElementNS(this.svgNS, 'svg');
|
97
|
-
svg.setAttribute('version', '1.1');
|
98
|
-
svg.setAttribute('width', container.clientWidth);
|
99
|
-
svg.setAttribute('height', container.clientHeight);
|
100
|
-
container.appendChild(svg);
|
101
|
-
this._afterLoad(container, svg, settings);
|
102
|
-
}
|
103
|
-
catch (e) {
|
104
|
-
if ($.browser.msie) {
|
105
|
-
if (!container.id) {
|
106
|
-
container.id = 'svg' + (this._uuid++);
|
107
|
-
}
|
108
|
-
this._settings[container.id] = settings;
|
109
|
-
container.innerHTML = '<embed type="image/svg+xml" width="100%" ' +
|
110
|
-
'height="100%" src="' + (settings.initPath || '') + 'blank.svg"/>';
|
111
|
-
}
|
112
|
-
else {
|
113
|
-
container.innerHTML = '<p class="svg_error">' +
|
114
|
-
this.local.notSupportedText + '</p>';
|
115
|
-
}
|
116
|
-
}
|
117
|
-
},
|
118
|
-
|
119
|
-
/* SVG callback after loading - register SVG root. */
|
120
|
-
_registerSVG: function() {
|
121
|
-
for (var i = 0; i < document.embeds.length; i++) { // Check all
|
122
|
-
var container = document.embeds[i].parentNode;
|
123
|
-
if (!$(container).hasClass($.svg.markerClassName) || // Not SVG
|
124
|
-
$.data(container, PROP_NAME)) { // Already done
|
125
|
-
continue;
|
126
|
-
}
|
127
|
-
var svg = null;
|
128
|
-
try {
|
129
|
-
svg = document.embeds[i].getSVGDocument();
|
130
|
-
}
|
131
|
-
catch(e) {
|
132
|
-
setTimeout($.svg._registerSVG, 250); // Renesis takes longer to load
|
133
|
-
return;
|
134
|
-
}
|
135
|
-
svg = (svg ? svg.documentElement : null);
|
136
|
-
if (svg) {
|
137
|
-
$.svg._afterLoad(container, svg);
|
138
|
-
}
|
139
|
-
}
|
140
|
-
},
|
141
|
-
|
142
|
-
/* Post-processing once loaded. */
|
143
|
-
_afterLoad: function(container, svg, settings) {
|
144
|
-
var settings = settings || this._settings[container.id];
|
145
|
-
this._settings[container.id] = null;
|
146
|
-
var wrapper = new this._wrapperClass(svg, container);
|
147
|
-
$.data(container, PROP_NAME, wrapper);
|
148
|
-
try {
|
149
|
-
if (settings.loadURL) { // Load URL
|
150
|
-
wrapper.load(settings.loadURL, settings);
|
151
|
-
}
|
152
|
-
if (settings.settings) { // Additional settings
|
153
|
-
wrapper.configure(settings.settings);
|
154
|
-
}
|
155
|
-
if (settings.onLoad && !settings.loadURL) { // Onload callback
|
156
|
-
settings.onLoad.apply(container, [wrapper]);
|
157
|
-
}
|
158
|
-
}
|
159
|
-
catch (e) {
|
160
|
-
alert(e);
|
161
|
-
}
|
162
|
-
},
|
163
|
-
|
164
|
-
/* Return the SVG wrapper created for a given container.
|
165
|
-
@param container (string) selector for the container or
|
166
|
-
(element) the container for the SVG object or
|
167
|
-
jQuery collection - first entry is the container
|
168
|
-
@return (SVGWrapper) the corresponding SVG wrapper element, or null if not attached */
|
169
|
-
_getSVG: function(container) {
|
170
|
-
container = (typeof container == 'string' ? $(container)[0] :
|
171
|
-
(container.jquery ? container[0] : container));
|
172
|
-
return $.data(container, PROP_NAME);
|
173
|
-
},
|
174
|
-
|
175
|
-
/* Remove the SVG functionality from a div.
|
176
|
-
@param container (element) the container for the SVG object */
|
177
|
-
_destroySVG: function(container) {
|
178
|
-
var $container = $(container);
|
179
|
-
if (!$container.hasClass(this.markerClassName)) {
|
180
|
-
return;
|
181
|
-
}
|
182
|
-
$container.removeClass(this.markerClassName).empty();
|
183
|
-
$.removeData(container, PROP_NAME);
|
184
|
-
},
|
185
|
-
|
186
|
-
/* Extend the SVGWrapper object with an embedded class.
|
187
|
-
The constructor function must take a single parameter that is
|
188
|
-
a reference to the owning SVG root object. This allows the
|
189
|
-
extension to access the basic SVG functionality.
|
190
|
-
@param name (string) the name of the SVGWrapper attribute to access the new class
|
191
|
-
@param extClass (function) the extension class constructor */
|
192
|
-
addExtension: function(name, extClass) {
|
193
|
-
this._extensions.push([name, extClass]);
|
194
|
-
}
|
195
|
-
});
|
196
|
-
|
197
|
-
/* The main SVG interface, which encapsulates the SVG element.
|
198
|
-
Obtain a reference from $().svg('get') */
|
199
|
-
function SVGWrapper(svg, container) {
|
200
|
-
this._svg = svg; // The SVG root node
|
201
|
-
this._container = container; // The containing div
|
202
|
-
for (var i = 0; i < $.svg._extensions.length; i++) {
|
203
|
-
var extension = $.svg._extensions[i];
|
204
|
-
this[extension[0]] = new extension[1](this);
|
205
|
-
}
|
206
|
-
}
|
207
|
-
|
208
|
-
$.extend(SVGWrapper.prototype, {
|
209
|
-
|
210
|
-
/* Retrieve the width of the SVG object. */
|
211
|
-
_width: function() {
|
212
|
-
return this._container.clientWidth;
|
213
|
-
},
|
214
|
-
|
215
|
-
/* Retrieve the height of the SVG object. */
|
216
|
-
_height: function() {
|
217
|
-
return this._container.clientHeight;
|
218
|
-
},
|
219
|
-
|
220
|
-
/* Retrieve the root SVG element.
|
221
|
-
@return the top-level SVG element */
|
222
|
-
root: function() {
|
223
|
-
return this._svg;
|
224
|
-
},
|
225
|
-
|
226
|
-
/* Configure the SVG root.
|
227
|
-
@param settings (object) additional settings for the root
|
228
|
-
@param clear (boolean) true to remove existing attributes first,
|
229
|
-
false to add to what is already there (optional)
|
230
|
-
@return (SVGWrapper) this root */
|
231
|
-
configure: function(settings, clear) {
|
232
|
-
if (clear) {
|
233
|
-
for (var i = this._svg.attributes.length - 1; i >= 0; i--) {
|
234
|
-
var attr = this._svg.attributes.item(i);
|
235
|
-
if (!(attr.nodeName == 'onload' || attr.nodeName == 'version' ||
|
236
|
-
attr.nodeName.substring(0, 5) == 'xmlns')) {
|
237
|
-
this._svg.attributes.removeNamedItem(attr.nodeName);
|
238
|
-
}
|
239
|
-
}
|
240
|
-
}
|
241
|
-
for (var attrName in settings) {
|
242
|
-
this._svg.setAttribute(attrName, settings[attrName]);
|
243
|
-
}
|
244
|
-
return this;
|
245
|
-
},
|
246
|
-
|
247
|
-
/* Locate a specific element in the SVG document.
|
248
|
-
@param id (string) the element's identifier
|
249
|
-
@return (element) the element reference, or null if not found */
|
250
|
-
getElementById: function(id) {
|
251
|
-
return this._svg.ownerDocument.getElementById(id);
|
252
|
-
},
|
253
|
-
|
254
|
-
/* Change the attributes for a SVG node.
|
255
|
-
@param element (SVG element) the node to change
|
256
|
-
@param settings (object) the new settings
|
257
|
-
@return (SVGWrapper) this root */
|
258
|
-
change: function(element, settings) {
|
259
|
-
if (element) {
|
260
|
-
for (var name in settings) {
|
261
|
-
if (settings[name] == null) {
|
262
|
-
element.removeAttribute(name);
|
263
|
-
}
|
264
|
-
else {
|
265
|
-
element.setAttribute(name, settings[name]);
|
266
|
-
}
|
267
|
-
}
|
268
|
-
}
|
269
|
-
return this;
|
270
|
-
},
|
271
|
-
|
272
|
-
/* Check for parent being absent and adjust arguments accordingly. */
|
273
|
-
_args: function(values, names, optSettings) {
|
274
|
-
names.splice(0, 0, 'parent');
|
275
|
-
names.splice(names.length, 0, 'settings');
|
276
|
-
var args = {};
|
277
|
-
var offset = 0;
|
278
|
-
if (values[0] != null && (typeof values[0] != 'object' || !values[0].nodeName)) {
|
279
|
-
args['parent'] = null;
|
280
|
-
offset = 1;
|
281
|
-
}
|
282
|
-
for (var i = 0; i < values.length; i++) {
|
283
|
-
args[names[i + offset]] = values[i];
|
284
|
-
}
|
285
|
-
if (optSettings) {
|
286
|
-
$.each(optSettings, function(i, value) {
|
287
|
-
if (typeof args[value] == 'object') {
|
288
|
-
args.settings = args[value];
|
289
|
-
args[value] = null;
|
290
|
-
}
|
291
|
-
});
|
292
|
-
}
|
293
|
-
return args;
|
294
|
-
},
|
295
|
-
|
296
|
-
/* Add a title.
|
297
|
-
@param parent (element) the parent node for the new title (optional)
|
298
|
-
@param text (string) the text of the title
|
299
|
-
@param settings (object) additional settings for the title (optional)
|
300
|
-
@return (element) the new title node */
|
301
|
-
title: function(parent, text, settings) {
|
302
|
-
var args = this._args(arguments, ['text']);
|
303
|
-
var node = this._makeNode(args.parent, 'title', args.settings || {});
|
304
|
-
node.appendChild(this._svg.ownerDocument.createTextNode(args.text));
|
305
|
-
return node;
|
306
|
-
},
|
307
|
-
|
308
|
-
/* Add a description.
|
309
|
-
@param parent (element) the parent node for the new description (optional)
|
310
|
-
@param text (string) the text of the description
|
311
|
-
@param settings (object) additional settings for the description (optional)
|
312
|
-
@return (element) the new description node */
|
313
|
-
describe: function(parent, text, settings) {
|
314
|
-
var args = this._args(arguments, ['text']);
|
315
|
-
var node = this._makeNode(args.parent, 'desc', args.settings || {});
|
316
|
-
node.appendChild(this._svg.ownerDocument.createTextNode(args.text));
|
317
|
-
return node;
|
318
|
-
},
|
319
|
-
|
320
|
-
/* Add a definitions node.
|
321
|
-
@param parent (element) the parent node for the new definitions (optional)
|
322
|
-
@param id (string) the ID of this definitions (optional)
|
323
|
-
@param settings (object) additional settings for the definitions (optional)
|
324
|
-
@return (element) the new definitions node */
|
325
|
-
defs: function(parent, id, settings) {
|
326
|
-
var args = this._args(arguments, ['id'], ['id']);
|
327
|
-
return this._makeNode(args.parent, 'defs', $.extend(
|
328
|
-
(args.id ? {id: args.id} : {}), args.settings || {}));
|
329
|
-
},
|
330
|
-
|
331
|
-
/* Add a symbol definition.
|
332
|
-
@param parent (element) the parent node for the new symbol (optional)
|
333
|
-
@param id (string) the ID of this symbol
|
334
|
-
@param x1 (number) the left coordinate for this symbol
|
335
|
-
@param y1 (number) the top coordinate for this symbol
|
336
|
-
@param x2 (number) the right coordinate for this symbol
|
337
|
-
@param y2 (number) the bottom coordinate for this symbol
|
338
|
-
@param settings (object) additional settings for the symbol (optional)
|
339
|
-
@return (element) the new symbol node */
|
340
|
-
symbol: function(parent, id, x1, y1, x2, y2, settings) {
|
341
|
-
var args = this._args(arguments, ['id', 'x1', 'y1', 'x2', 'y2']);
|
342
|
-
return this._makeNode(args.parent, 'symbol', $.extend(
|
343
|
-
{id: args.id, viewBox: args.x1 + ' ' + args.y1 + ' ' + args.x2 + ' ' + args.y2},
|
344
|
-
args.settings || {}));
|
345
|
-
},
|
346
|
-
|
347
|
-
/* Add a marker definition.
|
348
|
-
@param parent (element) the parent node for the new marker (optional)
|
349
|
-
@param id (string) the ID of this marker
|
350
|
-
@param refX (number) the x-coordinate for the reference point
|
351
|
-
@param refY (number) the y-coordinate for the reference point
|
352
|
-
@param mWidth (number) the marker viewport width
|
353
|
-
@param mHeight (number) the marker viewport height
|
354
|
-
@param orient (string or int) 'auto' or angle (degrees) (optional)
|
355
|
-
@param settings (object) additional settings for the marker (optional)
|
356
|
-
@return (element) the new marker node */
|
357
|
-
marker: function(parent, id, refX, refY, mWidth, mHeight, orient, settings) {
|
358
|
-
var args = this._args(arguments, ['id', 'refX', 'refY',
|
359
|
-
'mWidth', 'mHeight', 'orient'], ['orient']);
|
360
|
-
return this._makeNode(args.parent, 'marker', $.extend(
|
361
|
-
{id: args.id, refX: args.refX, refY: args.refY, markerWidth: args.mWidth,
|
362
|
-
markerHeight: args.mHeight, orient: args.orient || 'auto'}, args.settings || {}));
|
363
|
-
},
|
364
|
-
|
365
|
-
/* Add a style node.
|
366
|
-
@param parent (element) the parent node for the new node (optional)
|
367
|
-
@param styles (string) the CSS styles
|
368
|
-
@param settings (object) additional settings for the node (optional)
|
369
|
-
@return (element) the new style node */
|
370
|
-
style: function(parent, styles, settings) {
|
371
|
-
var args = this._args(arguments, ['styles']);
|
372
|
-
var node = this._makeNode(args.parent, 'style', $.extend(
|
373
|
-
{type: 'text/css'}, args.settings || {}));
|
374
|
-
node.appendChild(this._svg.ownerDocument.createTextNode(args.styles));
|
375
|
-
if ($.browser.opera) {
|
376
|
-
$('head').append('<style type="text/css">' + args.styles + '</style>');
|
377
|
-
}
|
378
|
-
return node;
|
379
|
-
},
|
380
|
-
|
381
|
-
/* Add a script node.
|
382
|
-
@param parent (element) the parent node for the new node (optional)
|
383
|
-
@param script (string) the JavaScript code
|
384
|
-
@param type (string) the MIME type for the code (optional, default 'text/javascript')
|
385
|
-
@param settings (object) additional settings for the node (optional)
|
386
|
-
@return (element) the new script node */
|
387
|
-
script: function(parent, script, type, settings) {
|
388
|
-
var args = this._args(arguments, ['script', 'type'], ['type']);
|
389
|
-
var node = this._makeNode(args.parent, 'script', $.extend(
|
390
|
-
{type: args.type || 'text/javascript'}, args.settings || {}));
|
391
|
-
node.appendChild(this._svg.ownerDocument.createTextNode(this._escapeXML(args.script)));
|
392
|
-
if (!$.browser.mozilla) {
|
393
|
-
$.globalEval(args.script);
|
394
|
-
}
|
395
|
-
return node;
|
396
|
-
},
|
397
|
-
|
398
|
-
/* Add a linear gradient definition.
|
399
|
-
Specify all of x1, y1, x2, y2 or none of them.
|
400
|
-
@param parent (element) the parent node for the new gradient (optional)
|
401
|
-
@param id (string) the ID for this gradient
|
402
|
-
@param stops (string[][]) the gradient stops, each entry is
|
403
|
-
[0] is offset (0.0-1.0 or 0%-100%), [1] is colour,
|
404
|
-
[2] is opacity (optional)
|
405
|
-
@param x1 (number) the x-coordinate of the gradient start (optional)
|
406
|
-
@param y1 (number) the y-coordinate of the gradient start (optional)
|
407
|
-
@param x2 (number) the x-coordinate of the gradient end (optional)
|
408
|
-
@param y2 (number) the y-coordinate of the gradient end (optional)
|
409
|
-
@param settings (object) additional settings for the gradient (optional)
|
410
|
-
@return (element) the new gradient node */
|
411
|
-
linearGradient: function(parent, id, stops, x1, y1, x2, y2, settings) {
|
412
|
-
var args = this._args(arguments,
|
413
|
-
['id', 'stops', 'x1', 'y1', 'x2', 'y2'], ['x1']);
|
414
|
-
var sets = $.extend({id: args.id},
|
415
|
-
(args.x1 != null ? {x1: args.x1, y1: args.y1, x2: args.x2, y2: args.y2} : {}));
|
416
|
-
return this._gradient(args.parent, 'linearGradient',
|
417
|
-
$.extend(sets, args.settings || {}), args.stops);
|
418
|
-
},
|
419
|
-
|
420
|
-
/* Add a radial gradient definition.
|
421
|
-
Specify all of cx, cy, r, fx, fy or none of them.
|
422
|
-
@param parent (element) the parent node for the new gradient (optional)
|
423
|
-
@param id (string) the ID for this gradient
|
424
|
-
@param stops (string[][]) the gradient stops, each entry
|
425
|
-
[0] is offset, [1] is colour, [2] is opacity (optional)
|
426
|
-
@param cx (number) the x-coordinate of the largest circle centre (optional)
|
427
|
-
@param cy (number) the y-coordinate of the largest circle centre (optional)
|
428
|
-
@param r (number) the radius of the largest circle (optional)
|
429
|
-
@param fx (number) the x-coordinate of the gradient focus (optional)
|
430
|
-
@param fy (number) the y-coordinate of the gradient focus (optional)
|
431
|
-
@param settings (object) additional settings for the gradient (optional)
|
432
|
-
@return (element) the new gradient node */
|
433
|
-
radialGradient: function(parent, id, stops, cx, cy, r, fx, fy, settings) {
|
434
|
-
var args = this._args(arguments,
|
435
|
-
['id', 'stops', 'cx', 'cy', 'r', 'fx', 'fy'], ['cx']);
|
436
|
-
var sets = $.extend({id: args.id}, (args.cx != null ?
|
437
|
-
{cx: args.cx, cy: args.cy, r: args.r, fx: args.fx, fy: args.fy} : {}));
|
438
|
-
return this._gradient(args.parent, 'radialGradient',
|
439
|
-
$.extend(sets, args.settings || {}), args.stops);
|
440
|
-
},
|
441
|
-
|
442
|
-
/* Add a gradient node. */
|
443
|
-
_gradient: function(parent, name, settings, stops) {
|
444
|
-
var node = this._makeNode(parent, name, settings);
|
445
|
-
for (var i = 0; i < stops.length; i++) {
|
446
|
-
var stop = stops[i];
|
447
|
-
this._makeNode(node, 'stop', $.extend(
|
448
|
-
{offset: stop[0], stopColor: stop[1]},
|
449
|
-
(stop[2] != null ? {stopOpacity: stop[2]} : {})));
|
450
|
-
}
|
451
|
-
return node;
|
452
|
-
},
|
453
|
-
|
454
|
-
/* Add a pattern definition.
|
455
|
-
Specify all of vx, vy, xwidth, vheight or none of them.
|
456
|
-
@param parent (element) the parent node for the new pattern (optional)
|
457
|
-
@param id (string) the ID for this pattern
|
458
|
-
@param x (number) the x-coordinate for the left edge of the pattern
|
459
|
-
@param y (number) the y-coordinate for the top edge of the pattern
|
460
|
-
@param width (number) the width of the pattern
|
461
|
-
@param height (number) the height of the pattern
|
462
|
-
@param vx (number) the minimum x-coordinate for view box (optional)
|
463
|
-
@param vy (number) the minimum y-coordinate for the view box (optional)
|
464
|
-
@param vwidth (number) the width of the view box (optional)
|
465
|
-
@param vheight (number) the height of the view box (optional)
|
466
|
-
@param settings (object) additional settings for the pattern (optional)
|
467
|
-
@return (element) the new pattern node */
|
468
|
-
pattern: function(parent, id, x, y, width, height, vx, vy, vwidth, vheight, settings) {
|
469
|
-
var args = this._args(arguments, ['id', 'x', 'y', 'width', 'height',
|
470
|
-
'vx', 'vy', 'vwidth', 'vheight'], ['vx']);
|
471
|
-
var sets = $.extend({id: args.id, x: args.x, y: args.y,
|
472
|
-
width: args.width, height: args.height}, (args.vx != null ?
|
473
|
-
{viewBox: args.vx + ' ' + args.vy + ' ' + args.vwidth + ' ' + args.vheight} : {}));
|
474
|
-
return this._makeNode(args.parent, 'pattern', $.extend(sets, args.settings || {}));
|
475
|
-
},
|
476
|
-
|
477
|
-
/* Add a mask definition.
|
478
|
-
@param parent (element) the parent node for the new mask (optional)
|
479
|
-
@param id (string) the ID for this mask
|
480
|
-
@param x (number) the x-coordinate for the left edge of the mask
|
481
|
-
@param y (number) the y-coordinate for the top edge of the mask
|
482
|
-
@param width (number) the width of the mask
|
483
|
-
@param height (number) the height of the mask
|
484
|
-
@param settings (object) additional settings for the mask (optional)
|
485
|
-
@return (element) the new mask node */
|
486
|
-
mask: function(parent, id, x, y, width, height, settings) {
|
487
|
-
var args = this._args(arguments, ['id', 'x', 'y', 'width', 'height']);
|
488
|
-
return this._makeNode(args.parent, 'mask', $.extend(
|
489
|
-
{id: args.id, x: args.x, y: args.y, width: args.width, height: args.height},
|
490
|
-
args.settings || {}));
|
491
|
-
},
|
492
|
-
|
493
|
-
/* Create a new path object.
|
494
|
-
@return (SVGPath) a new path object */
|
495
|
-
createPath: function() {
|
496
|
-
return new SVGPath();
|
497
|
-
},
|
498
|
-
|
499
|
-
/* Create a new text object.
|
500
|
-
@return (SVGText) a new text object */
|
501
|
-
createText: function() {
|
502
|
-
return new SVGText();
|
503
|
-
},
|
504
|
-
|
505
|
-
/* Add an embedded SVG element.
|
506
|
-
Specify all of vx, vy, vwidth, vheight or none of them.
|
507
|
-
@param parent (element) the parent node for the new node (optional)
|
508
|
-
@param x (number) the x-coordinate for the left edge of the node
|
509
|
-
@param y (number) the y-coordinate for the top edge of the node
|
510
|
-
@param width (number) the width of the node
|
511
|
-
@param height (number) the height of the node
|
512
|
-
@param vx (number) the minimum x-coordinate for view box (optional)
|
513
|
-
@param vy (number) the minimum y-coordinate for the view box (optional)
|
514
|
-
@param vwidth (number) the width of the view box (optional)
|
515
|
-
@param vheight (number) the height of the view box (optional)
|
516
|
-
@param settings (object) additional settings for the node (optional)
|
517
|
-
@return (element) the new node */
|
518
|
-
svg: function(parent, x, y, width, height, vx, vy, vwidth, vheight, settings) {
|
519
|
-
var args = this._args(arguments, ['x', 'y', 'width', 'height',
|
520
|
-
'vx', 'vy', 'vwidth', 'vheight'], ['vx']);
|
521
|
-
var sets = $.extend({x: args.x, y: args.y, width: args.width, height: args.height},
|
522
|
-
(args.vx != null ? {viewBox: args.vx + ' ' + args.vy + ' ' +
|
523
|
-
args.vwidth + ' ' + args.vheight} : {}));
|
524
|
-
return this._makeNode(args.parent, 'svg', $.extend(sets, args.settings || {}));
|
525
|
-
},
|
526
|
-
|
527
|
-
/* Create a group.
|
528
|
-
@param parent (element) the parent node for the new group (optional)
|
529
|
-
@param id (string) the ID of this group (optional)
|
530
|
-
@param settings (object) additional settings for the group (optional)
|
531
|
-
@return (element) the new group node */
|
532
|
-
group: function(parent, id, settings) {
|
533
|
-
var args = this._args(arguments, ['id'], ['id']);
|
534
|
-
return this._makeNode(args.parent, 'g', $.extend({id: args.id}, args.settings || {}));
|
535
|
-
},
|
536
|
-
|
537
|
-
/* Add a usage reference.
|
538
|
-
Specify all of x, y, width, height or none of them.
|
539
|
-
@param parent (element) the parent node for the new node (optional)
|
540
|
-
@param x (number) the x-coordinate for the left edge of the node (optional)
|
541
|
-
@param y (number) the y-coordinate for the top edge of the node (optional)
|
542
|
-
@param width (number) the width of the node (optional)
|
543
|
-
@param height (number) the height of the node (optional)
|
544
|
-
@param ref (string) the ID of the definition node
|
545
|
-
@param settings (object) additional settings for the node (optional)
|
546
|
-
@return (element) the new node */
|
547
|
-
use: function(parent, x, y, width, height, ref, settings) {
|
548
|
-
var args = this._args(arguments, ['x', 'y', 'width', 'height', 'ref']);
|
549
|
-
if (typeof args.x == 'string') {
|
550
|
-
args.ref = args.x;
|
551
|
-
args.settings = args.y;
|
552
|
-
args.x = args.y = args.width = args.height = null;
|
553
|
-
}
|
554
|
-
var node = this._makeNode(args.parent, 'use', $.extend(
|
555
|
-
{x: args.x, y: args.y, width: args.width, height: args.height},
|
556
|
-
args.settings || {}));
|
557
|
-
node.setAttributeNS($.svg.xlinkNS, 'href', args.ref);
|
558
|
-
return node;
|
559
|
-
},
|
560
|
-
|
561
|
-
/* Add a link, which applies to all child elements.
|
562
|
-
@param parent (element) the parent node for the new link (optional)
|
563
|
-
@param ref (string) the target URL
|
564
|
-
@param settings (object) additional settings for the link (optional)
|
565
|
-
@return (element) the new link node */
|
566
|
-
link: function(parent, ref, settings) {
|
567
|
-
var args = this._args(arguments, ['ref']);
|
568
|
-
var node = this._makeNode(args.parent, 'a', args.settings);
|
569
|
-
node.setAttributeNS($.svg.xlinkNS, 'href', args.ref);
|
570
|
-
return node;
|
571
|
-
},
|
572
|
-
|
573
|
-
/* Add an image.
|
574
|
-
@param parent (element) the parent node for the new image (optional)
|
575
|
-
@param x (number) the x-coordinate for the left edge of the image
|
576
|
-
@param y (number) the y-coordinate for the top edge of the image
|
577
|
-
@param width (number) the width of the image
|
578
|
-
@param height (number) the height of the image
|
579
|
-
@param ref (string) the path to the image
|
580
|
-
@param settings (object) additional settings for the image (optional)
|
581
|
-
@return (element) the new image node */
|
582
|
-
image: function(parent, x, y, width, height, ref, settings) {
|
583
|
-
var args = this._args(arguments, ['x', 'y', 'width', 'height', 'ref']);
|
584
|
-
var node = this._makeNode(args.parent, 'image', $.extend(
|
585
|
-
{x: args.x, y: args.y, width: args.width, height: args.height},
|
586
|
-
args.settings || {}));
|
587
|
-
node.setAttributeNS($.svg.xlinkNS, 'href', args.ref);
|
588
|
-
return node;
|
589
|
-
},
|
590
|
-
|
591
|
-
/* Draw a path.
|
592
|
-
@param parent (element) the parent node for the new shape (optional)
|
593
|
-
@param path (string or SVGPath) the path to draw
|
594
|
-
@param settings (object) additional settings for the shape (optional)
|
595
|
-
@return (element) the new shape node */
|
596
|
-
path: function(parent, path, settings) {
|
597
|
-
var args = this._args(arguments, ['path']);
|
598
|
-
return this._makeNode(args.parent, 'path', $.extend(
|
599
|
-
{d: (args.path.path ? args.path.path() : args.path)}, args.settings || {}));
|
600
|
-
},
|
601
|
-
|
602
|
-
/* Draw a rectangle.
|
603
|
-
Specify both of rx and ry or neither.
|
604
|
-
@param parent (element) the parent node for the new shape (optional)
|
605
|
-
@param x (number) the x-coordinate for the left edge of the rectangle
|
606
|
-
@param y (number) the y-coordinate for the top edge of the rectangle
|
607
|
-
@param width (number) the width of the rectangle
|
608
|
-
@param height (number) the height of the rectangle
|
609
|
-
@param rx (number) the x-radius of the ellipse for the rounded corners (optional)
|
610
|
-
@param ry (number) the y-radius of the ellipse for the rounded corners (optional)
|
611
|
-
@param settings (object) additional settings for the shape (optional)
|
612
|
-
@return (element) the new shape node */
|
613
|
-
rect: function(parent, x, y, width, height, rx, ry, settings) {
|
614
|
-
var args = this._args(arguments, ['x', 'y', 'width', 'height', 'rx', 'ry'], ['rx']);
|
615
|
-
return this._makeNode(args.parent, 'rect', $.extend(
|
616
|
-
{x: args.x, y: args.y, width: args.width, height: args.height},
|
617
|
-
(args.rx ? {rx: args.rx, ry: args.ry} : {}), args.settings || {}));
|
618
|
-
},
|
619
|
-
|
620
|
-
/* Draw a circle.
|
621
|
-
@param parent (element) the parent node for the new shape (optional)
|
622
|
-
@param cx (number) the x-coordinate for the centre of the circle
|
623
|
-
@param cy (number) the y-coordinate for the centre of the circle
|
624
|
-
@param r (number) the radius of the circle
|
625
|
-
@param settings (object) additional settings for the shape (optional)
|
626
|
-
@return (element) the new shape node */
|
627
|
-
circle: function(parent, cx, cy, r, settings) {
|
628
|
-
var args = this._args(arguments, ['cx', 'cy', 'r']);
|
629
|
-
return this._makeNode(args.parent, 'circle', $.extend(
|
630
|
-
{cx: args.cx, cy: args.cy, r: args.r}, args.settings || {}));
|
631
|
-
},
|
632
|
-
|
633
|
-
/* Draw an ellipse.
|
634
|
-
@param parent (element) the parent node for the new shape (optional)
|
635
|
-
@param cx (number) the x-coordinate for the centre of the ellipse
|
636
|
-
@param cy (number) the y-coordinate for the centre of the ellipse
|
637
|
-
@param rx (number) the x-radius of the ellipse
|
638
|
-
@param ry (number) the y-radius of the ellipse
|
639
|
-
@param settings (object) additional settings for the shape (optional)
|
640
|
-
@return (element) the new shape node */
|
641
|
-
ellipse: function(parent, cx, cy, rx, ry, settings) {
|
642
|
-
var args = this._args(arguments, ['cx', 'cy', 'rx', 'ry']);
|
643
|
-
return this._makeNode(args.parent, 'ellipse', $.extend(
|
644
|
-
{cx: args.cx, cy: args.cy, rx: args.rx, ry: args.ry}, args.settings || {}));
|
645
|
-
},
|
646
|
-
|
647
|
-
/* Draw a line.
|
648
|
-
@param parent (element) the parent node for the new shape (optional)
|
649
|
-
@param x1 (number) the x-coordinate for the start of the line
|
650
|
-
@param y1 (number) the y-coordinate for the start of the line
|
651
|
-
@param x2 (number) the x-coordinate for the end of the line
|
652
|
-
@param y2 (number) the y-coordinate for the end of the line
|
653
|
-
@param settings (object) additional settings for the shape (optional)
|
654
|
-
@return (element) the new shape node */
|
655
|
-
line: function(parent, x1, y1, x2, y2, settings) {
|
656
|
-
var args = this._args(arguments, ['x1', 'y1', 'x2', 'y2']);
|
657
|
-
return this._makeNode(args.parent, 'line', $.extend(
|
658
|
-
{x1: args.x1, y1: args.y1, x2: args.x2, y2: args.y2}, args.settings || {}));
|
659
|
-
},
|
660
|
-
|
661
|
-
/* Draw a polygonal line.
|
662
|
-
@param parent (element) the parent node for the new shape (optional)
|
663
|
-
@param points (number[][]) the x-/y-coordinates for the points on the line
|
664
|
-
@param settings (object) additional settings for the shape (optional)
|
665
|
-
@return (element) the new shape node */
|
666
|
-
polyline: function(parent, points, settings) {
|
667
|
-
var args = this._args(arguments, ['points']);
|
668
|
-
return this._poly(args.parent, 'polyline', args.points, args.settings);
|
669
|
-
},
|
670
|
-
|
671
|
-
/* Draw a polygonal shape.
|
672
|
-
@param parent (element) the parent node for the new shape (optional)
|
673
|
-
@param points (number[][]) the x-/y-coordinates for the points on the shape
|
674
|
-
@param settings (object) additional settings for the shape (optional)
|
675
|
-
@return (element) the new shape node */
|
676
|
-
polygon: function(parent, points, settings) {
|
677
|
-
var args = this._args(arguments, ['points']);
|
678
|
-
return this._poly(args.parent, 'polygon', args.points, args.settings);
|
679
|
-
},
|
680
|
-
|
681
|
-
/* Draw a polygonal line or shape. */
|
682
|
-
_poly: function(parent, name, points, settings) {
|
683
|
-
var ps = '';
|
684
|
-
for (var i = 0; i < points.length; i++) {
|
685
|
-
ps += points[i].join() + ' ';
|
686
|
-
}
|
687
|
-
return this._makeNode(parent, name, $.extend(
|
688
|
-
{points: $.trim(ps)}, settings || {}));
|
689
|
-
},
|
690
|
-
|
691
|
-
/* Draw text.
|
692
|
-
Specify both of x and y or neither of them.
|
693
|
-
@param parent (element) the parent node for the text (optional)
|
694
|
-
@param x (number or number[]) the x-coordinate(s) for the text (optional)
|
695
|
-
@param y (number or number[]) the y-coordinate(s) for the text (optional)
|
696
|
-
@param value (string) the text content or
|
697
|
-
(SVGText) text with spans and references
|
698
|
-
@param settings (object) additional settings for the text (optional)
|
699
|
-
@return (element) the new text node */
|
700
|
-
text: function(parent, x, y, value, settings) {
|
701
|
-
var args = this._args(arguments, ['x', 'y', 'value']);
|
702
|
-
if (typeof args.x == 'string' && arguments.length < 4) {
|
703
|
-
args.value = args.x;
|
704
|
-
args.settings = args.y;
|
705
|
-
args.x = args.y = null;
|
706
|
-
}
|
707
|
-
return this._text(args.parent, 'text', args.value, $.extend(
|
708
|
-
{x: (args.x && isArray(args.x) ? args.x.join(' ') : args.x),
|
709
|
-
y: (args.y && isArray(args.y) ? args.y.join(' ') : args.y)},
|
710
|
-
args.settings || {}));
|
711
|
-
},
|
712
|
-
|
713
|
-
/* Draw text along a path.
|
714
|
-
@param parent (element) the parent node for the text (optional)
|
715
|
-
@param path (string) the ID of the path
|
716
|
-
@param value (string) the text content or
|
717
|
-
(SVGText) text with spans and references
|
718
|
-
@param settings (object) additional settings for the text (optional)
|
719
|
-
@return (element) the new text node */
|
720
|
-
textpath: function(parent, path, value, settings) {
|
721
|
-
var args = this._args(arguments, ['path', 'value']);
|
722
|
-
var node = this._text(args.parent, 'textPath', args.value, args.settings || {});
|
723
|
-
node.setAttributeNS($.svg.xlinkNS, 'href', args.path);
|
724
|
-
return node;
|
725
|
-
},
|
726
|
-
|
727
|
-
/* Draw text. */
|
728
|
-
_text: function(parent, name, value, settings) {
|
729
|
-
var node = this._makeNode(parent, name, settings);
|
730
|
-
if (typeof value == 'string') {
|
731
|
-
node.appendChild(node.ownerDocument.createTextNode(value));
|
732
|
-
}
|
733
|
-
else {
|
734
|
-
for (var i = 0; i < value._parts.length; i++) {
|
735
|
-
var part = value._parts[i];
|
736
|
-
if (part[0] == 'tspan') {
|
737
|
-
var child = this._makeNode(node, part[0], part[2]);
|
738
|
-
child.appendChild(node.ownerDocument.createTextNode(part[1]));
|
739
|
-
node.appendChild(child);
|
740
|
-
}
|
741
|
-
else if (part[0] == 'tref') {
|
742
|
-
var child = this._makeNode(node, part[0], part[2]);
|
743
|
-
child.setAttributeNS($.svg.xlinkNS, 'href', part[1]);
|
744
|
-
node.appendChild(child);
|
745
|
-
}
|
746
|
-
else if (part[0] == 'textpath') {
|
747
|
-
var set = $.extend({}, part[2]);
|
748
|
-
set.href = null;
|
749
|
-
var child = this._makeNode(node, part[0], set);
|
750
|
-
child.setAttributeNS($.svg.xlinkNS, 'href', part[2].href);
|
751
|
-
child.appendChild(node.ownerDocument.createTextNode(part[1]));
|
752
|
-
node.appendChild(child);
|
753
|
-
}
|
754
|
-
else { // straight text
|
755
|
-
node.appendChild(node.ownerDocument.createTextNode(part[1]));
|
756
|
-
}
|
757
|
-
}
|
758
|
-
}
|
759
|
-
return node;
|
760
|
-
},
|
761
|
-
|
762
|
-
/* Add a custom SVG element.
|
763
|
-
@param parent (element) the parent node for the new element (optional)
|
764
|
-
@param name (string) the name of the element
|
765
|
-
@param settings (object) additional settings for the element (optional)
|
766
|
-
@return (element) the new title node */
|
767
|
-
other: function(parent, name, settings) {
|
768
|
-
var args = this._args(arguments, ['name']);
|
769
|
-
return this._makeNode(args.parent, args.name, args.settings || {});
|
770
|
-
},
|
771
|
-
|
772
|
-
/* Create a shape node with the given settings. */
|
773
|
-
_makeNode: function(parent, name, settings) {
|
774
|
-
parent = parent || this._svg;
|
775
|
-
var node = this._svg.ownerDocument.createElementNS($.svg.svgNS, name);
|
776
|
-
for (var name in settings) {
|
777
|
-
var value = settings[name];
|
778
|
-
if (value != null && value != null &&
|
779
|
-
(typeof value != 'string' || value != '')) {
|
780
|
-
node.setAttribute($.svg._attrNames[name] || name, value);
|
781
|
-
}
|
782
|
-
}
|
783
|
-
parent.appendChild(node);
|
784
|
-
return node;
|
785
|
-
},
|
786
|
-
|
787
|
-
/* Add an existing SVG node to the diagram.
|
788
|
-
@param parent (element) the parent node for the new node (optional)
|
789
|
-
@param node (element) the new node to add or
|
790
|
-
(string) the jQuery selector for the node or
|
791
|
-
(jQuery collection) set of nodes to add
|
792
|
-
@return (SVGWrapper) this wrapper */
|
793
|
-
add: function(parent, node) {
|
794
|
-
var args = this._args(arguments, ['node']);
|
795
|
-
var svg = this;
|
796
|
-
args.parent = args.parent || this._svg;
|
797
|
-
try {
|
798
|
-
if ($.svg._renesis) {
|
799
|
-
throw 'Force traversal';
|
800
|
-
}
|
801
|
-
args.parent.appendChild(args.node.cloneNode(true));
|
802
|
-
}
|
803
|
-
catch (e) {
|
804
|
-
args.node = (args.node.jquery ? args.node : $(args.node));
|
805
|
-
args.node.each(function() {
|
806
|
-
var child = svg._cloneAsSVG(this);
|
807
|
-
if (child) {
|
808
|
-
args.parent.appendChild(child);
|
809
|
-
}
|
810
|
-
});
|
811
|
-
}
|
812
|
-
return this;
|
813
|
-
},
|
814
|
-
|
815
|
-
/* SVG nodes must belong to the SVG namespace, so clone and ensure this is so. */
|
816
|
-
_cloneAsSVG: function(node) {
|
817
|
-
var newNode = null;
|
818
|
-
if (node.nodeType == 1) { // element
|
819
|
-
newNode = this._svg.ownerDocument.createElementNS(
|
820
|
-
$.svg.svgNS, this._checkName(node.nodeName));
|
821
|
-
for (var i = 0; i < node.attributes.length; i++) {
|
822
|
-
var attr = node.attributes.item(i);
|
823
|
-
if (attr.nodeName != 'xmlns' && attr.nodeValue) {
|
824
|
-
if (attr.prefix == 'xlink') {
|
825
|
-
newNode.setAttributeNS($.svg.xlinkNS, attr.localName, attr.nodeValue);
|
826
|
-
}
|
827
|
-
else {
|
828
|
-
newNode.setAttribute(this._checkName(attr.nodeName), attr.nodeValue);
|
829
|
-
}
|
830
|
-
}
|
831
|
-
}
|
832
|
-
for (var i = 0; i < node.childNodes.length; i++) {
|
833
|
-
var child = this._cloneAsSVG(node.childNodes[i]);
|
834
|
-
if (child) {
|
835
|
-
newNode.appendChild(child);
|
836
|
-
}
|
837
|
-
}
|
838
|
-
}
|
839
|
-
else if (node.nodeType == 3) { // text
|
840
|
-
if ($.trim(node.nodeValue)) {
|
841
|
-
newNode = this._svg.ownerDocument.createTextNode(node.nodeValue);
|
842
|
-
}
|
843
|
-
}
|
844
|
-
else if (node.nodeType == 4) { // CDATA
|
845
|
-
if ($.trim(node.nodeValue)) {
|
846
|
-
try {
|
847
|
-
newNode = this._svg.ownerDocument.createCDATASection(node.nodeValue);
|
848
|
-
}
|
849
|
-
catch (e) {
|
850
|
-
newNode = this._svg.ownerDocument.createTextNode(
|
851
|
-
node.nodeValue.replace(/&/g, '&').
|
852
|
-
replace(/</g, '<').replace(/>/g, '>'));
|
853
|
-
}
|
854
|
-
}
|
855
|
-
}
|
856
|
-
return newNode;
|
857
|
-
},
|
858
|
-
|
859
|
-
/* Node names must be lower case and without SVG namespace prefix. */
|
860
|
-
_checkName: function(name) {
|
861
|
-
name = (name.substring(0, 1) >= 'A' && name.substring(0, 1) <= 'Z' ?
|
862
|
-
name.toLowerCase() : name);
|
863
|
-
return (name.substring(0, 4) == 'svg:' ? name.substring(4) : name);
|
864
|
-
},
|
865
|
-
|
866
|
-
/* Load an external SVG document.
|
867
|
-
@param url (string) the location of the SVG document or
|
868
|
-
the actual SVG content
|
869
|
-
@param settings (boolean) see addTo below or
|
870
|
-
(function) see onLoad below or
|
871
|
-
(object) additional settings for the load with attributes below:
|
872
|
-
addTo (boolean) true to add to what's already there,
|
873
|
-
or false to clear the canvas first
|
874
|
-
changeSize (boolean) true to allow the canvas size to change,
|
875
|
-
or false to retain the original
|
876
|
-
onLoad (function) callback after the document has loaded,
|
877
|
-
'this' is the container, receives SVG object and
|
878
|
-
optional error message as a parameter
|
879
|
-
@return (SVGWrapper) this root */
|
880
|
-
load: function(url, settings) {
|
881
|
-
settings = (typeof settings == 'boolean'? {addTo: settings} :
|
882
|
-
(typeof settings == 'function'? {onLoad: settings} : settings || {}));
|
883
|
-
if (!settings.addTo) {
|
884
|
-
this.clear(false);
|
885
|
-
}
|
886
|
-
var size = [this._svg.getAttribute('width'), this._svg.getAttribute('height')];
|
887
|
-
var wrapper = this;
|
888
|
-
// Report a problem with the load
|
889
|
-
var reportError = function(message) {
|
890
|
-
message = $.svg.local.errorLoadingText + ': ' + message;
|
891
|
-
if (settings.onLoad) {
|
892
|
-
settings.onLoad.apply(wrapper._container, [wrapper, message]);
|
893
|
-
}
|
894
|
-
else {
|
895
|
-
wrapper.text(null, 10, 20, message);
|
896
|
-
}
|
897
|
-
};
|
898
|
-
// Create a DOM from SVG content
|
899
|
-
var loadXML4IE = function(data) {
|
900
|
-
var xml = new ActiveXObject('Microsoft.XMLDOM');
|
901
|
-
xml.validateOnParse = false;
|
902
|
-
xml.resolveExternals = false;
|
903
|
-
xml.async = false;
|
904
|
-
xml.loadXML(data);
|
905
|
-
if (xml.parseError.errorCode != 0) {
|
906
|
-
reportError(xml.parseError.reason);
|
907
|
-
return null;
|
908
|
-
}
|
909
|
-
return xml;
|
910
|
-
};
|
911
|
-
// Load the SVG DOM
|
912
|
-
var loadSVG = function(data) {
|
913
|
-
if (!data) {
|
914
|
-
return;
|
915
|
-
}
|
916
|
-
if (data.documentElement.nodeName != 'svg') {
|
917
|
-
var errors = data.getElementsByTagName('parsererror');
|
918
|
-
var messages = (errors.length ? errors[0].getElementsByTagName('div') : []); // Safari
|
919
|
-
reportError(!errors.length ? '???' :
|
920
|
-
(messages.length ? messages[0] : errors[0]).firstChild.nodeValue);
|
921
|
-
return;
|
922
|
-
}
|
923
|
-
var attrs = {};
|
924
|
-
for (var i = 0; i < data.documentElement.attributes.length; i++) {
|
925
|
-
var attr = data.documentElement.attributes.item(i);
|
926
|
-
if (!(attr.nodeName == 'version' || attr.nodeName.substring(0, 5) == 'xmlns')) {
|
927
|
-
attrs[attr.nodeName] = attr.nodeValue;
|
928
|
-
}
|
929
|
-
}
|
930
|
-
wrapper.configure(attrs, true);
|
931
|
-
var nodes = data.documentElement.childNodes;
|
932
|
-
for (var i = 0; i < nodes.length; i++) {
|
933
|
-
try {
|
934
|
-
if ($.svg._renesis) {
|
935
|
-
throw 'Force traversal';
|
936
|
-
}
|
937
|
-
wrapper._svg.appendChild(nodes[i].cloneNode(true));
|
938
|
-
}
|
939
|
-
catch (e) {
|
940
|
-
wrapper.add(null, nodes[i]);
|
941
|
-
}
|
942
|
-
}
|
943
|
-
if (!settings.changeSize) {
|
944
|
-
wrapper.configure({width: size[0], height: size[1]});
|
945
|
-
}
|
946
|
-
if (settings.onLoad) {
|
947
|
-
settings.onLoad.apply(wrapper._container, [wrapper]);
|
948
|
-
}
|
949
|
-
};
|
950
|
-
if (url.match('<svg')) { // Inline SVG
|
951
|
-
loadSVG($.browser.msie ? loadXML4IE(url) :
|
952
|
-
new DOMParser().parseFromString(url, 'text/xml'));
|
953
|
-
}
|
954
|
-
else { // Remote SVG
|
955
|
-
$.ajax({url: url, dataType: ($.browser.msie ? 'text' : 'xml'),
|
956
|
-
success: function(xml) {
|
957
|
-
loadSVG($.browser.msie ? loadXML4IE(xml) : xml);
|
958
|
-
}, error: function(http, message, exc) {
|
959
|
-
reportError(message + (exc ? ' ' + exc.message : ''));
|
960
|
-
}});
|
961
|
-
}
|
962
|
-
return this;
|
963
|
-
},
|
964
|
-
|
965
|
-
/* Delete a specified node.
|
966
|
-
@param node (element) the drawing node to remove
|
967
|
-
@return (SVGWrapper) this root */
|
968
|
-
remove: function(node) {
|
969
|
-
node.parentNode.removeChild(node);
|
970
|
-
return this;
|
971
|
-
},
|
972
|
-
|
973
|
-
/* Delete everything in the current document.
|
974
|
-
@param attrsToo (boolean) true to clear any root attributes as well,
|
975
|
-
false to leave them (optional)
|
976
|
-
@return (SVGWrapper) this root */
|
977
|
-
clear: function(attrsToo) {
|
978
|
-
if (attrsToo) {
|
979
|
-
this.configure({}, true);
|
980
|
-
}
|
981
|
-
while (this._svg.firstChild) {
|
982
|
-
this._svg.removeChild(this._svg.firstChild);
|
983
|
-
}
|
984
|
-
return this;
|
985
|
-
},
|
986
|
-
|
987
|
-
/* Serialise the current diagram into an SVG text document.
|
988
|
-
@param node (SVG element) the starting node (optional)
|
989
|
-
@return (string) the SVG as text */
|
990
|
-
toSVG: function(node) {
|
991
|
-
node = node || this._svg;
|
992
|
-
return (typeof XMLSerializer == 'undefined' ? this._toSVG(node) :
|
993
|
-
new XMLSerializer().serializeToString(node));
|
994
|
-
},
|
995
|
-
|
996
|
-
/* Serialise one node in the SVG hierarchy. */
|
997
|
-
_toSVG: function(node) {
|
998
|
-
var svgDoc = '';
|
999
|
-
if (!node) {
|
1000
|
-
return svgDoc;
|
1001
|
-
}
|
1002
|
-
if (node.nodeType == 3) { // Text
|
1003
|
-
svgDoc = node.nodeValue;
|
1004
|
-
}
|
1005
|
-
else if (node.nodeType == 4) { // CDATA
|
1006
|
-
svgDoc = '<![CDATA[' + node.nodeValue + ']]>';
|
1007
|
-
}
|
1008
|
-
else { // Element
|
1009
|
-
svgDoc = '<' + node.nodeName;
|
1010
|
-
if (node.attributes) {
|
1011
|
-
for (var i = 0; i < node.attributes.length; i++) {
|
1012
|
-
var attr = node.attributes.item(i);
|
1013
|
-
if (!($.trim(attr.nodeValue) == '' || attr.nodeValue.match(/^\[object/) ||
|
1014
|
-
attr.nodeValue.match(/^function/))) {
|
1015
|
-
svgDoc += ' ' + (attr.namespaceURI == $.svg.xlinkNS ? 'xlink:' : '') +
|
1016
|
-
attr.nodeName + '="' + attr.nodeValue + '"';
|
1017
|
-
}
|
1018
|
-
}
|
1019
|
-
}
|
1020
|
-
if (node.firstChild) {
|
1021
|
-
svgDoc += '>';
|
1022
|
-
var child = node.firstChild;
|
1023
|
-
while (child) {
|
1024
|
-
svgDoc += this._toSVG(child);
|
1025
|
-
child = child.nextSibling;
|
1026
|
-
}
|
1027
|
-
svgDoc += '</' + node.nodeName + '>';
|
1028
|
-
}
|
1029
|
-
else {
|
1030
|
-
svgDoc += '/>';
|
1031
|
-
}
|
1032
|
-
}
|
1033
|
-
return svgDoc;
|
1034
|
-
},
|
1035
|
-
|
1036
|
-
/* Escape reserved characters in XML. */
|
1037
|
-
_escapeXML: function(text) {
|
1038
|
-
text = text.replace(/&/g, '&');
|
1039
|
-
text = text.replace(/</g, '<');
|
1040
|
-
text = text.replace(/>/g, '>');
|
1041
|
-
return text;
|
1042
|
-
}
|
1043
|
-
});
|
1044
|
-
|
1045
|
-
/* Helper to generate an SVG path.
|
1046
|
-
Obtain an instance from the SVGWrapper object.
|
1047
|
-
String calls together to generate the path and use its value:
|
1048
|
-
var path = root.createPath();
|
1049
|
-
root.path(null, path.move(100, 100).line(300, 100).line(200, 300).close(), {fill: 'red'});
|
1050
|
-
or
|
1051
|
-
root.path(null, path.move(100, 100).line([[300, 100], [200, 300]]).close(), {fill: 'red'}); */
|
1052
|
-
function SVGPath() {
|
1053
|
-
this._path = '';
|
1054
|
-
}
|
1055
|
-
|
1056
|
-
$.extend(SVGPath.prototype, {
|
1057
|
-
/* Prepare to create a new path.
|
1058
|
-
@return (SVGPath) this path */
|
1059
|
-
reset: function() {
|
1060
|
-
this._path = '';
|
1061
|
-
return this;
|
1062
|
-
},
|
1063
|
-
|
1064
|
-
/* Move the pointer to a position.
|
1065
|
-
@param x (number) x-coordinate to move to or
|
1066
|
-
(number[][]) x-/y-coordinates to move to
|
1067
|
-
@param y (number) y-coordinate to move to (omitted if x is array)
|
1068
|
-
@param relative (boolean) true for coordinates relative to the current point,
|
1069
|
-
false for coordinates being absolute
|
1070
|
-
@return (SVGPath) this path */
|
1071
|
-
move: function(x, y, relative) {
|
1072
|
-
relative = (isArray(x) ? y : relative);
|
1073
|
-
return this._coords((relative ? 'm' : 'M'), x, y);
|
1074
|
-
},
|
1075
|
-
|
1076
|
-
/* Draw a line to a position.
|
1077
|
-
@param x (number) x-coordinate to move to or
|
1078
|
-
(number[][]) x-/y-coordinates to move to
|
1079
|
-
@param y (number) y-coordinate to move to (omitted if x is array)
|
1080
|
-
@param relative (boolean) true for coordinates relative to the current point,
|
1081
|
-
false for coordinates being absolute
|
1082
|
-
@return (SVGPath) this path */
|
1083
|
-
line: function(x, y, relative) {
|
1084
|
-
relative = (isArray(x) ? y : relative);
|
1085
|
-
return this._coords((relative ? 'l' : 'L'), x, y);
|
1086
|
-
},
|
1087
|
-
|
1088
|
-
/* Draw a horizontal line to a position.
|
1089
|
-
@param x (number) x-coordinate to draw to or
|
1090
|
-
(number[]) x-coordinates to draw to
|
1091
|
-
@param relative (boolean) true for coordinates relative to the current point,
|
1092
|
-
false for coordinates being absolute
|
1093
|
-
@return (SVGPath) this path */
|
1094
|
-
horiz: function(x, relative) {
|
1095
|
-
this._path += (relative ? 'h' : 'H') + (isArray(x) ? x.join(' ') : x);
|
1096
|
-
return this;
|
1097
|
-
},
|
1098
|
-
|
1099
|
-
/* Draw a vertical line to a position.
|
1100
|
-
@param y (number) y-coordinate to draw to or
|
1101
|
-
(number[]) y-coordinates to draw to
|
1102
|
-
@param relative (boolean) true for coordinates relative to the current point,
|
1103
|
-
false for coordinates being absolute
|
1104
|
-
@return (SVGPath) this path */
|
1105
|
-
vert: function(y, relative) {
|
1106
|
-
this._path += (relative ? 'v' : 'V') + (isArray(y) ? y.join(' ') : y);
|
1107
|
-
return this;
|
1108
|
-
},
|
1109
|
-
|
1110
|
-
/* Draw a cubic B�zier curve.
|
1111
|
-
@param x1 (number) x-coordinate of beginning control point or
|
1112
|
-
(number[][]) x-/y-coordinates of control and end points to draw to
|
1113
|
-
@param y1 (number) y-coordinate of beginning control point (omitted if x1 is array)
|
1114
|
-
@param x2 (number) x-coordinate of ending control point (omitted if x1 is array)
|
1115
|
-
@param y2 (number) y-coordinate of ending control point (omitted if x1 is array)
|
1116
|
-
@param x (number) x-coordinate of curve end (omitted if x1 is array)
|
1117
|
-
@param y (number) y-coordinate of curve end (omitted if x1 is array)
|
1118
|
-
@param relative (boolean) true for coordinates relative to the current point,
|
1119
|
-
false for coordinates being absolute
|
1120
|
-
@return (SVGPath) this path */
|
1121
|
-
curveC: function(x1, y1, x2, y2, x, y, relative) {
|
1122
|
-
relative = (isArray(x1) ? y1 : relative);
|
1123
|
-
return this._coords((relative ? 'c' : 'C'), x1, y1, x2, y2, x, y);
|
1124
|
-
},
|
1125
|
-
|
1126
|
-
/* Continue a cubic B�zier curve.
|
1127
|
-
Starting control point is the reflection of the previous end control point.
|
1128
|
-
@param x2 (number) x-coordinate of ending control point or
|
1129
|
-
(number[][]) x-/y-coordinates of control and end points to draw to
|
1130
|
-
@param y2 (number) y-coordinate of ending control point (omitted if x2 is array)
|
1131
|
-
@param x (number) x-coordinate of curve end (omitted if x2 is array)
|
1132
|
-
@param y (number) y-coordinate of curve end (omitted if x2 is array)
|
1133
|
-
@param relative (boolean) true for coordinates relative to the current point,
|
1134
|
-
false for coordinates being absolute
|
1135
|
-
@return (SVGPath) this path */
|
1136
|
-
smoothC: function(x2, y2, x, y, relative) {
|
1137
|
-
relative = (isArray(x2) ? y2 : relative);
|
1138
|
-
return this._coords((relative ? 's' : 'S'), x2, y2, x, y);
|
1139
|
-
},
|
1140
|
-
|
1141
|
-
/* Draw a quadratic B�zier curve.
|
1142
|
-
@param x1 (number) x-coordinate of control point or
|
1143
|
-
(number[][]) x-/y-coordinates of control and end points to draw to
|
1144
|
-
@param y1 (number) y-coordinate of control point (omitted if x1 is array)
|
1145
|
-
@param x (number) x-coordinate of curve end (omitted if x1 is array)
|
1146
|
-
@param y (number) y-coordinate of curve end (omitted if x1 is array)
|
1147
|
-
@param relative (boolean) true for coordinates relative to the current point,
|
1148
|
-
false for coordinates being absolute
|
1149
|
-
@return (SVGPath) this path */
|
1150
|
-
curveQ: function(x1, y1, x, y, relative) {
|
1151
|
-
relative = (isArray(x1) ? y1 : relative);
|
1152
|
-
return this._coords((relative ? 'q' : 'Q'), x1, y1, x, y);
|
1153
|
-
},
|
1154
|
-
|
1155
|
-
/* Continue a quadratic B�zier curve.
|
1156
|
-
Control point is the reflection of the previous control point.
|
1157
|
-
@param x (number) x-coordinate of curve end or
|
1158
|
-
(number[][]) x-/y-coordinates of points to draw to
|
1159
|
-
@param y (number) y-coordinate of curve end (omitted if x is array)
|
1160
|
-
@param relative (boolean) true for coordinates relative to the current point,
|
1161
|
-
false for coordinates being absolute
|
1162
|
-
@return (SVGPath) this path */
|
1163
|
-
smoothQ: function(x, y, relative) {
|
1164
|
-
relative = (isArray(x) ? y : relative);
|
1165
|
-
return this._coords((relative ? 't' : 'T'), x, y);
|
1166
|
-
},
|
1167
|
-
|
1168
|
-
/* Generate a path command with (a list of) coordinates. */
|
1169
|
-
_coords: function(cmd, x1, y1, x2, y2, x3, y3) {
|
1170
|
-
if (isArray(x1)) {
|
1171
|
-
for (var i = 0; i < x1.length; i++) {
|
1172
|
-
var cs = x1[i];
|
1173
|
-
this._path += (i == 0 ? cmd : ' ') + cs[0] + ',' + cs[1] +
|
1174
|
-
(cs.length < 4 ? '' : ' ' + cs[2] + ',' + cs[3] +
|
1175
|
-
(cs.length < 6 ? '': ' ' + cs[4] + ',' + cs[5]));
|
1176
|
-
}
|
1177
|
-
}
|
1178
|
-
else {
|
1179
|
-
this._path += cmd + x1 + ',' + y1 +
|
1180
|
-
(x2 == null ? '' : ' ' + x2 + ',' + y2 +
|
1181
|
-
(x3 == null ? '' : ' ' + x3 + ',' + y3));
|
1182
|
-
}
|
1183
|
-
return this;
|
1184
|
-
},
|
1185
|
-
|
1186
|
-
/* Draw an arc to a position.
|
1187
|
-
@param rx (number) x-radius of arc or
|
1188
|
-
(number/boolean[][]) x-/y-coordinates and flags for points to draw to
|
1189
|
-
@param ry (number) y-radius of arc (omitted if rx is array)
|
1190
|
-
@param xRotate (number) x-axis rotation (degrees, clockwise) (omitted if rx is array)
|
1191
|
-
@param large (boolean) true to draw the large part of the arc,
|
1192
|
-
false to draw the small part (omitted if rx is array)
|
1193
|
-
@param clockwise (boolean) true to draw the clockwise arc,
|
1194
|
-
false to draw the anti-clockwise arc (omitted if rx is array)
|
1195
|
-
@param x (number) x-coordinate of arc end (omitted if rx is array)
|
1196
|
-
@param y (number) y-coordinate of arc end (omitted if rx is array)
|
1197
|
-
@param relative (boolean) true for coordinates relative to the current point,
|
1198
|
-
false for coordinates being absolute
|
1199
|
-
@return (SVGPath) this path */
|
1200
|
-
arc: function(rx, ry, xRotate, large, clockwise, x, y, relative) {
|
1201
|
-
relative = (isArray(rx) ? ry : relative);
|
1202
|
-
this._path += (relative ? 'a' : 'A');
|
1203
|
-
if (isArray(rx)) {
|
1204
|
-
for (var i = 0; i < rx.length; i++) {
|
1205
|
-
var cs = rx[i];
|
1206
|
-
this._path += (i == 0 ? '' : ' ') + cs[0] + ',' + cs[1] + ' ' +
|
1207
|
-
cs[2] + ' ' + (cs[3] ? '1' : '0') + ',' +
|
1208
|
-
(cs[4] ? '1' : '0') + ' ' + cs[5] + ',' + cs[6];
|
1209
|
-
}
|
1210
|
-
}
|
1211
|
-
else {
|
1212
|
-
this._path += rx + ',' + ry + ' ' + xRotate + ' ' +
|
1213
|
-
(large ? '1' : '0') + ',' + (clockwise ? '1' : '0') + ' ' + x + ',' + y;
|
1214
|
-
}
|
1215
|
-
return this;
|
1216
|
-
},
|
1217
|
-
|
1218
|
-
/* Close the current path.
|
1219
|
-
@return (SVGPath) this path */
|
1220
|
-
close: function() {
|
1221
|
-
this._path += 'z';
|
1222
|
-
return this;
|
1223
|
-
},
|
1224
|
-
|
1225
|
-
/* Return the string rendering of the specified path.
|
1226
|
-
@return (string) stringified path */
|
1227
|
-
path: function() {
|
1228
|
-
return this._path;
|
1229
|
-
}
|
1230
|
-
});
|
1231
|
-
|
1232
|
-
SVGPath.prototype.moveTo = SVGPath.prototype.move;
|
1233
|
-
SVGPath.prototype.lineTo = SVGPath.prototype.line;
|
1234
|
-
SVGPath.prototype.horizTo = SVGPath.prototype.horiz;
|
1235
|
-
SVGPath.prototype.vertTo = SVGPath.prototype.vert;
|
1236
|
-
SVGPath.prototype.curveCTo = SVGPath.prototype.curveC;
|
1237
|
-
SVGPath.prototype.smoothCTo = SVGPath.prototype.smoothC;
|
1238
|
-
SVGPath.prototype.curveQTo = SVGPath.prototype.curveQ;
|
1239
|
-
SVGPath.prototype.smoothQTo = SVGPath.prototype.smoothQ;
|
1240
|
-
SVGPath.prototype.arcTo = SVGPath.prototype.arc;
|
1241
|
-
|
1242
|
-
/* Helper to generate an SVG text object.
|
1243
|
-
Obtain an instance from the SVGWrapper object.
|
1244
|
-
String calls together to generate the text and use its value:
|
1245
|
-
var text = root.createText();
|
1246
|
-
root.text(null, x, y, text.string('This is ').
|
1247
|
-
span('red', {fill: 'red'}).string('!'), {fill: 'blue'}); */
|
1248
|
-
function SVGText() {
|
1249
|
-
this._parts = []; // The components of the text object
|
1250
|
-
}
|
1251
|
-
|
1252
|
-
$.extend(SVGText.prototype, {
|
1253
|
-
/* Prepare to create a new text object.
|
1254
|
-
@return (SVGText) this text */
|
1255
|
-
reset: function() {
|
1256
|
-
this._parts = [];
|
1257
|
-
return this;
|
1258
|
-
},
|
1259
|
-
|
1260
|
-
/* Add a straight string value.
|
1261
|
-
@param value (string) the actual text
|
1262
|
-
@return (SVGText) this text object */
|
1263
|
-
string: function(value) {
|
1264
|
-
this._parts[this._parts.length] = ['text', value];
|
1265
|
-
return this;
|
1266
|
-
},
|
1267
|
-
|
1268
|
-
/* Add a separate text span that has its own settings.
|
1269
|
-
@param value (string) the actual text
|
1270
|
-
@param settings (object) the settings for this text
|
1271
|
-
@return (SVGText) this text object */
|
1272
|
-
span: function(value, settings) {
|
1273
|
-
this._parts[this._parts.length] = ['tspan', value, settings];
|
1274
|
-
return this;
|
1275
|
-
},
|
1276
|
-
|
1277
|
-
/* Add a reference to a previously defined text string.
|
1278
|
-
@param id (string) the ID of the actual text
|
1279
|
-
@param settings (object) the settings for this text
|
1280
|
-
@return (SVGText) this text object */
|
1281
|
-
ref: function(id, settings) {
|
1282
|
-
this._parts[this._parts.length] = ['tref', id, settings];
|
1283
|
-
return this;
|
1284
|
-
},
|
1285
|
-
|
1286
|
-
/* Add text drawn along a path.
|
1287
|
-
@param id (string) the ID of the path
|
1288
|
-
@param value (string) the actual text
|
1289
|
-
@param settings (object) the settings for this text
|
1290
|
-
@return (SVGText) this text object */
|
1291
|
-
path: function(id, value, settings) {
|
1292
|
-
this._parts[this._parts.length] = ['textpath', value,
|
1293
|
-
$.extend({href: id}, settings || {})];
|
1294
|
-
return this;
|
1295
|
-
}
|
1296
|
-
});
|
1297
|
-
|
1298
|
-
/* Attach the SVG functionality to a jQuery selection.
|
1299
|
-
@param command (string) the command to run (optional, default 'attach')
|
1300
|
-
@param options (object) the new settings to use for these SVG instances
|
1301
|
-
@return jQuery (object) for chaining further calls */
|
1302
|
-
$.fn.svg = function(options) {
|
1303
|
-
var otherArgs = Array.prototype.slice.call(arguments, 1);
|
1304
|
-
if (typeof options == 'string' && options == 'get') {
|
1305
|
-
return $.svg['_' + options + 'SVG'].apply($.svg, [this[0]].concat(otherArgs));
|
1306
|
-
}
|
1307
|
-
return this.each(function() {
|
1308
|
-
if (typeof options == 'string') {
|
1309
|
-
$.svg['_' + options + 'SVG'].apply($.svg, [this].concat(otherArgs));
|
1310
|
-
}
|
1311
|
-
else {
|
1312
|
-
$.svg._attachSVG(this, options || {});
|
1313
|
-
}
|
1314
|
-
});
|
1315
|
-
};
|
1316
|
-
|
1317
|
-
/* Determine whether an object is an array. */
|
1318
|
-
function isArray(a) {
|
1319
|
-
return (a && a.constructor == Array);
|
1320
|
-
}
|
1321
|
-
|
1322
|
-
// Singleton primary SVG interface
|
1323
|
-
$.svg = new SVGManager();
|
1324
|
-
|
1325
|
-
})(jQuery);
|