70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
# File 'lib/ropenlayer/acts_as/nodeable.rb', line 70
def node_data
attributes_config = self.class.ropenlayer_node_config[:attributes] || {}
node_map_attributes = Ropenlayer::Openlayer::Feature.all_attributes.inject({}) do |hash, attribute|
hash[attribute] = eval_node_attribute(attributes_config[attribute]) unless attributes_config[attribute].nil?
hash
end
if self.node.localizations.any?
node_map_attributes[:id] = self.node.id
node_map_attributes[:geometry] = self.node.geometry
node_map_attributes[:longitude] = self.node.localizations.first.longitude
node_map_attributes[:latitude] = self.node.localizations.first.latitude
node_map_attributes[:localizations] = self.node.localizations.map{|l| { :latitude => l.latitude, :longitude => l.longitude }}
else
node_map_attributes = nil
end
node_map_attributes
end
|