voruby 1.1.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile.rb +107 -224
- data/lib/misc.rb +1 -0
- data/lib/misc/misc.rb +60 -0
- data/lib/misc/propertyfile.rb +31 -0
- data/lib/symphony.rb +1 -0
- data/lib/symphony/symphony.rb +247 -0
- data/lib/voruby.rb +186 -0
- data/lib/voruby/active_votable/active_votable.rb +468 -347
- data/lib/voruby/adql/1.0/adql.rb +2418 -0
- data/lib/voruby/adql/support.rb +2 -0
- data/lib/voruby/misc.rb +351 -0
- data/lib/voruby/misc/connection_monitor.rb +97 -0
- data/lib/voruby/misc/libxml_ext.rb +121 -0
- data/lib/voruby/misc/rexml_ext.rb +223 -0
- data/lib/voruby/resolver/resolver.rb +12 -0
- data/lib/voruby/resolver/sesame.rb +299 -0
- data/lib/voruby/sky_query/sky_query.rb +192 -0
- data/lib/voruby/stc/1.10/coords.rb +2272 -0
- data/lib/voruby/stc/1.10/region.rb +892 -0
- data/lib/voruby/stc/1.10/stc.rb +3271 -0
- data/lib/voruby/stc/1.30/stc.rb +8666 -0
- data/lib/voruby/stc/support.rb +2 -0
- data/lib/voruby/ucd/ucd.rb +173 -0
- data/lib/voruby/voevent/1.1/voevent.rb +1124 -0
- data/lib/voruby/voevent/support.rb +5 -0
- data/lib/voruby/votable/1.0/votable.rb +1807 -0
- data/lib/voruby/votable/1.1/votable.rb +2100 -0
- data/lib/voruby/votable/votable.rb +305 -0
- data/lib/voruby/wesix/wesix.rb +491 -0
- data/lib/voruby/xlink/1.2/xlink.rb +21 -0
- data/test/voruby/active_votable/complex.vot +60 -0
- data/test/voruby/active_votable/error.vot +6 -0
- data/test/voruby/active_votable/large.vot +130040 -0
- data/test/voruby/active_votable/simple1.vot +38 -0
- data/test/voruby/active_votable/simple2.vot +38 -0
- data/test/voruby/active_votable/test.rb +193 -0
- data/test/voruby/adql/1.0/adql-alias.sql +1 -0
- data/test/voruby/adql/1.0/adql-alias.xml +26 -0
- data/test/voruby/adql/1.0/adql-avg.sql +1 -0
- data/test/voruby/adql/1.0/adql-avg.xml +31 -0
- data/test/voruby/adql/1.0/adql-circle.sql +1 -0
- data/test/voruby/adql/1.0/adql-circle.xml +46 -0
- data/test/voruby/adql/1.0/adql-expr.sql +1 -0
- data/test/voruby/adql/1.0/adql-expr.xml +34 -0
- data/test/voruby/adql/1.0/adql-function.sql +1 -0
- data/test/voruby/adql/1.0/adql-function.xml +41 -0
- data/test/voruby/adql/1.0/adql-group.sql +1 -0
- data/test/voruby/adql/1.0/adql-group.xml +51 -0
- data/test/voruby/adql/1.0/adql-having.sql +1 -0
- data/test/voruby/adql/1.0/adql-having.xml +25 -0
- data/test/voruby/adql/1.0/adql-like.sql +1 -0
- data/test/voruby/adql/1.0/adql-like.xml +17 -0
- data/test/voruby/adql/1.0/adql-order.sql +1 -0
- data/test/voruby/adql/1.0/adql-order.xml +37 -0
- data/test/voruby/adql/1.0/adql-simple.sql +1 -0
- data/test/voruby/adql/1.0/adql-simple.xml +12 -0
- data/test/voruby/adql/1.0/adql-top.sql +1 -0
- data/test/voruby/adql/1.0/adql-top.xml +33 -0
- data/test/voruby/adql/1.0/test.rb +2220 -0
- data/test/voruby/misc/test.rb +32 -0
- data/test/voruby/resolver/sesame/test.rb +56 -0
- data/test/voruby/sky_query/test.rb +107 -0
- data/test/voruby/stc/1.10/coords_test.rb +3704 -0
- data/test/voruby/stc/1.10/region_test.rb +993 -0
- data/test/voruby/stc/1.10/stc-catalog-entry-location.xml +112 -0
- data/test/voruby/stc/1.10/stc-obs-data-location.xml +126 -0
- data/test/voruby/stc/1.10/stc-region-circle.xml +5 -0
- data/test/voruby/stc/1.10/stc-region-convex.xml +11 -0
- data/test/voruby/stc/1.10/stc-region-convexhull.xml +5 -0
- data/test/voruby/stc/1.10/stc-region-ellipse.xml +7 -0
- data/test/voruby/stc/1.10/stc-region-intersection.xml +25 -0
- data/test/voruby/stc/1.10/stc-region-negation.xml +7 -0
- data/test/voruby/stc/1.10/stc-region-polygon.xml +13 -0
- data/test/voruby/stc/1.10/stc-region-sector.xml +6 -0
- data/test/voruby/stc/1.10/stc-region-union.xml +25 -0
- data/test/voruby/stc/1.10/stc-resource-profile.xml +60 -0
- data/test/voruby/stc/1.10/stc-search-location.xml +54 -0
- data/test/voruby/stc/1.10/stc_test.rb +4626 -0
- data/test/voruby/stc/1.30/stc-catalog-entry-location.xml +210 -0
- data/test/voruby/stc/1.30/stc-obs-data-location-arecibo.xml +353 -0
- data/test/voruby/stc/1.30/stc-obs-data-location-fits.xml +250 -0
- data/test/voruby/stc/1.30/stc-obs-data-location-xlink.xml +63 -0
- data/test/voruby/stc/1.30/stc-obs-data-location.xml +216 -0
- data/test/voruby/stc/1.30/stc-resource-profile-unusual-ref-pos.xml +39 -0
- data/test/voruby/stc/1.30/stc-resource-profile.xml +129 -0
- data/test/voruby/stc/1.30/stc-search-location-arecibo.xml +86 -0
- data/test/voruby/stc/1.30/stc-search-location.xml +101 -0
- data/test/voruby/stc/1.30/test.rb +6274 -0
- data/test/voruby/ucd/test.rb +48 -0
- data/test/voruby/voevent/1.1/test.rb +812 -0
- data/test/{voevent/voevent_v1_1.xml → voruby/voevent/1.1/voevent.xml} +2 -2
- data/test/voruby/voregistry/0.3/test.rb +137 -0
- data/test/voruby/votable/1.0/test.rb +714 -0
- data/test/voruby/votable/1.0/votable.basic.xml +660 -0
- data/test/voruby/votable/1.0/votable.html +86 -0
- data/test/voruby/votable/1.0/votable.ns.xml +56 -0
- data/test/voruby/votable/1.1/test.rb +785 -0
- data/test/voruby/votable/1.1/votable.basic.xml +38 -0
- data/test/voruby/votable/1.1/votable.html +86 -0
- data/test/voruby/votable/1.1/votable.ns.xml +56 -0
- data/test/voruby/votable/test.rb +15 -0
- data/test/voruby/wesix/test.rb +268 -0
- data/test/voruby/wesix/testr.fits +28 -0
- metadata +234 -247
- data/REQUIREMENTS +0 -6
- data/lib/voruby/active_votable/loader.rb +0 -5
- data/lib/voruby/adql/adql.rb +0 -2787
- data/lib/voruby/adql/ext.rb +0 -14
- data/lib/voruby/adql/loader.rb +0 -6
- data/lib/voruby/adql/operations.rb +0 -54
- data/lib/voruby/adql/parser.rb +0 -160
- data/lib/voruby/adql/transforms.rb +0 -573
- data/lib/voruby/ext.rb +0 -17
- data/lib/voruby/loader.rb +0 -4
- data/lib/voruby/misc/propertyfile.rb +0 -36
- data/lib/voruby/plastic/applications.rb +0 -174
- data/lib/voruby/plastic/constants.rb +0 -30
- data/lib/voruby/plastic/loader.rb +0 -10
- data/lib/voruby/plastic/plastic.rb +0 -1
- data/lib/voruby/resources/conesearch/conesearch.rb +0 -9
- data/lib/voruby/resources/conesearch/conesearch_v0_2.rb +0 -55
- data/lib/voruby/resources/conesearch/conesearch_v0_3.rb +0 -50
- data/lib/voruby/resources/conesearch/conesearch_v1_0.rb +0 -72
- data/lib/voruby/resources/conesearch/loader.rb +0 -4
- data/lib/voruby/resources/loader.rb +0 -50
- data/lib/voruby/resources/nodes.rb +0 -190
- data/lib/voruby/resources/openskynode/loader.rb +0 -4
- data/lib/voruby/resources/openskynode/openskynode.rb +0 -9
- data/lib/voruby/resources/openskynode/openskynode_v0_1.rb +0 -54
- data/lib/voruby/resources/sia/loader.rb +0 -5
- data/lib/voruby/resources/sia/sia.rb +0 -9
- data/lib/voruby/resources/sia/sia_v0_6.rb +0 -90
- data/lib/voruby/resources/sia/sia_v0_7.rb +0 -89
- data/lib/voruby/resources/sia/sia_v1_0.rb +0 -122
- data/lib/voruby/resources/stsci.rb +0 -59
- data/lib/voruby/resources/vodataservice/coverage_v0_2.rb +0 -195
- data/lib/voruby/resources/vodataservice/coverage_v0_3.rb +0 -158
- data/lib/voruby/resources/vodataservice/loader.rb +0 -5
- data/lib/voruby/resources/vodataservice/vodataservice.rb +0 -9
- data/lib/voruby/resources/vodataservice/vodataservice_v0_4.rb +0 -189
- data/lib/voruby/resources/vodataservice/vodataservice_v0_5.rb +0 -163
- data/lib/voruby/resources/vodataservice/vodataservice_v1_0.rb +0 -221
- data/lib/voruby/resources/voregistry/loader.rb +0 -4
- data/lib/voruby/resources/voregistry/voregistry.rb +0 -9
- data/lib/voruby/resources/voregistry/voregistry_v0_2.rb +0 -40
- data/lib/voruby/resources/voregistry/voregistry_v0_3.rb +0 -30
- data/lib/voruby/resources/voregistry/voregistry_v1_0.rb +0 -86
- data/lib/voruby/resources/voresource/loader.rb +0 -17
- data/lib/voruby/resources/voresource/voresource.rb +0 -9
- data/lib/voruby/resources/voresource/voresource_v0_10.rb +0 -327
- data/lib/voruby/resources/voresource/voresource_v0_9.rb +0 -405
- data/lib/voruby/resources/voresource/voresource_v1_0.rb +0 -230
- data/lib/voruby/services/ext.rb +0 -11
- data/lib/voruby/services/gestalt/footprint.rb +0 -95
- data/lib/voruby/services/gestalt/wcs_fixer.rb +0 -105
- data/lib/voruby/services/gestalt/wesix.rb +0 -155
- data/lib/voruby/services/loader.rb +0 -7
- data/lib/voruby/services/registry/registry.rb +0 -53
- data/lib/voruby/services/resolver/resolver.rb +0 -35
- data/lib/voruby/services/schema/schema.rb +0 -644
- data/lib/voruby/sesame/loader.rb +0 -6
- data/lib/voruby/sesame/sesame_v1_0.rb +0 -64
- data/lib/voruby/simple/loader.rb +0 -6
- data/lib/voruby/simple/parameters.rb +0 -196
- data/lib/voruby/simple/sap.rb +0 -446
- data/lib/voruby/spacetime/loader.rb +0 -3
- data/lib/voruby/spacetime/spacetime.rb +0 -607
- data/lib/voruby/stc/coords_v1_20.rb +0 -900
- data/lib/voruby/stc/loader.rb +0 -55
- data/lib/voruby/stc/region_v1_20.rb +0 -274
- data/lib/voruby/stc/stc_v1_20.rb +0 -1196
- data/lib/voruby/util.rb +0 -27
- data/lib/voruby/voevent/loader.rb +0 -7
- data/lib/voruby/voevent/voevent_v1_0.rb +0 -213
- data/lib/voruby/voevent/voevent_v1_1.rb +0 -196
- data/lib/voruby/votables/chandra.rb +0 -373
- data/lib/voruby/votables/data.rb +0 -179
- data/lib/voruby/votables/galex.rb +0 -377
- data/lib/voruby/votables/int.rb +0 -354
- data/lib/voruby/votables/libxml_parser.rb +0 -411
- data/lib/voruby/votables/libxml_votable.rb +0 -67
- data/lib/voruby/votables/loader.rb +0 -10
- data/lib/voruby/votables/meta.rb +0 -763
- data/lib/voruby/votables/misc.rb +0 -51
- data/lib/voruby/votables/nsa.rb +0 -410
- data/lib/voruby/votables/rexml_parser.rb +0 -408
- data/lib/voruby/votables/rexml_votable.rb +0 -67
- data/lib/voruby/votables/sdss.rb +0 -356
- data/lib/voruby/votables/transforms.rb +0 -388
- data/lib/voruby/votables/tree.rb +0 -45
- data/lib/voruby/votables/types.rb +0 -391
- data/lib/voruby/votables/votable.rb +0 -687
- data/test/active_votable/database.yml +0 -6
- data/test/active_votable/test.vot +0 -168492
- data/test/active_votable/unittest.rb +0 -41
- data/test/adql/test1.adql +0 -49
- data/test/adql/test2.adql +0 -51
- data/test/adql/test3.adql +0 -81
- data/test/adql/test4.adql +0 -53
- data/test/adql/test5.adql +0 -55
- data/test/adql/test6.adql +0 -18
- data/test/adql/test7.adql +0 -48
- data/test/adql/unittest.rb +0 -1672
- data/test/plastic/test.rb +0 -44
- data/test/plastic/test.vot +0 -5385
- data/test/plastic/unittest.rb +0 -66
- data/test/resources/conesearch/conesearch_v0_3.xml +0 -31
- data/test/resources/conesearch/conesearch_v1_0.xml +0 -86
- data/test/resources/conesearch/unittest_v0_3.rb +0 -22
- data/test/resources/conesearch/unittest_v1_0.rb +0 -24
- data/test/resources/openskynode/open_sky_node_v0_1.xml +0 -32
- data/test/resources/openskynode/unittest_v0_1.rb +0 -31
- data/test/resources/sia/simple_image_access_v0_7.xml +0 -36
- data/test/resources/sia/simple_image_access_v1_0.xml +0 -122
- data/test/resources/sia/unittest_v0_7.rb +0 -24
- data/test/resources/sia/unittest_v1_0.rb +0 -29
- data/test/resources/stsci.xml +0 -336
- data/test/resources/unittest_stsci.rb +0 -25
- data/test/resources/vodataservice/catalog_service_resource_v1_0.xml +0 -128
- data/test/resources/vodataservice/data_collection_resource_v0_5.xml +0 -54
- data/test/resources/vodataservice/data_collection_resource_v1_0.xml +0 -117
- data/test/resources/vodataservice/data_service_resource_v1_0.xml +0 -115
- data/test/resources/vodataservice/sky_service_resource_v0_10.xml +0 -45
- data/test/resources/vodataservice/table_service_resource_v1_0.xml +0 -122
- data/test/resources/vodataservice/tabular_sky_service_resource_v0_10.xml +0 -60
- data/test/resources/vodataservice/unittest_v0_5.rb +0 -126
- data/test/resources/vodataservice/unittest_v1_0.rb +0 -151
- data/test/resources/voregistry/authority_resource_v0_3.xml +0 -20
- data/test/resources/voregistry/authority_resource_v1_0.xml +0 -82
- data/test/resources/voregistry/registry_service_v0_3.xml +0 -20
- data/test/resources/voregistry/registry_service_v1_0.xml +0 -107
- data/test/resources/voregistry/unittest_v0_3.rb +0 -31
- data/test/resources/voregistry/unittest_v1_0.rb +0 -34
- data/test/resources/voresource/organisation_resource_v1_0.xml +0 -90
- data/test/resources/voresource/resource_organisation_v0_10.xml +0 -22
- data/test/resources/voresource/resource_service_v0_10.xml +0 -19
- data/test/resources/voresource/resource_v0_10.xml +0 -19
- data/test/resources/voresource/resource_v1_0.xml +0 -79
- data/test/resources/voresource/service_resource_v1_0.xml +0 -91
- data/test/resources/voresource/unittest_v0_10.rb +0 -61
- data/test/resources/voresource/unittest_v0_9.rb +0 -4
- data/test/resources/voresource/unittest_v1_0.rb +0 -190
- data/test/services/gestalt/unittest.rb +0 -74
- data/test/services/registry/unittest.rb +0 -34
- data/test/services/resolver/unittest.rb +0 -38
- data/test/simple/unittest.rb +0 -46
- data/test/spacetime/unittest.rb +0 -39
- data/test/stc/catalog_entry_location_v1_20.xml +0 -112
- data/test/stc/obs_data_location_v1_20.xml +0 -108
- data/test/stc/search_location_v1_20.xml +0 -54
- data/test/stc/stc_resource_profile_v1_20.xml +0 -60
- data/test/stc/unittest_v1_20.rb +0 -620
- data/test/voevent/unittest_v1_0.rb +0 -79
- data/test/voevent/unittest_v1_1.rb +0 -70
- data/test/voevent/voevent_v1_0.xml +0 -96
- data/test/votables/test.vot +0 -366
- data/test/votables/unittest.rb +0 -54
data/lib/voruby/votables/misc.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
module VORuby
|
2
|
-
module VOTables
|
3
|
-
module VOTable
|
4
|
-
|
5
|
-
# Miscellaneous classes that don't fit elsewhere.
|
6
|
-
module Misc
|
7
|
-
|
8
|
-
# An exception thrown when the incoming type does not match
|
9
|
-
# the expected value.
|
10
|
-
class TypeException < Exception
|
11
|
-
|
12
|
-
# [_obj_:]
|
13
|
-
# The object itself.
|
14
|
-
# [_prototype_:]
|
15
|
-
# The prototype of the expected class.
|
16
|
-
def initialize(obj=nil, prototype=nil)
|
17
|
-
super("Invalid type: #{obj.class} (#{obj}) != #{prototype}")
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
# A class which checks to see whether the type of the incoming class
|
22
|
-
# matches expectation.
|
23
|
-
class TypeCheck
|
24
|
-
attr_accessor :obj, :proto
|
25
|
-
|
26
|
-
# [_obj_:]
|
27
|
-
# The object in question.
|
28
|
-
# [_proto_:]
|
29
|
-
# The prototype of the expected class.
|
30
|
-
def initialize(obj=nil, proto=nil)
|
31
|
-
#raise "TypeCheck must have an object" if obj == nil
|
32
|
-
#raise "TypeCheck must have a prototype" if proto == nil
|
33
|
-
|
34
|
-
@obj = obj
|
35
|
-
@proto = proto
|
36
|
-
end
|
37
|
-
|
38
|
-
# Check to see whether the class is of the expected type.
|
39
|
-
def check
|
40
|
-
raise TypeException.new(@obj, @proto) if @obj and !@obj.is_a?(@proto)
|
41
|
-
end
|
42
|
-
|
43
|
-
def to_s
|
44
|
-
"{object=#{@obj};prototype=#{@proto}}"
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
data/lib/voruby/votables/nsa.rb
DELETED
@@ -1,410 +0,0 @@
|
|
1
|
-
# A set of classes designed to read and manipulate
|
2
|
-
# especific VOTables[http://www.ivoa.net/Documents/latest/VOT.html].
|
3
|
-
# This class represents a NSA VOTable.
|
4
|
-
|
5
|
-
require 'voruby/votables/votable'
|
6
|
-
|
7
|
-
module VORuby
|
8
|
-
module VOTables
|
9
|
-
|
10
|
-
module VOTable
|
11
|
-
class NSAVOTable < VOTable
|
12
|
-
|
13
|
-
# Our object's contructor
|
14
|
-
# [_votable:_]
|
15
|
-
# The VOTable object
|
16
|
-
def initialize(votable)
|
17
|
-
super(votable.id, votable.version, votable.description,
|
18
|
-
votable.definitions, votable.coosys, votable.params,
|
19
|
-
votable.info, votable.resources)
|
20
|
-
end
|
21
|
-
|
22
|
-
# Find the column number(s) associated with a Name.
|
23
|
-
# Returns a list of column positions.
|
24
|
-
# [_res_:]
|
25
|
-
# The resource from which to extract the table in question.
|
26
|
-
# [_tbl_:]
|
27
|
-
# The resource from which to extract the table in question.
|
28
|
-
def find_columns(name, res=0, tbl=0)
|
29
|
-
columns = []
|
30
|
-
|
31
|
-
col_count = 0
|
32
|
-
fields = fields(res, tbl)
|
33
|
-
if fields
|
34
|
-
fields.each do |field|
|
35
|
-
if field.name() != nil
|
36
|
-
columns.push(col_count) if field.name() == name
|
37
|
-
end
|
38
|
-
col_count += 1
|
39
|
-
end
|
40
|
-
end
|
41
|
-
return columns
|
42
|
-
end
|
43
|
-
|
44
|
-
# Find a field in NSA SIAP configuration file given a key.
|
45
|
-
# Returns a hash with the field's attributes
|
46
|
-
# [_key_:]
|
47
|
-
# The key indexing on field's attribute.
|
48
|
-
def find_field_in_conf_file(key)
|
49
|
-
nsa_field = {'id'=> nil, 'name'=> nil, 'ucd'=> nil}
|
50
|
-
|
51
|
-
if key != nil
|
52
|
-
NSA_SIAP_CONFIG.each do |archive|
|
53
|
-
archive['votable_fields'].each do |field|
|
54
|
-
if field['key'] == key
|
55
|
-
nsa_field['id'] = field['id'] if field['id'] != 'nil'
|
56
|
-
nsa_field['name'] = field['name'] if field['name'] != 'nil'
|
57
|
-
nsa_field['ucd'] = field['ucd'] if field['ucd'] != 'nil'
|
58
|
-
break
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
return nsa_field
|
64
|
-
end
|
65
|
-
|
66
|
-
def image_access_reference_columns()
|
67
|
-
access_key = find_field_in_conf_file('reference')['name']
|
68
|
-
|
69
|
-
if find_columns(access_key).first != nil
|
70
|
-
find_columns(access_key).first
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
def image_ra_columns
|
75
|
-
ra_key = find_field_in_conf_file('ra')['name']
|
76
|
-
|
77
|
-
if find_columns(ra_key).first != nil
|
78
|
-
find_columns(ra_key).first
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
def image_dec_columns
|
83
|
-
dec_key = find_field_in_conf_file('dec')['name']
|
84
|
-
|
85
|
-
if find_columns(dec_key).first != nil
|
86
|
-
find_columns(dec_key).first
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
def image_obstype_columns
|
91
|
-
obstype_key = find_field_in_conf_file('object')['name']
|
92
|
-
|
93
|
-
if find_columns(obstype_key).first != nil
|
94
|
-
find_columns(obstype_key).first
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
def image_filter_columns
|
99
|
-
#filter_key = find_field_in_conf_file('')['name']
|
100
|
-
|
101
|
-
#if find_columns(filter_key).first != nil
|
102
|
-
# find_columns(filter_key).first
|
103
|
-
#end
|
104
|
-
end
|
105
|
-
|
106
|
-
def image_date_obs_columns
|
107
|
-
#date_obs_key = find_field_in_conf_file('')['name']
|
108
|
-
|
109
|
-
#if find_columns(date_obs_key).first != nil
|
110
|
-
# find_columns(date_obs_key).first
|
111
|
-
#end
|
112
|
-
end
|
113
|
-
|
114
|
-
def image_telescope_columns
|
115
|
-
telescope_key = find_field_in_conf_file('telescope')['name']
|
116
|
-
|
117
|
-
if find_columns(telescope_key).first != nil
|
118
|
-
find_columns(telescope_key).first
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
def image_survey_columns
|
123
|
-
survey_key = find_field_in_conf_file('prop_id')['name']
|
124
|
-
|
125
|
-
if find_columns(survey_key).first != nil
|
126
|
-
find_columns(survey_key).first
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
def image_instrument_columns
|
131
|
-
instrument_key = find_field_in_conf_file('instrument')['name']
|
132
|
-
|
133
|
-
if find_columns(instrument_key).first != nil
|
134
|
-
find_columns(instrument_key).first
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
def image_sky_columns
|
139
|
-
#sky_key = find_field_in_conf_file('')['name']
|
140
|
-
|
141
|
-
#if find_columns(sky_key).first != nil
|
142
|
-
# find_columns(sky_key).first
|
143
|
-
#end
|
144
|
-
end
|
145
|
-
|
146
|
-
def image_zeropoint_columns
|
147
|
-
#zeropoint_key = find_field_in_conf_file('')['name']
|
148
|
-
|
149
|
-
#if find_columns(zeropoint_key).first != nil
|
150
|
-
# find_columns(zeropoint_key).first
|
151
|
-
#end
|
152
|
-
end
|
153
|
-
|
154
|
-
def image_seeing_columns
|
155
|
-
seeing_key = find_field_in_conf_file('seeing')['name']
|
156
|
-
|
157
|
-
if find_columns(seeing_key).first != nil
|
158
|
-
find_columns(seeing_key).first
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
def image_depth_columns
|
163
|
-
depth_key = find_field_in_conf_file('depth')['name']
|
164
|
-
|
165
|
-
if find_columns(depth_key).first != nil
|
166
|
-
find_columns(depth_key).first
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
170
|
-
def image_exptime_columns
|
171
|
-
#exptime_key = find_field_in_conf_file('')['name']
|
172
|
-
|
173
|
-
#if find_columns(exptime_key).first != nil
|
174
|
-
# find_columns(exptime_key).first
|
175
|
-
#end
|
176
|
-
end
|
177
|
-
|
178
|
-
def image_vo_id_columns
|
179
|
-
vo_id_key = find_field_in_conf_file('vo_id')['name']
|
180
|
-
|
181
|
-
if find_columns(vo_id_key).first != nil
|
182
|
-
find_columns(vo_id_key).first
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
def show_columns(col_count)
|
187
|
-
case col_count
|
188
|
-
when image_access_reference_columns()
|
189
|
-
return false
|
190
|
-
when image_vo_id_columns()
|
191
|
-
return false
|
192
|
-
else
|
193
|
-
return true
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
# Create the headers for HTML table
|
198
|
-
# [_access_ref_index_:]
|
199
|
-
# A valid SIA VOTable will only ever have one VOX:Image_AccessReference.
|
200
|
-
# [_options_:]
|
201
|
-
#
|
202
|
-
def create_headers(access_ref_index, options)
|
203
|
-
thead, thead_2row = create_header_cart_links(options)
|
204
|
-
|
205
|
-
if options[:infer_access_ref] and access_ref_index
|
206
|
-
thead << "<th>#{options[:access_ref_header_label]}</th>\n"
|
207
|
-
thead_2row.push(' ')
|
208
|
-
end
|
209
|
-
|
210
|
-
col_count = 0
|
211
|
-
fields(options[:res], options[:tbl]).each do |field|
|
212
|
-
field_archive = find_field_in_conf_file(field.name)
|
213
|
-
field_ucd = field_archive['ucd']
|
214
|
-
if options[:infer_access_ref] and access_ref_index and col_count == access_ref_index
|
215
|
-
thead_2row[1] = field_ucd if field_ucd != 'nil'
|
216
|
-
elsif show_columns(col_count)
|
217
|
-
thead << "<th>#{field_archive['name']}</th>\n"
|
218
|
-
if field_ucd != 'nil'
|
219
|
-
thead_2row.push(field_ucd)
|
220
|
-
else
|
221
|
-
thead_2row.push(' ')
|
222
|
-
end
|
223
|
-
end
|
224
|
-
col_count += 1
|
225
|
-
end
|
226
|
-
|
227
|
-
thead << " </tr>\n"
|
228
|
-
|
229
|
-
thead << "<tr>\n"
|
230
|
-
thead_2row.each do |h|
|
231
|
-
thead << "<th>#{h}</th>\n"
|
232
|
-
end
|
233
|
-
thead << "</tr>\n"
|
234
|
-
|
235
|
-
thead << "</thead>"
|
236
|
-
|
237
|
-
return thead
|
238
|
-
end
|
239
|
-
|
240
|
-
# Creates the cart parameters
|
241
|
-
# [_cart_params:_]
|
242
|
-
#
|
243
|
-
# [_columns:_]
|
244
|
-
#
|
245
|
-
def create_item_cart_params(cart_params, columns)
|
246
|
-
link_ref_array = []
|
247
|
-
|
248
|
-
cart_params.each do |key, value|
|
249
|
-
link_ref_array.push("#{key}=#{value}")
|
250
|
-
end
|
251
|
-
|
252
|
-
ra_index = image_ra_columns()
|
253
|
-
link_ref_array.push("rac=#{convert_ra_to_degrees(columns[ra_index].value.to_s).to_s}") if ra_index
|
254
|
-
dec_index = image_dec_columns()
|
255
|
-
link_ref_array.push("decc=#{convert_dec_to_degrees(columns[dec_index].value.to_s).to_s}") if dec_index
|
256
|
-
obstype_index = image_obstype_columns()
|
257
|
-
link_ref_array.push("obstype=#{columns[obstype_index].value.to_s}") if obstype_index
|
258
|
-
filter_index = image_filter_columns()
|
259
|
-
link_ref_array.push("filter=#{columns[filter_index].value.to_s}") if filter_index
|
260
|
-
date_obs_index = image_date_obs_columns()
|
261
|
-
link_ref_array.push("date_obs=#{columns[date_obs_index].value.to_s}") if date_obs_index
|
262
|
-
teles_index = image_telescope_columns()
|
263
|
-
link_ref_array.push("telescop=#{columns[teles_index].value.to_s}") if teles_index
|
264
|
-
survey_index = image_survey_columns()
|
265
|
-
link_ref_array.push("survey=#{columns[survey_index].value.to_s}") if survey_index
|
266
|
-
instrum_index = image_instrument_columns()
|
267
|
-
link_ref_array.push("instrument=#{columns[instrum_index].value.to_s}") if instrum_index
|
268
|
-
sky_index = image_sky_columns()
|
269
|
-
link_ref_array.push("sky=#{columns[sky_index].value.to_s}") if sky_index
|
270
|
-
zerop_index = image_zeropoint_columns()
|
271
|
-
link_ref_array.push("zeropoint=#{columns[zerop_index].value.to_s}") if zerop_index
|
272
|
-
seeing_index = image_seeing_columns()
|
273
|
-
link_ref_array.push("seeing=#{columns[seeing_index].value.to_s}") if seeing_index
|
274
|
-
depth_index = image_depth_columns()
|
275
|
-
link_ref_array.push("depth=#{columns[depth_index].value.to_s}") if depth_index
|
276
|
-
exptime_index = image_exptime_columns()
|
277
|
-
link_ref_array.push("exptime=#{columns[exptime_index].value.to_s}") if exptime_index
|
278
|
-
|
279
|
-
return link_ref_array.join('&')
|
280
|
-
end
|
281
|
-
|
282
|
-
# Create body for HTML table
|
283
|
-
# [_access_ref_index_:]
|
284
|
-
# A valid SIA VOTable will only ever have one VOX:Image_AccessReference.
|
285
|
-
# [_options_:]
|
286
|
-
#
|
287
|
-
def create_body(access_ref_index, options)
|
288
|
-
tbody = "<tbody class=\"#{options[:body_class]}\" align=\"center\">\n"
|
289
|
-
row_count = 0
|
290
|
-
rows_data = rows(options[:res], options[:tbl])
|
291
|
-
if rows_data
|
292
|
-
rows_data.each do |tr|
|
293
|
-
tbody << "<tr class=\"#{options[:row_classes][row_count % 2]}\">\n"
|
294
|
-
|
295
|
-
# Specially mark up the first column to link to the image.
|
296
|
-
columns = tr.tds()
|
297
|
-
|
298
|
-
if options[:infer_add_to_cart_ref] and access_ref_index
|
299
|
-
link_ref = "&resource=#{CGI.escape(columns[access_ref_index].value).to_s}"
|
300
|
-
if options[:ssl]
|
301
|
-
resource = URI.parse(columns[access_ref_index].value)
|
302
|
-
resource.scheme = options[:resource_link][:scheme]
|
303
|
-
resource.port = options[:resource_link][:port]
|
304
|
-
resource_link = resource.scheme.to_s + '://' + resource.host.to_s + ':' +
|
305
|
-
resource.port.to_s + resource.request_uri().to_s
|
306
|
-
link_ref = "&resource=#{CGI.escape(resource_link).to_s}"
|
307
|
-
end
|
308
|
-
|
309
|
-
tbody << "<td><input type=\"checkbox\" " +
|
310
|
-
"id=\"checkbox_add_#{options[:cart_params][:archive]}_#{row_count.to_s}\" " +
|
311
|
-
"value=\"#{create_item_cart_params(options[:cart_params], columns)}#{link_ref}\"/></td>\n"
|
312
|
-
end
|
313
|
-
|
314
|
-
if options[:infer_access_ref] and access_ref_index
|
315
|
-
tbody << "<td><a href=\"#{columns[access_ref_index].value}\">#{options[:access_ref_link_label]}</a></td>\n"
|
316
|
-
end
|
317
|
-
|
318
|
-
col_count = 0
|
319
|
-
ra_index = image_ra_columns()
|
320
|
-
dec_index = image_dec_columns()
|
321
|
-
columns.each do |td|
|
322
|
-
if col_count != access_ref_index
|
323
|
-
if ra_index and col_count == ra_index
|
324
|
-
tbody << "<td>#{convert_ra_to_degrees(td.value)}</td>\n"
|
325
|
-
elsif dec_index and col_count == dec_index
|
326
|
-
tbody << "<td>#{convert_dec_to_degrees(td.value)}</td>\n"
|
327
|
-
else
|
328
|
-
tbody << "<td>#{td.value}</td>\n"
|
329
|
-
end
|
330
|
-
end
|
331
|
-
col_count += 1
|
332
|
-
end
|
333
|
-
|
334
|
-
tbody << "</tr>\n"
|
335
|
-
row_count += 1
|
336
|
-
end
|
337
|
-
end
|
338
|
-
tbody << "</tbody>"
|
339
|
-
|
340
|
-
return tbody
|
341
|
-
end
|
342
|
-
|
343
|
-
# Convert the specified table in the specified resource into an HTML
|
344
|
-
# table.
|
345
|
-
# [_options_:]
|
346
|
-
# The options for this VOTable.
|
347
|
-
def to_html(options={})
|
348
|
-
# The ID to assign to the HTML table as a whole.
|
349
|
-
options[:id] = options[:id] || "#{votable}_#{Time.now.to_i}_#{rand(10000)}"
|
350
|
-
|
351
|
-
options[:infer_add_to_cart_ref] = true if options[:infer_add_to_cart_ref] == nil
|
352
|
-
options[:add_to_cart_header_label] = options[:add_to_cart_header_label] || 'Add to Cart'
|
353
|
-
options[:cart_params] = {} if options[:cart_params] == nil
|
354
|
-
#options[:add_to_cart_url] = options[:add_to_cart_url] || nil
|
355
|
-
|
356
|
-
options[:throbber_src] = options[:throbber_src] || '/images/general/indicator.gif'
|
357
|
-
options[:throbber_size] = options[:throbber_size] || '16x16'
|
358
|
-
options[:throbber_class] = options[:throbber_class] || 'throbber'
|
359
|
-
options[:throbber_id] = options[:throbber_id] || "#{options[:id]}_throbber_id"
|
360
|
-
|
361
|
-
options[:flash_notice_class] = options[:flash_notice_class] || 'flash_notice'
|
362
|
-
options[:flash_notice_id] = options[:flash_notice_id] || "#{options[:id]}_flash_notice_id"
|
363
|
-
|
364
|
-
# Link the access reference URL associated with a row.
|
365
|
-
options[:infer_access_ref] = true if options[:infer_access_ref] == nil
|
366
|
-
#options[:retrieve_link_ref] = options[:retrieve_link_ref] || nil
|
367
|
-
# For the access reference column, place this value in the header.
|
368
|
-
options[:access_ref_header_label] = options[:access_ref_header_label] || 'URL'
|
369
|
-
# For the access reference column, link this word.
|
370
|
-
options[:access_ref_link_label] = options[:access_ref_link_label] || 'Retrieve'
|
371
|
-
options[:ssl] = false if options[:ssl] == nil
|
372
|
-
#options[:resource_link] = options[:resource_link]
|
373
|
-
|
374
|
-
# The resource from which to extract the table in question.
|
375
|
-
options[:res] = options[:res] || 0
|
376
|
-
# The table inside the resource from which to extract the rows in question.
|
377
|
-
options[:tbl] = options[:tbl] || 0
|
378
|
-
|
379
|
-
# The boolean value to show HTML table border
|
380
|
-
options[:show_border] = false if options[:show_border] == nil
|
381
|
-
# The class to assign the HTML table as a whole.
|
382
|
-
options[:table_class] = options[:table_class] || 'votable'
|
383
|
-
# The class to assign the header of the HTML table.
|
384
|
-
options[:header_class] = options[:header_class] || 'header'
|
385
|
-
# The class to assign the body of the HTML table.
|
386
|
-
options[:body_class] = options[:body_class] || 'body'
|
387
|
-
# The class to assign the HTML table body rows.
|
388
|
-
options[:row_classes] = options[:row_classes] || ['row1', 'row2']
|
389
|
-
|
390
|
-
begin
|
391
|
-
# A valid SIA VOTable will only ever have one VOX:Image_AccessReference.
|
392
|
-
access_ref_index = image_access_reference_columns()
|
393
|
-
|
394
|
-
return create_votable(create_headers(access_ref_index, options),
|
395
|
-
create_body(access_ref_index, options),
|
396
|
-
options)
|
397
|
-
|
398
|
-
rescue Exception => e
|
399
|
-
title = 'Error...'
|
400
|
-
message = "VORuby error: #{e.message}<br>#{e.backtrace}"
|
401
|
-
message << "<br>#{@resources[0].info[0].text().to_s()}" if @resources[0].info[0]
|
402
|
-
create_message(title, message, options)
|
403
|
-
end
|
404
|
-
end
|
405
|
-
|
406
|
-
end
|
407
|
-
end
|
408
|
-
|
409
|
-
end
|
410
|
-
end
|