Permalink
Browse files

v1/a1/b1 v2/a2/b2

  • Loading branch information...
1 parent 8ea94da commit bb9cc442be2f4d8f2d34352db0596d0d43233cdc @taw committed Mar 18, 2012
Showing with 14 additions and 10 deletions.
  1. +4 −4 esfxml/esf_semantic_converter.rb
  2. +10 −6 esfxml/xml2esf
@@ -190,15 +190,15 @@ def convert_rec_cell
out!(%Q[<cell x='#{x}' y='#{y}' mask='#{mask}'>])
until data.empty?
- c1, c2, mask1, mask2 = data.shift(4)
- mask1 = "%08x" % mask1
- mask2 = "%08x" % mask2
+ c1, c2, ab1, ab2 = data.shift(4)
+ a1, b1 = ab1 >> 16, ab1 & 0xffff
+ a2, b2 = ab2 >> 16, ab2 & 0xffff
c1x = @region_data_vertices[2*c1]
c1y = @region_data_vertices[2*c1+1]
c2x = @region_data_vertices[2*c2]
c2y = @region_data_vertices[2*c2+1]
- out!(%[ <cell_quad v1='#{c1} (#{c1x},#{c1y})' v2='#{c2} (#{c2x},#{c2y})' mask1='#{mask1}' mask2='#{mask2}'/>])
+ out!(%[ <line_segment v1='#{c1} (#{c1x},#{c1y})' a1='#{a1}' b1='#{b1}' v2='#{c2} (#{c2x},#{c2y})' a2='#{a2}' b2='#{b2}'/>])
end
out!(%Q[</cell>])
end
View
@@ -48,12 +48,16 @@ module XmlTagHandlers
end
## Semantic data types - regions.esf
- def on_empty_node_cell_quad(attributes, buf, ctx)
- mask1 = attributes[:mask1].to_i(16)
- mask2 = attributes[:mask2].to_i(16)
- coord1 = attributes[:coord1].to_i
- coord2 = attributes[:coord2].to_i
- data = [coord1, coord2, mask1, mask2].pack("l*")
+ def on_empty_node_line_segment(attributes, buf, ctx)
+ a1 = attributes[:a1].to_i
+ b1 = attributes[:b1].to_i
+ ab1 = (a1 << 16) | b1
+ a2 = attributes[:a2].to_i
+ b2 = attributes[:b2].to_i
+ ab2 = (a2 << 16) | b2
+ v1 = attributes[:v1].to_i
+ v2 = attributes[:v2].to_i
+ data = [v1, v2, ab1, ab2].pack("l*")
@stack[-1][3][:data] << data
end

0 comments on commit bb9cc44

Please sign in to comment.