Module: Adiwg_GeoProperties

Defined in:
lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_geoProperties.rb

Class Method Summary collapse

Class Method Details

.unpack(hGeoProps, intElement) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_geoProperties.rb', line 15

def self.unpack(hGeoProps, intElement)

	# set element extent - (default true)
	intElement[:elementIncludeData] = true
	if hGeoProps.has_key?('includesData')
		if !hGeoProps['includesData']
			intElement[:elementIncludeData] = false
		end
	end

	# set element feature name
	if hGeoProps.has_key?('featureName')
		s = hGeoProps['featureName']
		if s != ''
			intElement[:elementName] = s
		end
	end

	# set element description
	if hGeoProps.has_key?('description')
		s = hGeoProps['description']
		if s != ''
			intElement[:elementDescription] = s
		end
	end

	# set temporal information
	if hGeoProps.has_key?('temporalElement')
		hTempEle = hGeoProps['temporalElement']
		unless hTempEle.empty?
			intElement[:temporalElements] = Adiwg_TemporalElement.unpack(hTempEle)
		end
	end

	# set vertical information
	if hGeoProps.has_key?('verticalElement')
		aVertEle = hGeoProps['verticalElement']
		unless aVertEle.empty?
			aVertEle.each do |hVertEle|
				intElement[:verticalElements] << Adiwg_VerticalElement.unpack(hVertEle)
			end
		end
	end

	# set other assigned IDs
	if hGeoProps.has_key?('identifier')
		aResIds = hGeoProps['identifier']
		unless aResIds.empty?
			aResIds.each do |hIdentifier|
				intElement[:elementIdentifiers] << Adiwg_ResourceIdentifier.unpack(hIdentifier)
			end
		end
	end

	# set feature scope
	if hGeoProps.has_key?('featureScope')
		s = hGeoProps['featureScope']
		if s != ''
			intElement[:elementScope] = s
		end
	end

	# set feature acquisition methodology
	if hGeoProps.has_key?('featureAcquisitionMethod')
		s = hGeoProps['featureAcquisitionMethod']
		if s != ''
			intElement[:elementAcquisition] = s
		end
	end

	return intElement

end